package tezt-tezos

  1. Overview
  2. Docs

Helpers built upon the Sc_rollup_node and Sc_rollup_client

val hooks : Tezt.Process.hooks

Hooks that handles hashes specific to smart rollups.

val rpc_hooks : RPC_core.rpc_hooks

Expose Tezos_regression.rpc_hooks for regressions

val hex_encode : string -> string

hex_encode s returns the hexadecimal representation of the given string s.

val read_kernel : ?base:string -> string -> string

read_kernel filename reads binary encoded WebAssembly module (e.g. `foo.wasm`) and returns a hex-encoded Wasm PVM boot sector, suitable for passing to originate_sc_rollup.

module Installer_kernel_config : sig ... end
type installer_result = {
  1. output : string;
    (*

    Output path of the boot sector.

    *)
  2. boot_sector : string;
    (*

    Boot sector.

    *)
  3. root_hash : string;
    (*

    Root hash of the boot sector.

    *)
}
val prepare_installer_kernel : ?runner:Tezt_wrapper.Runner.t -> preimages_dir:string -> ?config: [< `Config of Installer_kernel_config.t | `Path of string | `Both of Installer_kernel_config.t * string ] -> Tezt_wrapper.Uses.t -> installer_result Lwt.t

prepare_installer_kernel ~preimages_dir ?config installee feeds the smart-rollup-installer with a kernel (installee), and returns the boot sector corresponding to the installer for this specific kernel.

A Installer_kernel_config.t can optionally be provided to the installer via config.

The preimages of the installee are saved to preimages_dir. This should be the reveal data directory of the rollup node.

The returned installer is hex-encoded and may be passed to originate_sc_rollup directly.

val prepare_installer_kernel_with_arbitrary_file : ?runner:Tezt_wrapper.Runner.t -> preimages_dir:string -> ?config: [< `Config of Installer_kernel_config.t | `Path of string | `Both of Installer_kernel_config.t * string ] -> string -> installer_result Lwt.t

Same as prepare_installer_kernel but not forcing to use pre-generated kernels. Should be used for kernel generated by the test itself.

val setup_l1 : ?timestamp:Client.timestamp -> ?bootstrap_smart_rollups:Protocol.bootstrap_smart_rollup list -> ?bootstrap_contracts:Protocol.bootstrap_contract list -> ?commitment_period:int -> ?challenge_window:int -> ?timeout:int -> ?whitelist_enable:bool -> ?rpc_external:bool -> ?riscv_pvm_enable:bool -> ?minimal_block_delay:int -> Protocol.t -> (Node.t * Client.t) Lwt.t

setup_l1 protocol initializes a protocol with the given parameters, and returns the L1 node and client.

val originate_sc_rollup : ?keys:string list -> ?hooks:Tezt_wrapper.Process_hooks.t -> ?burn_cap:Tez.t -> ?whitelist:string list -> ?alias:string -> ?src:string -> kind:string -> ?parameters_ty:string -> ?boot_sector:string -> Client.t -> string Lwt.t

originate_sc_rollup is a wrapper above Client.originate_sc_rollup that waits for the block to be included.

val setup_rollup : kind:string -> ?hooks:Tezt_wrapper.Process_hooks.t -> ?alias:string -> ?mode:Sc_rollup_node.mode -> ?boot_sector:string -> ?parameters_ty:string -> ?src:string -> ?operator:string -> ?operators:(Sc_rollup_node.purpose * string) list -> ?data_dir:string -> ?rollup_node_name:string -> ?whitelist:string list -> ?sc_rollup:string -> ?allow_degraded:bool -> Node.t -> Client.t -> (Sc_rollup_node.t * string) Lwt.t
val originate_forward_smart_contract : ?src:string -> Client.t -> Protocol.t -> string Lwt.t
val default_boot_sector_of : kind:string -> string

default_boot_sector_of k returns a valid boot sector for a PVM of kind kind.

val last_cemented_commitment_hash_with_level : sc_rollup:string -> Client.t -> (string * int) Lwt.t
val genesis_commitment : sc_rollup:string -> Client.t -> RPC.smart_rollup_commitment Lwt.t

genesis_commitment ~sc_rollup client returns the genesis commitment, fails if this commitment have been cleaned from the context.

val call_rpc : smart_rollup_node:Sc_rollup_node.t -> service:string -> Tezt_wrapper.JSON.t Lwt.t

call_rpc ~smart_rollup_node ~service call the RPC for service on smart_rollup_node.

type bootstrap_smart_rollup_setup = {
  1. bootstrap_smart_rollup : Protocol.bootstrap_smart_rollup;
    (*

    The bootstrap smart rollup to add in the parameter files.

    *)
  2. smart_rollup_node_data_dir : string;
    (*

    The data dir to use for the smart rollup node, where the smart rollup preimages are available.

    *)
  3. smart_rollup_node_extra_args : Sc_rollup_node.argument list;
    (*

    The extra arguments needed by the smart rollup node when the smart rollup is a bootstrap smart rollup.

    *)
}

Bootstrap smart rollup setup information.

val setup_bootstrap_smart_rollup : ?name:string -> address:string -> ?parameters_ty:string -> ?whitelist:string list -> installee:Tezt_wrapper.Uses.t -> ?config:[< `Config of Installer_kernel_config.t | `Path of string ] -> unit -> bootstrap_smart_rollup_setup Lwt.t

