Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 76d1881

Browse files
committed
make auditor pubkey optional in mint and burn proof generation
1 parent 3ace556 commit 76d1881

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

token/confidential-transfer/proof-generation/src/burn.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ pub fn burn_split_proof_data(
3636
burn_amount: u64,
3737
source_elgamal_keypair: &ElGamalKeypair,
3838
source_aes_key: &AeKey,
39-
auditor_elgamal_pubkey: &ElGamalPubkey,
39+
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
4040
supply_elgamal_pubkey: &ElGamalPubkey,
4141
) -> Result<BurnProofData, TokenProofGenerationError> {
42+
let default_auditor_pubkey = ElGamalPubkey::default();
43+
let auditor_elgamal_pubkey = auditor_elgamal_pubkey.unwrap_or(&default_auditor_pubkey);
44+
4245
// split the burn amount into low and high bits
4346
let (burn_amount_lo, burn_amount_hi) = try_split_u64(burn_amount, BURN_AMOUNT_LO_BIT_LENGTH)
4447
.ok_or(TokenProofGenerationError::IllegalAmountBitLength)?;

token/confidential-transfer/proof-generation/src/mint.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ pub fn mint_split_proof_data(
3838
supply_elgamal_keypair: &ElGamalKeypair,
3939
supply_aes_key: &AeKey,
4040
destination_elgamal_pubkey: &ElGamalPubkey,
41-
auditor_elgamal_pubkey: &ElGamalPubkey,
41+
auditor_elgamal_pubkey: Option<&ElGamalPubkey>,
4242
) -> Result<MintProofData, TokenProofGenerationError> {
43+
let default_auditor_pubkey = ElGamalPubkey::default();
44+
let auditor_elgamal_pubkey = auditor_elgamal_pubkey.unwrap_or(&default_auditor_pubkey);
45+
4346
// split the mint amount into low and high bits
4447
let (mint_amount_lo, mint_amount_hi) = try_split_u64(mint_amount, MINT_AMOUNT_LO_BIT_LENGTH)
4548
.ok_or(TokenProofGenerationError::IllegalAmountBitLength)?;

token/confidential-transfer/proof-tests/tests/proof_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn test_mint_validity(mint_amount: u64, supply: u64) {
238238
&supply_keypair,
239239
&supply_aes_key,
240240
destination_pubkey,
241-
auditor_pubkey,
241+
Some(auditor_pubkey),
242242
)
243243
.unwrap();
244244

@@ -291,7 +291,7 @@ fn test_burn_validity(spendable_balance: u64, burn_amount: u64) {
291291
burn_amount,
292292
&source_keypair,
293293
&aes_key,
294-
auditor_pubkey,
294+
Some(auditor_pubkey),
295295
supply_pubkey,
296296
)
297297
.unwrap();

0 commit comments

Comments
 (0)