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

Commit 091f6d8

Browse files
committed
fix registry and token account owner check
1 parent 367d367 commit 091f6d8

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

token/client/src/token.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,6 @@ where
19801980
&self,
19811981
account: &Pubkey,
19821982
elgamal_registry_account: &Pubkey,
1983-
authority: &Pubkey,
19841983
) -> TokenResult<T::Output> {
19851984
self.process_ixs::<[&dyn Signer; 0]>(
19861985
&[
@@ -1989,7 +1988,6 @@ where
19891988
account,
19901989
&self.pubkey,
19911990
elgamal_registry_account,
1992-
authority,
19931991
)?,
19941992
],
19951993
&[],

token/program-2022-test/tests/confidential_transfer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2902,7 +2902,7 @@ async fn confidential_transfer_configure_token_account_with_registry() {
29022902
token
29032903
.create_auxiliary_token_account_with_extension_space(
29042904
&alice_account_keypair,
2905-
&alice_token_account,
2905+
&alice.pubkey(),
29062906
vec![ExtensionType::ConfidentialTransferAccount],
29072907
)
29082908
.await
@@ -2912,7 +2912,6 @@ async fn confidential_transfer_configure_token_account_with_registry() {
29122912
.confidential_transfer_configure_token_account_with_registry(
29132913
&alice_account_keypair.pubkey(),
29142914
&elgamal_registry_address,
2915-
&alice.pubkey(),
29162915
)
29172916
.await
29182917
.unwrap();

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ pub enum ConfidentialTransferInstruction {
490490
/// 0. `[writable]` The SPL Token account.
491491
/// 1. `[]` The corresponding SPL Token mint.
492492
/// 2. `[]` The ElGamal registry account.
493-
/// 3. `[]` The account owner.
494493
///
495494
/// Data expected by this instruction:
496495
/// None
@@ -1731,14 +1730,12 @@ pub fn configure_account_with_registry(
17311730
token_account: &Pubkey,
17321731
mint: &Pubkey,
17331732
elgamal_registry_account: &Pubkey,
1734-
authority: &Pubkey,
17351733
) -> Result<Instruction, ProgramError> {
17361734
check_program_account(token_program_id)?;
17371735
let accounts = vec![
17381736
AccountMeta::new(*token_account, false),
17391737
AccountMeta::new_readonly(*mint, false),
17401738
AccountMeta::new_readonly(*elgamal_registry_account, false),
1741-
AccountMeta::new_readonly(*authority, false),
17421739
];
17431740

17441741
Ok(encode_instruction(

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ fn process_configure_account(
151151
}
152152
};
153153

154-
let authority_info = next_account_info(account_info_iter)?;
155-
let authority_info_data_len = authority_info.data_len();
156-
157154
check_program_account(token_account_info.owner)?;
158155
let token_account_data = &mut token_account_info.data.borrow_mut();
159156
let mut token_account = PodStateWithExtensionsMut::<PodAccount>::unpack(token_account_data)?;
@@ -164,6 +161,9 @@ fn process_configure_account(
164161

165162
match elgamal_pubkey_source {
166163
ElGamalPubkeySource::ProofInstructionOffset(_) => {
164+
let authority_info = next_account_info(account_info_iter)?;
165+
let authority_info_data_len = authority_info.data_len();
166+
167167
Processor::validate_owner(
168168
program_id,
169169
&token_account.base.owner,
@@ -176,7 +176,7 @@ fn process_configure_account(
176176
// if ElGamal registry was provided, then just verify that the owners of the
177177
// registry and token accounts match, then skip the signature
178178
// verification check
179-
if elgamal_registry_account.owner != *authority_info.key {
179+
if elgamal_registry_account.owner != token_account.base.owner {
180180
return Err(TokenError::OwnerMismatch.into());
181181
}
182182
}

0 commit comments

Comments
 (0)