From 0d0f6dc8dd4b6ef1b8da403a3f44523050a20771 Mon Sep 17 00:00:00 2001 From: Deepthi S Kumar Date: Tue, 19 Nov 2024 11:24:21 -0800 Subject: [PATCH] move sync ledger constants back to compile time --- .../src/cli_entrypoint/mina_cli_entrypoint.ml | 2 +- src/config/dev.mlh | 4 ++++ src/config/devnet.mlh | 4 ++++ src/config/lightnet.mlh | 4 ++++ src/config/mainnet.mlh | 4 ++++ src/lib/block_producer/block_producer.ml | 4 ++-- .../bootstrap_controller.ml | 12 +++++----- src/lib/consensus/intf.ml | 2 +- src/lib/consensus/proof_of_stake.ml | 6 ++--- src/lib/fake_network/fake_network.ml | 4 ++-- .../genesis_constants/genesis_constants.ml | 4 ---- .../lib/genesis_ledger_helper_lib.ml | 6 ----- src/lib/ledger_catchup/super_catchup.ml | 2 +- src/lib/mina_block/validation.ml | 2 +- src/lib/mina_block/validation.mli | 2 +- .../mina_compile_config.ml | 23 ++++++++++++++++--- src/lib/mina_lib/mina_lib.ml | 5 ++-- .../node_config_for_unit_tests.ml | 4 ++++ .../node_config_for_unit_tests.mli | 4 ++++ src/lib/node_config/intf/node_config_intf.mli | 4 ++++ src/lib/node_config/node_config.ml | 5 ++++ src/lib/runtime_config/runtime_config.ml | 15 ++++++------ src/lib/sync_handler/sync_handler.ml | 6 ++--- src/lib/syncable_ledger/dune | 2 +- src/lib/syncable_ledger/syncable_ledger.ml | 12 ++++------ .../full_frontier/full_frontier.ml | 4 ++-- .../transition_frontier.ml | 2 +- src/lib/transition_handler/processor.ml | 2 +- src/lib/transition_handler/validator.ml | 2 +- .../transition_router/transition_router.ml | 6 ++--- src/lib/vrf_evaluator/vrf_evaluator.ml | 12 +++++----- 31 files changed, 104 insertions(+), 66 deletions(-) diff --git a/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml b/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml index 0b2e187db3d5..491c63c8125c 100644 --- a/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml +++ b/src/app/cli/src/cli_entrypoint/mina_cli_entrypoint.ml @@ -1006,7 +1006,7 @@ let setup_daemon logger ~itn_features = let module Context = struct let logger = logger - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config let constraint_constants = precomputed_values.constraint_constants diff --git a/src/config/dev.mlh b/src/config/dev.mlh index 85914d9c89ab..a2bea1045b3d 100644 --- a/src/config/dev.mlh +++ b/src/config/dev.mlh @@ -83,3 +83,7 @@ [%%undef compaction_interval] [%%define vrf_poll_interval 0] [%%undef zkapp_cmd_limit] + +(* Sync ledger query/response size*) +[%%define sync_ledger_max_subtree_depth 4] +[%%define sync_ledger_default_subtree_depth 3] diff --git a/src/config/devnet.mlh b/src/config/devnet.mlh index d3e0dbe3aa7f..0b27ffe230b7 100644 --- a/src/config/devnet.mlh +++ b/src/config/devnet.mlh @@ -78,3 +78,7 @@ [%%define vrf_poll_interval 5000] [%%define zkapp_cmd_limit 24] [%%undef scan_state_transaction_capacity_log_2] + +(* Constants determining sync ledger query/response size*) +[%%define sync_ledger_max_subtree_depth 8] +[%%define sync_ledger_default_subtree_depth 6] \ No newline at end of file diff --git a/src/config/lightnet.mlh b/src/config/lightnet.mlh index a1fdf7396406..d59207c06cf4 100644 --- a/src/config/lightnet.mlh +++ b/src/config/lightnet.mlh @@ -77,3 +77,7 @@ [%%define compaction_interval 360000] [%%define vrf_poll_interval 5000] [%%undef zkapp_cmd_limit] + +(* Constants determining sync ledger query/response size*) +[%%define sync_ledger_max_subtree_depth 8] +[%%define sync_ledger_default_subtree_depth 6] diff --git a/src/config/mainnet.mlh b/src/config/mainnet.mlh index 777cdb5ec6e1..1af34773c8ac 100644 --- a/src/config/mainnet.mlh +++ b/src/config/mainnet.mlh @@ -78,3 +78,7 @@ [%%define vrf_poll_interval 5000] [%%define zkapp_cmd_limit 24] [%%undef scan_state_transaction_capacity_log_2] + +(* Constants determining sync ledger query/response size*) +[%%define sync_ledger_max_subtree_depth 8] +[%%define sync_ledger_default_subtree_depth 6] diff --git a/src/lib/block_producer/block_producer.ml b/src/lib/block_producer/block_producer.ml index 2b8ee32c1c32..17d0904b90d5 100644 --- a/src/lib/block_producer/block_producer.ml +++ b/src/lib/block_producer/block_producer.ml @@ -821,7 +821,7 @@ let produce ~genesis_breadcrumb ~context:(module Context : CONTEXT) ~prover let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in Internal_tracing.with_state_hash protocol_state_hashes.state_hash @@ fun () -> @@ -1419,7 +1419,7 @@ let run_precomputed ~context:(module Context : CONTEXT) ~verifier ~trust_system let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in Debug_assert.debug_assert (fun () -> [%test_result: [ `Take | `Keep ]] diff --git a/src/lib/bootstrap_controller/bootstrap_controller.ml b/src/lib/bootstrap_controller/bootstrap_controller.ml index cc54647d1a96..85c771e27b26 100644 --- a/src/lib/bootstrap_controller/bootstrap_controller.ml +++ b/src/lib/bootstrap_controller/bootstrap_controller.ml @@ -64,10 +64,10 @@ let time_deferred deferred = (Time.diff end_time start_time, result) let worth_getting_root ({ context = (module Context); _ } as t) candidate = - let module Context = struct + let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config let logger = Logger.extend logger @@ -77,7 +77,7 @@ let worth_getting_root ({ context = (module Context); _ } as t) candidate = end in Consensus.Hooks.equal_select_status `Take @@ Consensus.Hooks.select - ~context:(module Context) + ~context:(module Consensus_context) ~existing: ( t.best_seen_transition |> Mina_block.Validation.block_with_hash |> With_hash.map ~f:Mina_block.consensus_state ) @@ -240,7 +240,7 @@ let external_transition_compare ~context:(module Context : CONTEXT) = let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let get_consensus_state = Fn.compose Protocol_state.consensus_state Mina_block.Header.protocol_state @@ -337,7 +337,7 @@ let run ~context:(module Context : CONTEXT) ~trust_system ~verifier ~network let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let%bind sync_ledger_time, (hash, sender, expected_staged_ledger_hash) = time_deferred @@ -823,7 +823,7 @@ let%test_module "Bootstrap_controller tests" = let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let root_sync_ledger = Sync_ledger.Db.create diff --git a/src/lib/consensus/intf.ml b/src/lib/consensus/intf.ml index a00b0b623983..df4e178cac4f 100644 --- a/src/lib/consensus/intf.ml +++ b/src/lib/consensus/intf.ml @@ -12,7 +12,7 @@ module type CONTEXT = sig val consensus_constants : Constants.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end module type Constants = sig diff --git a/src/lib/consensus/proof_of_stake.ml b/src/lib/consensus/proof_of_stake.ml index c3869c74ef9c..32abc3dd2e5b 100644 --- a/src/lib/consensus/proof_of_stake.ml +++ b/src/lib/consensus/proof_of_stake.ml @@ -31,7 +31,7 @@ module Make_str (A : Wire_types.Concrete) = struct val consensus_constants : Constants.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end let make_checked t = Snark_params.Tick.Run.make_checked t @@ -3111,7 +3111,7 @@ module Make_str (A : Wire_types.Concrete) = struct let consensus_constants = Lazy.force Constants.for_unit_tests - let genesis_constants = Genesis_constants.For_unit_tests.t + let compile_config = Mina_compile_config.For_unit_tests.t end in (* Even when consensus constants are of prod sizes, candidate should still trigger a bootstrap *) should_bootstrap_len @@ -3439,7 +3439,7 @@ module Make_str (A : Wire_types.Concrete) = struct let consensus_constants = constants - let genesis_constants = Genesis_constants.For_unit_tests.t + let compile_config = Mina_compile_config.For_unit_tests.t end let test_update constraint_constants = diff --git a/src/lib/fake_network/fake_network.ml b/src/lib/fake_network/fake_network.ml index 58cc462ac7bd..f79896b05c07 100644 --- a/src/lib/fake_network/fake_network.ml +++ b/src/lib/fake_network/fake_network.ml @@ -216,7 +216,7 @@ module Generator = struct let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let open Context in let epoch_ledger_location = @@ -263,7 +263,7 @@ module Generator = struct let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let open Context in let epoch_ledger_location = diff --git a/src/lib/genesis_constants/genesis_constants.ml b/src/lib/genesis_constants/genesis_constants.ml index a2fb1a3ff6c1..c02e60fc7a59 100644 --- a/src/lib/genesis_constants/genesis_constants.ml +++ b/src/lib/genesis_constants/genesis_constants.ml @@ -223,8 +223,6 @@ module T = struct ; max_action_elements : int ; zkapp_cmd_limit_hardcap : int ; minimum_user_command_fee : Currency.Fee.Stable.Latest.t - ; sync_ledger_default_subtree_depth : int - ; sync_ledger_max_subtree_depth : int } [@@deriving to_yojson, sexp_of, bin_io_unversioned] @@ -436,8 +434,6 @@ module Make (Node_config : Node_config_intf.S) : S = struct ; zkapp_cmd_limit_hardcap = 128 ; minimum_user_command_fee = Currency.Fee.of_mina_string_exn Node_config.minimum_user_command_fee - ; sync_ledger_max_subtree_depth = 8 - ; sync_ledger_default_subtree_depth = 6 } end diff --git a/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml b/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml index 68bb2d2f1515..7f886539d1df 100644 --- a/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml +++ b/src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml @@ -577,12 +577,6 @@ let make_genesis_constants ~logger ~(default : Genesis_constants.t) ; minimum_user_command_fee = Option.value ~default:default.minimum_user_command_fee (config.daemon >>= fun cfg -> cfg.minimum_user_command_fee) - ; sync_ledger_default_subtree_depth = - Option.value ~default:default.sync_ledger_default_subtree_depth - (config.daemon >>= fun cfg -> cfg.sync_ledger_default_subtree_depth) - ; sync_ledger_max_subtree_depth = - Option.value ~default:default.sync_ledger_max_subtree_depth - (config.daemon >>= fun cfg -> cfg.sync_ledger_max_subtree_depth) } let%test_module "Runtime config" = diff --git a/src/lib/ledger_catchup/super_catchup.ml b/src/lib/ledger_catchup/super_catchup.ml index a92306be64fd..c276b5fbf2e2 100644 --- a/src/lib/ledger_catchup/super_catchup.ml +++ b/src/lib/ledger_catchup/super_catchup.ml @@ -769,7 +769,7 @@ let pick ~context:(module Context : CONTEXT) let module Context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in match Consensus.Hooks.select diff --git a/src/lib/mina_block/validation.ml b/src/lib/mina_block/validation.ml index d9bd83bdb730..5254a05d2c1f 100644 --- a/src/lib/mina_block/validation.ml +++ b/src/lib/mina_block/validation.ml @@ -19,7 +19,7 @@ module type CONTEXT = sig val consensus_constants : Consensus.Constants.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end let validation (_, v) = v diff --git a/src/lib/mina_block/validation.mli b/src/lib/mina_block/validation.mli index 97a4acb9d007..718812583047 100644 --- a/src/lib/mina_block/validation.mli +++ b/src/lib/mina_block/validation.mli @@ -20,7 +20,7 @@ module type CONTEXT = sig val consensus_constants : Consensus.Constants.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end val validation : diff --git a/src/lib/mina_compile_config/mina_compile_config.ml b/src/lib/mina_compile_config/mina_compile_config.ml index 17849c24d10b..fd47b4f12b22 100644 --- a/src/lib/mina_compile_config/mina_compile_config.ml +++ b/src/lib/mina_compile_config/mina_compile_config.ml @@ -21,14 +21,16 @@ module Inputs = struct ; rpc_heartbeat_timeout_sec : float ; rpc_heartbeat_send_every_sec : float ; zkapps_disabled : bool + ; sync_ledger_max_subtree_depth : int + ; sync_ledger_default_subtree_depth : int } [@@deriving yojson, bin_io_unversioned] end type t = { curve_size : int - ; default_snark_worker_fee : Currency.Fee.t - ; minimum_user_command_fee : Currency.Fee.t + ; default_snark_worker_fee : Currency.Fee.Stable.Latest.t + ; minimum_user_command_fee : Currency.Fee.Stable.Latest.t ; itn_features : bool ; compaction_interval : Time.Span.t option ; block_window_duration : Time.Span.t @@ -39,8 +41,10 @@ type t = ; rpc_heartbeat_timeout : Time_ns.Span.t ; rpc_heartbeat_send_every : Time_ns.Span.t ; zkapps_disabled : bool + ; sync_ledger_max_subtree_depth : int + ; sync_ledger_default_subtree_depth : int } -[@@deriving sexp_of] +[@@deriving sexp_of, bin_io_unversioned] let make (inputs : Inputs.t) = { curve_size = inputs.curve_size @@ -64,6 +68,8 @@ let make (inputs : Inputs.t) = ; network_id = inputs.network_id ; zkapp_cmd_limit = inputs.zkapp_cmd_limit ; zkapps_disabled = inputs.zkapps_disabled + ; sync_ledger_max_subtree_depth = inputs.sync_ledger_max_subtree_depth + ; sync_ledger_default_subtree_depth = inputs.sync_ledger_default_subtree_depth } let to_yojson t = @@ -91,6 +97,9 @@ let to_yojson t = , Option.value_map ~default:`Null ~f:(fun x -> `Int x) t.zkapp_cmd_limit ) ; ("zkapps_disabled", `Bool t.zkapps_disabled) + ; ("sync_ledger_max_subtree_depth", `Int t.sync_ledger_max_subtree_depth) + ; ( "sync_ledger_default_subtree_depth" + , `Int t.sync_ledger_default_subtree_depth ) ] (*TODO: Delete this module and read in a value from the environment*) @@ -110,6 +119,10 @@ module Compiled = struct ; rpc_heartbeat_timeout_sec = 60.0 ; rpc_heartbeat_send_every_sec = 10.0 ; zkapps_disabled = false + ; sync_ledger_max_subtree_depth = + Node_config.sync_ledger_max_subtree_depth + ; sync_ledger_default_subtree_depth = + Node_config.sync_ledger_default_subtree_depth } in make inputs @@ -137,6 +150,10 @@ module For_unit_tests = struct ; network_id = Node_config_for_unit_tests.network ; zkapp_cmd_limit = Node_config_for_unit_tests.zkapp_cmd_limit ; zkapps_disabled = Node_config_for_unit_tests.zkapps_disabled + ; sync_ledger_max_subtree_depth = + Node_config_for_unit_tests.sync_ledger_max_subtree_depth + ; sync_ledger_default_subtree_depth = + Node_config_for_unit_tests.sync_ledger_default_subtree_depth } in make inputs diff --git a/src/lib/mina_lib/mina_lib.ml b/src/lib/mina_lib/mina_lib.ml index 6b12bededdfa..c32135ef7fcb 100644 --- a/src/lib/mina_lib/mina_lib.ml +++ b/src/lib/mina_lib/mina_lib.ml @@ -1269,6 +1269,7 @@ let context ~commit_id (config : Config.t) : (module CONTEXT) = let compaction_interval = config.compile_config.compaction_interval + (*Same as config.precomputed_values.compile_config. TODO: Remove redundant fields *) let compile_config = config.compile_config end ) @@ -1618,8 +1619,8 @@ let create ~commit_id ?wallets (config : Config.t) = ~pids:config.pids ~logger:config.logger ~conf_dir:config.conf_dir ~consensus_constants ~keypairs:config.block_production_keypairs - ~genesis_constants: - config.precomputed_values.genesis_constants ) ) + ~compile_config:config.precomputed_values.compile_config ) + ) >>| Result.ok_exn in let snark_worker = diff --git a/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.ml b/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.ml index 04f628d700a8..5b35e3b05290 100644 --- a/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.ml +++ b/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.ml @@ -96,3 +96,7 @@ let rpc_handshake_timeout_sec = 60.0 let rpc_heartbeat_timeout_sec = 60.0 let rpc_heartbeat_send_every_sec = 10.0 (*same as the default*) + +let sync_ledger_max_subtree_depth = 4 + +let sync_ledger_default_subtree_depth = 3 diff --git a/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.mli b/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.mli index bbe3b4300d0c..1037949c11ea 100644 --- a/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.mli +++ b/src/lib/node_config/for_unit_tests/node_config_for_unit_tests.mli @@ -21,3 +21,7 @@ val rpc_handshake_timeout_sec : float val rpc_heartbeat_timeout_sec : float val rpc_heartbeat_send_every_sec : float + +val sync_ledger_max_subtree_depth : int + +val sync_ledger_default_subtree_depth : int diff --git a/src/lib/node_config/intf/node_config_intf.mli b/src/lib/node_config/intf/node_config_intf.mli index 4daed897314c..55d3e444ad62 100644 --- a/src/lib/node_config/intf/node_config_intf.mli +++ b/src/lib/node_config/intf/node_config_intf.mli @@ -62,4 +62,8 @@ module type S = sig val zkapp_cmd_limit : int option val scan_state_tps_goal_x10 : int option + + val sync_ledger_max_subtree_depth : int + + val sync_ledger_default_subtree_depth : int end diff --git a/src/lib/node_config/node_config.ml b/src/lib/node_config/node_config.ml index 4d519dd5a843..7b411144ee9e 100644 --- a/src/lib/node_config/node_config.ml +++ b/src/lib/node_config/node_config.ml @@ -28,6 +28,11 @@ include Node_config_version [%%inject "scan_state_with_tps_goal", scan_state_with_tps_goal] +[%%inject "sync_ledger_max_subtree_depth", sync_ledger_max_subtree_depth] + +[%%inject +"sync_ledger_default_subtree_depth", sync_ledger_default_subtree_depth] + [%%ifndef scan_state_transaction_capacity_log_2] let scan_state_transaction_capacity_log_2 : int option = None diff --git a/src/lib/runtime_config/runtime_config.ml b/src/lib/runtime_config/runtime_config.ml index 347c2adf986a..3daae5df9565 100644 --- a/src/lib/runtime_config/runtime_config.ml +++ b/src/lib/runtime_config/runtime_config.ml @@ -1892,14 +1892,6 @@ module Constants : Constants_intf = struct ; minimum_user_command_fee = Option.value ~default:a.genesis_constants.minimum_user_command_fee Option.(b.daemon >>= fun d -> d.minimum_user_command_fee) - ; sync_ledger_default_subtree_depth = - Option.value - ~default:a.genesis_constants.sync_ledger_default_subtree_depth - Option.(b.daemon >>= fun d -> d.sync_ledger_default_subtree_depth) - ; sync_ledger_max_subtree_depth = - Option.value - ~default:a.genesis_constants.sync_ledger_max_subtree_depth - Option.(b.daemon >>= fun d -> d.sync_ledger_max_subtree_depth) } in let constraint_constants = @@ -1975,6 +1967,13 @@ module Constants : Constants_intf = struct ; network_id = Option.value ~default:a.compile_config.network_id Option.(b.daemon >>= fun d -> d.network_id) + ; sync_ledger_max_subtree_depth = + Option.value ~default:a.compile_config.sync_ledger_max_subtree_depth + Option.(b.daemon >>= fun d -> d.sync_ledger_max_subtree_depth) + ; sync_ledger_default_subtree_depth = + Option.value + ~default:a.compile_config.sync_ledger_default_subtree_depth + Option.(b.daemon >>= fun d -> d.sync_ledger_default_subtree_depth) } in { genesis_constants; constraint_constants; proof_level; compile_config } diff --git a/src/lib/sync_handler/sync_handler.ml b/src/lib/sync_handler/sync_handler.ml index ef4e5d64efd8..27e4c961c985 100644 --- a/src/lib/sync_handler/sync_handler.ml +++ b/src/lib/sync_handler/sync_handler.ml @@ -97,7 +97,7 @@ module Make (Inputs : Inputs_intf) : ( module struct let logger = Context.logger - let genesis_constants = Context.precomputed_values.genesis_constants + let compile_config = Context.precomputed_values.compile_config end ) in match get_ledger_by_hash ~frontier hash with @@ -205,7 +205,7 @@ module Make (Inputs : Inputs_intf) : let module Context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config let logger = Logger.extend logger [ ("selection_context", `String "Root.prove") ] @@ -234,7 +234,7 @@ module Make (Inputs : Inputs_intf) : let module Context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config let logger = Logger.extend logger [ ("selection_context", `String "Root.verify") ] diff --git a/src/lib/syncable_ledger/dune b/src/lib/syncable_ledger/dune index d0c99d5fd6d9..5e51630c4b96 100644 --- a/src/lib/syncable_ledger/dune +++ b/src/lib/syncable_ledger/dune @@ -22,7 +22,7 @@ direction error_json ppx_version.runtime - genesis_constants + mina_compile_config ) (preprocess (pps ppx_mina ppx_version ppx_jane ppx_compare ppx_deriving_yojson ppx_register_event)) diff --git a/src/lib/syncable_ledger/syncable_ledger.ml b/src/lib/syncable_ledger/syncable_ledger.ml index 9b9b4f50cf6c..ac8cb70bd4af 100644 --- a/src/lib/syncable_ledger/syncable_ledger.ml +++ b/src/lib/syncable_ledger/syncable_ledger.ml @@ -108,7 +108,7 @@ end module type CONTEXT = sig val logger : Logger.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end module type Inputs_intf = sig @@ -403,8 +403,7 @@ end = struct match subtree_depth with | n when n >= 1 - && n - <= Context.genesis_constants.sync_ledger_max_subtree_depth + && n <= Context.compile_config.sync_ledger_max_subtree_depth -> ( let ledger_depth = MT.depth mt in let addresses = @@ -576,7 +575,7 @@ end = struct let is_more_than_two = len >= 2 in let subtree_depth = Int.ceil_log2 len in let less_than_max = - len <= Int.pow 2 Context.genesis_constants.sync_ledger_max_subtree_depth + len <= Int.pow 2 Context.compile_config.sync_ledger_max_subtree_depth in let less_than_requested = subtree_depth <= requested_depth in let valid_length = @@ -653,8 +652,7 @@ end = struct Linear_pipe.write_without_pushback_if_open t.queries ( desired_root_exn t , What_child_hashes - (addr, Context.genesis_constants.sync_ledger_default_subtree_depth) - ) ) + (addr, Context.compile_config.sync_ledger_default_subtree_depth) ) ) (** Handle the initial Num_accounts message, starting the main syncing process. *) @@ -789,7 +787,7 @@ end = struct be a power of 2 in the range 2-2^$depth" , [ ( "depth" , `Int - Context.genesis_constants + Context.compile_config .sync_ledger_max_subtree_depth ) ] ) ) in diff --git a/src/lib/transition_frontier/full_frontier/full_frontier.ml b/src/lib/transition_frontier/full_frontier/full_frontier.ml index 3c799c9c66ac..73d1079b544a 100644 --- a/src/lib/transition_frontier/full_frontier/full_frontier.ml +++ b/src/lib/transition_frontier/full_frontier/full_frontier.ml @@ -566,7 +566,7 @@ let calculate_diffs ({ context = (module Context); _ } as t) breadcrumb = let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in O1trace.sync_thread "calculate_diff_frontier_diffs" (fun () -> let breadcrumb_hash = Breadcrumb.state_hash breadcrumb in @@ -964,7 +964,7 @@ module For_tests = struct let consensus_constants = precomputed_values.consensus_constants - let genesis_constants = Genesis_constants.For_unit_tests.t + let compile_config = precomputed_values.compile_config end let verifier () = diff --git a/src/lib/transition_frontier/transition_frontier.ml b/src/lib/transition_frontier/transition_frontier.ml index b1c6c572337e..f2fdff6036cc 100644 --- a/src/lib/transition_frontier/transition_frontier.ml +++ b/src/lib/transition_frontier/transition_frontier.ml @@ -720,7 +720,7 @@ module For_tests = struct let consensus_constants = precomputed_values.consensus_constants - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let open Context in let open Quickcheck.Generator.Let_syntax in diff --git a/src/lib/transition_handler/processor.ml b/src/lib/transition_handler/processor.ml index 3a3749ab2995..6c36a9d07202 100644 --- a/src/lib/transition_handler/processor.ml +++ b/src/lib/transition_handler/processor.ml @@ -115,7 +115,7 @@ let process_transition ~context:(module Context : CONTEXT) ~trust_system let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let open Consensus_context in let block_window_duration = diff --git a/src/lib/transition_handler/validator.ml b/src/lib/transition_handler/validator.ml index 20ee229dbfd3..cb1e39b4df26 100644 --- a/src/lib/transition_handler/validator.ml +++ b/src/lib/transition_handler/validator.ml @@ -22,7 +22,7 @@ let validate_header_is_relevant ~context:(module Context : CONTEXT) ~frontier let module Context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config let logger = Logger.extend logger diff --git a/src/lib/transition_router/transition_router.ml b/src/lib/transition_router/transition_router.ml index 21855ad463a7..57489dd5dc82 100644 --- a/src/lib/transition_router/transition_router.ml +++ b/src/lib/transition_router/transition_router.ml @@ -286,7 +286,7 @@ let download_best_tip ~context:(module Context : CONTEXT) ~notify_online let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in let res = List.fold tips ~init:None ~f:(fun acc enveloped_candidate_best_tip -> @@ -410,7 +410,7 @@ let initialize ~context:(module Context : CONTEXT) ~sync_local_state ~network let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in match%bind Deferred.both @@ -580,7 +580,7 @@ let run ?(sync_local_state = true) ?(cache_exceptions = false) let module Consensus_context = struct include Context - let genesis_constants = precomputed_values.genesis_constants + let compile_config = precomputed_values.compile_config end in [%log info] "Starting transition router" ; let initialization_finish_signal = Ivar.create () in diff --git a/src/lib/vrf_evaluator/vrf_evaluator.ml b/src/lib/vrf_evaluator/vrf_evaluator.ml index baab2b8e7e6a..561f9292f0a3 100644 --- a/src/lib/vrf_evaluator/vrf_evaluator.ml +++ b/src/lib/vrf_evaluator/vrf_evaluator.ml @@ -11,7 +11,7 @@ module type CONTEXT = sig val consensus_constants : Consensus.Constants.t - val genesis_constants : Genesis_constants.t + val compile_config : Mina_compile_config.t end (*Slot number within an epoch*) @@ -77,7 +77,7 @@ module Worker_state = struct type init_arg = { constraint_constants : Genesis_constants.Constraint_constants.t ; consensus_constants : Consensus.Constants.Stable.Latest.t - ; genesis_constants : Genesis_constants.t + ; compile_config : Mina_compile_config.t ; conf_dir : string ; logger : Logger.t ; commit_id : string @@ -87,7 +87,7 @@ module Worker_state = struct let context_of_config ({ constraint_constants ; consensus_constants - ; genesis_constants + ; compile_config ; logger ; conf_dir = _ ; commit_id = _ @@ -100,7 +100,7 @@ module Worker_state = struct let logger = logger - let genesis_constants = genesis_constants + let compile_config = compile_config end ) type t = @@ -420,7 +420,7 @@ let update_block_producer_keys { connection; process = _ } ~keypairs = ~arg:(Keypair.And_compressed_pk.Set.to_list keypairs) let create ~constraint_constants ~pids ~consensus_constants ~conf_dir ~logger - ~keypairs ~commit_id ~genesis_constants = + ~keypairs ~commit_id ~compile_config = let on_failure err = [%log error] "VRF evaluator process failed with error $err" ~metadata:[ ("err", Error_json.error_to_yojson err) ] ; @@ -432,7 +432,7 @@ let create ~constraint_constants ~pids ~consensus_constants ~conf_dir ~logger ~on_failure ~shutdown_on:Connection_closed ~connection_state_init_arg:() { constraint_constants ; consensus_constants - ; genesis_constants + ; compile_config ; conf_dir ; logger ; commit_id