Module Tezos_baking_alpha.Baking_actions

Action types

type action =
  1. | Do_nothing
  2. | Prepare_block of {
    1. block_to_bake : Baking_state.block_to_bake;
    }
  3. | Prepare_preattestations of {
    1. preattestations : Baking_state.unsigned_consensus_vote_batch;
    }
  4. | Prepare_attestations of {
    1. attestations : Baking_state.unsigned_consensus_vote_batch;
    }
  5. | Prepare_consensus_votes of {
    1. preattestations : Baking_state.unsigned_consensus_vote_batch;
    2. attestations : Baking_state.unsigned_consensus_vote_batch;
    }
  6. | Inject_block of {
    1. prepared_block : Baking_state.prepared_block;
    2. force_injection : bool;
    3. asynchronous : bool;
    }
  7. | Inject_preattestation of {
    1. signed_preattestation : Baking_state.signed_consensus_vote;
    }
  8. | Inject_attestations of {
    1. signed_attestations : Baking_state.signed_consensus_vote_batch;
    }
  9. | Update_to_level of level_update
  10. | Synchronize_round of round_update
  11. | Watch_prequorum
  12. | Watch_quorum
and level_update = {
  1. new_level_proposal : Baking_state.proposal;
  2. 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 = {
  1. new_round_proposal : Baking_state.proposal;
  2. handle_proposal : Baking_state.state -> (Baking_state.state * action) Lwt.t;
}
type t = action
val pp_action : Stdlib.Format.formatter -> action -> unit

Functions used by the baker

prepare_block global_state block_to_bake prepares a block by:

  • inferring the block timestamp
  • recovering the operations from the mempool if the block is a new proposal, or reusing the operations from block_to_bake's payload if the block is a reproposal
  • generating the seed nonce hash if needed
  • setting the votes for liquidity baking and adaptive issuance according to the per_block_vote_file
  • calling Block_forge.forge to forge the block
  • signing the block header
  • registering the seed nonce if needed

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.

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.

compute_round proposal round_durations computes the round from the current timestamp, the proposal's timestamp and the round_durations.

perform_action state action performs the given action using the state

Functions only needed for the baking_lib

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.

inject_consensus_votes state signed_consensus_vote_batch injects consensus votes from signed_consensus_vote_batch.

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.

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.