Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changes/17964.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Add a --stop-time-interval option to control the upper bound (inclusive) on the
random number of hours added to the daemon's --stop-time. Setting it to 0
disables the randomness. The default is 9, which is the pre-existing upper
bound.
16 changes: 14 additions & 2 deletions src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
were no slots won within an hour after the stop time) (Default: \
%d)"
Cli_lib.Default.stop_time )
and stop_time_interval =
flag "--stop-time-interval" ~aliases:[ "stop-time-interval" ] (optional int)
~doc:
(sprintf
"UPTIME An upper bound (inclusive) on the random number of hours \
added to the stop-time. Setting it to zero disables this \
randomness. (Default: %d)"
Cli_lib.Default.stop_time_interval )
and upload_blocks_to_gcloud =
flag "--upload-blocks-to-gcloud"
~aliases:[ "upload-blocks-to-gcloud" ]
Expand Down Expand Up @@ -1289,6 +1297,10 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
or_from_config YJ.Util.to_int_option "stop-time"
~default:Cli_lib.Default.stop_time stop_time
in
let stop_time_interval =
or_from_config YJ.Util.to_int_option "stop-time-interval"
~default:Cli_lib.Default.stop_time_interval stop_time_interval
in
if enable_tracing then Mina_tracing.start conf_dir |> don't_wait_for ;
let%bind () =
if enable_internal_tracing then
Expand Down Expand Up @@ -1469,8 +1481,8 @@ Pass one of -peer, -peer-list-file, -seed, -peer-list-url.|} ;
~log_precomputed_blocks ~start_filtered_logs
~upload_blocks_to_gcloud ~block_reward_threshold ~uptime_url
~uptime_submitter_keypair ~uptime_send_node_commit ~stop_time
~node_status_url ~graphql_control_port:itn_graphql_port
~simplified_node_stats
~stop_time_interval ~node_status_url
~graphql_control_port:itn_graphql_port ~simplified_node_stats
~zkapp_cmd_limit:(ref compile_config.zkapp_cmd_limit)
~itn_features ~compile_config ~hardfork_mode () )
in
Expand Down
2 changes: 2 additions & 0 deletions src/lib/cli_lib/default.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ let conf_dir_name = ".mina-config"

let stop_time = 168

let stop_time_interval = 9

let receiver_key_warning =
"Warning: If the key is from a zkApp account, the account's receive \
permission must be None."
Expand Down
1 change: 1 addition & 0 deletions src/lib/mina_lib/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type t =
; uptime_submitter_keypair : Keypair.t option [@default None]
; uptime_send_node_commit : bool [@default false]
; stop_time : int
; stop_time_interval : int
; file_log_level : Logger.Level.t [@default Logger.Level.Info]
; log_level : Logger.Level.t [@default Logger.Level.Info]
; log_json : bool [@default false]
Expand Down
7 changes: 6 additions & 1 deletion src/lib/mina_lib/mina_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,12 @@ let check_and_stop_daemon t ~wait =
`Check_in (Core.Time.Span.scale vrf_poll_interval 2.0) )

let stop_long_running_daemon t =
let wait_mins = (t.config.stop_time * 60) + (Random.int 10 * 60) in
(* The Random.int upper bound is exclusive *)
let additional_wait_hours =
if t.config.stop_time_interval < 1 then 0
else Random.int (t.config.stop_time_interval + 1)
in
let wait_mins = (t.config.stop_time + additional_wait_hours) * 60 in
[%log' info t.config.logger]
"Stopping daemon after $wait mins and when there are no blocks to be \
produced"
Expand Down