Runtime execution state of a Cartouche.VM step: program counter, stack,
memory, transient storage, halt/revert flags, return data, and the FFI
table available to the VM.
Summary
Functions
Looks up the FFI registered at address in the context's FFI table.
Returns {:error, {:unknown_ffi, address}} when no FFI is registered.
Builds a fresh Context for executing code with the given FFI table.
Pre-computes the program-counter-keyed op_map from the assembled
bytecode so subsequent steps can resolve operations in O(1).
Renders the context as a multi-line string showing the program counter and stack contents. Used for verbose VM tracing.
Renders the EVM stack as a debugger-style multi-line string with descending offsets and word values in hex.
Types
@type op_map() :: %{required(integer()) => Cartouche.VM.opcode()}
Functions
@spec fetch_ffi(t(), Cartouche.VM.address()) :: {:ok, Cartouche.VM.ffi()} | {:error, Cartouche.VM.vm_error()}
Looks up the FFI registered at address in the context's FFI table.
Returns {:error, {:unknown_ffi, address}} when no FFI is registered.
@spec init_from(Cartouche.VM.code(), Cartouche.VM.ffis()) :: t()
Builds a fresh Context for executing code with the given FFI table.
Pre-computes the program-counter-keyed op_map from the assembled
bytecode so subsequent steps can resolve operations in O(1).
Renders the context as a multi-line string showing the program counter and stack contents. Used for verbose VM tracing.
Renders the EVM stack as a debugger-style multi-line string with descending offsets and word values in hex.