Legend:
Library
Module
Module type
Parameter
Class
Class type
Spawn Tezos nodes and control them.
Convention: in this module, some functions implement node commands; those functions are named after those commands. For instance, Node.config_init corresponds to octez-node config init, and Node.run corresponds to octez-node run.
The arguments of those functions are also named after the actual arguments. For instance, ?network is named after --network, to make Node.config_init ~network:"carthagenet" look as close as possible to octez-node config init --network carthagenet.
Most options have default values which are not necessarily the default values of octez-node. Indeed, the latter are tailored for Mainnet, but here we use defaults which are tailored for the sandbox. In particular, the default value for ?network is "sandbox". However, if you specify an option such as ~network or ~history_mode, they are passed to the node unchanged, to reduce surprises.
These conventions are also followed in the Client module.
History modes for the node.
type history_mode =
| Archive
| Fullofint option
| Rollingofint option
The parameter for Full And Rolling mode is called additional_cycles.
For the Full (resp. Rolling) mode it controls the number of contexts (resp. blocks) we preserved behind the checkpoint (aka the no fork point). Default in sandbox mode is 2 and 5 for mainnet parameters (see preserved_cycles in the protocol parameters).
type media_type =
| Json
| Binary
| Any
Values that can be passed to the node's --media-type argument
Not all arguments are available here. Some are simply not implemented, and some are handled separately because they need special care. The latter are implemented as optional labeled arguments (e.g. ?net_port and ?data_dir).
type tls_config = {
certificate_path : string;
key_path : string;
}
A TLS configuration for the node: paths to a .crt and a .key file.
Passed to run like commands through the --rpc-tls argument.
This function just creates the t value, it does not call identity_generate nor config_init nor run.
The standard output and standard error output of the node will be logged with prefix name and color color.
Default data_dir is a temporary directory which is always the same for each name.
Default event_pipe is a temporary file whose name is derived from name. It will be created as a named pipe so that node events can be received.
Default value for net_addr is either 127.0.0.1 if no runner is provided, or a value allowing the local Tezt program to connect to it if it is.
Default values for net_port or rpc_port are chosen automatically with values starting from 16384 (configurable with `--starting-port`). They are used by config_init and by functions from the Client module. They are not used by run, so if you do not call config_init or generate the configuration file through some other means, your node will not listen.
Default value for allow_all_rpc is true.
The argument list is a list of configuration options that the node should run with. It is passed to the first run of octez-node config init. It is also passed to all runs of octez-node run that occur before octez-node config init. If Expected_pow is given, it is also used as the default value for identity_generate.
If runner is specified, the node will be spawned on this runner using SSH.
Add an argument to a node as if it was passed to create.
The argument is passed to the next run of octez-node config init. It is also passed to all runs of octez-node run that occur before the next octez-node config init.
Return "<ADDRESS>:<PORT>#<ID>" where <PORT> is the P2P port and <ID> is the identity of the node.
<ADDRESS> is obtained using Runner.address runner with ?from being the runner of from and runner is the runner of the node. In other words it is the address where from can contact node.
Return (<ADDRESS>,<PORT>) where <PORT> is the P2P port and <ADDRESS> is the reachable address of the node.
<ADDRESS> is obtained using Runner.address runner with ?from being the runner of from and runner is the runner of the node. In other words it is the address where from can contact node.
The resulting promise is fulfilled as soon as the node has been spawned. It continues running in the background.
event_level specifies the verbosity of the file descriptor sink. This must be at least `Notice, which is the level of event "node_is_ready.v0", needed for wait_for_ready. The default value is `Info which is also the default event level of the node.
event_sections_levels specifies the verbosity for events in sections whose prefix is in the list. For instance ~event_sections_levels:[("prevalidator", `Debug); ("validator.block", `Debug)] will activate the logs at debug level for events whose section starts with "prevalidator" or "validator.block". See Tezos_stdlib_unix.File_descriptor_sink and the logging documentation for a more precise semantic.
More precisely, wait until a head_increment or branch_switch with a level greater or equal to the requested level occurs. If such an event already occurred, return immediately.
Returns 0 if the node is not running or if no head_increment or branch_switch event was received yet. This makes this function equivalent to wait_for_level node 0 except that it does not actually wait for the level to be known.
Note that, as the node's status is updated only on head increments, this value is wrong just after a snapshot import.
Arguments are passed to config_init. If you specified Expected_pow, it is also passed to identity_generate. Arguments are not passed to run. If you do not wish the arguments to be stored in the configuration file (which will affect future runs too), do not use init.
When patch_config is provided, the function is used to patch the configuration file generated by config_init before the call to run. This argument should only be used to test configuration options that cannot be set with command-line arguments.
To import a snapshot before calling run, specify ~snapshot:(file, do_reconstruct), where file is the path to the snapshot. If reconstruct is true, then --reconstruct is passed to the import command.