Skip to main content

precompile_output_to_interpreter_result

Function precompile_output_to_interpreter_result 

Source
pub fn precompile_output_to_interpreter_result(
    output: PrecompileOutput,
    gas_limit: u64,
) -> InterpreterResult
Expand description

Converts a [PrecompileOutput] into an [InterpreterResult] for a call frame with gas_limit regular gas.

Maps precompile status to the corresponding instruction result:

  • Success -> [InstructionResult::Return]
  • Revert -> [InstructionResult::Revert]
  • Halt(OOG) -> [InstructionResult::PrecompileOOG]
  • Halt(other) -> [InstructionResult::PrecompileError]

A precompile that reports more gas than it was given is downgraded to [InstructionResult::PrecompileOOG]. Anything but a success or revert consumes all regular gas and returns no output bytes.