Tezos_baking_alpha.Baking_schedulingval retry :
Tezos_client_alpha.Protocol_client_context.full ->
?max_delay:float ->
delay:float ->
factor:float ->
?tries:int ->
?msg:(Tezos_base.TzPervasives.tztrace -> string) ->
('a -> 'b Tezos_base.TzPervasives.tzresult Lwt.t) ->
'a ->
'b Tezos_base.TzPervasives.tzresult Lwt.tretry ctxt ~delay ?max_delay ~factor ~tries ?msg f x retries applying f x tries until it succeeds or returns an error different from Connection_failed, at most tries number of times. After each try it waits for a number of seconds, but not more than max_delay, if given. The wait time between tries is given by the initial delay, multiplied by factor at each subsequent try. At each failure, msg together with the current delay is printed using ctxt#message.
val run :
Tezos_client_alpha.Protocol_client_context.full ->
?dal_node_rpc_ctxt:Tezos_rpc.Context.generic ->
?canceler:Lwt_canceler.t ->
?stop_on_event:(Baking_state.event -> bool) ->
?on_error:
(Tezos_base.TzPervasives.tztrace ->
unit Tezos_base.TzPervasives.tzresult Lwt.t) ->
?constants:Tezos_protocol_alpha.Protocol.Alpha_context.Constants.t ->
chain:Tezos_shell_services.Chain_services.chain ->
Baking_configuration.t ->
Baking_state_types.Key.t list ->
unit Tezos_base.TzPervasives.tzresult Lwt.trun context ?canceler ?stop_on_event ?on_error ?constants chain baking_configuration consensus_keys is the entry point of the baker automaton. This function performs the following tasks:
create_initial_stateregister_dal_profiles node RPCBaking_nonces.start_revelation_workercreate_loop_stateautomaton_loopval sleep_until : Tezos_base.TzPervasives.Time.Protocol.t -> unit Lwt.t optionsleep_until time is blocking until it is time.
val first_potential_round_at_next_level :
Baking_state.state ->
earliest_round:Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
(Tezos_protocol_alpha.Protocol.Alpha_context.Round.t
* Baking_state_types.Delegate.t)
optionfirst_potential_round_at_next_level Returns the first round at the next level, at or after earliest_round, whose baking slot belongs to one of our own delegates; also returns the corresponding delegate. Or returns None if no such round exists.
val first_potential_round_at_current_level :
Baking_state.state ->
earliest_round:Tezos_protocol_alpha.Protocol.Alpha_context.Round.t ->
(Tezos_protocol_alpha.Protocol.Alpha_context.Round.t
* Baking_state_types.Delegate.t)
optionfirst_potential_round_at_current_level Returns the first round at current level, at or after earliest_round, whose baking slot belongs to one of our own delegates; also returns the corresponding delegate. Or returns None if no such round exists.
val compute_next_potential_baking_time_at_next_level :
Baking_state.state ->
(Tezos_base.TzPervasives.Time.Protocol.t
* Tezos_protocol_alpha.Protocol.Alpha_context.Round.t)
option
Lwt.tcompute_next_potential_baking_time state From the current state, the function returns an optional association pair, which consists of the next baking timestamp and its baking round. In that case, an elected block must exist.
val compute_bootstrap_event :
Baking_state.state ->
Baking_state.event Tezos_base.TzPervasives.tzresultcompute_bootstrap_event state emits the first event. If the latest proposal is for the current round, then trigger the new proposal event to possibly preattest. Otherwise, trigger the end of round event (for the previous round) to check whether we need to propose at this level or not.
val create_loop_state :
?get_valid_blocks_stream:Baking_state.proposal Lwt_stream.t Lwt.t ->
heads_stream:Baking_state.proposal Lwt_stream.t ->
forge_event_stream:Baking_state.forge_event Lwt_stream.t ->
Operation_worker.t ->
loop_statecreate_loop_state ?get_valid_blocks_stream heads_stream forge_event_stream operation_worker creates a loop state with the streams of valid blocks, new heads, forged events and operations from the node's mempool.
val create_initial_state :
Tezos_client_alpha.Protocol_client_context.full ->
?dal_node_rpc_ctxt:Tezos_rpc.Context.generic ->
?synchronize:bool ->
chain:Tezos_shell_services.Chain_services.chain ->
Baking_configuration.t ->
Operation_worker.t ->
Tezos_protocol_alpha.Protocol.Alpha_context.Round.round_durations ->
current_proposal:Baking_state.proposal ->
?constants:Tezos_protocol_alpha.Protocol.Alpha_context.Constants.t ->
Baking_state_types.Key.t list ->
Baking_state.state Tezos_base.TzPervasives.tzresult Lwt.tcreate_initial_state context ?synchronize chain baking_configuration operation_worker current_proposal ?constants consensus_keys creates an initial Baking_state.t by initializing a Baking_state.global_state, a Baking_state.level_state and a Baking_state.round_state.
global_state initialization, a validation mode is set based on the baking_configuration and a forge worker is started. If constants is not provided, an RPC is called to recover them from the context.level_state initialization, information regarding the current level is retrieved (the current level being that of the current_proposal) and delegates slots are computed for the given consensus_keys.round_state initialization, current round is compute by calling Baking_actions.compute_round with current_proposal information if synchronize is set to true (which is the default).val automaton_loop :
?stop_on_event:(Baking_state.event -> bool) ->
config:Baking_configuration.t ->
on_error:
(Tezos_base.TzPervasives.tztrace ->
(unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t) ->
loop_state ->
Baking_state.state ->
Baking_state.event ->
Baking_state.event option Tezos_base.TzPervasives.tzresult Lwt.tautomaton_loop ?stop_on_event baking_configuration on_error loop_state state event:
State_transition.step with the state and event and recover a new state and an action to performBaking_actions.perform_action on this new state and actionbaking_configuration is not Baking_configuration.state_recorder_config.Memorystate using a function that returns an Lwt promise that fulfills once the nearest timeout (between those computed by wait_end_of_round and wait_baking_time_next_level) is expired (at that moment the state machine will react)stop_on_event matches the given event; recursively calls itself with the new event otherwise