Module Evm_node_lib_dev.Evm_state

val kernel_logs_directory : data_dir:string -> string

Directory where the kernel logs are stored. The function execute below expect the directory to exist.

val execute : ?execution_timestamp:Tezos_base.TzPervasives.Time.Protocol.t -> ?wasm_pvm_fallback:bool -> ?profile:Evm_node_config.Configuration.profile_mode -> ?kind:Events.kernel_log_kind -> data_dir:string -> ?log_file:string -> ?wasm_entrypoint:string -> config:Wasm_debugger.config -> native_execution:bool -> t -> [< `Input of string ] list -> t Tezos_base.TzPervasives.tzresult Lwt.t

execute ?execution_timestamp ?simulation ~data_dir ?log_file ~wasm_entrypoint ~config evm_state messages executes the wasm_entrypoint function (default to kernel_run) with messages within the inbox of evm_state.

Kernel logs are stored under the kernel_logs_directory in log_file. simulation adds a prefix to the event to differenciate the logs.

When execution_timestamp is provided it's used as the l1 timestamp of in the Info_per_level message of the inbox, default value is `epoch`.

init ~kernel initializes the local evm_state with kernel.

val modify : ?edit_readonly:bool -> key:string -> value:string -> t -> t Lwt.t

modify ~key ~value evm_state sets value at key in the local EVM state.

val delete : kind:Tezos_scoru_wasm.Durable.kind -> t -> string -> t Lwt.t

delete ~kind evm_state key delete the value/directory at key

val exists : t -> string -> bool Lwt.t

exists evm_state key returns true if a value or a tree/subtree exists under key in evm_state, false otherwise.

val inspect : t -> string -> bytes option Lwt.t

inspect evm_state key returns the value stored under key in evm_state, if any.

val subkeys : t -> string -> string Tezos_base.TzPervasives.trace Lwt.t

subkeys evm_state key returns the list of keys stored under key in evm_state.

val read : t -> string -> bytes option Tezos_base.TzPervasives.tzresult Lwt.t

read evm_state key returns the bytes stored under key in evm_state.

val execute_and_inspect : ?wasm_pvm_fallback:bool -> data_dir:string -> ?wasm_entrypoint:string -> config:Wasm_debugger.config -> native_execution_policy:Evm_node_config.Configuration.native_execution_policy -> input:Simulation.Encodings.simulate_input -> t -> bytes option list Tezos_base.TzPervasives.tzresult Lwt.t

execute_and_inspect ~data_dir ?wasm_entrypoint ~config ~input evm_state executes the wasm_entrypoint function (default to kernel_run) with input within the inbox of evm_state, and returns input.insights_requests.

current_block_height ~root evm_state returns the height of the latest block produced by the kernel at root.

Same as current_block_height for the block hash.

type apply_result =
  1. | Apply_success of {
    1. evm_state : t;
    2. block : Evm_node_lib_dev_encoding.Ethereum_types.legacy_transaction_object Evm_node_lib_dev_encoding.L2_types.block;
    }
  2. | Apply_failure
val apply_unsigned_chunks : ?wasm_pvm_fallback:bool -> ?log_file:string -> ?profile:Evm_node_config.Configuration.profile_mode -> data_dir:string -> chain_family:_ Evm_node_lib_dev_encoding.L2_types.chain_family -> config:Wasm_debugger.config -> native_execution_policy:Evm_node_config.Configuration.native_execution_policy -> t -> Sequencer_blueprint.unsigned_chunk list -> apply_result Tezos_base.TzPervasives.tzresult Lwt.t

apply_unsigned_chunks ~data-dir ~config state chunks applies the blueprint chunks on top of evm_state. If the payload produces a block, the new updated EVM state is returned along with the new block’s height.

The data-dir is used to store the kernel logs in the kernel_logs_directory.

val flag_local_exec : t -> t Lwt.t

flag_local_exec evm_state adds a flag telling the kernel it is executed by an EVM node, not a rollup node.

val clear_delayed_inbox : t -> t Lwt.t

clear_delayed_inbox evm_state removes the delayed inbox from the current EVM state.

val wasm_pvm_version : t -> Tezos_scoru_wasm.Wasm_pvm_state.version Lwt.t
val irmin_store_path : data_dir:string -> string

irmin_store_path ~data_dir returns the path wherein the Irmin store is expected to be located, relatively to the data directory.

val preload_kernel : t -> unit Lwt.t

preload_kernel evm_state ensures the kernel of evm_state is added to the kernel cache of the execution runtime in use. This will speed-up the execution time for the first call of this kernel (typically in the context of a RPC call).

get_delayed_inbox_item state hash returns the delayed inbox content behind the hash hash. It fails if the hash does not exist or if the value cannot be decoded.

val clear_block_storage : _ Evm_node_lib_dev_encoding.L2_types.chain_family -> 'transaction_object Evm_node_lib_dev_encoding.L2_types.block -> t -> t Lwt.t

clear_block_storage chain_family block state removes the parent of block, and all durable storage information stored for block, if this function is called they need to be store elsewhere, mainly it consists in transactions.

val storage_version : t -> int Tezos_base.TzPervasives.tzresult Lwt.t

storage_version tree returns the current storage version set by the kernel. This storage version is used by the EVM node to determine whether a given feature is implemented by the kernel or not.