Module Raw_context.Consensus

val allowed_attestations : t -> (consensus_pk * int * int) Slot_repr.Map.t option

Returns a map where from the initial slot of each attester in the TB committee for a given level, to the attester's public key and its consensus power and DAL power.

val allowed_preattestations : t -> (consensus_pk * int * int) Slot_repr.Map.t option

Returns the set of delegates that are not allowed to bake or attest blocks; i.e., delegates which have zero frozen deposit due to a previous slashing.

type Tezos_protocol_environment_alpha.Error_monad.error +=
  1. | Slot_map_not_found of {
    1. loc : string;
    }

Missing pre-computed map by first slot. This error should not happen.

val current_attestation_power : t -> int

attestation power ctx returns the attestation power of the current block.

val initialize_consensus_operation : t -> allowed_attestations:(consensus_pk * int * int) Slot_repr.Map.t option -> allowed_preattestations:(consensus_pk * int * int) Slot_repr.Map.t option -> t

Initializes the map of allowed attestations and preattestations, this function must be called only once and before applying any consensus operation.

val record_attestation : t -> initial_slot:Slot_repr.t -> power:int -> t Tezos_protocol_environment_alpha.Error_monad.tzresult

record_attestation ctx ~initial_slot ~power records an attestation for the current block.

The attestation should be valid in the sense that Int_map.find_opt initial_slot allowed_attestation ctx = Some (pkh, power).

val record_preattestation : t -> initial_slot:Slot_repr.t -> power:int -> Round_repr.t -> t Tezos_protocol_environment_alpha.Error_monad.tzresult

record_preattestation ctx ~initial_slot ~power round payload_hash power records a preattestation for a proposal at round with payload payload_hash.

The preattestation should be valid in the sense that Int_map.find_opt initial_slot allowed_preattestation ctx = Some (pkh, power).

forbid_delegate ctx delegate adds delegate to the set of forbidden delegates, which prevents this delegate from baking or attesting.

set_forbidden_delegate ctx delegates sets delegates as the current forbidden delegates.

val attestations_seen : t -> Slot_repr.Set.t
val get_preattestations_quorum_round : t -> Round_repr.t option

get_preattestations_quorum_round ctx returns None if no preattestation are included in the current block. Otherwise, return Some r where r is the round of the preattestations included in the block.

val set_preattestations_quorum_round : t -> Round_repr.t -> t

set_preattestations_quorum_round ctx round sets the round for preattestations included in this block. This function should be called only once.

This function is only used in Full_construction mode.

val locked_round_evidence : t -> (Round_repr.t * int) option

locked_round_evidence ctx returns the round of the recorded preattestations as well as their power.