Module Dal_common.Attestations

Encoding/decoding of the DAL content included in attestation operations.

val encode_for_one_lag : Protocol.t -> ?lag_index:int -> Parameters.t -> bool array -> string

encode_for_one_lag protocol ?lag_index dal_parameters slot_array encodes an array of Booleans into a string, the format depending on the protocol and dal_parameters. The latter is necessary for protocol values >= 025, ?lag_index being an optional parameter to set the offset for the encoding, defaulting to the last position in the attestation_lags list.

val encode : Protocol.t -> bool array array -> string

encode protocol parameters attestations_per_lag encodes attestations for multiple lag indices in a single call. attestations_per_lag is an array of bool arrays, one per lag index, where element i contains the slot attestations for lag index i. For protocols < 025, the attestations_per_lag array must only contain a single element and will be encoded using the pre-025 single-lag format.

val decode : Protocol.t -> Parameters.t -> string -> bool array array

decode protocol parameters str decodes and returns an array of size number_of_lags, where each element is a bool array of size number_of_slots representing attested slots at that lag index.