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

Coherent IT config passing #16137

Draft
wants to merge 5 commits into
base: compatible
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
8 changes: 2 additions & 6 deletions src/app/test_executive/block_production_priority.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
}
; txpool_max_size = 10_000_000
; snark_worker_fee = "0.0001"
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.small
}
; work_delay = 1
; transaction_capacity_log_2 = 2
}

let fee = Currency.Fee.of_nanomina_int_exn 10_000_000
Expand Down
2 changes: 1 addition & 1 deletion src/app/test_executive/epoch_ledger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
[ { node_name = "node-a"; account_name = "node-a-key" }
; { node_name = "node-b"; account_name = "node-b-key" }
]
; proof_config = { proof_config_default with fork = Some fork_config }
; fork = Some fork_config
}

let run network t =
Expand Down
20 changes: 5 additions & 15 deletions src/app/test_executive/hard_fork.ml
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,17 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
}
; snark_worker_fee = "0.0002"
; num_archive_nodes = 1
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.small
; fork = Some fork_config
}
; work_delay = 1
; transaction_capacity_log_2 = 2
; fork = Some fork_config
}

let run network t =
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let all_mina_nodes = Network.all_mina_nodes network in
let constants = Network.constants network in
let constraint_constants = constants.constraint_constants in
let%bind () =
wait_for t
(Wait_condition.nodes_to_initialize
Expand Down Expand Up @@ -301,7 +299,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let zkapp_keypairs =
List.init 3 ~f:(fun _ -> Signature_lib.Keypair.create ())
in
let constraint_constants = Network.constraint_constants network in
let amount = Currency.Amount.of_mina_int_exn 10 in
let nonce = Account.Nonce.zero in
let memo =
Expand Down Expand Up @@ -362,7 +359,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
; sender = (fish1.keypair, Account.Nonce.(succ one))
}
in
let constraint_constants = Network.constraint_constants network in
let%bind vk_proof =
Malleable_error.lift
@@ Transaction_snark.For_tests.update_states ~constraint_constants
Expand Down Expand Up @@ -480,12 +476,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
send_payments ~logger ~sender_pub_key ~receiver_pub_key
~amount:Currency.Amount.one ~fee ~node:sender 10
in
let constants : Test_config.constants =
{ genesis_constants = Network.genesis_constants network
; constraint_constants = Network.constraint_constants network
; compile_config = Network.compile_config network
}
in
wait_for t
(Wait_condition.ledger_proofs_emitted_since_genesis
~test_config:(config ~constants) ~num_proofs:1 ) )
Expand Down
15 changes: 3 additions & 12 deletions src/app/test_executive/payments_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
}
; snark_worker_fee = "0.0002"
; num_archive_nodes = 1
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.small
}
; work_delay = 1
; transaction_capacity_log_2 = 2
Copy link
Member

Choose a reason for hiding this comment

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

nit
slight preference for modifying type and changing transaction_capacity_log_2 to a the variable.

}

let run network t =
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let constants = Network.constants network in
let all_mina_nodes = Network.all_mina_nodes network in
let%bind () =
wait_for t
Expand Down Expand Up @@ -378,12 +375,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
Malleable_error.soft_error_format ~value:()
"Payment failed for unexpected reason: %s" err_str ) )
in
let constants : Test_config.constants =
{ genesis_constants = Network.genesis_constants network
; constraint_constants = Network.constraint_constants network
; compile_config = Network.compile_config network
}
in
let config = config ~constants in
let%bind () =
section_hard
Expand Down
18 changes: 7 additions & 11 deletions src/app/test_executive/slot_end_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
; txpool_max_size = 10_000_000
; snark_worker_fee = "0.0002"
; num_archive_nodes = 0
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.small
}
; work_delay = 1
; transaction_capacity_log_2 = 2
Copy link
Member

Choose a reason for hiding this comment

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

nit
same as above

