Function revm::interpreter::interpreter::analysis::validate_eof_code

source ยท
pub fn validate_eof_code(
    code: &[u8],
    data_size: usize,
    this_types_index: usize,
    num_of_containers: usize,
    types: &[TypesSection]
) -> Result<HashSet<usize>, EofValidationError>
Expand description

Validates that:

  • All instructions are valid.
  • It ends with a terminating instruction or RJUMP.
  • All instructions are accessed by forward jumps or .

Validate stack requirements and if all codes sections are used.

TODO mark accessed Types/Codes

Preconditions:

  • Jump destinations are valid.
  • All instructions are valid and well formed.
  • All instruction is accessed by forward jumps.
  • Bytecode is valid and ends with terminating instruction.

Preconditions are checked in validate_eof_bytecode.