Skip to content

Commit

Permalink
v1.16: [zk-token-proof] Enable proof program to be invoked as an inne…
Browse files Browse the repository at this point in the history
…r call (backport of #33045) (#33071)

[zk-token-proof] Enable proof program to be invoked as an inner call (#33045)

enable close context state account instruction to be invoked as an inner call

(cherry picked from commit 01dbe49)

Co-authored-by: samkim-crypto <[email protected]>
  • Loading branch information
mergify[bot] and samkim-crypto authored Aug 30, 2023
1 parent fb1693b commit 33474a7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions programs/zk-token-proof/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ fn process_close_proof_context(invoke_context: &mut InvokeContext) -> Result<(),
}

declare_process_instruction!(process_instruction, 0, |invoke_context| {
if invoke_context.get_stack_height() != TRANSACTION_LEVEL_STACK_HEIGHT {
// Not supported as an inner instruction
return Err(InstructionError::UnsupportedProgramId);
}

// Consume compute units if feature `native_programs_consume_cu` is activated
let native_programs_consume_cu = invoke_context
.feature_set
Expand All @@ -130,6 +125,13 @@ declare_process_instruction!(process_instruction, 0, |invoke_context| {
let instruction = ProofInstruction::instruction_type(instruction_data)
.ok_or(InstructionError::InvalidInstructionData)?;

if invoke_context.get_stack_height() != TRANSACTION_LEVEL_STACK_HEIGHT
&& instruction != ProofInstruction::CloseContextState
{
// Proof verification instructions are not supported as an inner instruction
return Err(InstructionError::UnsupportedProgramId);
}

match instruction {
ProofInstruction::CloseContextState => {
if native_programs_consume_cu {
Expand Down

0 comments on commit 33474a7

Please sign in to comment.