Skip to content

Commit

Permalink
reapply test configuration changes to constants value
Browse files Browse the repository at this point in the history
  • Loading branch information
martyall committed Sep 25, 2024
1 parent 3b579f3 commit 781ba91
Show file tree
Hide file tree
Showing 18 changed files with 253 additions and 235 deletions.
14 changes: 5 additions & 9 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 All @@ -71,6 +67,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 = Network.constants network in
let constraint_constants = constants.constraint_constants in
let receiver =
Core.String.Map.find_exn (Network.block_producers network) "receiver"
in
Expand Down Expand Up @@ -107,9 +105,7 @@ 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_mina_nodes = Network.all_mina_nodes network in
let%bind () =
wait_for t
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
}

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
5 changes: 3 additions & 2 deletions src/app/test_executive/peers_reliability_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let open Network in
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let constants = Network.constants network in
let constraint_constants = constants.constraint_constants in
let all_mina_nodes = Network.all_mina_nodes network in
[%log info] "peers_list"
~metadata:
Expand Down Expand Up @@ -139,8 +141,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
}
in
Malleable_error.lift
@@ Transaction_snark.For_tests.deploy_snapp
~constraint_constants:(Network.constraint_constants network)
@@ Transaction_snark.For_tests.deploy_snapp ~constraint_constants
parties_spec
in
let%bind () =
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
; 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
1 change: 1 addition & 0 deletions src/app/test_executive/test_executive.ml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ let main inputs =
}
; constraint_constants = Genesis_constants.Compiled.constraint_constants
; compile_config = Mina_compile_config.Compiled.t
; proof_level = Genesis_constants.Compiled.proof_level
}
in
let images =
Expand Down
3 changes: 2 additions & 1 deletion src/app/test_executive/verification_key_update.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let logger = Logger.create ()

let run network t =
let constants = Network.constants network in
let constraint_constants = constants.constraint_constants in
let open Malleable_error.Let_syntax in
let%bind () =
section_hard "Wait for nodes to initialize"
Expand All @@ -110,7 +112,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
in
let%bind whale1_pk = pub_key_of_node whale1 in
let%bind whale1_sk = priv_key_of_node whale1 in
let constraint_constants = Network.constraint_constants network in
let (whale1_kp : Keypair.t) =
{ public_key = whale1_pk |> Public_key.decompress_exn
; private_key = whale1_sk
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
}

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
}

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
3 changes: 2 additions & 1 deletion src/app/test_executive/zkapps_timing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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 = Network.constants network in
let constraint_constants = constants.constraint_constants in
let all_mina_nodes = Network.all_mina_nodes network in
let%bind () =
wait_for t
Expand All @@ -46,7 +48,6 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
Network.block_producers network |> Core.String.Map.data
in
let node = List.hd_exn block_producer_nodes in
let constraint_constants = Network.constraint_constants network in
let block_window_duration_ms =
constraint_constants.block_window_duration_ms
in
Expand Down
8 changes: 8 additions & 0 deletions src/lib/genesis_constants/genesis_constants.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ module Proof_level = struct
No_check
| s ->
failwithf "unrecognised proof level %s" s ()

let to_yojson t = `String (to_string t)

let of_yojson = function
| `String s ->
Ok (of_string s)
| _ ->
Error "expected string"
end

module Fork_constants = struct
Expand Down
6 changes: 0 additions & 6 deletions src/lib/integration_test_cloud_engine/kubernetes_network.ml
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,6 @@ type t =

let constants { constants; _ } = constants

let constraint_constants { constants; _ } = constants.constraint_constants

let genesis_constants { constants; _ } = constants.genesis_constants

let compile_config { constants; _ } = constants.compile_config

let seeds { seeds; _ } = seeds

let block_producers { block_producers; _ } = block_producers
Expand Down
Loading

0 comments on commit 781ba91

Please sign in to comment.