package tezos-protocol-017-PtNairob
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-protocol-017-PtNairob.raw/Tezos_raw_protocol_017_PtNairob/Raw_context/Dal/index.html
Module Raw_context.Dal
Source
record_attested_shards ctxt attestation shards
records that the list of shards shards
were attested (declared available by some attestor). 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 Tezos_protocol_environment_017_PtNairob.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.
candidates ctxt
returns the current list of slot for which there is at least one candidate.
is_slot_index_attested 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_017_PtNairob.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_017_PtNairob.Signature.Public_key_hash.Map.t;
shard_to_pkh : Tezos_protocol_environment_017_PtNairob.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 both: a mapping from public key hashes to shards and a mapping from 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 i = 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 shard assignments are contiguous
val compute_committee :
t ->
(Slot_repr.t ->
(t * Tezos_protocol_environment_017_PtNairob.Signature.Public_key_hash.t)
Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult
Tezos_protocol_environment_017_PtNairob.Lwt.t) ->
committee Tezos_protocol_environment_017_PtNairob.Error_monad.tzresult
Tezos_protocol_environment_017_PtNairob.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 sizes. 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 modulo the Tenderbake committee. Slots assignments 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
).