Tezos_baking_alpha.Baking_actions
type action =
| Do_nothing
| Prepare_block of {
block_to_bake : Baking_state.block_to_bake;
}
| Prepare_preattestations of {
preattestations : Baking_state.unsigned_consensus_vote_batch;
}
| Prepare_attestations of {
attestations : Baking_state.unsigned_consensus_vote_batch;
}
| Prepare_consensus_votes of {
preattestations : Baking_state.unsigned_consensus_vote_batch;
attestations : Baking_state.unsigned_consensus_vote_batch;
}
| Inject_block of {
prepared_block : Baking_state.prepared_block;
force_injection : bool;
asynchronous : bool;
}
| Inject_preattestation of {
signed_preattestation : Baking_state.signed_consensus_vote;
}
| Inject_attestations of {
signed_attestations : Baking_state.signed_consensus_vote_batch;
}
| Update_to_level of level_update
| Synchronize_round of round_update
| Watch_prequorum
| Watch_quorum
and level_update = {
new_level_proposal : Baking_state.proposal;
compute_new_state : current_round:
Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
delegate_slots:Baking_state.delegate_slots ->
next_level_delegate_slots:Baking_state.delegate_slots ->
dal_attestable_slots:Baking_state.dal_attestable_slots ->
next_level_dal_attestable_slots:Baking_state.dal_attestable_slots ->
(Baking_state.state * action) Lwt.t;
}
and round_update = {
new_round_proposal : Baking_state.proposal;
handle_proposal : Baking_state.state -> (Baking_state.state * action) Lwt.t;
}
type t = action
val pp_action : Stdlib.Format.formatter -> action -> unit
val prepare_block :
Baking_state.global_state ->
Baking_state.block_to_bake ->
Baking_state.prepared_block Tezos_base.TzPervasives.tzresult Lwt.t
prepare_block global_state block_to_bake
prepares a block by:
block_to_bake
's payload if the block is a reproposalBlock_forge.forge
to forge the blockval authorized_consensus_votes :
Baking_state.global_state ->
Baking_state.unsigned_consensus_vote_batch ->
Baking_state.unsigned_consensus_vote list Tezos_base.TzPervasives.tzresult
Lwt.t
authorized_consensus_votes global_state unsigned_consensus_vote_batch
records and returns the list of unsigned_consensus_vote authorized according to the Baking_highwatermarks
. This function emits an event for each unauthorized consensus vote.
val forge_and_sign_consensus_vote :
Baking_state.global_state ->
branch:Tezos_base.TzPervasives.Block_hash.t ->
Baking_state.unsigned_consensus_vote ->
Baking_state.signed_consensus_vote Tezos_base.TzPervasives.tzresult Lwt.t
forge_and_sign_consensus_vote global_state branch unsigned_consensus_vote
forges a consensus operation by encoding the operation consensus content from unsigned_consensus_vote
with the branch
and then sign it.
val compute_round :
Baking_state.proposal ->
Tezos_protocol_alpha.Protocol.Alpha_context.Round.round_durations ->
Tezos_protocol_alpha.Protocol.Alpha_context.Round.t
Tezos_base.TzPervasives.tzresult
compute_round proposal round_durations
computes the round from the current timestamp, the proposal
's timestamp and the round_durations
.
val perform_action :
Baking_state.state ->
t ->
Baking_state.state Tezos_base.TzPervasives.tzresult Lwt.t
perform_action state action
performs the given action
using the state
val sign_consensus_votes :
Baking_state.global_state ->
Baking_state.unsigned_consensus_vote_batch ->
Baking_state.signed_consensus_vote_batch Tezos_base.TzPervasives.tzresult
Lwt.t
sign_consensus_votes global_state unsigned_consensus_vote_batch
recovers the authorized consensus votes by calling authorized_consensus_votes
, then signs these operation by calling forge_and_sign_consensus_vote
, and then creates a batch with Baking_state.make_signed_consensus_vote_batch
.
val inject_consensus_votes :
Baking_state.state ->
Baking_state.signed_consensus_vote_batch ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
inject_consensus_votes state signed_consensus_vote_batch
injects consensus votes from signed_consensus_vote_batch
.
val update_to_level :
Baking_state.state ->
level_update ->
(Baking_state.state * t) Tezos_base.TzPervasives.tzresult Lwt.t
update_to_level state level_update
computes the delegate slots for the given level and the next one, computes round information by calling compute_round
and updates the state accordingly.
val may_get_dal_content :
Baking_state.state ->
Baking_state.unsigned_consensus_vote ->
Tezos_protocol_alpha.Protocol.Alpha_context.dal_content option
Tezos_base.TzPervasives.tzresult
Lwt.t
may_get_dal_content state unsigned_consensus_vote
, if the DAL feature is enabled, recovers the attestable slots by calling Node_rpc.get_attestable_slots
and computes the corresponding dal_content
.