package tezt-tezos

  1. Overview
  2. Docs
type t

EVM node server state.

type mode =
  1. | Sequencer of {
    1. kernel : string;
      (*

      Path to the kernel used by the sequencer.

      *)
    2. preimage_dir : string;
      (*

      Path to the directory with the associated preimages.

      *)
    }
  2. | Proxy

EVM node mode.

val create : ?runner:Tezt_wrapper.Runner.t -> ?mode:mode -> ?data_dir:string -> ?devmode:bool -> ?rpc_addr:string -> ?rpc_port:int -> string -> t

create ?runner ?mode ?data_dir ?devmode ?rpc_addr ?rpc_port rollup_node_endpoint creates an EVM node server.

The server listens to requests at address rpc_addr and the port rpc_port. rpc_addr defaults to "127.0.0.1" and a fresh port is chosen if rpc_port is not set.

To use the node on development set devmode to true. Otherwise to set it to the one on production set devmode to false (or omit the parameter).

The server communicates with a rollup-node and sets its endpoint via rollup_node_endpoint.

mode defaults to Proxy.

val run : t -> unit Lwt.t

run evm_node launches the EVM node server with the arguments given during create.

val init : ?runner:Tezt_wrapper.Runner.t -> ?mode:mode -> ?data_dir:string -> ?devmode:bool -> ?rpc_addr:string -> ?rpc_port:int -> string -> t Lwt.t

init ?runner ?mode ?data_dir ?devmode ?rpc_addr ?rpc_port rollup_node_endpoint creates an EVM node server with create and runs it with run.

val spawn_run : t -> Tezt_wrapper.Process.t

spawn_run evm_node same as run but spawns a process.

val terminate : ?timeout:float -> t -> unit Lwt.t

Send SIGTERM and wait for the process to terminate.

Default timeout is 30 seconds, after which SIGKILL is sent.

val endpoint : t -> string

endpoint evm_node returns the endpoint to communicate with the evm_node.

type request = {
  1. method_ : string;
  2. parameters : Tezt_wrapper.JSON.u;
}

JSON-RPC request.

val call_evm_rpc : t -> request -> Tezt_wrapper.JSON.t Lwt.t

call_evm_rpc evm_node ~request sends a JSON-RPC request to the evm_node, for the given request.

val batch_evm_rpc : t -> request list -> Tezt_wrapper.JSON.t Lwt.t

batch_evm_rpc evm_node ~requests sends multiple JSON-RPC requests to the evm_node, for the given requests.

val extract_result : Tezt_wrapper.JSON.t -> Tezt_wrapper.JSON.t

extract_result json expects a JSON-RPC `result` and returns the value.

val extract_error_message : Tezt_wrapper.JSON.t -> Tezt_wrapper.JSON.t

extract_error_message json expects a JSON-RPC `error.message` and returns the value.

val fetch_contract_code : t -> string -> string Lwt.t

fetch_contract_code evm_node contract returns the code associated to the given contract in the rollup.

type txpool_slot = {
  1. address : string;
  2. transactions : (int64 * Tezt_wrapper.JSON.t) list;
}

A slot in the transaction pool associates an address to a mapping of nonces to transactions.

val txpool_content : t -> (txpool_slot list * txpool_slot list) Lwt.t

txpool_content evm_node returns the transaction hash and nonce contained in the `pending` and `queued` pools.

OCaml

Innovation. Community. Security.