package tezt-tezos

  1. Overview
  2. Docs
type t

A baker instance

val name : t -> string

See Daemon.Make.name

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 kill : t -> unit Lwt.t

Send SIGKILL and wait for the process to terminate.

val stop : t -> unit Lwt.t

Send SIGSTOP to the process.

val continue : t -> unit Lwt.t

Send SIGCONT to the process.

val log_events : ?max_length:int -> t -> unit

See Daemon.Make.log_events.

val wait_for : ?where:string -> t -> string -> (Tezt_wrapper.JSON.t -> 'a option) -> 'a Lwt.t

See Daemon.Make.wait_for.

val wait_for_ready : t -> unit Lwt.t

Wait until the baker is ready.

More precisely, wait until a "Baker started" event occurs. If this event alreay happened, return immediately.

type event = {
  1. name : string;
  2. value : Tezt_wrapper.JSON.t;
  3. timestamp : float;
}

Raw events.

val on_event : t -> (event -> unit) -> unit

See Daemon.Make.on_event.

val run : ?event_level:Daemon.Level.default_level -> ?event_sections_levels:(string * Daemon.Level.level) list -> t -> unit Lwt.t

Spawn octez-baker run.

The resulting promise is fulfilled as soon as the baker has been spawned. It continues running in the background.

type liquidity_baking_vote =
  1. | Off
  2. | On
  3. | Pass

Liquidity baking vote values.

val liquidity_baking_vote_of_string_opt : string -> liquidity_baking_vote option

Returns the liquidity_baking_vote corresponding to a string, or None if the string is not a valid liquidity baking vote.

val liquidity_baking_vote_to_string : liquidity_baking_vote -> string

Returns the string representation of a liquidity_baking_vote.

val liquidity_baking_votefile : ?path:string -> liquidity_baking_vote -> string

Writes a liquidity baking votefile, as read by the bakers --votefile argument.

If path is set, the vote file is written there. Otherwise, it is written to a temporary file.

Returns the path to the file that was written.

val create : ?runner:Tezt_wrapper.Runner.t -> protocol:Protocol.t -> ?path:string -> ?name:string -> ?color:Tezt_wrapper.Log.Color.t -> ?event_pipe:string -> ?delegates:string list -> ?votefile:string -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> ?force_apply:bool -> ?remote_mode:bool -> ?operations_pool:string -> ?dal_node:Dal_node.t -> ?minimal_nanotez_per_gas_unit:int -> ?state_recorder:bool -> Node.t -> Client.t -> t

Create a baker.

This function just creates a value of type t, it does not call run.

path provides the path to the baker binary, the default being the one derived from the protocol.

The standard output and standard error output of the baker will be logged with prefix name and color color.

Default event_pipe is a temporary file whose name is derived from name. It will be created as a named pipe so that baker events can be received.

The Node.t parameter is the node used by the baker. The baker is configured to use the node's data dir.

The Client.t parameter is the client used by the baker. The baker is configured to use the client's base directory.

If runner is specified, the baker will be spawned on this runner using SSH.

delegates is a list of account aliases (see Account.key.alias), e.g., bootstrap accounts (see Constant.bootstrap_keys), delegated to this baker. This defaults to the empty list, which is a shortcut for "every known account".

votefile and liquidity_baking_toggle_vote are passed to the baker daemon through the flags --votefile and --liquidity-baking-toggle-vote. If --liquidity-baking-toggle-vote is None, then --liquidity-baking-toggle-vote is not passed. If it is Some x then --liquidity-baking-toggle-vote x is passed. The default value is Some Pass.

operations_pool, force_apply and state_recorder are passed to the baker daemon through the flag --operations-pool, --force_apply and --record-state.

If remote_mode is specified, the baker will run in RPC-only mode.

If dal_node is specified, then it is the DAL node that the baker queries in order to determine the attestations it sends to the L1 node. A --dal_node argument is passed to specify the DAL node's endpoint.

minimal_nanotez_per_gas_unit is an integer passed to the baker daemon through the flag --minimal-nanotez-per-gas-unit.

val create_from_uris : ?runner:Tezt_wrapper.Runner.t -> protocol:Protocol.t -> ?path:string -> ?name:string -> ?color:Tezt_wrapper.Log.Color.t -> ?event_pipe:string -> ?delegates:string list -> ?votefile:string -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> ?force_apply:bool -> ?remote_mode:bool -> ?operations_pool:string -> ?dal_node_rpc_endpoint:Endpoint.t -> ?minimal_nanotez_per_gas_unit:int -> ?state_recorder:bool -> base_dir:string -> node_data_dir:string -> node_rpc_endpoint:Endpoint.t -> unit -> t

Similar to create, but nodes RPCs addresses, wallet base directory and L1 data directory are directly provided instead of a Client.t, a Node.t and optionally a Dal_node.t.

The node_data_dir parameter provides the (local) node's data directory used for baking.

The node_rpc_endpoint parameter provides the (local) node's RPC server endpoint to which the baker will connect to.

The base_dir parameter contains needed information about the wallets used by the baker.

If dal_node_rpc_endpoint is specified, then it provides the DAL node RPC server's endpoint that the baker queries in order to determine the attestations it sends to the L1 node. A --dal_node argument is passed to specify the DAL node's endpoint.

val init : ?runner:Tezt_wrapper.Runner.t -> protocol:Protocol.t -> ?path:string -> ?name:string -> ?color:Tezt_wrapper.Log.Color.t -> ?event_pipe:string -> ?event_sections_levels:(string * Daemon.Level.level) list -> ?delegates:string list -> ?votefile:string -> ?liquidity_baking_toggle_vote:liquidity_baking_vote option -> ?force_apply:bool -> ?remote_mode:bool -> ?operations_pool:string -> ?dal_node:Dal_node.t -> ?minimal_nanotez_per_gas_unit:int -> ?state_recorder:bool -> Node.t -> Client.t -> t Lwt.t

Initialize a baker.

This creates a baker, waits for it to be ready, and then returns it.

As the baker usually relies on a node, we first wait for the node to be ready and then, run the baker.

The path to the baker binary is chosen from the protocol.

The standard output and standard error output of the baker will be logged with prefix name and color color.

Default event_pipe is a temporary file whose name is derived from name. It will be created as a named pipe so that baker events can be received.

The Node.t parameter is the node used by the baker. The baker is configured to use the node's data dir.

The Client.t parameter is the client used by the baker. The baker is configured to use the client's base directory.

If runner is specified, the baker will be spawned on this runner using SSH.

delegates is a list of account aliases (see Account.key.alias), e.g., bootstrap accounts (see Constant.bootstrap_keys), delegated to this baker. This defaults to the empty list, which is a shortcut for "every known account".

votefile, liquidity_baking_toggle_vote, force_apply, state_recorder respectively operations_pool are passed to the baker daemon through the flags --votefile, --liquidity-baking-toggle-vote, --should-apply, --record-state respectively --operations-pool.

If remote_mode is specified, the baker will run in RPC-only mode.

If dal_node is specified, then it is the DAL node that the baker queries in order to determine the attestations it sends to the L1 node. A --dal_node argument is passed to specify the DAL node's endpoint.

val log_block_injection : ?color:Tezt_wrapper.Log.Color.t -> t -> unit

Log block injection events.

Show the baker daemon name, level and round of the block, and delegate for which it was injected.

This log is relatively lightweight and a good indicator of chain progress during a test. It can also be useful to observe baking rights at the levels and rounds featured in a test.

val log_shortened_events : t -> unit

Log all baker events with Log.info on a single line each, which should be easily readable by a human.

This function should not be called by any test on a permanent basis, but is available for debugging.

If an event has an unexpected format, the anomaly is signaled with Log.warn.

If you want to see all events, don't forget to launch the baker with

~event_sections_levels:
  [(String.concat "." [Protocol.encoding_prefix protocol; "baker"], `Debug)]
OCaml

Innovation. Community. Security.