Mavryk_baking_002_PtBoreas.Baking_state
type consensus_key = {
alias : string option;
public_key : Mavryk_base.TzPervasives.Signature.public_key;
public_key_hash : Mavryk_base.TzPervasives.Signature.public_key_hash;
secret_key_uri : Mavryk_client_base.Client_keys.sk_uri;
}
val consensus_key_encoding :
consensus_key Mavryk_base.TzPervasives.Data_encoding.t
val pp_consensus_key : Stdlib.Format.formatter -> consensus_key -> unit
type consensus_key_and_delegate =
consensus_key * Mavryk_base.TzPervasives.Signature.Public_key_hash.t
val consensus_key_and_delegate_encoding :
consensus_key_and_delegate Mavryk_base.TzPervasives.Data_encoding.t
val pp_consensus_key_and_delegate :
Stdlib.Format.formatter ->
consensus_key_and_delegate ->
unit
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.
type prequorum = {
level : int32;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
block_payload_hash : Mavryk_protocol_002_PtBoreas.Protocol.Block_payload_hash.t;
preattestations : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.preattestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list;
}
type block_info = {
hash : Mavryk_base.TzPervasives.Block_hash.t;
shell : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Block_header.shell_header;
payload_hash : Mavryk_protocol_002_PtBoreas.Protocol.Block_payload_hash.t;
payload_round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
prequorum : prequorum option;
quorum : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.attestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list;
payload : Operation_pool.payload;
}
type cache = {
known_timestamps : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Timestamp.time
Baking_cache.Timestamp_of_round_cache.t;
round_timestamps : (Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Timestamp.time
* Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t
* consensus_key_and_delegate)
Baking_cache.Round_timestamp_interval_cache.t;
}
type block_kind =
| Fresh of Operation_pool.pool
| Reproposal of {
consensus_operations : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.packed_operation
list;
payload_hash : Mavryk_protocol_002_PtBoreas.Protocol.Block_payload_hash.t;
payload_round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
payload : Operation_pool.payload;
}
type block_to_bake = {
predecessor : block_info;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
delegate : consensus_key_and_delegate;
kind : block_kind;
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 permanently set using the --force-apply
flag (see force_apply_switch_arg
in baking_commands.ml
).
}
val block_info_encoding : block_info Mavryk_base.TzPervasives.Data_encoding.t
type delegate_slot = {
consensus_key_and_delegate : consensus_key_and_delegate;
first_slot : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Slot.t;
attesting_power : int;
}
A delegate slot consists of the delegate's consensus key, its public key hash, its first slot, and its attesting power at some level.
module Delegate_slots : sig ... end
type delegate_slots = Delegate_slots.t
val proposal_encoding : proposal Mavryk_base.TzPervasives.Data_encoding.t
val is_first_block_in_protocol : proposal -> bool
Identify 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 : Mavryk_protocol_002_PtBoreas.Protocol.Block_payload_hash.t;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
}
val locked_round_encoding :
locked_round Mavryk_base.TzPervasives.Data_encoding.t
val attestable_payload_encoding :
attestable_payload Mavryk_base.TzPervasives.Data_encoding.t
type elected_block = {
proposal : proposal;
attestation_qc : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.attestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list;
}
type prepared_block = {
signed_block_header : Mavryk_protocol_002_PtBoreas.Protocol.block_header;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
delegate : consensus_key_and_delegate;
operations : Mavryk_base.Operation.t list list;
baking_votes : Mavryk_protocol_002_PtBoreas.Protocol.Per_block_votes_repr.per_block_votes;
}
val pp_consensus_vote_kind :
Stdlib.Format.formatter ->
consensus_vote_kind ->
unit
val consensus_vote_kind_encoding :
consensus_vote_kind Mavryk_base.TzPervasives.Data_encoding.t
type unsigned_consensus_vote = {
vote_kind : consensus_vote_kind;
vote_consensus_content : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.consensus_content;
delegate : consensus_key_and_delegate;
dal_content : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.dal_content
option;
}
type signed_consensus_vote = {
unsigned_consensus_vote : unsigned_consensus_vote;
signed_operation : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.packed_operation;
}
type batch_content = {
level : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Raw_level.t;
round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
block_payload_hash : Mavryk_protocol_002_PtBoreas.Protocol.Block_payload_hash.t;
}
type unsigned_consensus_vote_batch = private {
batch_kind : consensus_vote_kind;
batch_content : batch_content;
batch_branch : Mavryk_base.TzPervasives.Block_hash.t;
unsigned_consensus_votes : unsigned_consensus_vote list;
}
val make_unsigned_consensus_vote_batch :
consensus_vote_kind ->
batch_content ->
batch_branch:Mavryk_base.TzPervasives.Block_hash.t ->
(consensus_key_and_delegate
* Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Slot.t)
list ->
unsigned_consensus_vote_batch
val dal_content_map_p :
(unsigned_consensus_vote ->
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.dal_content option
Mavryk_base.TzPervasives.tzresult
Lwt.t) ->
unsigned_consensus_vote_batch ->
unsigned_consensus_vote_batch Lwt.t
type signed_consensus_vote_batch = private {
batch_kind : consensus_vote_kind;
batch_content : batch_content;
batch_branch : Mavryk_base.TzPervasives.Block_hash.t;
signed_consensus_votes : signed_consensus_vote list;
}
val make_signed_consensus_vote_batch :
consensus_vote_kind ->
batch_content ->
batch_branch:Mavryk_base.TzPervasives.Block_hash.t ->
signed_consensus_vote list ->
signed_consensus_vote_batch Mavryk_base.TzPervasives.tzresult
val make_singleton_consensus_vote_batch :
signed_consensus_vote ->
signed_consensus_vote_batch
type level_state = {
current_level : int32;
latest_proposal : proposal;
is_latest_proposal_applied : bool;
locked_round : locked_round option;
attestable_payload : attestable_payload option;
elected_block : elected_block option;
delegate_slots : delegate_slots;
next_level_delegate_slots : delegate_slots;
next_level_proposed_round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t
option;
}
val phase_encoding : phase Mavryk_base.TzPervasives.Data_encoding.t
type round_state = {
current_round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
current_phase : phase;
delayed_quorum : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.attestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list
option;
early_attestations : signed_consensus_vote list;
awaiting_unlocking_pqc : bool;
}
type forge_event =
| Block_ready of prepared_block
| Preattestation_ready of signed_consensus_vote
| Attestation_ready of signed_consensus_vote
forge_event
type used to return the result of a task completion in the forge worker.
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.
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.
type global_state = {
cctxt : Mavryk_client_002_PtBoreas.Protocol_client_context.full;
chain_id : Mavryk_base.TzPervasives.Chain_id.t;
config : Baking_configuration.t;
constants : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Constants.t;
round_durations : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.round_durations;
operation_worker : Operation_worker.t;
mutable forge_worker_hooks : forge_worker_hooks;
validation_mode : validation_mode;
delegates : consensus_key list;
cache : cache;
dal_node_rpc_ctxt : Mavryk_rpc.Context.generic option;
}
type t = state
val round_proposer :
state ->
level:[ `Current | `Next ] ->
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t ->
delegate_slot option
Returns, 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.
type timeout_kind =
| End_of_round of {
ending_round : Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t;
}
| Time_to_prepare_next_level_block of {
}
val timeout_kind_encoding :
timeout_kind Mavryk_base.TzPervasives.Data_encoding.t
type event =
| New_valid_proposal of proposal
| New_head_proposal of proposal
| Prequorum_reached of Operation_worker.candidate
* Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.preattestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list
| Quorum_reached of Operation_worker.candidate
* Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Kind.attestation
Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.operation
list
| New_forge_event of forge_event
| Timeout of timeout_kind
val event_encoding : event Mavryk_base.TzPervasives.Data_encoding.t
val forge_event_encoding : forge_event Mavryk_base.TzPervasives.Data_encoding.t
type state_data = {
level_data : int32;
locked_round_data : locked_round option;
attestable_payload_data : attestable_payload option;
}
val state_data_encoding : state_data Mavryk_base.TzPervasives.Data_encoding.t
val record_state : t -> unit Mavryk_base.TzPervasives.tzresult Lwt.t
val may_record_new_state :
previous_state:t ->
new_state:t ->
unit Mavryk_base.TzPervasives.tzresult Lwt.t
val load_attestable_data :
Mavryk_client_002_PtBoreas.Protocol_client_context.full ->
[ `State ] Baking_files.location ->
state_data option Mavryk_base.TzPervasives.tzresult Lwt.t
val may_load_attestable_data : t -> t Mavryk_base.TzPervasives.tzresult Lwt.t
val compute_delegate_slots :
Mavryk_client_002_PtBoreas.Protocol_client_context.full ->
?block:Mavryk_shell_services.Block_services.block ->
level:int32 ->
chain:Mavryk_shell_services.Shell_services.chain ->
consensus_key list ->
delegate_slots Mavryk_base.TzPervasives.tzresult Lwt.t
val create_cache : unit -> cache
val timestamp_of_round :
state ->
predecessor_timestamp:Mavryk_base.TzPervasives.Time.Protocol.t ->
predecessor_round:Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t ->
round:Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t ->
Mavryk_base.TzPervasives.Time.Protocol.t Mavryk_base.TzPervasives.tzresult
Memoization wrapper for Round.timestamp_of_round
.
val compute_next_round_time :
state ->
(Mavryk_base.TzPervasives.Time.Protocol.t
* Mavryk_protocol_002_PtBoreas.Protocol.Alpha_context.Round.t)
option
From the current state
, the function returns an optional association pair, which consists of the next round timestamp and its round.
val pp_validation_mode : Stdlib.Format.formatter -> validation_mode -> unit
val pp_global_state : Stdlib.Format.formatter -> global_state -> unit
val pp_block_info : Stdlib.Format.formatter -> block_info -> unit
val pp_proposal : Stdlib.Format.formatter -> proposal -> unit
val pp_locked_round : Stdlib.Format.formatter -> locked_round -> unit
val pp_attestable_payload :
Stdlib.Format.formatter ->
attestable_payload ->
unit
val pp_elected_block : Stdlib.Format.formatter -> elected_block -> unit
val pp_delegate_slot : Stdlib.Format.formatter -> delegate_slot -> unit
val pp_delegate_slots : Stdlib.Format.formatter -> delegate_slots -> unit
val pp_prepared_block : Stdlib.Format.formatter -> prepared_block -> unit
val pp_level_state : Stdlib.Format.formatter -> level_state -> unit
val pp_phase : Stdlib.Format.formatter -> phase -> unit
val pp_round_state : Stdlib.Format.formatter -> round_state -> unit
val pp : Stdlib.Format.formatter -> t -> unit
val pp_timeout_kind : Stdlib.Format.formatter -> timeout_kind -> unit
val pp_event : Stdlib.Format.formatter -> event -> unit
val pp_forge_event : Stdlib.Format.formatter -> forge_event -> unit