Module Dal_common.Helpers

val endpoint : Dal_node.t -> string
type slot

Abstract version of a slot to deal with messages content which are smaller than the expected size of a slot.

val make_slot : ?padding:bool -> slot_size:int -> string -> slot

make_slot ?padding ~slot_size content produces a slot. If padding=true (which is the default), then the content is padded to reach the expected size given by slot_size (which is usually obtained from Cryptobox.parameters).

val content_of_slot : slot -> string

content_of_slot slot retrieves the original content of a slot by removing the padding.

val slot_of_pages : slot_size:int -> string list -> slot

slot_of_pages ~slot_size pages produces a slot from a list of pages. The length of the result is checked against the given slot_size.

val make_cryptobox : ?on_error:(string -> Cryptobox.t Lwt.t) -> Cryptobox.parameters -> Cryptobox.t Lwt.t
val init_prover : ?__LOC__:string -> unit -> unit Lwt.t
val get_commitment_and_shards_with_proofs : ?precomputation:Cryptobox.shards_proofs_precomputation -> Cryptobox.t -> slot:bytes -> Cryptobox.commitment * Cryptobox.commitment_proof * (Cryptobox.shard * Cryptobox.shard_proof) Stdlib.Seq.t
val publish_commitment : ?dont_wait:bool -> ?counter:int -> ?force:bool -> ?source:Account.key -> ?fee:int -> ?gas_limit:int -> ?error:Tezt_wrapper.Base.rex -> index:int -> commitment:Cryptobox.commitment -> proof:Cryptobox.commitment_proof -> Client.t -> [ `OpHash of string ] Lwt.t

This function builds a slot with the given content, and makes the given DAL node to compute and store the corresponding commitment and shards by calling relevant RPCs. It returns the commitment and its proof.

val store_slot : Dal_node.t -> slot_index:int -> slot -> (string * string) Lwt.t
val store_slot_uri : Endpoint.t -> slot_index:int -> slot -> (string * string) Lwt.t
val publish_and_store_slot : ?dont_wait:bool -> ?counter:int -> ?force:bool -> ?fee:int -> ?gas_limit:int -> Client.t -> Dal_node.t -> Account.key -> index:int -> slot -> string Lwt.t
val wait_for_gossipsub_worker_event : name:string -> Dal_node.t -> (Tezt_wrapper.JSON.t -> 'a option) -> 'a Lwt.t
val check_new_connection_event : main_node:Dal_node.t -> ?other_peer_id:string -> other_node:Dal_node.t -> is_trusted:bool -> unit -> unit Lwt.t

Wait for a connection event between main_node and other_node. The optional argument other_peer_id can be used to ignore the connection events which are not between these two nodes. When this optional argument is given, it must be the peer of other_node; this assumption is checked by this function after the reception of the connection event.

val check_disconnection_event : Dal_node.t -> peer_id:string -> unit Lwt.t

Wait for a disconnection from the given peer id.

val connect_nodes_via_p2p : ?init_config:bool -> Dal_node.t -> Dal_node.t -> unit Lwt.t

Connect dal_node1 and dal_node2 using the bootstrap peer mechanism. dal_node2 will use dal_node1 as a bootstrap peer. For this to work, dal_node1 must already be running. If init_config (false by default) is set to true, Dal_node.init_config will be performed for dal_node2 with dal_node1 as peer