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

Commit e3e7c17

Browse files
committed
require owner signature when creating registry account
1 parent b358c18 commit e3e7c17

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub enum RegistryInstruction {
1919
///
2020
/// 0. `[writable, signer]` The funding account (must be a system account)
2121
/// 1. `[writable]` The account to be created
22-
/// 2. `[]` The wallet address (will also be the owner address for the
22+
/// 2. `[signer]` The wallet address (will also be the owner address for the
2323
/// registry account)
2424
/// 3. `[]` System program
2525
/// 4. `[]` Instructions sysvar if `VerifyPubkeyValidity` is included in the
@@ -110,7 +110,7 @@ pub fn create_registry(
110110
let mut accounts = vec![
111111
AccountMeta::new(*funding_address, true),
112112
AccountMeta::new(elgamal_registry_address, false),
113-
AccountMeta::new_readonly(*owner_address, false),
113+
AccountMeta::new_readonly(*owner_address, true),
114114
AccountMeta::new_readonly(system_program::id(), false),
115115
];
116116
let proof_instruction_offset = proof_instruction_offset(&mut accounts, proof_location);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ pub fn process_create_registry_account(
3535
let wallet_account_info = next_account_info(account_info_iter)?;
3636
let system_program_info = next_account_info(account_info_iter)?;
3737

38+
if !wallet_account_info.is_signer {
39+
return Err(ProgramError::MissingRequiredSignature);
40+
}
41+
3842
// zero-knowledge proof certifies that the supplied ElGamal public key is valid
3943
let proof_context = verify_and_extract_context::<
4044
PubkeyValidityProofData,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2862,7 +2862,7 @@ async fn confidential_transfer_configure_token_account_with_registry() {
28622862
let tx = Transaction::new_signed_with_payer(
28632863
&instructions,
28642864
Some(&ctx.payer.pubkey()),
2865-
&[&ctx.payer],
2865+
&[&ctx.payer, &alice],
28662866
ctx.last_blockhash,
28672867
);
28682868
ctx.banks_client.process_transaction(tx).await.unwrap();

0 commit comments

Comments
 (0)