[zk-token-proof] Feature gate transfer with fee related proofs (#34103)
feature gate zk-token-proof transfer with fee
This commit is contained in:
parent
07b0b9f9e9
commit
a8863bd9fe
|
@ -135,6 +135,11 @@ declare_process_instruction!(Entrypoint, 0, |invoke_context| {
|
|||
let native_programs_consume_cu = invoke_context
|
||||
.feature_set
|
||||
.is_active(&feature_set::native_programs_consume_cu::id());
|
||||
|
||||
let enable_zk_transfer_with_fee = invoke_context
|
||||
.feature_set
|
||||
.is_active(&feature_set::enable_zk_transfer_with_fee::id());
|
||||
|
||||
let transaction_context = &invoke_context.transaction_context;
|
||||
let instruction_context = transaction_context.get_current_instruction_context()?;
|
||||
let instruction_data = instruction_context.get_instruction_data();
|
||||
|
@ -198,6 +203,11 @@ declare_process_instruction!(Entrypoint, 0, |invoke_context| {
|
|||
process_verify_proof::<TransferData, TransferProofContext>(invoke_context)
|
||||
}
|
||||
ProofInstruction::VerifyTransferWithFee => {
|
||||
// transfer with fee related proofs are not enabled
|
||||
if !enable_zk_transfer_with_fee {
|
||||
return Err(InstructionError::InvalidInstructionData);
|
||||
}
|
||||
|
||||
if native_programs_consume_cu {
|
||||
invoke_context
|
||||
.consume_checked(VERIFY_TRANSFER_WITH_FEE_COMPUTE_UNITS)
|
||||
|
@ -291,6 +301,11 @@ declare_process_instruction!(Entrypoint, 0, |invoke_context| {
|
|||
>(invoke_context)
|
||||
}
|
||||
ProofInstruction::VerifyFeeSigma => {
|
||||
// transfer with fee related proofs are not enabled
|
||||
if !enable_zk_transfer_with_fee {
|
||||
return Err(InstructionError::InvalidInstructionData);
|
||||
}
|
||||
|
||||
invoke_context
|
||||
.consume_checked(VERIFY_FEE_SIGMA_COMPUTE_UNITS)
|
||||
.map_err(|_| InstructionError::ComputationalBudgetExceeded)?;
|
||||
|
|
|
@ -728,6 +728,10 @@ pub mod disable_rent_fees_collection {
|
|||
solana_sdk::declare_id!("CJzY83ggJHqPGDq8VisV3U91jDJLuEaALZooBrXtnnLU");
|
||||
}
|
||||
|
||||
pub mod enable_zk_transfer_with_fee {
|
||||
solana_sdk::declare_id!("zkNLP7EQALfC1TYeB3biDU7akDckj8iPkvh9y2Mt2K3");
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
|
@ -905,6 +909,7 @@ lazy_static! {
|
|||
(update_hashes_per_tick6::id(), "Update desired hashes per tick to 10M"),
|
||||
(validate_fee_collector_account::id(), "validate fee collector account #33888"),
|
||||
(disable_rent_fees_collection::id(), "Disable rent fees collection #33945"),
|
||||
(enable_zk_transfer_with_fee::id(), "enable Zk Token proof program transfer with fee"),
|
||||
/*************** ADD NEW FEATURES HERE ***************/
|
||||
]
|
||||
.iter()
|
||||
|
|
Loading…
Reference in New Issue