Dal_helpers.Make
Some global constants.
module P : sig ... end
val genesis_history :
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.t
val genesis_history_cache :
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.History_cache.t
val level_one : Mavryk_protocol_001_PtAtLas.Protocol.Raw_level_repr.t
val level_ten : Mavryk_protocol_001_PtAtLas.Protocol.Raw_level_repr.t
Helper functions.
val get_history :
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.History_cache.t ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.hash ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.t option Lwt.t
Retrieves the history from a given cache.
val dal_mk_polynomial_from_slot :
bytes ->
Mavryk_crypto_dal.Cryptobox.polynomial Mavryk_base.TzPervasives.tzresult
Returns the slot's polynomial from the given slot's data.
val dal_commit :
Mavryk_crypto_dal.Cryptobox.t ->
Mavryk_crypto_dal.Cryptobox.polynomial ->
(Mavryk_crypto_dal.Cryptobox.commitment,
Mavryk_base.TzPervasives.error Mavryk_base.TzPervasives.trace)
Stdlib.result
val dal_mk_prove_page :
Mavryk_crypto_dal.Cryptobox.polynomial ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Page.t ->
Mavryk_crypto_dal.Cryptobox.page_proof Mavryk_base.TzPervasives.tzresult
Using the given slot's polynomial, this function computes the page proof of the page whose ID is provided.
val mk_slot :
?level:Mavryk_protocol_001_PtAtLas.Protocol.Raw_level_repr.t ->
?index:Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_index_repr.t ->
?fill_function:(int -> char) ->
unit ->
(bytes
* Mavryk_crypto_dal.Cryptobox.polynomial
* Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Header.t)
Mavryk_base.TzPervasives.tzresult
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).
val mk_page_id :
Mavryk_protocol_001_PtAtLas.Protocol.Raw_level_repr.t ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_index_repr.t ->
int ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Page.t
Constructs a record value of type Page.id.
val mk_page_info :
?default_char:char ->
?level:Mavryk_protocol_001_PtAtLas.Protocol.Raw_level_repr.t ->
?page_index:int ->
?custom_data:(default_char:char -> int -> bytes option) option ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Header.t ->
Mavryk_crypto_dal.Cryptobox.polynomial ->
((bytes * Mavryk_crypto_dal.Cryptobox.page_proof) option
* Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Page.t,
Mavryk_base.TzPervasives.error Mavryk_base.TzPervasives.trace)
Stdlib.result
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
.
Returns the char after c
. Restarts from the char whose code is 0 if c
's code is 255.
val succ_slot_index :
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_index_repr.t ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_index_repr.t
Increment the given slot index. Returns zero in case of overflow.
val produce_and_verify_proof :
check_produce:
((Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.proof
* bytes option)
Mavryk_base.TzPervasives.tzresult ->
(bytes * Mavryk_crypto_dal.Cryptobox.page_proof) option ->
(unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
?check_verify:
(bytes option Mavryk_base.TzPervasives.tzresult ->
(bytes * Mavryk_crypto_dal.Cryptobox.page_proof) option ->
(unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
get_history:
(Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.hash ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.t option Lwt.t) ->
Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.History.t ->
page_info:(bytes * Mavryk_crypto_dal.Cryptobox.page_proof) option ->
page_id:Mavryk_protocol_001_PtAtLas.Protocol.Dal_slot_repr.Page.t ->
(unit, Mavryk_base.TzPervasives.tztrace) Stdlib.result Lwt.t
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.
val eq_page_proof :
Mavryk_crypto_dal.Cryptobox.page_proof ->
Mavryk_crypto_dal.Cryptobox.page_proof ->
bool
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.