Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #16186, split for re-review #16502

Open
wants to merge 25 commits into
base: georgeee/redo-16186-for-better-review-base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
37fde44
Move transaction_capacity_log_2 to Runtime_config
georgeee Jan 22, 2025
33ce3c3
Introduce Runtime_config.Constants
georgeee Jan 22, 2025
71bd217
Rename Genesis_ledger_helper.init_from_config_file
georgeee Jan 22, 2025
e053563
Split out legacy part from inputs_from_config_file
georgeee Jan 22, 2025
788ab19
Add compile_config to Genesis_proof.Inputs
georgeee Jan 22, 2025
37e3584
Add config_files flag to Cli_lib
georgeee Jan 22, 2025
f070475
Remove default_transaction_fee from node_config
georgeee Jan 22, 2025
ffbfe45
Implement init_from_config_file (non-legacy)
georgeee Jan 22, 2025
b2eb3df
Use init_from_config_file in mina_lib tests
georgeee Jan 22, 2025
34d7a98
Use init_from_config_file in archive
georgeee Jan 22, 2025
d5a56e3
Accept optional --config-file in standalone SW
georgeee Jan 22, 2025
7860cdf
Accept optional --config-file in 'internal snark-worker'
georgeee Jan 22, 2025
3062393
Use load_constants in snarky_tests
georgeee Jan 22, 2025
eaba812
Accept optional --config-file in vrf cli commands
georgeee Jan 22, 2025
09bd9bd
Use load_constants in delegation_verify app
georgeee Jan 22, 2025
2249d75
Accept --config-file in hash ledger and two other
georgeee Jan 22, 2025
10df606
Accept optional --config-file for compile-time-constants
georgeee Jan 22, 2025
39b7c74
Accept optional --config-file in constraint_system_digests
georgeee Jan 22, 2025
eefcc50
Accept optional --config-file in 'internal run-prover'
georgeee Jan 22, 2025
bb8ebe1
Accept optional --config-file in 'internal run-verifier', 'internal r…
georgeee Jan 22, 2025
c1d7fbd
Move load_config_files to Genesis_ledger_helpers
georgeee Jan 22, 2025
b47cf86
Remove default_snark_worker_fee usage
georgeee Jan 22, 2025
cb395b2
Use non-legacy inputs_from_config_file in load_config_files
georgeee Jan 22, 2025
b98f42f
Remove legacy functions from Config_loader
georgeee Jan 22, 2025
60b5ab3
Remainder of changes from PR #16186
georgeee Jan 22, 2025
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
32 changes: 22 additions & 10 deletions src/app/archive/cli/archive_cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,38 @@ let command_run =
"int Delete blocks that are more than n blocks lower than the \
maximum seen block."
in
let runtime_config_opt =
Option.map runtime_config_file ~f:(fun file ->
Yojson.Safe.from_file file |> Runtime_config.of_yojson
|> Result.ok_or_failwith )
in
fun () ->
let logger = Logger.create () in
let genesis_constants = Genesis_constants.Compiled.genesis_constants in
let constraint_constants =
Genesis_constants.Compiled.constraint_constants
let open Deferred.Let_syntax in
let%bind config =
Runtime_config.Json_loader.load_config_files ~logger
(Option.to_list runtime_config_file)
|> Deferred.Or_error.ok_exn
in
let constants = Runtime_config.Constants.load_constants' config in
let%bind precomputed_values_opt =
match runtime_config_file with
| None ->
return None
| Some _ ->
Deferred.Or_error.(
Genesis_ledger_helper.Config_loader.init_from_config_file ~logger
~constants config
>>| fun (a, _) -> Option.some a)
|> Deferred.Or_error.ok_exn
in
Stdout_log.setup log_json log_level ;
[%log info] "Starting archive process; built with commit $commit"
~metadata:[ ("commit", `String Mina_version.commit_id) ] ;
Archive_lib.Processor.setup_server ~metrics_server_port ~logger
~genesis_constants ~constraint_constants
~genesis_constants:
(Runtime_config.Constants.genesis_constants constants)
~constraint_constants:
(Runtime_config.Constants.constraint_constants constants)
~postgres_address:postgres.value
~server_port:
(Option.value server_port.value ~default:server_port.default)
~delete_older_than ~runtime_config_opt ~missing_blocks_width )
~delete_older_than ~precomputed_values_opt ~missing_blocks_width )

let time_arg =
(* Same timezone as Genesis_constants.genesis_state_timestamp. *)
Expand Down
32 changes: 8 additions & 24 deletions src/app/archive/lib/processor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4728,26 +4728,12 @@ let run pool reader ~genesis_constants ~constraint_constants ~logger
Deferred.unit )

(* [add_genesis_accounts] is called when starting the archive process *)
let add_genesis_accounts ~logger ~(runtime_config_opt : Runtime_config.t option)
~(genesis_constants : Genesis_constants.t)
~(constraint_constants : Genesis_constants.Constraint_constants.t) pool =
match runtime_config_opt with
let add_genesis_accounts ~logger
~(precomputed_values_opt : Precomputed_values.t option) pool =
match precomputed_values_opt with
| None ->
Deferred.unit
| Some runtime_config -> (
let%bind precomputed_values =
match%map
Genesis_ledger_helper.init_from_config_file ~logger
~proof_level:Genesis_constants.Compiled.proof_level
~genesis_constants ~constraint_constants runtime_config
~cli_proof_level:None
with
| Ok (precomputed_values, _) ->
precomputed_values
| Error err ->
failwithf "Could not get precomputed values, error: %s"
(Error.to_string_hum err) ()
in
| Some precomputed_values -> (
let ledger =
Precomputed_values.genesis_ledger precomputed_values |> Lazy.force
in
Expand All @@ -4767,7 +4753,8 @@ let add_genesis_accounts ~logger ~(runtime_config_opt : Runtime_config.t option)
let%bind.Deferred.Result genesis_block_id =
Block.add_if_doesn't_exist
(module Conn)
~constraint_constants genesis_block
~constraint_constants:precomputed_values.constraint_constants
genesis_block
in
let%bind.Deferred.Result { ledger_hash; _ } =
Block.load (module Conn) ~id:genesis_block_id
Expand Down Expand Up @@ -4874,7 +4861,7 @@ let create_metrics_server ~logger ~metrics_server_port ~missing_blocks_width
let setup_server ~(genesis_constants : Genesis_constants.t)
~(constraint_constants : Genesis_constants.Constraint_constants.t)
~metrics_server_port ~logger ~postgres_address ~server_port
~delete_older_than ~runtime_config_opt ~missing_blocks_width =
~delete_older_than ~precomputed_values_opt ~missing_blocks_width =
let where_to_listen =
Async.Tcp.Where_to_listen.bind_to All_addresses (On_port server_port)
in
Expand Down Expand Up @@ -4903,10 +4890,7 @@ let setup_server ~(genesis_constants : Genesis_constants.t)
~metadata:[ ("error", `String (Caqti_error.show e)) ] ;
Deferred.unit
| Ok pool ->
let%bind () =
add_genesis_accounts pool ~logger ~genesis_constants
~constraint_constants ~runtime_config_opt
in
let%bind () = add_genesis_accounts pool ~logger ~precomputed_values_opt in
run ~constraint_constants ~genesis_constants pool reader ~logger
~delete_older_than
|> don't_wait_for ;
Expand Down
36 changes: 21 additions & 15 deletions src/app/batch_txn_tool/batch_txn_tool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,10 @@ let there_and_back_again ~num_txn_per_acct ~txns_per_block ~slot_time ~fill_rate
~origin_sender_secret_key_path
~(origin_sender_secret_key_pw_option : string option)
~returner_secret_key_path ~(returner_secret_key_pw_option : string option)
~graphql_target_node_option ~minimum_user_command_fee () =
~graphql_target_node_option ~minimum_user_command_fee ~logger () =
let open Deferred.Let_syntax in
(* define the rate limiting function *)
let open Logger in
let logger = Logger.create () in
let limit_level =
let slot_limit =
Float.(
Expand Down Expand Up @@ -310,8 +309,6 @@ let there_and_back_again ~num_txn_per_acct ~txns_per_block ~slot_time ~fill_rate
return ()

let output_there_and_back_cmds =
let genesis_constants = Genesis_constants.Compiled.genesis_constants in
let compile_config = Mina_compile_config.Compiled.t in
let open Command.Let_syntax in
Command.async
~summary:
Expand Down Expand Up @@ -390,23 +387,32 @@ let output_there_and_back_cmds =
transactions, if this is not present then we use the env var \
MINA_PRIVKEY_PASS"
(optional string)
and config_file = Cli_lib.Flag.config_files
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification: commit f070475 (Remove default_transaction_fee from node_config) also adds --config-file to the batch_txn_tool app

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're calling a list of config files here config_file? That feels confusing at the very least.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a typo, there are a few more places like this one, fixed in 6d26821

and graphql_target_node_option =
flag "--graphql-target-node" ~aliases:[ "graphql-target-node" ]
~doc:
"URL The graphql node to send graphl commands to. must be in \
format `<ip>:<port>`. default is `127.0.0.1:3085`"
(optional string)
and minimum_user_command_fee =
let default = compile_config.default_transaction_fee in
Cli_lib.Flag.fee_common
~minimum_user_command_fee:genesis_constants.minimum_user_command_fee
~default_transaction_fee:default
in
there_and_back_again ~num_txn_per_acct ~txns_per_block ~txn_fee_option
~slot_time ~fill_rate ~rate_limit ~rate_limit_level ~rate_limit_interval
~origin_sender_secret_key_path ~origin_sender_secret_key_pw_option
~returner_secret_key_path ~returner_secret_key_pw_option
~graphql_target_node_option ~minimum_user_command_fee )
and minimum_user_command_fee_opt = Cli_lib.Flag.fee_common in
fun () ->
let open Deferred.Let_syntax in
let logger = Logger.create () in
let%bind minimum_user_command_fee =
let%map conf =
Runtime_config.Constants.load_constants ~logger config_file
in
Option.value
~default:
(Runtime_config.Constants.genesis_constants conf)
.minimum_user_command_fee minimum_user_command_fee_opt
in
there_and_back_again ~num_txn_per_acct ~txns_per_block ~txn_fee_option
~slot_time ~fill_rate ~rate_limit ~rate_limit_level
~rate_limit_interval ~origin_sender_secret_key_path
~origin_sender_secret_key_pw_option ~returner_secret_key_path
~returner_secret_key_pw_option ~graphql_target_node_option
~minimum_user_command_fee ~logger () )

let () =
Command.run
Expand Down
Loading