; slot_tx_end = Some slot_tx_end
; slot_chain_end = Some slot_chain_end
}
Expand All @@ -73,6 +69,9 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let run network t =
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let { Test_config.genesis_constants; constraint_constants; _ } =
Network.constants network
in
let num_slots = slot_chain_end + 2 in
let receiver =
String.Map.find_exn (Network.block_producers network) "receiver"
Expand All @@ -98,18 +97,15 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let pk = s.keypair.public_key |> Signature_lib.Public_key.compress in
return ([%log info] "sender: %s" (pk_to_string pk)) )
in
let window_ms =
(Network.constraint_constants network).block_window_duration_ms
in
let window_ms = constraint_constants.block_window_duration_ms in
let all_nodes = Network.all_mina_nodes network in
let%bind () =
wait_for t
(Wait_condition.nodes_to_initialize (String.Map.data all_nodes))
in
let genesis_timestamp =
Block_time.to_time_exn
@@ Block_time.of_int64
(Network.genesis_constants network).protocol.genesis_state_timestamp
@@ Block_time.of_int64 genesis_constants.protocol.genesis_state_timestamp
in
let end_t =
Time.add genesis_timestamp
Expand Down
17 changes: 4 additions & 13 deletions src/app/test_executive/zkapps.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
; worker_nodes = 2
}
; snark_worker_fee = "0.0001"
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.small
}
; work_delay = 1
; transaction_capacity_log_2 = 2
Copy link
Member

Choose a reason for hiding this comment

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

nit
i have a slight preference for modifying the type and using the variable.

}

let transactions_sent = ref 0
Expand Down Expand Up @@ -123,12 +119,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let run network t =
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let constants : Test_config.constants =
{ genesis_constants = Network.genesis_constants network
; constraint_constants = Network.constraint_constants network
; compile_config = Network.compile_config network
}
in
let constants = Network.constants network in
let constraint_constants = constants.constraint_constants in
let block_producer_nodes =
Network.block_producers network |> Core.String.Map.data
in
Expand All @@ -142,7 +134,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let node =
Core.String.Map.find_exn (Network.block_producers network) "node-a"
in
let constraint_constants = Network.constraint_constants network in
let fish1_kp =
(Core.String.Map.find_exn (Network.genesis_keypairs network) "fish1")
.keypair
Expand Down
15 changes: 3 additions & 12 deletions src/app/test_executive/zkapps_nonce_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
; worker_nodes = 5
}
; snark_worker_fee = "0.0001"
; proof_config =
{ proof_config_default with
work_delay = Some 1
; transaction_capacity =
Some Runtime_config.Proof_keys.Transaction_capacity.medium
}
; work_delay = 1
; transaction_capacity_log_2 = 3
Copy link
Member

Choose a reason for hiding this comment

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

ditto

}

let transactions_sent = ref 0
Expand Down Expand Up @@ -89,12 +85,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct

let run network t =
let open Malleable_error.Let_syntax in
let constants : Test_config.constants =
{ genesis_constants = Network.genesis_constants network
; constraint_constants = Network.constraint_constants network
; compile_config = Network.compile_config network
}
in
let constants = Network.constants network in
let logger = Logger.create () in
let block_producer_nodes =
Network.block_producers network |> Core.String.Map.data
Expand Down
29 changes: 29 additions & 0 deletions src/lib/genesis_ledger_helper/lib/genesis_ledger_helper_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,35 @@ module Accounts = struct
with Stop -> accounts
end

let make_compile_config ~(default : Mina_compile_config.t)
(config : Runtime_config.Daemon.t) : Mina_compile_config.t =
{ default with
zkapp_proof_update_cost =
Option.value ~default:default.zkapp_proof_update_cost
config.zkapp_proof_update_cost
; zkapp_signed_single_update_cost =
Option.value ~default:default.zkapp_signed_single_update_cost
config.zkapp_signed_single_update_cost
; zkapp_signed_pair_update_cost =
Option.value ~default:default.zkapp_signed_pair_update_cost
config.zkapp_signed_pair_update_cost
; zkapp_transaction_cost_limit =
Option.value ~default:default.zkapp_transaction_cost_limit
config.zkapp_transaction_cost_limit
; max_event_elements =
Option.value ~default:default.max_event_elements config.max_event_elements
; max_action_elements =
Option.value ~default:default.max_action_elements
config.max_action_elements
; zkapp_cmd_limit_hardcap =
Option.value ~default:default.zkapp_cmd_limit_hardcap
config.zkapp_cmd_limit_hardcap
; minimum_user_command_fee =
Option.value ~default:default.minimum_user_command_fee
config.minimum_user_command_fee
; network_id = Option.value ~default:default.network_id config.network_id
}

