3434 CiphertextCiphertextEqualityProofContext , CiphertextCiphertextEqualityProofData ,
3535 } ,
3636 } ,
37+ spl_pod:: optional_keys:: OptionalNonZeroPubkey ,
3738 spl_token_confidential_transfer_proof_extraction:: instruction:: verify_and_extract_context,
3839} ;
3940
@@ -48,7 +49,6 @@ fn process_initialize_mint(accounts: &[AccountInfo], data: &InitializeMintData)
4849 let mut mint = PodStateWithExtensionsMut :: < PodMint > :: unpack_uninitialized ( mint_data) ?;
4950 let mint_burn_extension = mint. init_extension :: < ConfidentialMintBurn > ( true ) ?;
5051
51- mint_burn_extension. authority = data. authority ;
5252 mint_burn_extension. supply_elgamal_pubkey = data. supply_elgamal_pubkey ;
5353 mint_burn_extension. decryptable_supply = data. decryptable_supply ;
5454
@@ -68,6 +68,7 @@ fn process_rotate_supply_elgamal_pubkey(
6868 check_program_account ( mint_info. owner ) ?;
6969 let mint_data = & mut mint_info. data . borrow_mut ( ) ;
7070 let mut mint = PodStateWithExtensionsMut :: < PodMint > :: unpack ( mint_data) ?;
71+ let mint_authority = mint. base . mint_authority ;
7172 let mint_burn_extension = mint. get_extension_mut :: < ConfidentialMintBurn > ( ) ?;
7273
7374 let proof_context = verify_and_extract_context :: <
@@ -95,8 +96,8 @@ fn process_rotate_supply_elgamal_pubkey(
9596 let authority_info = next_account_info ( account_info_iter) ?;
9697 let authority_info_data_len = authority_info. data_len ( ) ;
9798
98- let authority = Option :: < Pubkey > :: from ( mint_burn_extension . authority )
99- . ok_or ( TokenError :: NoAuthorityExists ) ?;
99+ let authority = OptionalNonZeroPubkey :: try_from ( mint_authority ) ? ;
100+ let authority = Option :: < Pubkey > :: from ( authority ) . ok_or ( TokenError :: NoAuthorityExists ) ?;
100101
101102 Processor :: validate_owner (
102103 program_id,
@@ -126,10 +127,11 @@ fn process_update_decryptable_supply(
126127 check_program_account ( mint_info. owner ) ?;
127128 let mint_data = & mut mint_info. data . borrow_mut ( ) ;
128129 let mut mint = PodStateWithExtensionsMut :: < PodMint > :: unpack ( mint_data) ?;
130+ let mint_authority = mint. base . mint_authority ;
129131 let mint_burn_extension = mint. get_extension_mut :: < ConfidentialMintBurn > ( ) ?;
130132
131- let authority = Option :: < Pubkey > :: from ( mint_burn_extension . authority )
132- . ok_or ( TokenError :: NoAuthorityExists ) ?;
133+ let authority = OptionalNonZeroPubkey :: try_from ( mint_authority ) ? ;
134+ let authority = Option :: < Pubkey > :: from ( authority ) . ok_or ( TokenError :: NoAuthorityExists ) ?;
133135
134136 Processor :: validate_owner (
135137 program_id,
@@ -158,6 +160,7 @@ fn process_confidential_mint(
158160 check_program_account ( mint_info. owner ) ?;
159161 let mint_data = & mut mint_info. data . borrow_mut ( ) ;
160162 let mut mint = PodStateWithExtensionsMut :: < PodMint > :: unpack ( mint_data) ?;
163+ let mint_authority = mint. base . mint_authority ;
161164
162165 let auditor_elgamal_pubkey = mint
163166 . get_extension :: < ConfidentialTransferMint > ( ) ?
@@ -178,8 +181,8 @@ fn process_confidential_mint(
178181 let authority_info = next_account_info ( account_info_iter) ?;
179182 let authority_info_data_len = authority_info. data_len ( ) ;
180183
181- let authority = Option :: < Pubkey > :: from ( mint_burn_extension . authority )
182- . ok_or ( TokenError :: NoAuthorityExists ) ?;
184+ let authority = OptionalNonZeroPubkey :: try_from ( mint_authority ) ? ;
185+ let authority = Option :: < Pubkey > :: from ( authority ) . ok_or ( TokenError :: NoAuthorityExists ) ?;
183186
184187 Processor :: validate_owner (
185188 program_id,
@@ -314,19 +317,19 @@ fn process_confidential_burn(
314317 return Err ( TokenError :: ConfidentialTransferElGamalPubkeyMismatch . into ( ) ) ;
315318 }
316319
317- let source_transfer_amount_lo = & proof_context
320+ let burn_amount_lo = & proof_context
318321 . burn_amount_ciphertext_lo
319322 . try_extract_ciphertext ( 0 )
320323 . map_err ( |_| ProgramError :: InvalidAccountData ) ?;
321- let source_transfer_amount_hi = & proof_context
324+ let burn_amount_hi = & proof_context
322325 . burn_amount_ciphertext_hi
323326 . try_extract_ciphertext ( 0 )
324327 . map_err ( |_| ProgramError :: InvalidAccountData ) ?;
325328
326329 let new_source_available_balance = ciphertext_arithmetic:: subtract_with_lo_hi (
327330 & confidential_transfer_account. available_balance ,
328- source_transfer_amount_lo ,
329- source_transfer_amount_hi ,
331+ burn_amount_lo ,
332+ burn_amount_hi ,
330333 )
331334 . ok_or ( TokenError :: CiphertextArithmeticFailed ) ?;
332335
0 commit comments