EEVM.Config (eevm v0.1.0)

Copy Markdown View Source

Runtime configuration for EEVM execution.

Holds both the hardfork specification (which EIP rules are active) and custom precompile registration.

Summary

Functions

Creates a new config with the given hardfork (default: :cancun).

Types

t()

@type t() :: %EEVM.Config{
  hardfork: EEVM.HardforkConfig.t(),
  precompiles: %{optional(non_neg_integer()) => module()}
}

Functions

new(spec_id \\ :cancun)

@spec new(EEVM.HardforkConfig.spec_id()) :: t()

Creates a new config with the given hardfork (default: :cancun).

Examples

iex> EEVM.Config.new()
%EEVM.Config{hardfork: %EEVM.HardforkConfig{spec_id: :cancun}, precompiles: %{}}

iex> EEVM.Config.new(:berlin)
%EEVM.Config{hardfork: %EEVM.HardforkConfig{spec_id: :berlin}, precompiles: %{}}

register_precompile(config, address, module)

@spec register_precompile(t(), non_neg_integer(), module()) :: t()