Skip to main content

verify

Function verify 

Source
pub fn verify(
    program_info: ProgramInfo,
    stack_inputs: StackInputs,
    stack_outputs: StackOutputs,
    proof: ExecutionProof,
) -> Result<u32, VerificationError>
Expand description

Returns the security level of the proof if the specified program was executed correctly against the specified inputs and outputs.

Specifically, verifies that if a program with the specified program_hash is executed against the provided stack_inputs and some secret inputs, the result is equal to the stack_outputs.

Stack inputs are expected to be ordered as if they would be pushed onto the stack one by one. Thus, their expected order on the stack will be the reverse of the order in which they are provided, and the last value in the stack_inputs slice is expected to be the value at the top of the stack.

Stack outputs are expected to be ordered as if they would be popped off the stack one by one. Thus, the value at the top of the stack is expected to be in the first position of the stack_outputs slice, and the order of the rest of the output elements will also match the order on the stack. This is the reverse of the order of the stack_inputs slice.

ยงErrors

Returns an error if:

  • The provided proof does not prove a correct execution of the program.
  • The proof contains one or more precompile requests. When precompile requests are present, use verify_with_precompiles instead with an appropriate PrecompileVerifierRegistry to verify the precompile computations.