From 62b6eafd7c2f1fe7d52fa26383f0573d0864a261 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 4 Oct 2021 17:32:10 -0700 Subject: [PATCH] Prevent proof program from being invoked as an inner instruction --- programs/zk-token-proof/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/zk-token-proof/src/lib.rs b/programs/zk-token-proof/src/lib.rs index 6c88f321bd..11a8667cfe 100644 --- a/programs/zk-token-proof/src/lib.rs +++ b/programs/zk-token-proof/src/lib.rs @@ -29,6 +29,11 @@ pub fn process_instruction( input: &[u8], invoke_context: &mut dyn InvokeContext, ) -> Result<(), InstructionError> { + if invoke_context.invoke_depth() != 1 { + // Not supported as an inner instruction + return Err(InstructionError::UnsupportedProgramId); + } + match ProofInstruction::decode_type(program_id, input) .ok_or(InstructionError::InvalidInstructionData)? {