[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
This commit is contained in:
samkim-crypto 2023-08-30 08:18:22 -07:00 committed by GitHub
parent 48f27d5e73
commit 01dbe4970c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -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
@ -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 => {
ic_msg!(invoke_context, "CloseContextState");