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

Commit ba2b795

Browse files
remove ElGamal pubkey from confidential transfer ConfigureAccount data (#3927)
1 parent 9a0ecb3 commit ba2b795

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

token/client/src/token.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,6 @@ where
15581558
&self.program_id,
15591559
token_account,
15601560
&self.pubkey,
1561-
elgamal_keypair.public.into(),
15621561
decryptable_zero_balance,
15631562
maximum_pending_balance_credit_counter,
15641563
&authority.pubkey(),

token/program-2022/src/extension/confidential_transfer/instruction.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,6 @@ pub enum ConfidentialTransferInstruction {
423423
#[derive(Clone, Copy, Pod, Zeroable)]
424424
#[repr(C)]
425425
pub struct ConfigureAccountInstructionData {
426-
/// The public key associated with the account
427-
pub encryption_pubkey: EncryptionPubkey,
428426
/// The decryptable balance (always 0) once the configure account succeeds
429427
pub decryptable_zero_balance: DecryptableBalance,
430428
/// The maximum number of despots and transfers that an account can receiver before the
@@ -562,7 +560,6 @@ pub fn inner_configure_account(
562560
token_program_id: &Pubkey,
563561
token_account: &Pubkey,
564562
mint: &Pubkey,
565-
encryption_pubkey: EncryptionPubkey,
566563
decryptable_zero_balance: AeCiphertext,
567564
maximum_pending_balance_credit_counter: u64,
568565
authority: &Pubkey,
@@ -587,7 +584,6 @@ pub fn inner_configure_account(
587584
TokenInstruction::ConfidentialTransferExtension,
588585
ConfidentialTransferInstruction::ConfigureAccount,
589586
&ConfigureAccountInstructionData {
590-
encryption_pubkey,
591587
decryptable_zero_balance: decryptable_zero_balance.into(),
592588
maximum_pending_balance_credit_counter: maximum_pending_balance_credit_counter.into(),
593589
proof_instruction_offset,
@@ -602,7 +598,6 @@ pub fn configure_account(
602598
token_program_id: &Pubkey,
603599
token_account: &Pubkey,
604600
mint: &Pubkey,
605-
encryption_pubkey: EncryptionPubkey,
606601
decryptable_zero_balance: AeCiphertext,
607602
maximum_pending_balance_credit_counter: u64,
608603
authority: &Pubkey,
@@ -614,7 +609,6 @@ pub fn configure_account(
614609
token_program_id,
615610
token_account,
616611
mint,
617-
encryption_pubkey,
618612
decryptable_zero_balance,
619613
maximum_pending_balance_credit_counter,
620614
authority,

token/program-2022/src/extension/confidential_transfer/processor.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ fn process_update_mint(
9999
fn process_configure_account(
100100
program_id: &Pubkey,
101101
accounts: &[AccountInfo],
102-
encryption_pubkey: &EncryptionPubkey,
103102
decryptable_zero_balance: &DecryptableBalance,
104103
maximum_pending_balance_credit_counter: &PodU64,
105104
proof_instruction_offset: i64,
@@ -139,18 +138,13 @@ fn process_configure_account(
139138
ProofInstruction::VerifyPubkeyValidity,
140139
&zkp_instruction,
141140
)?;
142-
// Check that the encryption public key associated with the confidential extension account is
143-
// consistent with what was actually used to generate the zkp.
144-
if proof_data.pubkey != *encryption_pubkey {
145-
return Err(TokenError::ConfidentialTransferElGamalPubkeyMismatch.into());
146-
}
147141

148142
// Note: The caller is expected to use the `Reallocate` instruction to ensure there is
149143
// sufficient room in their token account for the new `ConfidentialTransferAccount` extension
150144
let mut confidential_transfer_account =
151145
token_account.init_extension::<ConfidentialTransferAccount>(false)?;
152146
confidential_transfer_account.approved = confidential_transfer_mint.auto_approve_new_accounts;
153-
confidential_transfer_account.encryption_pubkey = *encryption_pubkey;
147+
confidential_transfer_account.encryption_pubkey = proof_data.pubkey;
154148
confidential_transfer_account.maximum_pending_balance_credit_counter =
155149
*maximum_pending_balance_credit_counter;
156150

@@ -1204,7 +1198,6 @@ pub(crate) fn process_instruction(
12041198
process_configure_account(
12051199
program_id,
12061200
accounts,
1207-
&data.encryption_pubkey,
12081201
&data.decryptable_zero_balance,
12091202
&data.maximum_pending_balance_credit_counter,
12101203
data.proof_instruction_offset as i64,

0 commit comments

Comments
 (0)