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

Commit 01e54df

Browse files
committed
derive registry address in UpdateRegistry instruction constructor
1 parent e3e7c17 commit 01e54df

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

token/confidential-transfer/elgamal-registry/src/instruction.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@ pub fn create_registry(
128128

129129
/// Create a `RegistryInstruction::UpdateRegistry` instruction
130130
pub fn update_registry(
131-
registry_account: &Pubkey,
132-
owner: &Pubkey,
131+
owner_address: &Pubkey,
133132
proof_location: ProofLocation<PubkeyValidityProofData>,
134133
) -> Result<Vec<Instruction>, ProgramError> {
135-
let mut accounts = vec![AccountMeta::new(*registry_account, false)];
134+
let elgamal_registry_address = get_elgamal_registry_address(owner_address, &id());
135+
136+
let mut accounts = vec![AccountMeta::new(elgamal_registry_address, false)];
136137
let proof_instruction_offset = proof_instruction_offset(&mut accounts, proof_location);
137-
accounts.push(AccountMeta::new_readonly(*owner, true));
138+
accounts.push(AccountMeta::new_readonly(*owner_address, true));
138139

139140
let registry_instruction = Instruction {
140141
program_id: id(),

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,12 +2884,9 @@ async fn confidential_transfer_configure_token_account_with_registry() {
28842884
&spl_elgamal_registry::id(),
28852885
);
28862886

2887-
let instructions = spl_elgamal_registry::instruction::update_registry(
2888-
&elgamal_registry_address,
2889-
&alice.pubkey(),
2890-
proof_location,
2891-
)
2892-
.unwrap();
2887+
let instructions =
2888+
spl_elgamal_registry::instruction::update_registry(&alice.pubkey(), proof_location)
2889+
.unwrap();
28932890
let tx = Transaction::new_signed_with_payer(
28942891
&instructions,
28952892
Some(&ctx.payer.pubkey()),

0 commit comments

Comments
 (0)