Skip to content

Commit 969cff2

Browse files
[rust-legacy-client] Always assume that the supply ElGamal public key is set (#178)
always assume that the supply ElGamal public key is set
1 parent efd0c95 commit 969cff2

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

clients/rust-legacy/src/token.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3410,7 +3410,6 @@ where
34103410
&self.program_id,
34113411
destination_account,
34123412
&self.pubkey,
3413-
Some(*supply_elgamal_keypair.pubkey()),
34143413
&mint_amount_auditor_ciphertext_lo,
34153414
&mint_amount_auditor_ciphertext_hi,
34163415
authority,
@@ -3548,7 +3547,6 @@ where
35483547
&self.program_id,
35493548
source_account,
35503549
&self.pubkey,
3551-
Some(*supply_elgamal_pubkey),
35523550
&new_decryptable_balance,
35533551
&burn_amount_auditor_ciphertext_lo,
35543552
&burn_amount_auditor_ciphertext_hi,

program/src/extension/confidential_mint_burn/instruction.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ use {
2323
};
2424
#[cfg(not(target_os = "solana"))]
2525
use {
26-
solana_zk_sdk::{
27-
encryption::elgamal::ElGamalPubkey,
28-
zk_elgamal_proof_program::{
29-
instruction::ProofInstruction,
30-
proof_data::{
31-
BatchedGroupedCiphertext3HandlesValidityProofData, BatchedRangeProofU128Data,
32-
CiphertextCiphertextEqualityProofData, CiphertextCommitmentEqualityProofData,
33-
},
26+
solana_zk_sdk::zk_elgamal_proof_program::{
27+
instruction::ProofInstruction,
28+
proof_data::{
29+
BatchedGroupedCiphertext3HandlesValidityProofData, BatchedRangeProofU128Data,
30+
CiphertextCiphertextEqualityProofData, CiphertextCommitmentEqualityProofData,
3431
},
3532
},
3633
spl_token_confidential_transfer_proof_extraction::instruction::{
@@ -112,8 +109,7 @@ pub enum ConfidentialMintBurnInstruction {
112109
///
113110
/// * Single authority
114111
/// 0. `[writable]` The SPL Token account.
115-
/// 1. `[]` The SPL Token mint. `[writable]` if the mint has a non-zero
116-
/// supply elgamal-pubkey
112+
/// 1. `[writable]` The SPL Token mint.
117113
/// 2. `[]` (Optional) Instructions sysvar if at least one of the
118114
/// `zk_elgamal_proof` instructions are included in the same
119115
/// transaction.
@@ -152,8 +148,7 @@ pub enum ConfidentialMintBurnInstruction {
152148
///
153149
/// * Single authority
154150
/// 0. `[writable]` The SPL Token account.
155-
/// 1. `[]` The SPL Token mint. `[writable]` if the mint has a non-zero
156-
/// supply elgamal-pubkey
151+
/// 1. `[writable]` The SPL Token mint.
157152
/// 2. `[]` (Optional) Instructions sysvar if at least one of the
158153
/// `zk_elgamal_proof` instructions are included in the same
159154
/// transaction.
@@ -421,7 +416,6 @@ pub fn confidential_mint_with_split_proofs(
421416
token_program_id: &Pubkey,
422417
token_account: &Pubkey,
423418
mint: &Pubkey,
424-
supply_elgamal_pubkey: Option<ElGamalPubkey>,
425419
mint_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
426420
mint_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
427421
authority: &Pubkey,
@@ -434,14 +428,10 @@ pub fn confidential_mint_with_split_proofs(
434428
new_decryptable_supply: &DecryptableBalance,
435429
) -> Result<Vec<Instruction>, ProgramError> {
436430
check_program_account(token_program_id)?;
437-
let mut accounts = vec![AccountMeta::new(*token_account, false)];
438-
// we only need write lock to adjust confidential suppy on
439-
// mint if a value for supply_elgamal_pubkey has been set
440-
if supply_elgamal_pubkey.is_some() {
441-
accounts.push(AccountMeta::new(*mint, false));
442-
} else {
443-
accounts.push(AccountMeta::new_readonly(*mint, false));
444-
}
431+
let mut accounts = vec![
432+
AccountMeta::new(*token_account, false),
433+
AccountMeta::new(*mint, false),
434+
];
445435

446436
let mut expected_instruction_offset = 1;
447437
let mut proof_instructions = vec![];
@@ -508,7 +498,6 @@ pub fn confidential_burn_with_split_proofs(
508498
token_program_id: &Pubkey,
509499
token_account: &Pubkey,
510500
mint: &Pubkey,
511-
supply_elgamal_pubkey: Option<ElGamalPubkey>,
512501
new_decryptable_available_balance: &DecryptableBalance,
513502
burn_amount_auditor_ciphertext_lo: &PodElGamalCiphertext,
514503
burn_amount_auditor_ciphertext_hi: &PodElGamalCiphertext,
@@ -521,12 +510,10 @@ pub fn confidential_burn_with_split_proofs(
521510
range_proof_location: ProofLocation<BatchedRangeProofU128Data>,
522511
) -> Result<Vec<Instruction>, ProgramError> {
523512
check_program_account(token_program_id)?;
524-
let mut accounts = vec![AccountMeta::new(*token_account, false)];
525-
if supply_elgamal_pubkey.is_some() {
526-
accounts.push(AccountMeta::new(*mint, false));
527-
} else {
528-
accounts.push(AccountMeta::new_readonly(*mint, false));
529-
}
513+
let mut accounts = vec![
514+
AccountMeta::new(*token_account, false),
515+
AccountMeta::new(*mint, false),
516+
];
530517

531518
let mut expected_instruction_offset = 1;
532519
let mut proof_instructions = vec![];

0 commit comments

Comments
 (0)