View Source Signet.VM (Signet v1.3.8)
An Ethereum VM in Signet, that can only execute pure functions.
Summary
Functions
Executes the Ethereum Virtual Machine (EVM) with the given code
and input
.
Runs the given EVM, returning the RETURN
data or the REVERT
data.
Types
@type address() :: <<_::160>>
@type code() :: [opcode()]
@type context_result() :: {:ok, Context.t()} | {:error, vm_error()}
@type opcode() :: Signet.Assembly.opcode()
@type signed() :: integer()
@type unsigned() :: non_neg_integer()
@type word() :: <<_::256>>
Functions
@spec exec(code() | binary(), binary(), exec_opts()) :: {:ok, Signet.VM.ExecutionResult.t()} | {:error, vm_error()}
Executes the Ethereum Virtual Machine (EVM) with the given code
and input
.
Parameters
code
: The bytecode to be executed, either as abinary
or decoded.calldata
: The call data for the execution.opts
: Execution options (see below)
Options
:callvalue
: value passed as callvalue for the execution.:ffis
: A mapping of address to functions to run as natively implemented ffis
Returns the result of the execution.
Runs the given EVM, returning the RETURN
data or the REVERT
data.
Raises on any other exceptional state.
Parameters
code
: The bytecode to be executed, either as abinary
or decoded.calldata
: The call data for the execution.opts
: Execution options (see below)
Options
:callvalue
: value passed as callvalue for the execution.:ffis
: A mapping of address to functions to run as natively implemented ffis
@spec inc_pc(context_result(), opcode()) :: context_result()
@spec peek(Signet.VM.Context.t(), integer()) :: {:ok, word()} | {:error, vm_error()}
@spec pop2(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), word(), word()} | {:error, vm_error()}
@spec pop2_unsigned(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), unsigned(), unsigned()} | {:error, vm_error()}
@spec pop2_unsigned_word(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), unsigned(), word()} | {:error, vm_error()}
@spec pop3(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), word(), word(), word()} | {:error, vm_error()}
@spec pop3_unsigned(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), unsigned(), unsigned(), unsigned()} | {:error, vm_error()}
@spec pop(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), word()} | {:error, vm_error()}
@spec pop_unsigned(Signet.VM.Context.t()) :: {:ok, Signet.VM.Context.t(), unsigned()} | {:error, vm_error()}
@spec push_word(Signet.VM.Context.t(), word()) :: {:ok, Signet.VM.Context.t()} | {:error, vm_error()}
@spec run_single_op(Signet.VM.Context.t(), Signet.VM.Input.t(), Keyword.t()) :: context_result()