Dal_attestation_repr.Accountability
This module is used to record the shard attestations.
For each attester, a list of shards is associated. For each attested slot (see t
) we record that those shards were deemed available.
This information will be used at the end of block finalisation to have the protocol declaring whether the slot is available.
type attested_slots = t
DAL/FIXME https://gitlab.com/tezos/tezos/-/issues/3145
Consider using the Bounded
module. In particular, change the semantics of is_slot_attested
accordingly.
val init : number_of_slots:int -> t
init ~number_of_slots
initialises a new accountability data-structure with number_of_slots
slots and where for every slot, no shard is available.
val record_number_of_attested_shards : t -> attested_slots -> int -> t
record_number_of_attested_shards t slots number
records that, for all slots declared available in slots
, the given number
of shard indices are deemed available. This function must be called at most once for a given attester; otherwise the count will be flawed.
val is_slot_attested :
t ->
threshold:int ->
number_of_shards:int ->
Dal_slot_index_repr.t ->
bool
is_slot_attested t ~threshold ~number_of_shards slot
returns true
if the number of shards recorded in t
for the slot
is above the threshold
with respect to the total number of shards specified by number_of_shards
. Returns false
otherwise or if the index
is out of the interval 0; number_of_slots - 1
where number_of_slots
is the value provided to the init
function.