package tezos-protocol-016-PtMumbai
val record_available_shards : t -> Dal_attestation_repr.t -> int list -> t
record_available_shards ctxt slots shards
records that the list of shards shards
were declared available. The function assumes that a shard belongs to the interval 0; number_of_shards
- 1
. Otherwise, for each shard outside this interval, it is a no-op.
val register_slot_header :
t ->
Dal_slot_repr.Header.t ->
(t * bool) Tezos_protocol_environment_016_PtMumbai.Error_monad.tzresult
register_slot_header ctxt slot_header
returns a new context where the new candidate slot
have been taken into account. Returns Some (ctxt,updated)
where updated=true
if the candidate is registered. Some (ctxt,false)
if another candidate was already registered previously. Returns an error if the slot is invalid.
val candidates : t -> Dal_slot_repr.Header.t list
candidates ctxt
returns the current list of slot for which there is at least one candidate.
val is_slot_index_available : t -> Dal_slot_repr.Index.t -> bool
is_slot_index_available ctxt slot_index
returns true
if the slot_index
is declared available by the protocol. false
otherwise. If the index
is out of the interval 0;number_of_slots - 1
, returns false
.
val shards_of_attestor :
t ->
attestor:Tezos_protocol_environment_016_PtMumbai.Signature.Public_key_hash.t ->
int list option
shards_of_attestor ctxt ~attestor
returns the shard assignment of the DAL committee of the current level for attestor
. This function never returns an empty list.
type committee = {
pkh_to_shards : (Dal_attestation_repr.shard_index * int) Tezos_protocol_environment_016_PtMumbai.Signature.Public_key_hash.Map.t;
shard_to_pkh : Tezos_protocol_environment_016_PtMumbai.Signature.Public_key_hash.t Dal_attestation_repr.Shard_map.t;
}
The DAL committee is a subset of the Tenderbake committee. A shard from 0;number_of_shards
is associated to a public key hash. For efficiency reasons, the committee is two-folds: a mapping public key hash to shards and shards to public key hashes. The DAL committee ensures the shards associated to the same public key hash are contiguous. The list of shards is represented as two natural numbers (initial, power)
which encodes the list of shards: initial;initial + 1;...;initial + power - 1
.
This data-type ensures the following invariants:
- \forall pkh shard, find pkh_to_shards pkh = Some (start,n) -> \forall i, i \in
start; start + n -1
-> find shard_to_pkh shard = Some pkh
- forall pkh shard, find shard_to_pkh shard = Some pkh -> \exists (start,n), find pkh_to_shards pkh = Some (start,n) /\ start <= shard <= start + n -1
- Given an attestor, all its shards assignement are contiguous
val compute_committee :
t ->
(Slot_repr.t ->
(t * Tezos_protocol_environment_016_PtMumbai.Signature.Public_key_hash.t)
Tezos_protocol_environment_016_PtMumbai.Error_monad.tzresult
Tezos_protocol_environment_016_PtMumbai.Lwt.t) ->
committee Tezos_protocol_environment_016_PtMumbai.Error_monad.tzresult
Tezos_protocol_environment_016_PtMumbai.Lwt.t
compute_committee ctxt pkh_from_tenderbake_slot
computes the DAL committee using the pkh_from_tenderbake_slot
function. This functions takes into account the fact that the DAL committee and the Tenderbake committee may have different size. If the DAL committee is smaller, then we simply take a projection of the Tenderbake committee for the first n
slots. If the DAL committee is larger, shards are computed moduloe the Tenderbake committee. Slots assignements are reordered for a given a public key hash, to ensure all the slots (or shards in the context of DAL) shards are contiguous (see committee
).