Alpha_context.Consensus
This module re-exports definitions from Raw_context.Consensus
.
include Raw_context.CONSENSUS
with type t := t
and type slot := Slot.t
and type 'a slot_map := 'a Slot.Map.t
and type slot_set := Slot.Set.t
and type round := Round.t
and type consensus_pk := Consensus_key.pk
val allowed_attestations : t -> (Consensus_key.pk * int) Slot.Map.t option
Returns a map where each attester's pkh is associated to the list of its attesting slots (in decreasing order) for a given level.
val allowed_preattestations : t -> (Consensus_key.pk * int) Slot.Map.t option
Returns a map where each attester's pkh is associated to the list of its attesting slots (in decreasing order) for a given level.
val forbidden_delegates :
t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.Set.t
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.
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_key.pk * int) Slot.Map.t option ->
allowed_preattestations:(Consensus_key.pk * int) Slot.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.t ->
power:int ->
t Mavryk_protocol_environment_001_PtAtLas.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.t ->
power:int ->
Round.t ->
t Mavryk_protocol_environment_001_PtAtLas.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)
.
val forbid_delegate :
t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.t ->
t
forbid_delegate ctx delegate
adds delegate
to the set of forbidden delegates, which prevents this delegate from baking or attesting.
val set_forbidden_delegates :
t ->
Mavryk_protocol_environment_001_PtAtLas.Signature.Public_key_hash.Set.t ->
t
set_forbidden_delegate ctx delegates
sets delegates
as the current forbidden delegates.
val attestations_seen : t -> Slot.Set.t
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.
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.
locked_round_evidence ctx
returns the round of the recorded preattestations as well as their power.
val set_attestation_branch :
t ->
(Mavryk_protocol_environment_001_PtAtLas.Block_hash.t * Block_payload_hash.t) ->
t
val attestation_branch :
t ->
(Mavryk_protocol_environment_001_PtAtLas.Block_hash.t * Block_payload_hash.t)
option
val store_attestation_branch :
context ->
(Mavryk_protocol_environment_001_PtAtLas.Block_hash.t * Block_payload_hash.t) ->
context Mavryk_protocol_environment_001_PtAtLas.Lwt.t
store_attestation_branch context branch
sets the "attestation branch" (see Storage.Tenderbake.Attestation_branch
to branch
in both the disk storage and RAM.