Module Dal_helpers.Make

Some global constants.

Parameters

module P : sig ... end

Signature

Helper functions.

Retrieves the history from a given cache.

Returns the slot's polynomial from the given slot's data.

Using the given slot's polynomial, this function computes the page proof of the page whose ID is provided.

Constructs a slot whose ID is defined from the given level and given index, and whose data are built using the given fill function. The function returns the slot's data, polynomial, and header (in the sense: ID + kate commitment).

Constructs a record value of type Page.id.

val no_data : (default_char:char -> int -> bytes option) option

Constructs a page whose level and slot indexes are those of the given slot (except if level is redefined via ?level), and whose page index and data are given by arguments page_index and mk_data. If mk_data is set to No, the function returns the pair (None, page_id). Otherwise, the page's data and proof is computed, and the function returns Some (data, proof), page_id.

val next_char : char -> char

Returns the char after c. Restarts from the char whose code is 0 if c's code is 255.

Increment the given slot index. Returns zero in case of overflow.

Auxiliary test function used by both unit and PBT tests: This function produces a proof from the given information and verifies the produced result, if any. The result of each step is checked with check_produce_result and check_verify_result, respectively.

Check if two page proofs are equal.

val successful_check_produce_result : __LOC__:string -> [ `Confirmed | `Unconfirmed ] -> (Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.proof * bytes option) Mavryk_base.TzPervasives.tzresult -> (bytes * 'a) option -> (unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t

Helper for the case where produce_proof is expected to succeed.

val successful_check_verify_result : __LOC__:string -> [> `Confirmed ] -> bytes option Mavryk_base.TzPervasives.tzresult -> (bytes * 'a) option -> (unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t

Helper for the case where verify_proof is expected to succeed.

val slot_confirmed_but_page_data_not_provided : __LOC__:string -> 'a Mavryk_base.TzPervasives.tzresult -> 'b -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

Helper for the case where produce_proof is expected to fail because the slot is confirmed but no page information are provided.

val slot_not_confirmed_but_page_data_provided : __LOC__:string -> 'a Mavryk_base.TzPervasives.tzresult -> 'b -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

Helper for the case where produce_proof is expected to fail because the slot is not confirmed but page_info are provided.

val failing_check_produce_result : __LOC__:string -> expected_error:Mavryk_protocol_001_PtAtLas.Environment.Error_monad.error -> 'a Mavryk_base.TzPervasives.tzresult -> 'b -> unit Mavryk_base.TzPervasives.tzresult Lwt.t

Helper for the case where produce_proof is expected to fail.