Tezos_dal_node_lib.Slot_manager
This module provides different handlers related to DAL slots.
Functions to manage slots storage.
FIXME: https://gitlab.com/tezos/tezos/-/issues/4099 DAL/Node: make slot_header/commitment definition consistent with alpha_context.mli
val get_slot_pages :
reconstruct_if_missing:bool ->
Node_context.t ->
Tezos_dal_node_services.Types.slot_id ->
(bytes list, [> Errors.not_found | Errors.other ]) Stdlib.result Lwt.t
get_slot_pages ~reconstruct_if_missing cryptobox node_ctxt store
slot_id
fetches from the store the slot corresponding to the given slot id and split it into pages. If the slot is not found in the store and reconstruct_if_missing
is true, the slot is reconstructed from the stored shards.
Returns an Error _
if:
reconstruct_if_missing
is false,reconstruct_if_missing
is true, and too few shards are stored to reconstruct the slot,Cryptobox.commitment
is ill-formed. Specifically, when its length is not a multiple of the page-size specified in the Cryptobox.parameters
argument.val polynomial_from_shards :
Tezos_crypto_dal.Cryptobox.t ->
Tezos_crypto_dal.Cryptobox.shard Tezos_base.TzPervasives.Seq.t ->
(Tezos_crypto_dal.Cryptobox.polynomial, [> Errors.other ]) Stdlib.result
Lwt.t
type Tezos_base.TzPervasives.error +=
val polynomial_from_slot :
Tezos_crypto_dal.Cryptobox.t ->
Tezos_crypto_dal.Cryptobox.slot ->
(Tezos_crypto_dal.Cryptobox.polynomial, [> Errors.other ]) Stdlib.result
Cryptobox.polynomial_from_slot
but using the Errors
module.
The function returns an error Invalid_slot_size
if the slot
's size doesn't match the expected slots' size given in cryptobox
, or the slot
's polynomial otherwise.
val commit :
Tezos_crypto_dal.Cryptobox.t ->
Tezos_crypto_dal.Cryptobox.polynomial ->
(Tezos_crypto_dal.Cryptobox.commitment, [> Errors.other ]) Stdlib.result
commit cryptobox polynomial
computes the commitment of the given polynomial
.
val get_slot_content :
reconstruct_if_missing:bool ->
Node_context.t ->
Tezos_dal_node_services.Types.slot_id ->
(slot, [> Errors.other | Errors.not_found ]) Stdlib.result Lwt.t
get_slot_content ~reconstruct_if_missing node_ctxt slot_id
returns the slot content associated with the given slot_id
in the node's store.
If the slot is not found in the store and reconstruct_if_missing
is true, the slot is reconstructed from the stored shards.
In addition to decoding errors, the function returns `Not_found
if there is no slot content for slot_id
in the node's store or if reconstruct_if_missing
is true and not enough shards are stored to reconstruct the slot.
val add_commitment_shards :
shards_proofs_precomputation:
Tezos_crypto_dal.Cryptobox.shards_proofs_precomputation option ->
Store.t ->
Tezos_crypto_dal.Cryptobox.t ->
Tezos_crypto_dal.Cryptobox.commitment ->
Tezos_crypto_dal.Cryptobox.slot ->
Tezos_crypto_dal.Cryptobox.polynomial ->
(unit, [> Errors.other ]) Stdlib.result Lwt.t
add_commitment_shards ~shards_proofs_precomputation node_store
cryptobox commitment slot polynomial
registers the shards of the slot whose commitment is given.
Proofs are generated for the computed shards using shards_proofs_precomputation
and stored in a bounded structure in memory.
In addition to storage errors, this function may return the following errors:
Invalid_slot_size
if the given slot does not have the expected size,No_prover_SRS
if the given shards_proofs_precomputation
is None
.val publish_proved_shards :
Node_context.t ->
Tezos_dal_node_services.Types.slot_id ->
level_committee:
(level:int32 ->
Committee_cache.shard_indexes
Tezos_crypto.Signature.Public_key_hash.Map.t
Tezos_base.TzPervasives.tzresult
Lwt.t) ->
Tezos_dal_node_services.Types.proto_parameters ->
Tezos_crypto_dal.Cryptobox.commitment ->
Tezos_crypto_dal.Cryptobox.shard Tezos_base.TzPervasives.Seq.t ->
Tezos_crypto_dal.Cryptobox.shard_proof array ->
Tezos_dal_node_lib_gossipsub.Gossipsub.Worker.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
This function publishes the given shards and their proofs.
val publish_slot_data :
Node_context.t ->
level_committee:
(level:int32 ->
Committee_cache.shard_indexes
Tezos_crypto.Signature.Public_key_hash.Map.t
Tezos_base.TzPervasives.tzresult
Lwt.t) ->
slot_size:int ->
Tezos_dal_node_lib_gossipsub.Gossipsub.Worker.t ->
Tezos_dal_node_services.Types.proto_parameters ->
Tezos_crypto_dal.Cryptobox.commitment ->
Tezos_dal_node_services.Types.slot_id ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
This function publishes the shards of a commitment that is waiting for attestion on L1 if this node has those shards on disk and their proofs in memory.
val store_slot_headers :
number_of_slots:int ->
block_level:int32 ->
Dal_plugin.slot_header list ->
Store.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
store_slot_headers ~number_of_slots ~block_level ~block_hash slot_headers
node_store
stores slot_headers
onto the node_store
associated to the given block_hash
baked at level block_level
.
val update_selected_slot_headers_statuses :
block_level:int32 ->
attestation_lag:int ->
number_of_slots:int ->
(Dal_plugin.slot_index -> bool) ->
Store.t ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
update_selected_slot_headers_statuses ~block_level ~attestation_lag
~number_of_slots attested_slots store
updates the statuses of the previously selected slots at level block_level
- attestation_lag
and that were waiting for attestation.
Slot headers whose indexes are in attested_slots
are now set as `Attested
in store
. Those which are not are marked as `Unattested
in the store
if they previously had a "waiting for attestation" status.
val get_slot_status :
slot_id:Tezos_dal_node_services.Types.slot_id ->
Store.t ->
(Tezos_dal_node_services.Types.header_status,
[ Errors.other | Errors.not_found ])
Stdlib.result
Lwt.t
get_slot_status ~slot_id store
returns the status associated to the accepted slot of id slot_id
or None
if no status is currently stored for that slot id.
val get_slot_shard :
Store.t ->
Tezos_dal_node_services.Types.slot_id ->
Tezos_dal_node_services.Types.shard_index ->
(Tezos_crypto_dal.Cryptobox.shard, [ Errors.other | Errors.not_found ])
Stdlib.result
Lwt.t
get_slot_shard store slot_id shard_index
returns the shard at index shard_index
of the slot given by slot_id
.
val maybe_register_trap :
Store.Traps.t ->
traps_fraction:Q.t ->
Tezos_dal_node_services.Types.Message_id.t ->
Tezos_dal_node_services.Types.Message.t ->
unit
maybe_register_trap traps_store ~traps_fraction message_id message
checks if the given message is a trap according to Trap.share_is_trap
. If the share is identified as a trap, it is stored in the traps cache of the DAL node store. Otherwise does nothing.