Module Evm_node_lib_dev.Evm_context

type init_status =
  1. | Loaded
  2. | Created
type head = {
  1. current_block_hash : Evm_node_lib_dev_encoding.Ethereum_types.block_hash;
  2. next_blueprint_number : Evm_node_lib_dev_encoding.Ethereum_types.quantity;
  3. evm_state : Evm_state.t;
}
val start : ?kernel_path:string -> data_dir:string -> preimages:string -> preimages_endpoint:Uri.t option -> smart_rollup_address:string -> fail_on_missing_blueprint:bool -> unit -> init_status Mavryk_base.TzPervasives.tzresult Lwt.t

start ~data_dir ~preimages ~preimages_endpoint ~smart_rollup_address () creates a new worker to manage a local EVM context where it initializes the index, and use a checkpoint mechanism to load the latest store if any.

Returns a value telling if the context was loaded from disk (Loaded) or was initialized from scratch (Created).

val init_from_rollup_node : data_dir:string -> rollup_node_data_dir:string -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

init_from_rollup_node ~data_dir ~rollup_node_data_dir initialises the irmin context and metadata of the evm using the latest known evm state of the given rollup node.

val reset : data_dir:string -> l2_level:Evm_node_lib_dev_encoding.Ethereum_types.quantity -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

reset ~data_dir ~l2_level reset the sequencer storage to l2_level. Warning: b Data will be lost !

val apply_evm_events : ?finalized_level:int32 -> Evm_node_lib_dev_encoding.Ethereum_types.Evm_events.t list -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

apply_evm_events ~finalized_level events applies all the events events on the local context. The events are performed in a transactional context.

Stores finalized_level with new_last_known_l1_level if provided.

val inspect : string -> bytes option Mavryk_base.TzPervasives.tzresult Lwt.t

inspect ctxt path returns the value stored in path of the freshest EVM state, if it exists.

val execute_and_inspect : ?wasm_entrypoint:string -> Simulation.Encodings.simulate_input -> bytes option list Mavryk_base.TzPervasives.tzresult Lwt.t

execute_and_inspect ~input ctxt executes input using the freshest EVM state, and returns input.insights_requests.

If wasm_entrypoint is omitted, the kernel_run function of the kernel is executed.

val last_produced_blueprint : unit -> Blueprint_types.t Mavryk_base.TzPervasives.tzresult Lwt.t

last_produced_blueprint ctxt returns the blueprint used to create the current head of the chain.

apply_blueprint timestamp payload delayed_transactions applies payload in the freshest EVM state stored under ctxt at timestamp timestamp, forwards the Blueprint_types.with_events. It commits the result if the blueprint produces the expected block.

val head_info : unit -> head Lwt.t
val blueprints_watcher : unit -> Blueprint_types.with_events Lwt_stream.t * Lwt_watcher.stopper
val last_known_l1_level : unit -> int32 option Mavryk_base.TzPervasives.tzresult Lwt.t
val new_last_known_l1_level : int32 -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
val shutdown : unit -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

delayed_inbox_hashes ctxt returns the hashes in the delayed inbox.