remove ElGamal pubkey from confidential transfer `ConfigureAccount` data (#3927)
This commit is contained in:
parent
9a0ecb3814
commit
ba2b7951fc
|
@ -1558,7 +1558,6 @@ where
|
|||
&self.program_id,
|
||||
token_account,
|
||||
&self.pubkey,
|
||||
elgamal_keypair.public.into(),
|
||||
decryptable_zero_balance,
|
||||
maximum_pending_balance_credit_counter,
|
||||
&authority.pubkey(),
|
||||
|
|
|
@ -423,8 +423,6 @@ pub enum ConfidentialTransferInstruction {
|
|||
#[derive(Clone, Copy, Pod, Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct ConfigureAccountInstructionData {
|
||||
/// The public key associated with the account
|
||||
pub encryption_pubkey: EncryptionPubkey,
|
||||
/// The decryptable balance (always 0) once the configure account succeeds
|
||||
pub decryptable_zero_balance: DecryptableBalance,
|
||||
/// The maximum number of despots and transfers that an account can receiver before the
|
||||
|
@ -562,7 +560,6 @@ pub fn inner_configure_account(
|
|||
token_program_id: &Pubkey,
|
||||
token_account: &Pubkey,
|
||||
mint: &Pubkey,
|
||||
encryption_pubkey: EncryptionPubkey,
|
||||
decryptable_zero_balance: AeCiphertext,
|
||||
maximum_pending_balance_credit_counter: u64,
|
||||
authority: &Pubkey,
|
||||
|
@ -587,7 +584,6 @@ pub fn inner_configure_account(
|
|||
TokenInstruction::ConfidentialTransferExtension,
|
||||
ConfidentialTransferInstruction::ConfigureAccount,
|
||||
&ConfigureAccountInstructionData {
|
||||
encryption_pubkey,
|
||||
decryptable_zero_balance: decryptable_zero_balance.into(),
|
||||
maximum_pending_balance_credit_counter: maximum_pending_balance_credit_counter.into(),
|
||||
proof_instruction_offset,
|
||||
|
@ -602,7 +598,6 @@ pub fn configure_account(
|
|||
token_program_id: &Pubkey,
|
||||
token_account: &Pubkey,
|
||||
mint: &Pubkey,
|
||||
encryption_pubkey: EncryptionPubkey,
|
||||
decryptable_zero_balance: AeCiphertext,
|
||||
maximum_pending_balance_credit_counter: u64,
|
||||
authority: &Pubkey,
|
||||
|
@ -614,7 +609,6 @@ pub fn configure_account(
|
|||
token_program_id,
|
||||
token_account,
|
||||
mint,
|
||||
encryption_pubkey,
|
||||
decryptable_zero_balance,
|
||||
maximum_pending_balance_credit_counter,
|
||||
authority,
|
||||
|
|
|
@ -99,7 +99,6 @@ fn process_update_mint(
|
|||
fn process_configure_account(
|
||||
program_id: &Pubkey,
|
||||
accounts: &[AccountInfo],
|
||||
encryption_pubkey: &EncryptionPubkey,
|
||||
decryptable_zero_balance: &DecryptableBalance,
|
||||
maximum_pending_balance_credit_counter: &PodU64,
|
||||
proof_instruction_offset: i64,
|
||||
|
@ -139,18 +138,13 @@ fn process_configure_account(
|
|||
ProofInstruction::VerifyPubkeyValidity,
|
||||
&zkp_instruction,
|
||||
)?;
|
||||
// Check that the encryption public key associated with the confidential extension account is
|
||||
// consistent with what was actually used to generate the zkp.
|
||||
if proof_data.pubkey != *encryption_pubkey {
|
||||
return Err(TokenError::ConfidentialTransferElGamalPubkeyMismatch.into());
|
||||
}
|
||||
|
||||
// Note: The caller is expected to use the `Reallocate` instruction to ensure there is
|
||||
// sufficient room in their token account for the new `ConfidentialTransferAccount` extension
|
||||
let mut confidential_transfer_account =
|
||||
token_account.init_extension::<ConfidentialTransferAccount>(false)?;
|
||||
confidential_transfer_account.approved = confidential_transfer_mint.auto_approve_new_accounts;
|
||||
confidential_transfer_account.encryption_pubkey = *encryption_pubkey;
|
||||
confidential_transfer_account.encryption_pubkey = proof_data.pubkey;
|
||||
confidential_transfer_account.maximum_pending_balance_credit_counter =
|
||||
*maximum_pending_balance_credit_counter;
|
||||
|
||||
|
@ -1204,7 +1198,6 @@ pub(crate) fn process_instruction(
|
|||
process_configure_account(
|
||||
program_id,
|
||||
accounts,
|
||||
&data.encryption_pubkey,
|
||||
&data.decryptable_zero_balance,
|
||||
&data.maximum_pending_balance_credit_counter,
|
||||
data.proof_instruction_offset as i64,
|
||||
|
|
Loading…
Reference in New Issue