let make_constraint_constants
~(default : Genesis_constants.Constraint_constants.t)
(config : Runtime_config.Proof_keys.t) :
Expand Down
71 changes: 29 additions & 42 deletions src/lib/integration_test_cloud_engine/mina_automation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module Network_config = struct
; num_archive_nodes
; log_precomputed_blocks (* ; num_plain_nodes *)
; start_filtered_logs
; proof_config
; work_delay
; k
; delta
; slots_per_epoch
Expand All @@ -130,7 +130,9 @@ module Network_config = struct
; slot_tx_end
; slot_chain_end
; network_id
; _
; block_window_duration_ms
; transaction_capacity_log_2
; fork
}
: Test_config.t ) =
test_config
Expand Down Expand Up @@ -219,10 +221,6 @@ module Network_config = struct
let genesis_accounts_and_keys = List.zip_exn genesis_ledger keypairs in
let genesis_ledger_accounts = add_accounts genesis_accounts_and_keys in
(* DAEMON CONFIG *)
let constraint_constants =
Genesis_ledger_helper.make_constraint_constants
~default:constants.constraint_constants proof_config
in
let ledger_is_prefix ledger1 ledger2 =
List.is_prefix ledger2 ~prefix:ledger1
~equal:(fun
Expand All @@ -245,7 +243,10 @@ module Network_config = struct
; slot_tx_end
; slot_chain_end
; minimum_user_command_fee = None
; network_id
; network_id =
Some
(Option.value ~default:constants.compile_config.network_id
network_id )
}
; genesis =
Some
Expand All @@ -257,7 +258,22 @@ module Network_config = struct
; genesis_state_timestamp =
Some Core.Time.(to_string_abs ~zone:Zone.utc (now ()))
}
; proof = Some proof_config (* TODO: prebake ledger and only set hash *)
; proof =
Some
{ level = (None : Runtime_config.Proof_keys.Level.t option)
; sub_windows_per_window = None
; ledger_depth = Some constants.constraint_constants.ledger_depth
; work_delay = Some work_delay
; block_window_duration_ms = Some block_window_duration_ms
; transaction_capacity =
Some
(Runtime_config.Proof_keys.Transaction_capacity.Log_2
transaction_capacity_log_2 )
; coinbase_amount = None
; supercharged_coinbase_factor = None
; account_creation_fee = None
; fork
}
; ledger =
Some
{ base =
Expand Down Expand Up @@ -375,13 +391,11 @@ module Network_config = struct
({ staking; next } : Runtime_config.Epoch_data.t) )
}
in
let genesis_constants =
Or_error.ok_exn
(Genesis_ledger_helper.make_genesis_constants ~logger
~default:constants.genesis_constants runtime_config )
in
let constants : Test_config.constants =
{ constants with genesis_constants; constraint_constants }
(* This value for constants is what gets stored in the network config,
it's important to apply any configuration patching here as well for coherence
*)
let constants =
Test_config.apply_runtime_config ~logger runtime_config constants
in
(* BLOCK PRODUCER CONFIG *)
let mk_net_keypair keypair_name (pk, sk) =
Expand Down Expand Up @@ -679,33 +693,6 @@ module Network_manager = struct
| None ->
(Core.String.Map.of_alist_exn [], Core.String.Map.of_alist_exn [])
in
(*
let snark_coordinator_id =
String.lowercase
(String.sub network_config.terraform.snark_worker_public_key
~pos:
(String.length network_config.terraform.snark_worker_public_key - 6)
~len:6 )
in
let snark_coordinator_workloads =
if network_config.terraform.snark_worker_replicas > 0 then
[ Kubernetes_network.Workload_to_deploy.construct_workload
("snark-coordinator-" ^ snark_coordinator_id)
[ Kubernetes_network.Workload_to_deploy.cons_pod_info "mina" ]
]
else []
in
let snark_worker_workloads =
if network_config.terraform.snark_worker_replicas > 0 then
[ Kubernetes_network.Workload_to_deploy.construct_workload
("snark-worker-" ^ snark_coordinator_id)
(List.init network_config.terraform.snark_worker_replicas
~f:(fun _i ->
Kubernetes_network.Workload_to_deploy.cons_pod_info "worker" )
)
]
else []
in *)
let block_producer_workloads =
List.map network_config.terraform.block_producer_configs
~f:(fun bp_config ->
Expand Down
Loading