Raw_context.Dal
type cryptobox = Mavryk_protocol_environment_001_PtAtLas.Dal.t
val number_of_slots : t -> int
val record_attested_shards : t -> Dal_attestation_repr.t -> int list -> t
record_attested_shards ctxt attestation shards
records that the list of shards shards
were attested (declared available by some attester). 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 Mavryk_protocol_environment_001_PtAtLas.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_attested : t -> Dal_slot_index_repr.t -> bool
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_attester :
t ->
attester:Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t ->
int list option
shards_of_attester ctxt ~attester
returns the shard assignment of the DAL committee of the current level for attester
. This function never returns an empty list.
type committee = {
pkh_to_shards : (Dal_attestation_repr.shard_index * int)
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.Map.t;
shard_to_pkh : Mavryk_protocol_environment_001_PtAtLas.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:
start; start + n - 1
-> find shard_to_pkh i = Some pkhval compute_committee :
t ->
(Slot_repr.t ->
(t * Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t)
Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.Lwt.t) ->
committee Mavryk_protocol_environment_001_PtAtLas.Error_monad.tzresult
Mavryk_protocol_environment_001_PtAtLas.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
).