From 2cb15753c9f0e7a4ebf505c8aafb412569efce8a Mon Sep 17 00:00:00 2001 From: Sam Kim Date: Thu, 10 Aug 2023 10:57:58 +0900 Subject: [PATCH] move `WithdrawWithheldTokensFrom{Accounts,Mint}` instructions into `zk-ops` feature --- .../confidential_transfer_fee/instruction.rs | 8 ++-- .../confidential_transfer_fee/processor.rs | 37 +++++++++++-------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/token/program-2022/src/extension/confidential_transfer_fee/instruction.rs b/token/program-2022/src/extension/confidential_transfer_fee/instruction.rs index d75eb3970ea..62739a59614 100644 --- a/token/program-2022/src/extension/confidential_transfer_fee/instruction.rs +++ b/token/program-2022/src/extension/confidential_transfer_fee/instruction.rs @@ -159,11 +159,11 @@ pub enum ConfidentialTransferFeeInstruction { /// Accounts expected by this instruction: /// /// * Single owner/delegate - /// 0. `[writable]` The SPL Token account. + /// 0. `[writable]` The token mint. /// 1. `[signer]` The confidential transfer fee authority. /// /// *Multisignature owner/delegate - /// 0. `[writable]` The SPL Token account. + /// 0. `[writable]` The token mint. /// 1. `[]` The confidential transfer fee multisig authority, /// 2. `[signer]` Required M signer accounts for the SPL Token Multisig account. /// @@ -176,11 +176,11 @@ pub enum ConfidentialTransferFeeInstruction { /// Accounts expected by this instruction: /// /// * Single owner/delegate - /// 0. `[writable]` The SPL Token account. + /// 0. `[writable]` The token mint. /// 1. `[signer]` The confidential transfer fee authority. /// /// *Multisignature owner/delegate - /// 0. `[writable]` The SPL Token account. + /// 0. `[writable]` The token mint. /// 1. `[]` The confidential transfer fee multisig authority, /// 2. `[signer]` Required M signer accounts for the SPL Token Multisig account. /// diff --git a/token/program-2022/src/extension/confidential_transfer_fee/processor.rs b/token/program-2022/src/extension/confidential_transfer_fee/processor.rs index cd3733fee82..34dd8f1bd23 100644 --- a/token/program-2022/src/extension/confidential_transfer_fee/processor.rs +++ b/token/program-2022/src/extension/confidential_transfer_fee/processor.rs @@ -469,24 +469,31 @@ pub(crate) fn process_instruction( } ConfidentialTransferFeeInstruction::WithdrawWithheldTokensFromMint => { msg!("ConfidentialTransferFeeInstruction::WithdrawWithheldTokensFromMint"); - let data = decode_instruction_data::(input)?; - process_withdraw_withheld_tokens_from_mint( - program_id, - accounts, - &data.new_decryptable_available_balance, - data.proof_instruction_offset as i64, - ) + #[cfg(feature = "zk-ops")] + { + let data = decode_instruction_data::(input)?; + process_withdraw_withheld_tokens_from_mint( + program_id, + accounts, + &data.new_decryptable_available_balance, + data.proof_instruction_offset as i64, + ) + } } ConfidentialTransferFeeInstruction::WithdrawWithheldTokensFromAccounts => { msg!("ConfidentialTransferFeeInstruction::WithdrawWithheldTokensFromAccounts"); - let data = decode_instruction_data::(input)?; - process_withdraw_withheld_tokens_from_accounts( - program_id, - accounts, - data.num_token_accounts, - &data.new_decryptable_available_balance, - data.proof_instruction_offset as i64, - ) + #[cfg(feature = "zk-ops")] + { + let data = + decode_instruction_data::(input)?; + process_withdraw_withheld_tokens_from_accounts( + program_id, + accounts, + data.num_token_accounts, + &data.new_decryptable_available_balance, + data.proof_instruction_offset as i64, + ) + } } ConfidentialTransferFeeInstruction::HarvestWithheldTokensToMint => { msg!("ConfidentialTransferFeeInstruction::HarvestWithheldTokensToMint");