setup_bootstrap_smart_rollup ?name ~address ?parameters_ty ~installee ?config () creates a bootstrap_smart_rollup_setup that can be used to run a bootstrap smart rollup.

name is the smart rollup node data-dir's name. Defaults to "smart-rollup". address is the smart rollup address. parameters_ty is the smart rollup type. Defaults to "string". config is the optional smart rollup installer configuration, see prepare_installer_kernel.

type refutation_scenario_parameters = {
  1. loser_modes : string list;
  2. inputs : string list list;
  3. final_level : int;
  4. empty_levels : int list;
  5. stop_loser_at : int list;
  6. reset_honest_on : (string * int * Sc_rollup_node.mode option) list;
  7. bad_reveal_at : int list;
  8. priority : [ `Priority_honest | `Priority_loser | `No_priority ];
  9. allow_degraded : bool;
}
val refutation_scenario_parameters : ?loser_modes:string list -> final_level:int -> ?empty_levels:int list -> ?stop_loser_at:int list -> ?reset_honest_on:(string * int * Sc_rollup_node.mode option) list -> ?bad_reveal_at:int list -> ?priority:[ `No_priority | `Priority_honest | `Priority_loser ] -> ?allow_degraded:bool -> string list list -> refutation_scenario_parameters
type test = {
  1. variant : string option;
  2. tags : string list;
  3. description : string;
}
val format_title_scenario : string -> test -> string
val send_message : ?hooks:Tezt_wrapper.Process_hooks.t -> ?src:string -> Client.t -> string -> unit Lwt.t
val send_messages : ?hooks:Tezt_wrapper.Process_hooks.t -> ?src:string -> ?batch_size:int -> int -> Client.t -> unit Lwt.t

Smart rollup constants

type sc_rollup_constants = {
  1. origination_size : int;
  2. challenge_window_in_blocks : int;
  3. stake_amount : Tez.t;
  4. commitment_period_in_blocks : int;
  5. max_lookahead_in_blocks : int32;
  6. max_active_outbox_levels : int32;
  7. max_outbox_messages_per_level : int;
  8. number_of_sections_in_dissection : int;
  9. timeout_period_in_blocks : int;
}
val get_sc_rollup_constants : Client.t -> sc_rollup_constants Lwt.t
val publish_commitment : ?src:string -> commitment:RPC.smart_rollup_commitment -> Client.t -> string -> unit Runnable.process
val forge_and_publish_commitment_return_runnable : ?compressed_state:string -> ?number_of_ticks:int -> inbox_level:int -> predecessor:string -> sc_rollup:string -> src:string -> Client.t -> RPC.smart_rollup_commitment * unit Runnable.process
val get_staked_on_commitment : sc_rollup:string -> staker:string -> Client.t -> string Lwt.t
val forge_and_publish_commitment : ?compressed_state:string -> ?number_of_ticks:int -> inbox_level:int -> predecessor:string -> sc_rollup:string -> src:string -> Client.t -> (RPC.smart_rollup_commitment * string) Lwt.t
val bake_period_then_publish_commitment : ?compressed_state:string -> ?number_of_ticks:int -> sc_rollup:string -> src:string -> Client.t -> (RPC.smart_rollup_commitment * string) Lwt.t
val cement_commitment : Protocol.t -> ?src:string -> ?fail:string -> sc_rollup:string -> hash:string -> Client.t -> unit Lwt.t
val bake_operation_via_rpc : __LOC__:string -> Client.t -> Operation_core.Manager.t -> unit Lwt.t
val start_refute : Client.t -> source:Account.key -> opponent:string -> sc_rollup:string -> player_commitment_hash:string -> opponent_commitment_hash:string -> unit Lwt.t
val move_refute_with_unique_state_hash : ?number_of_sections_in_dissection:int -> Client.t -> source:Account.key -> opponent:string -> sc_rollup:string -> state_hash:string -> unit Lwt.t
val timeout : ?expect_failure:bool -> sc_rollup:string -> staker1:string -> staker2:string -> ?src:string -> Client.t -> unit Lwt.t
val send_text_messages : ?format:[< `Hex | `Raw Raw ] -> ?hooks:Tezt_wrapper.Process_hooks.t -> ?src:string -> Client.t -> string list -> unit Lwt.t
type reveal_hash = {
  1. message : string;
  2. filename : string;
}
val reveal_hash : protocol:'a -> kind:string -> string -> reveal_hash
val test_refutation_scenario_aux : mode:Sc_rollup_node.mode -> kind:string -> refutation_scenario_parameters -> 'a -> Sc_rollup_node.t -> string -> Node.t -> Client.t -> unit Lwt.t

A common test that use both in sc_rollup and sc_rollup_migration for refutation tests

val inputs_for : int -> string list list
val wait_for_injecting_event : ?tags:string list -> ?count:int -> Sc_rollup_node.t -> int Lwt.t
val injecting_refute_event : 'a -> Sc_rollup_node.t -> unit Lwt.t
type transaction = {
  1. destination : string;
  2. entrypoint : string option;
  3. parameters : Tezt_wrapper.JSON.u;
  4. parameters_ty : Tezt_wrapper.JSON.u option;
}
val json_of_output_tx_batch : transaction list -> Tezt_wrapper.JSON.u

Converts a list of transactions into a JSON object.

val prioritize_refute_operations : Sc_rollup_node.t -> unit

Configure the rollup node to pay more fees for its refute operations.

OCaml

Innovation. Community. Security.