Skip to content

Commit 6e2925d

Browse files
committed
Rename hardfork-mode to hardfork-handling
The (now-closed) hard fork automation MIP specifies that the name of the option controlling the feature will be --hardfork-handling, with values keep-running and migrate-exit. This is an internal flag; for the upcoming Mesa hard fork, users are expected to choose the auto hard fork package if they want to use the "auto" mode. For that reason, the specification in the MIP gave it this somewhat awkward new name to more accurately reflect what daemon behaviours will change if it is enabled.
1 parent fe8d307 commit 6e2925d

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

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

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -610,20 +610,24 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
610610
"true|false Whether to send the commit SHA used to build the node to \
611611
the uptime service. (default: false)"
612612
no_arg
613-
and hardfork_mode =
614-
(*
615-
There's 2 hardfork mode, namely Legacy and Auto. Reference:
616-
- https://www.notion.so/o1labs/HF-Mina-node-changes-specification-216e79b1f910805d9865e44f2f4baf0e
617-
- https://www.notion.so/o1labs/V2-MIP-draft-HF-automation-250e79b1f9108010b0c5f2b1f416640b
618-
*)
619-
flag "--hardfork-mode" ~aliases:[ "hardfork-mode" ]
613+
and hardfork_handling =
614+
(* The two hard fork modes are migrate-exit (the "auto" hard fork mode) and
615+
keep-running (the "legacy" hard fork mode). See
616+
https://github.com/MinaProtocol/MIPs/pull/32. This option currently only
617+
controls the ledger sync feature (keeping migrated versions of the root
618+
and epoch ledger databases alongside the stable ones). TODO: the code
619+
will eventually need to be updated so this option also causes the daemon
620+
to generate and save its own hard fork config at the [slot_chain_end] and
621+
then shut down. *)
622+
flag "--hardfork-handling" ~aliases:[ "hardfork-handling" ]
620623
~doc:
621-
"auto|legacy Mode of hardfork. Under auto mode, the daemon would back \
622-
all ledgers that are needed for post-hardfork node to bootstrap with \
623-
2 databases, one for before, and one for after the hardfork. Under \
624-
legacy mode, all databased backed ledgers are backed by one database. \
625-
THIS FLAG IS INTERNAL USE ONLY AND WOULD BE REMOVED WITHOUT NOTICE"
626-
(optional_with_default Hardfork_mode.Legacy Hardfork_mode.arg)
624+
"keep-running|migrate-exit Internal flag, controlling how the daemon \
625+
handles an upcoming hard fork. Exposed for testing purposes. \
626+
Currently it only causes the daemon to maintain migrated versions of \
627+
the root and epoch ledger databases alongside the stable databases. \
628+
(default: keep-running). "
629+
(optional_with_default Hardfork_handling.Keep_running
630+
Hardfork_handling.arg )
627631
in
628632
let to_pubsub_topic_mode_option =
629633
let open Gossip_net.Libp2p in
@@ -833,7 +837,7 @@ let setup_daemon logger ~itn_features ~default_snark_worker_fee =
833837
in
834838
let compile_config = Mina_compile_config.Compiled.t in
835839
let ledger_backing_type =
836-
Mina_lib.Config.ledger_backing ~hardfork_mode
840+
Mina_lib.Config.ledger_backing ~hardfork_handling
837841
in
838842
let%bind ( precomputed_values
839843
, config_jsons
@@ -1472,7 +1476,7 @@ Pass one of -peer, -peer-list-file, -seed, -peer-list-url.|} ;
14721476
~node_status_url ~graphql_control_port:itn_graphql_port
14731477
~simplified_node_stats
14741478
~zkapp_cmd_limit:(ref compile_config.zkapp_cmd_limit)
1475-
~itn_features ~compile_config ~hardfork_mode () )
1479+
~itn_features ~compile_config ~hardfork_handling () )
14761480
in
14771481
{ mina
14781482
; 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
@@ -70,13 +70,13 @@ type t =
7070
; zkapp_cmd_limit : int option ref
7171
; compile_config : Mina_compile_config.t
7272
; itn_features : bool
73-
; hardfork_mode : Cli_lib.Arg_type.Hardfork_mode.t
73+
; hardfork_handling : Cli_lib.Arg_type.Hardfork_handling.t
7474
}
7575
[@@deriving make]
7676

77-
let ledger_backing ~hardfork_mode =
78-
match hardfork_mode with
79-
| Cli_lib.Arg_type.Hardfork_mode.Auto ->
77+
let ledger_backing ~hardfork_handling =
78+
match hardfork_handling with
79+
| Cli_lib.Arg_type.Hardfork_handling.Migrate_exit ->
8080
Root_ledger.Config.Converting_db
81-
| _ ->
81+
| Cli_lib.Arg_type.Hardfork_handling.Keep_running ->
8282
Stable_db

src/lib/mina_lib/mina_lib.ml

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

22222222
let ledger_backing =
2223-
Config.ledger_backing ~hardfork_mode:config.hardfork_mode
2223+
Config.ledger_backing ~hardfork_handling:config.hardfork_handling
22242224
in
22252225
let valid_transitions, initialization_finish_signal =
22262226
Transition_router.run

0 commit comments

Comments
 (0)