EEVM.Interpreter.MachineState.Frame (eevm v0.1.0)

Copy Markdown View Source

Per-call execution frame.

A frame is everything that gets a fresh value when a CALL/CREATE-like opcode spawns a child, and that gets restored when the child halts:

  • pc, stack, memory, gas, refund — execution registers
  • code — the currently-executing bytecode
  • program — code decoded for the interpreter (EEVM.Interpreter.InstructionTable.decode/3), or undecoded/0 while the frame runs code undecoded; nil until the frame starts
  • return_data — buffer holding the most recent child frame's output
  • contract — the per-call message context (msg.sender, msg.value, address, calldata, balances)
  • depth — the EVM call depth (max 1024)
  • is_static — STATICCALL flag; state-mutating opcodes revert under it

The active frame lives at MachineState.frame. CALL and CREATE run a child frame in a nested EEVM.Interpreter.run_loop/1 and copy its result back into the parent frame.

Summary

Types

t()

A frame running its code undecoded (#210): the gas left at which its next jump decodes the code, and the code's JUMPDEST map (EEVM.Interpreter.InstructionTable.jumpdests/1) once it has jumped.

Types

t()

@type t() :: %EEVM.Interpreter.MachineState.Frame{
  code: binary(),
  contract: EEVM.Context.Contract.t(),
  depth: non_neg_integer(),
  gas: non_neg_integer(),
  is_static: boolean(),
  memory: EEVM.Interpreter.Memory.t(),
  pc: non_neg_integer(),
  program: EEVM.Interpreter.InstructionTable.program() | undecoded() | nil,
  refund: integer(),
  return_data: binary(),
  stack: EEVM.Interpreter.Stack.t()
}

undecoded()

@type undecoded() :: {:undecoded, decode_at :: integer(), jumpdests :: binary() | nil}

A frame running its code undecoded (#210): the gas left at which its next jump decodes the code, and the code's JUMPDEST map (EEVM.Interpreter.InstructionTable.jumpdests/1) once it has jumped.