Skip to content

Commit 3515f45

Browse files
authored
Merge pull request #18023 from MinaProtocol/cjjdespres/change-hard-fork-mode-option-name
Rename the hardfork-mode option to hardfork-handling
2 parents 047c3c9 + 909c2ab commit 3515f45

File tree

5 files changed

+34
-28
lines changed

5 files changed

+34
-28
lines changed

changes/18023.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The internal --hardfork-mode command-line option has been renamed to
2+
--hardfork-handling.

src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -618,20 +618,24 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
618618
"true|false Whether to send the commit SHA used to build the node to \
619619
the uptime service. (default: false)"
620620
no_arg
621-
and hardfork_mode =
622-
(*
623-
There's 2 hardfork mode, namely Legacy and Auto. Reference:
624-
- https://www.notion.so/o1labs/HF-Mina-node-changes-specification-216e79b1f910805d9865e44f2f4baf0e
625-
- https://www.notion.so/o1labs/V2-MIP-draft-HF-automation-250e79b1f9108010b0c5f2b1f416640b
626-
*)
627-
flag "--hardfork-mode" ~aliases:[ "hardfork-mode" ]
621+
and hardfork_handling =
622+
(* The two hard fork modes are migrate-exit (the "auto" hard fork mode) and
623+
keep-running (the "legacy" hard fork mode). See
624+
https://github.com/MinaProtocol/MIPs/pull/32. This option currently only
625+
controls the ledger sync feature (keeping migrated versions of the root
626+
and epoch ledger databases alongside the stable ones). TODO: the code
627+
will eventually need to be updated so this option also causes the daemon
628+
to generate and save its own hard fork config at the [slot_chain_end] and
629+
then shut down. *)
630+
flag "--hardfork-handling" ~aliases:[ "hardfork-handling" ]
628631
~doc:
629-
"auto|legacy Mode of hardfork. Under auto mode, the daemon would back \
630-
all ledgers that are needed for post-hardfork node to bootstrap with \
631-
2 databases, one for before, and one for after the hardfork. Under \
632-
legacy mode, all databased backed ledgers are backed by one database. \
633-
THIS FLAG IS INTERNAL USE ONLY AND WOULD BE REMOVED WITHOUT NOTICE"
634-
(optional_with_default Hardfork_mode.Legacy Hardfork_mode.arg)
632+
"keep-running|migrate-exit Internal flag, controlling how the daemon \
633+
handles an upcoming hard fork. Exposed for testing purposes. \
634+
Currently it only causes the daemon to maintain migrated versions of \
635+
the root and epoch ledger databases alongside the stable databases. \
636+
(default: keep-running). "
637+
(optional_with_default Hardfork_handling.Keep_running
638+
Hardfork_handling.arg )
635639
in
636640
let to_pubsub_topic_mode_option =
637641
let open Gossip_net.Libp2p in
@@ -841,7 +845,7 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
841845
in
842846
let compile_config = Mina_compile_config.Compiled.t in
843847
let ledger_backing_type =
844-
Mina_lib.Config.ledger_backing ~hardfork_mode
848+
Mina_lib.Config.ledger_backing ~hardfork_handling
845849
in
846850
let%bind ( precomputed_values
847851
, config_jsons
@@ -1484,7 +1488,7 @@ Pass one of -peer, -peer-list-file, -seed, -peer-list-url.|} ;
14841488
~stop_time_interval ~node_status_url
14851489
~graphql_control_port:itn_graphql_port ~simplified_node_stats
14861490
~zkapp_cmd_limit:(ref compile_config.zkapp_cmd_limit)
1487-
~itn_features ~compile_config ~hardfork_mode () )
1491+
~itn_features ~compile_config ~hardfork_handling () )
14881492
in
14891493
{ mina
14901494
; client_trustlist

src/lib/cli_lib/arg_type.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,16 @@ let work_selection_method_to_module :
147147
| Random_offset ->
148148
(module Work_selector.Selection_methods.Random_offset)
149149

150-
module Hardfork_mode = struct
151-
type t = Auto | Legacy
150+
module Hardfork_handling = struct
151+
type t = Keep_running | Migrate_exit
152152

153153
let of_string = function
154-
| "auto" ->
155-
Auto
156-
| "legacy" ->
157-
Legacy
154+
| "keep-running" ->
155+
Keep_running
156+
| "migrate-exit" ->
157+
Migrate_exit
158158
| _ ->
159-
failwith "Invalid hardfork mode"
159+
failwith "Invalid hardfork handling"
160160

161161
let arg = Command.Arg_type.map Command.Param.string ~f:of_string
162162
end

src/lib/mina_lib/config.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ type t =
7171
; zkapp_cmd_limit : int option ref
7272
; compile_config : Mina_compile_config.t
7373
; itn_features : bool
74-
; hardfork_mode : Cli_lib.Arg_type.Hardfork_mode.t
74+
; hardfork_handling : Cli_lib.Arg_type.Hardfork_handling.t
7575
}
7676
[@@deriving make]
7777

78-
let ledger_backing ~hardfork_mode =
79-
match hardfork_mode with
80-
| Cli_lib.Arg_type.Hardfork_mode.Auto ->
78+
let ledger_backing ~hardfork_handling =
79+
match hardfork_handling with
80+
| Cli_lib.Arg_type.Hardfork_handling.Migrate_exit ->
8181
Root_ledger.Config.Converting_db
82-
| _ ->
82+
| Cli_lib.Arg_type.Hardfork_handling.Keep_running ->
8383
Stable_db

src/lib/mina_lib/mina_lib.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,7 @@ let create ~commit_id ?wallets (config : Config.t) =
22252225
in
22262226

22272227
let ledger_backing =
2228-
Config.ledger_backing ~hardfork_mode:config.hardfork_mode
2228+
Config.ledger_backing ~hardfork_handling:config.hardfork_handling
22292229
in
22302230
let valid_transitions, initialization_finish_signal =
22312231
Transition_router.run

0 commit comments

Comments
 (0)