Tezos_baking_alpha.Baking_statetype delegate_info = {delegate : Baking_state_types.Delegate.t;attestation_slot : Tezos_protocol_alpha.Protocol.Alpha_context.Slot.t;attesting_power : int64;}A delegate slot consists of the delegate's consensus key, its public key hash, its first slot, and its attesting power at some level.
val pp_delegate_info : Stdlib.Format.formatter -> delegate_info -> unitmodule Delegate_infos : sig ... endtype delegate_infos = Delegate_infos.tval pp_delegate_infos : Stdlib.Format.formatter -> delegate_infos -> unitval compute_delegate_infos :
Tezos_client_alpha.Protocol_client_context.full ->
?block:Tezos_shell_services.Block_services.block ->
level:int32 ->
chain:Tezos_shell_services.Shell_services.chain ->
Baking_state_types.Key.t list ->
delegate_infos Tezos_base.TzPervasives.tzresult Lwt.tcompute_delegate_infos cctxt ?block ~level ~chain delegates computes the delegate slots of the given delegates for the level
type dal_attestable_slots =
(Baking_state_types.Delegate_id.t
* Tezos_dal_node_services.Types.attestable_slots
Tezos_base.TzPervasives.tzresult
Lwt.t)
listval consensus_vote_kind_encoding :
consensus_vote_kind Tezos_base.TzPervasives.Data_encoding.tval pp_consensus_vote_kind :
Stdlib.Format.formatter ->
consensus_vote_kind ->
unitval pp_dal_content :
Stdlib.Format.formatter ->
Tezos_protocol_alpha.Protocol.Alpha_context.dal_content ->
unitval dal_content_encoding :
Tezos_protocol_alpha.Protocol.Alpha_context.dal_content
Tezos_base.TzPervasives.Data_encoding.ttype unsigned_consensus_vote = {vote_kind : consensus_vote_kind;vote_consensus_content : Tezos_protocol_alpha.Protocol.Alpha_context.consensus_content;delegate : Baking_state_types.Delegate.t;dal_content : Tezos_protocol_alpha.Protocol.Alpha_context.dal_content option;}An unsigned consensus vote consists of the consensus vote kind, either an attestation or a preattestation, the delegate keys and its protocol and dal content.
val pp_unsigned_consensus_vote :
Stdlib.Format.formatter ->
unsigned_consensus_vote ->
unitval unsigned_consensus_vote_encoding_for_logging__cannot_decode :
unsigned_consensus_vote Tezos_base.TzPervasives.Data_encoding.tPartial encoding that omits secret keys to avoid leaking them in event logs; see Baking_state_types.Key.encoding_for_logging__cannot_decode.
Warning: As a consequence, decoding from this encoding will always fail.
type batch_content = {level : Tezos_protocol_alpha.Protocol.Alpha_context.Raw_level.t;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;block_payload_hash : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;}A batch content contains information common to all consensus operation in a batch of consensus votes.
type unsigned_consensus_vote_batch = private {batch_kind : consensus_vote_kind;batch_content : batch_content;batch_branch : Tezos_base.TzPervasives.Block_hash.t;unsigned_consensus_votes : unsigned_consensus_vote list;}An unsigned consensus batch consists of a batch kind: either preattestations or attestations, a batch content and a batch branch. These values should be common to each operations in the batch. This type also contains the list of unsigned consensus votes.
val make_unsigned_consensus_vote_batch :
consensus_vote_kind ->
batch_content ->
batch_branch:Tezos_base.TzPervasives.Block_hash.t ->
(Baking_state_types.Delegate.t
* Tezos_protocol_alpha.Protocol.Alpha_context.Slot.t)
list ->
unsigned_consensus_vote_batchmake_unsigned_consensus_vote_batch kind batch_content ~batch_branch delegates_and_slots maps the delegates_and_slots list to create a list of unsigned_consensus_vote that is then included in an unsigned_consensus_vote_batch with kind, batch_content and batch_branch. Note: dal_content of each operations is set to None, dal_content_map_p needs to be called to update the dal_content field.
val dal_content_map_p :
(unsigned_consensus_vote ->
Tezos_protocol_alpha.Protocol.Alpha_context.dal_content option
Tezos_base.TzPervasives.tzresult
Lwt.t) ->
unsigned_consensus_vote_batch ->
unsigned_consensus_vote_batch Lwt.tdal_content_map_p f unsigned_consensus_vote_batch map each unsigned_consensus_vote in the batch with f.
type signed_consensus_vote = {unsigned_consensus_vote : unsigned_consensus_vote;signed_operation : Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation;}A signed consensus vote consists of an unsigned consensus vote and its packed version signed.
val pp_signed_consensus_vote :
Stdlib.Format.formatter ->
signed_consensus_vote ->
unitval signed_consensus_vote_encoding_for_logging__cannot_decode :
signed_consensus_vote Tezos_base.TzPervasives.Data_encoding.tPartial encoding that omits secret keys to avoid leaking them in event logs; see Baking_state_types.Key.encoding_for_logging__cannot_decode.
Warning: As a consequence, decoding from this encoding will always fail.
type signed_consensus_vote_batch = private {batch_kind : consensus_vote_kind;batch_content : batch_content;batch_branch : Tezos_base.TzPervasives.Block_hash.t;signed_consensus_votes : signed_consensus_vote list;}Similar to unsigned_consensus_vote_batch type but the list of the operation are signed consensus votes.
val make_signed_consensus_vote_batch :
consensus_vote_kind ->
batch_content ->
batch_branch:Tezos_base.TzPervasives.Block_hash.t ->
signed_consensus_vote list ->
signed_consensus_vote_batch Tezos_base.TzPervasives.tzresultmake_signed_consensus_vote_batch batch_kind batch_content ~batch_branch signed_consensus_votes creates a signed_consensus_vote_batch. This function raises an error if the batch is ill-formed:
batch_kindbatch_contentbatch_contentbatch_contentPreattestation and a batch consensus vote contains a dal_content.val make_singleton_consensus_vote_batch :
signed_consensus_vote ->
signed_consensus_vote_batchmake_singleton_consensus_vote_batch signed_consensus_vote similar to make_signed_consensus_vote_batch but creates a batch with only one operation.
type prequorum = {level : int32;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;block_payload_hash : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;preattestations : Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation
list;}A prequorum consists of a level, a round, a block_payload_hash and the list of preattestations that has a total voting power higher than the protocol threshold.
type block_info = {hash : Tezos_base.TzPervasives.Block_hash.t;shell : Tezos_protocol_alpha.Protocol.Alpha_context.Block_header.shell_header;payload_hash : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;payload_round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;prequorum : prequorum option;quorum : Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation list;payload : Operation_pool.payload;grandparent : Tezos_base.TzPervasives.Block_hash.t;}val block_info_encoding : block_info Tezos_base.TzPervasives.Data_encoding.tval pp_block_info : Stdlib.Format.formatter -> block_info -> unitA proposal consists of information about the current block proposal and its predecessor.
val proposal_encoding : proposal Tezos_base.TzPervasives.Data_encoding.tval pp_proposal : Stdlib.Format.formatter -> proposal -> unittype elected_block = {proposal : proposal;attestation_qc : Tezos_protocol_alpha.Protocol.Alpha_context.Kind.attestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list;}An elected block is a proposal where the quorum has been reached. The type consists of the proposal and the quorum proof ie. an attestation list where the total voting power of the operation is higher than the protocol threshold.
val pp_elected_block : Stdlib.Format.formatter -> elected_block -> unitval is_first_block_in_protocol : proposal -> boolIdentify the first block of the protocol, ie. the block that activates the current protocol.
This block should be baked by the baker of the previous protocol (that's why this same block is also referred to as the last block of the previous protocol). It is always considered final and therefore is not attested.
type locked_round = {payload_hash : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;}A locked round is the last block attested by the baker.
val locked_round_encoding :
locked_round Tezos_base.TzPervasives.Data_encoding.tval pp_locked_round : Stdlib.Format.formatter -> locked_round -> unitAn attestable payload is a proposal on which the prequorum has been reached.
val attestable_payload_encoding :
attestable_payload Tezos_base.TzPervasives.Data_encoding.tval pp_attestable_payload :
Stdlib.Format.formatter ->
attestable_payload ->
unittype level_state = {current_level : int32;latest_proposal : proposal;latest validated block by the node that the baker work on.
*)is_latest_proposal_applied : bool;true when the proposal, validated by the block has also been applied.
*)locked_round : locked_round option;Has value when the baker have attested the current proposal
*)attestable_payload : attestable_payload option;Has value when a pqc has been reached on a previous or current round.
*)elected_block : elected_block option;A quorum has been reached on an applied proposal.
*)delegate_infos : delegate_infos;Delegate infos for the baker delegates at the current level
*)next_level_delegate_infos : delegate_infos;Delegate infos for the baker delegates at the next level
*)next_level_latest_forge_request : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t
option;Some if a forge request has been sent for the next level on the given round
*)dal_attestable_slots : dal_attestable_slots;For each (own) delegate having a DAL slot at the current level, store a promise to obtain the attestable slots for that level.
*)next_level_dal_attestable_slots : dal_attestable_slots;and similarly for the next level
*)}A level state consists of all usefull information regarding the current level such as the latest proposal, its status, the delegate slots, etc.
val pp_level_state : Stdlib.Format.formatter -> level_state -> unitval phase_encoding : phase Tezos_base.TzPervasives.Data_encoding.tval pp_phase : Stdlib.Format.formatter -> phase -> unittype round_state = {current_round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;current_phase : phase;delayed_quorum : Tezos_protocol_alpha.Protocol.Alpha_context.Kind.attestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list
option;Has value when the Quorum has been reached but the current proposal has not yet been applied
*)early_attestations : signed_consensus_vote list;Attestations ready for injection before the prequorum has been reached
*)awaiting_unlocking_pqc : bool;Used to avoid preattesting reproposal if its round is lower than the one we are locked on
*)}A round state consists of information related to the current round phase
val pp_round_state : Stdlib.Format.formatter -> round_state -> unittype block_kind = | Fresh of Operation_pool.poolA Fresh proposal contains the list its operations.
*)| Reproposal of {consensus_operations : Tezos_protocol_alpha.Protocol.Alpha_context.packed_operation
list;payload_hash : Tezos_protocol_alpha.Protocol.Block_payload_hash.t;payload_round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;payload : Operation_pool.payload;}A Reproposal contains the consensus_operations as a proof that the prequorum was reached for this proposal. It also contains information about the payload of the previous proposal.
*)A block kind is either a reproposal of a proposal that has reached a prequorum, or a fresh block.
type block_to_bake = {predecessor : block_info;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;delegate : Baking_state_types.Delegate.t;Delegate that have the right to bake the block.
*)kind : block_kind;Either a reproposal or a fresh proposal
*)force_apply : bool;if true, while baking the block, try and apply the block and its operations instead of only validating them. This can be set using the --force-apply-from-round flag (see force_apply_from_round_arg in baking_commands.ml).
}type forge_request = | Forge_and_sign_block of block_to_bake| Forge_and_sign_preattestations of {unsigned_preattestations : unsigned_consensus_vote_batch;}| Forge_and_sign_attestations of {unsigned_attestations : unsigned_consensus_vote_batch;}forge_request type used to push a concurrent forging task in the forge worker.
manager_operations_infos contains information about the number of manager operations in the forged block and the summing fees from these operations
val manager_operations_infos_encoding :
manager_operations_infos Tezos_base.TzPervasives.Data_encoding.ttype prepared_block = {signed_block_header : Tezos_protocol_alpha.Protocol.block_header;round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;delegate : Baking_state_types.Delegate.t;operations : Tezos_base.Operation.t list list;manager_operations_infos : manager_operations_infos option;baking_votes : Tezos_protocol_alpha.Protocol.Per_block_votes_repr.per_block_votes;}prepared_block type returned by the forge worker and that contains all information useful for block injection.
val pp_prepared_block : Stdlib.Format.formatter -> prepared_block -> unittype forge_event = | Block_ready of prepared_block| Preattestation_ready of signed_consensus_vote| Attestation_ready of signed_consensus_voteforge_event type used to return the result of a task completion in the forge worker.
val pp_forge_event : Stdlib.Format.formatter -> forge_event -> unitval forge_event_encoding_for_logging__cannot_decode :
forge_event Tezos_base.TzPervasives.Data_encoding.tPartial encoding for forge_event that omits secret keys to avoid leaking them in event logs; see Baking_state_types.Key.encoding_for_logging__cannot_decode.
Warning: As a consequence, decoding from this encoding will always fail.
type forge_worker_hooks = {push_request : forge_request -> unit;get_forge_event_stream : unit -> forge_event Lwt_stream.t;cancel_all_pending_tasks : unit -> unit;}forge_worker_hooks type that allows interactions with the forge worker. Hooks are needed in order to break a circular dependency.
The validation mode specifies whether the baker (filters and) validates mempool operations via an RPC to the node, or if it does so "locally", by using the context.
val pp_validation_mode : Stdlib.Format.formatter -> validation_mode -> unittype cache = {known_timestamps : Tezos_protocol_alpha.Protocol.Alpha_context.Timestamp.time
Baking_cache.Timestamp_of_round_cache.t;}Caches of timestamps
val create_cache : unit -> cachetype global_state = {cctxt : Tezos_client_alpha.Protocol_client_context.full;chain_id : Tezos_base.TzPervasives.Chain_id.t;config : Baking_configuration.t;constants : Tezos_protocol_alpha.Protocol.Alpha_context.Constants.t;round_durations : Tezos_protocol_alpha.Protocol.Alpha_context.Round.round_durations;operation_worker : Operation_worker.t;mutable forge_worker_hooks : forge_worker_hooks;validation_mode : validation_mode;delegates : Baking_state_types.Key.t list;cache : cache;dal_node_rpc_ctxt : Tezos_rpc.Context.generic option;}A global state contains all information related to the chain and baker configuration.
val pp_global_state : Stdlib.Format.formatter -> global_state -> unittype t = stateval pp : Stdlib.Format.formatter -> t -> unitupdate_current_phase t new_phase updates the round state in t with the new_phase.
val round_proposer :
state ->
level:[ `Current | `Next ] ->
Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
delegate_info optionReturns, among our *own* delegates, the delegate (and its attesting slot) that has a proposer slot at the given round and the current or next level, if any.
val timestamp_of_round :
state ->
predecessor_timestamp:Tezos_base.TzPervasives.Time.Protocol.t ->
predecessor_round:Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
round:Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
Tezos_base.TzPervasives.Time.Protocol.t Tezos_base.TzPervasives.tzresultMemoization wrapper for Round.timestamp_of_round.
val compute_next_round_time :
state ->
(Tezos_base.TzPervasives.Time.Protocol.t
* Tezos_protocol_alpha.Protocol.Alpha_context.Round.t)
optionFrom the current state, the function returns an optional association pair, which consists of the next round timestamp and its round.
type timeout_kind = | End_of_round of {ending_round : Tezos_protocol_alpha.Protocol.Alpha_context.Round.t;}| Time_to_prepare_next_level_block of {}timeout kind is either a timeout triggered at the end of a round or a timeout triggered when it is time to prepare the block at the next level.
val timeout_kind_encoding :
timeout_kind Tezos_base.TzPervasives.Data_encoding.tval pp_timeout_kind : Stdlib.Format.formatter -> timeout_kind -> unitval record_state : t -> unit Tezos_base.TzPervasives.tzresult Lwt.trecord_state t writes the current level, the locked round and the attestable payload to the disk.
val may_record_new_state :
previous_state:t ->
new_state:t ->
unit Tezos_base.TzPervasives.tzresult Lwt.tmay_record_new_state ~previous_state ~new_state Does nothing if the baker configuration is set to Baking_configuration.state_recorder_config.Memory only. Otherwise, check that information from the new_state are consistent with previous_state and if the information has been updated, record the new_state to the disk.
type state_data = {level_data : int32;locked_round_data : locked_round option;attestable_payload_data : attestable_payload option;}type used for data recorded on disk.
val state_data_encoding : state_data Tezos_base.TzPervasives.Data_encoding.tval load_attestable_data :
Tezos_client_alpha.Protocol_client_context.full ->
[ `State ] Baking_files.location ->
state_data option Tezos_base.TzPervasives.tzresult Lwt.tload_attestable_data cctxt location tries to load the state_data from the cctxt at location, returns None if the file does not exists.
val may_load_attestable_data : t -> t Tezos_base.TzPervasives.tzresult Lwt.tmay_load_attestable_data t tries to load locked round and attestable payload from t if it is recorded, if not, return the state.
type event = | New_valid_proposal of proposal| New_head_proposal of proposal| Prequorum_reached of Operation_worker.candidate
* Tezos_protocol_alpha.Protocol.Alpha_context.Kind.preattestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list| Quorum_reached of Operation_worker.candidate
* Tezos_protocol_alpha.Protocol.Alpha_context.Kind.attestation
Tezos_protocol_alpha.Protocol.Alpha_context.operation
list| New_forge_event of forge_event| Timeout of timeout_kindEvent type used in the baking_scheduling to trigger state transition.
val pp_event : Stdlib.Format.formatter -> event -> unitval pp_short_event : Stdlib.Format.formatter -> event -> unitPrints event description in a few words.
val event_encoding_for_logging__cannot_decode :
event Tezos_base.TzPervasives.Data_encoding.tPartial encoding for event that omits secret keys to avoid leaking them in event logs; see Baking_state_types.Key.encoding_for_logging__cannot_decode.
Warning: As a consequence, decoding from this encoding will always fail.