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 1 commit
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
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
24 changes: 8 additions & 16 deletions src/app/cli/src/init/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ open Signature_lib
open Mina_base
open Mina_transaction

(* TODO consider a better way of setting a default transaction fee than
a fixed compile-time value *)
let default_transaction_fee = Currency.Fee.of_nanomina_int_exn 250000000
Copy link
Member

Choose a reason for hiding this comment

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

?!?!?!

Copy link
Member

Choose a reason for hiding this comment

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

Revert


module Client = Graphql_lib.Client.Make (struct
let preprocess_variables_string = Fn.id

Expand Down Expand Up @@ -513,14 +517,8 @@ let send_payment_graphql =
flag "--amount" ~aliases:[ "amount" ]
~doc:"VALUE Payment amount you want to send" (required txn_amount)
in
let genesis_constants = Genesis_constants.Compiled.genesis_constants in
let compile_config = Mina_compile_config.Compiled.t in
let args =
Args.zip3
(Cli_lib.Flag.signed_command_common
~minimum_user_command_fee:genesis_constants.minimum_user_command_fee
~default_transaction_fee:compile_config.default_transaction_fee )
receiver_flag amount_flag
Args.zip3 Cli_lib.Flag.signed_command_common receiver_flag amount_flag
in
Command.async ~summary:"Send payment to an address"
(Cli_lib.Background_daemon.graphql_init args
Expand All @@ -530,6 +528,7 @@ let send_payment_graphql =
->
let%map response =
let input =
let fee = Option.value ~default:default_transaction_fee fee in
Mina_graphql.Types.Input.SendPaymentInput.make_input ~to_:receiver
~from:sender ~amount ~fee ?memo ?nonce ()
in
Expand All @@ -548,21 +547,14 @@ let delegate_stake_graphql =
~doc:"PUBLICKEY Public key to which you want to delegate your stake"
(required public_key_compressed)
in
let genesis_constants = Genesis_constants.Compiled.genesis_constants in
let compile_config = Mina_compile_config.Compiled.t in
let args =
Args.zip2
(Cli_lib.Flag.signed_command_common
~minimum_user_command_fee:genesis_constants.minimum_user_command_fee
~default_transaction_fee:compile_config.default_transaction_fee )
receiver_flag
in
let args = Args.zip2 Cli_lib.Flag.signed_command_common receiver_flag in
Command.async ~summary:"Delegate your stake to another public key"
(Cli_lib.Background_daemon.graphql_init args
~f:(fun
graphql_endpoint
({ Cli_lib.Flag.sender; fee; nonce; memo }, receiver)
->
let fee = Option.value ~default:default_transaction_fee fee in
let%map response =
Graphql_client.query_exn
Graphql_queries.Send_delegation.(
Expand Down
1 change: 0 additions & 1 deletion src/config/dev.mlh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@


(*BEGIN src/config/amount_defaults/standard.mlh*)
[%%define default_transaction_fee "5"]
Copy link
Member

Choose a reason for hiding this comment

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

This whole commit should really be reverted. What a nightmare.

[%%define default_snark_worker_fee "1"]
[%%define minimum_user_command_fee "2"]
(*END src/config/amount_defaults/standard.mlh*)
Expand Down
1 change: 0 additions & 1 deletion src/config/devnet.mlh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


(*BEGIN src/config/amount_defaults/realistic.mlh*)
[%%define default_transaction_fee "0.25"]
[%%define default_snark_worker_fee "0.1"]
[%%define minimum_user_command_fee "0.001"]
(*END src/config/amount_defaults/realistic.mlh*)
Expand Down
1 change: 0 additions & 1 deletion src/config/lightnet.mlh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


(*BEGIN src/config/amount_defaults/realistic.mlh*)
[%%define default_transaction_fee "0.25"]
[%%define default_snark_worker_fee "0.1"]
[%%define minimum_user_command_fee "0.001"]
(*END src/config/amount_defaults/realistic.mlh*)
Expand Down
1 change: 0 additions & 1 deletion src/config/mainnet.mlh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@


(*BEGIN src/config/amount_defaults/realistic.mlh*)
[%%define default_transaction_fee "0.25"]
[%%define default_snark_worker_fee "0.1"]
[%%define minimum_user_command_fee "0.001"]
(*END src/config/amount_defaults/realistic.mlh*)
Expand Down
31 changes: 9 additions & 22 deletions src/lib/cli_lib/flag.ml
Original file line number Diff line number Diff line change
Expand Up @@ -352,32 +352,24 @@ end

type signed_command_common =
{ sender : Signature_lib.Public_key.Compressed.t
; fee : Currency.Fee.t
; fee : Currency.Fee.t option
; nonce : Mina_base.Account.Nonce.t option
; memo : string option
}

let fee_common ~default_transaction_fee ~minimum_user_command_fee :
Currency.Fee.t Command.Param.t =
let fee_common : Currency.Fee.t option Command.Param.t =
Command.Param.flag "--fee" ~aliases:[ "fee" ]
~doc:
(Printf.sprintf
"FEE Amount you are willing to pay to process the transaction \
(default: %s) (minimum: %s)"
(Currency.Fee.to_mina_string default_transaction_fee)
(Currency.Fee.to_mina_string minimum_user_command_fee) )
(Command.Param.optional_with_default default_transaction_fee
Arg_type.txn_fee )
Comment on lines -355 to -361
Copy link
Member

Choose a reason for hiding this comment

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

Removing this information arbitrarily? No thanks.


let signed_command_common ~default_transaction_fee ~minimum_user_command_fee :
signed_command_common Command.Param.t =
~doc:"FEE Amount you are willing to pay to process the transaction"
(Command.Param.optional Arg_type.txn_fee)

let signed_command_common : signed_command_common Command.Param.t =
let open Command.Let_syntax in
let open Arg_type in
let%map_open sender =
flag "--sender" ~aliases:[ "sender" ]
(required public_key_compressed)
~doc:"PUBLICKEY Public key from which you want to send the transaction"
and fee = fee_common ~default_transaction_fee ~minimum_user_command_fee
and fee = fee_common
and nonce =
flag "--nonce" ~aliases:[ "nonce" ]
~doc:
Expand Down Expand Up @@ -410,15 +402,10 @@ module Signed_command = struct
flag "--amount" ~aliases:[ "amount" ]
~doc:"VALUE Payment amount you want to send" (required txn_amount)

let fee ~default_transaction_fee ~minimum_user_command_fee =
let fee =
let open Command.Param in
flag "--fee" ~aliases:[ "fee" ]
~doc:
(Printf.sprintf
"FEE Amount you are willing to pay to process the transaction \
(default: %s) (minimum: %s)"
(Currency.Fee.to_mina_string default_transaction_fee)
(Currency.Fee.to_mina_string minimum_user_command_fee) )
Comment on lines -408 to -412
Copy link
Member

Choose a reason for hiding this comment

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

Put it back.

~doc:"FEE Amount you are willing to pay to process the transaction"
(optional txn_fee)

let valid_until =
Expand Down
17 changes: 4 additions & 13 deletions src/lib/cli_lib/flag.mli
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,14 @@ end

type signed_command_common =
{ sender : Signature_lib.Public_key.Compressed.t
; fee : Currency.Fee.t
; fee : Currency.Fee.t option
; nonce : Mina_base.Account.Nonce.t option
; memo : string option
}

val fee_common :
default_transaction_fee:Currency.Fee.t
-> minimum_user_command_fee:Currency.Fee.t
-> Currency.Fee.t Command.Param.t
val fee_common : Currency.Fee.t option Command.Param.t

val signed_command_common :
default_transaction_fee:Currency.Fee.t
-> minimum_user_command_fee:Currency.Fee.t
-> signed_command_common Command.Param.t
val signed_command_common : signed_command_common Command.Param.t

module Signed_command : sig
val hd_index : Mina_numbers.Hd_index.t Command.Param.t
Expand All @@ -105,10 +99,7 @@ module Signed_command : sig

val amount : Currency.Amount.t Command.Param.t

val fee :
default_transaction_fee:Currency.Fee.t
-> minimum_user_command_fee:Currency.Fee.t
-> Currency.Fee.t option Command.Param.t
val fee : Currency.Fee.t option Command.Param.t

val valid_until :
Mina_numbers.Global_slot_since_genesis.t option Command.Param.t
Expand Down
9 changes: 0 additions & 9 deletions src/lib/mina_compile_config/mina_compile_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ open Core_kernel
module Inputs = struct
type t =
{ curve_size : int
; default_transaction_fee_string : string
; default_snark_worker_fee_string : string
; minimum_user_command_fee_string : string
; itn_features : bool
Expand All @@ -35,7 +34,6 @@ end

type t =
{ curve_size : int
; default_transaction_fee : Currency.Fee.t
; default_snark_worker_fee : Currency.Fee.t
; minimum_user_command_fee : Currency.Fee.t
; itn_features : bool
Expand All @@ -59,8 +57,6 @@ type t =

let make (inputs : Inputs.t) =
{ curve_size = inputs.curve_size
; default_transaction_fee =
Currency.Fee.of_mina_string_exn inputs.default_transaction_fee_string
; default_snark_worker_fee =
Currency.Fee.of_mina_string_exn inputs.default_snark_worker_fee_string
; minimum_user_command_fee =
Expand Down Expand Up @@ -93,8 +89,6 @@ let make (inputs : Inputs.t) =
let to_yojson t =
`Assoc
[ ("curve_size", `Int t.curve_size)
; ( "default_transaction_fee"
, Currency.Fee.to_yojson t.default_transaction_fee )
; ( "default_snark_worker_fee"
, Currency.Fee.to_yojson t.default_snark_worker_fee )
; ( "minimum_user_command_fee"
Expand Down Expand Up @@ -132,7 +126,6 @@ module Compiled = struct
let t : t =
let (inputs : Inputs.t) =
{ curve_size = Node_config.curve_size
; default_transaction_fee_string = Node_config.default_transaction_fee
; default_snark_worker_fee_string = Node_config.default_snark_worker_fee
; minimum_user_command_fee_string = Node_config.minimum_user_command_fee
; itn_features = Node_config.itn_features
Expand Down Expand Up @@ -163,8 +156,6 @@ module For_unit_tests = struct
let t : t =
let inputs : Inputs.t =
{ curve_size = Node_config_for_unit_tests.curve_size
; default_transaction_fee_string =
Node_config_for_unit_tests.default_transaction_fee
; default_snark_worker_fee_string =
Node_config_for_unit_tests.default_snark_worker_fee
; minimum_user_command_fee_string =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ let (pool_max_size : int) = (3000 : int)

let (account_creation_fee_int : string) = ("0.001" : string)

let (default_transaction_fee : string) = ("5" : string)

let (default_snark_worker_fee : string) = ("1" : string)

let (minimum_user_command_fee : string) = ("2" : string)
Expand Down
2 changes: 0 additions & 2 deletions src/lib/node_config/intf/node_config_intf.mli
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ module type S = sig

val account_creation_fee_int : string

val default_transaction_fee : string

val default_snark_worker_fee : string

val minimum_user_command_fee : string
Expand Down
2 changes: 0 additions & 2 deletions src/lib/node_config/node_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ let scan_state_transaction_capacity_log_2 =

[%%inject "account_creation_fee_int", account_creation_fee_int]

[%%inject "default_transaction_fee", default_transaction_fee]

[%%inject "default_snark_worker_fee", default_snark_worker_fee]

[%%inject "minimum_user_command_fee", minimum_user_command_fee]
Expand Down