Skip to content

Commit

Permalink
derive registry address in UpdateRegistry instruction constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto committed Oct 21, 2024
1 parent e3e7c17 commit 01e54df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ pub fn create_registry(

/// Create a `RegistryInstruction::UpdateRegistry` instruction
pub fn update_registry(
registry_account: &Pubkey,
owner: &Pubkey,
owner_address: &Pubkey,
proof_location: ProofLocation<PubkeyValidityProofData>,
) -> Result<Vec<Instruction>, ProgramError> {
let mut accounts = vec![AccountMeta::new(*registry_account, false)];
let elgamal_registry_address = get_elgamal_registry_address(owner_address, &id());

let mut accounts = vec![AccountMeta::new(elgamal_registry_address, false)];
let proof_instruction_offset = proof_instruction_offset(&mut accounts, proof_location);
accounts.push(AccountMeta::new_readonly(*owner, true));
accounts.push(AccountMeta::new_readonly(*owner_address, true));

let registry_instruction = Instruction {
program_id: id(),
Expand Down
9 changes: 3 additions & 6 deletions token/program-2022-test/tests/confidential_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2884,12 +2884,9 @@ async fn confidential_transfer_configure_token_account_with_registry() {
&spl_elgamal_registry::id(),
);

let instructions = spl_elgamal_registry::instruction::update_registry(
&elgamal_registry_address,
&alice.pubkey(),
proof_location,
)
.unwrap();
let instructions =
spl_elgamal_registry::instruction::update_registry(&alice.pubkey(), proof_location)
.unwrap();
let tx = Transaction::new_signed_with_payer(
&instructions,
Some(&ctx.payer.pubkey()),
Expand Down

0 comments on commit 01e54df

Please sign in to comment.