Skip to content

Commit a46685f

Browse files
[program] Check that new supply in the mint and proof data are consistent (#174)
check that new supply in the mint and proof data are consistent
1 parent 9d71a62 commit a46685f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

program/src/extension/confidential_mint_burn/processor.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ fn process_confidential_mint(
268268
.map_err(|_| ProgramError::InvalidAccountData)?,
269269
)
270270
.ok_or(TokenError::CiphertextArithmeticFailed)?;
271+
272+
// Check that the computed supply ciphertext is consistent with what was
273+
// actually used to generate the zkp on the client side.
274+
if mint_burn_extension.confidential_supply != proof_context.new_supply_ciphertext {
275+
return Err(TokenError::ConfidentialTransferBalanceMismatch.into());
276+
}
277+
271278
mint_burn_extension.decryptable_supply = data.new_decryptable_supply;
272279

273280
Ok(())

0 commit comments

Comments
 (0)