Module Mavryk_baking_alpha.Baking_state

type consensus_key = {
  1. alias : string option;
  2. public_key : Mavryk_base.TzPervasives.Signature.public_key;
  3. public_key_hash : Mavryk_base.TzPervasives.Signature.public_key_hash;
  4. 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
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
type validation_mode =
  1. | Node
  2. | Local of Abstract_context_index.t

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 block_to_bake = {
  1. predecessor : block_info;
  2. round : Mavryk_protocol_alpha.Protocol.Alpha_context.Round.t;
  3. delegate : consensus_key_and_delegate;
  4. kind : block_kind;
  5. 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 = {
  1. consensus_key_and_delegate : consensus_key_and_delegate;
  2. first_slot : Mavryk_protocol_alpha.Protocol.Alpha_context.Slot.t;
  3. 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
type proposal = {
  1. block : block_info;
  2. predecessor : block_info;
}
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.

val locked_round_encoding : locked_round Mavryk_base.TzPervasives.Data_encoding.t
type attestable_payload = {
  1. proposal : proposal;
  2. prequorum : prequorum;
}
val attestable_payload_encoding : attestable_payload Mavryk_base.TzPervasives.Data_encoding.t
type consensus_vote_kind =
  1. | Attestation
  2. | Preattestation
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 signed_consensus_vote = {
  1. unsigned_consensus_vote : unsigned_consensus_vote;
  2. signed_operation : Mavryk_protocol_alpha.Protocol.Alpha_context.packed_operation;
}
type unsigned_consensus_vote_batch = private {
  1. batch_kind : consensus_vote_kind;
  2. batch_content : batch_content;
  3. batch_branch : Mavryk_base.TzPervasives.Block_hash.t;
  4. unsigned_consensus_votes : unsigned_consensus_vote list;
}
type signed_consensus_vote_batch = private {
  1. batch_kind : consensus_vote_kind;
  2. batch_content : batch_content;
  3. batch_branch : Mavryk_base.TzPervasives.Block_hash.t;
  4. signed_consensus_votes : signed_consensus_vote list;
}
type Mavryk_base.TzPervasives.error +=
  1. | Mismatch_signed_consensus_vote_in_batch
val make_singleton_consensus_vote_batch : signed_consensus_vote -> signed_consensus_vote_batch
type level_state = {
  1. current_level : int32;
  2. latest_proposal : proposal;
  3. is_latest_proposal_applied : bool;
  4. locked_round : locked_round option;
  5. attestable_payload : attestable_payload option;
  6. elected_block : elected_block option;
  7. delegate_slots : delegate_slots;
  8. next_level_delegate_slots : delegate_slots;
  9. next_level_proposed_round : Mavryk_protocol_alpha.Protocol.Alpha_context.Round.t option;
}
type phase =
  1. | Idle
  2. | Awaiting_preattestations
  3. | Awaiting_attestations
  4. | Awaiting_application
val phase_encoding : phase Mavryk_base.TzPervasives.Data_encoding.t
type round_state = {
  1. current_round : Mavryk_protocol_alpha.Protocol.Alpha_context.Round.t;
  2. current_phase : phase;
  3. delayed_quorum : Mavryk_protocol_alpha.Protocol.Alpha_context.Kind.attestation Mavryk_protocol_alpha.Protocol.Alpha_context.operation list option;
  4. early_attestations : signed_consensus_vote list;
  5. awaiting_unlocking_pqc : bool;
}
type forge_event =
  1. | Block_ready of prepared_block
  2. | Preattestation_ready of signed_consensus_vote
  3. | 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 =
  1. | Forge_and_sign_block of block_to_bake
  2. | Forge_and_sign_preattestations of {
    1. unsigned_preattestations : unsigned_consensus_vote_batch;
    }
  3. | Forge_and_sign_attestations of {
    1. unsigned_attestations : unsigned_consensus_vote_batch;
    }

forge_request type used to push a concurrent forging task in the forge worker.

type forge_worker_hooks = {
  1. push_request : forge_request -> unit;
  2. get_forge_event_stream : unit -> forge_event Lwt_stream.t;
  3. 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 state = {
  1. global_state : global_state;
  2. level_state : level_state;
  3. round_state : round_state;
}
type t = state
val update_current_phase : t -> phase -> t
val round_proposer : state -> level:[ `Current | `Next ] -> Mavryk_protocol_alpha.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 =
  1. | End_of_round of {
    1. ending_round : Mavryk_protocol_alpha.Protocol.Alpha_context.Round.t;
    }
  2. | Time_to_prepare_next_level_block of {
    1. at_round : Mavryk_protocol_alpha.Protocol.Alpha_context.Round.t;
    }
val timeout_kind_encoding : timeout_kind Mavryk_base.TzPervasives.Data_encoding.t
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 = {
  1. level_data : int32;
  2. locked_round_data : locked_round option;
  3. 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 may_load_attestable_data : t -> t Mavryk_base.TzPervasives.tzresult Lwt.t
  • parameter block

    default to `Head 0

val create_cache : unit -> cache

Memoization wrapper for Round.timestamp_of_round.

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_option : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a option -> 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