Skip to content

Commit

Permalink
remove snark workers from initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteStochastic committed Feb 28, 2022
1 parent acc5483 commit 90216e2
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 53 deletions.
5 changes: 1 addition & 4 deletions src/app/test_executive/archive_node_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let all_nodes = Network.all_nodes network in
(* waiting for archive_node does not seem to work *)
[%log info] "archive node test: waiting for block producers to initialize" ;
let%bind () =
Malleable_error.List.iter all_nodes ~f:(fun bp ->
wait_for t (Wait_condition.node_to_initialize bp))
in
let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in
[%log info] "archive node test: waiting for archive node to initialize" ;
let%bind () = wait_for t (Wait_condition.node_to_initialize archive_node) in
[%log info] "archive node test: running network for %0.1f minutes"
Expand Down
7 changes: 1 addition & 6 deletions src/app/test_executive/chain_reliability_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,10 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let all_nodes = Network.all_nodes network in

let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in
let[@warning "-8"] [ node_a; node_b; node_c ] =
Network.block_producers network
in
(* TODO: let%bind () = wait_for t (Wait_condition.nodes_to_initialize [node_a; node_b; node_c]) in *)
let%bind () =
Malleable_error.List.iter all_nodes
~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize)
in
let%bind _ =
section "blocks are produced"
(wait_for t (Wait_condition.blocks_to_be_produced 2))
Expand Down
28 changes: 16 additions & 12 deletions src/app/test_executive/gossip_consistency.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
})
}

let wait_for_all_to_initialize ~logger network t =
let open Malleable_error.Let_syntax in
let all_nodes = Network.all_nodes network in
let n = List.length all_nodes in
List.mapi all_nodes ~f:(fun i node ->
let%map () = wait_for t (Wait_condition.node_to_initialize node) in
[%log info]
"gossip_consistency test: Block producer %d (of %d) initialized"
(i + 1) n ;
())
|> Malleable_error.all_unit
(* let wait_for_all_to_initialize ~logger network t =
let open Malleable_error.Let_syntax in
let all_nodes = Network.all_nodes network in
let n = List.length all_nodes in
List.mapi all_nodes ~f:(fun i node ->
let%map () = wait_for t (Wait_condition.node_to_initialize node) in
[%log info]
"gossip_consistency test: Block producer %d (of %d) initialized"
(i + 1) n ;
())
|> Malleable_error.all_unit *)

let send_payments ~logger ~sender_pub_key ~receiver_pub_key ~amount ~fee ~node
n =
Expand Down Expand Up @@ -84,7 +84,11 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
[%log info] "gossip_consistency test: starting..." ;
let%bind () = wait_for_all_to_initialize ~logger network t in
(* let%bind () = wait_for_all_to_initialize ~logger network t in *)
let%bind () =
wait_for t
(Wait_condition.nodes_to_initialize (Network.all_nodes network))
in
[%log info] "gossip_consistency test: done waiting for initializations" ;
let receiver_bp = Caml.List.nth (Network.block_producers network) 0 in
let%bind receiver_pub_key = Util.pub_key_of_node receiver_bp in
Expand Down
5 changes: 1 addition & 4 deletions src/app/test_executive/payments_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
(* fee for user commands *)
let fee = Currency.Fee.of_int 10_000_000 in
let all_nodes = Network.all_nodes network in
let%bind () =
Malleable_error.List.iter all_nodes
~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize)
in
let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in
let[@warning "-8"] [ untimed_node_a; untimed_node_b; timed_node_a ] =
Network.block_producers network
in
Expand Down
10 changes: 3 additions & 7 deletions src/app/test_executive/peers_reliability_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
let open Malleable_error.Let_syntax in
let logger = Logger.create () in
let all_nodes = Network.all_nodes network in
let[@warning "-8"] [ node_a; node_b; node_c ] =
Network.block_producers network
in
[%log info] "peers_list"
~metadata:
[ ("peers", `List (List.map all_nodes ~f:(fun n -> `String (Node.id n))))
] ;
(* TODO: let%bind () = wait_for t (Wait_condition.nodes_to_initialize [node_a; node_b; node_c]) in *)
let%bind () =
Malleable_error.List.iter all_nodes
~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize)
let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in
let[@warning "-8"] [ node_a; node_b; node_c ] =
Network.block_producers network
in
let%bind initial_connectivity_data =
Util.fetch_connectivity_data ~logger all_nodes
Expand Down
29 changes: 15 additions & 14 deletions src/lib/integration_test_cloud_engine/kubernetes_network.ml
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,12 @@ let snark_workers { snark_workers; _ } = snark_workers

let archive_nodes { archive_nodes; _ } = archive_nodes

(* TODO: snark workers (until then, pretty sure snark work won't be done) *)
let all_nodes
(* all_nodes returns all *actual* mina nodes; note that a snark_worker is a pod within the network but not technically a mina node, therefore not included here. snark coordinators on the other hand ARE mina nodes *)
let all_nodes { seeds; block_producers; snark_coordinators; archive_nodes; _ } =
List.concat [ seeds; block_producers; snark_coordinators; archive_nodes ]

(* all_pods returns everything in the network. remember that snark_workers will never initialize and will never sync, and aren't supposed to *)
let all_pods
{ seeds
; block_producers
; snark_coordinators
Expand All @@ -516,6 +520,12 @@ let all_nodes
List.concat
[ seeds; block_producers; snark_coordinators; snark_workers; archive_nodes ]

(* all_non_seed_pods returns everything in the network except seed nodes *)
let all_non_seed_pods
{ block_producers; snark_coordinators; snark_workers; archive_nodes; _ } =
List.concat
[ block_producers; snark_coordinators; snark_workers; archive_nodes ]

let keypairs { keypairs; _ } = keypairs

let lookup_node_by_pod_id t = Map.find t.nodes_by_pod_id
Expand Down Expand Up @@ -611,28 +621,19 @@ let initialize ~logger network =
res
| Ok _ ->
[%log info] "Starting the daemons within the pods" ;
let seed_nodes = seeds network in
let start_print (node : Node.t) =
let open Malleable_error.Let_syntax in
[%log info] "starting %s ..." node.pod_id ;
let%bind res = Node.start ~fresh_state:false node in
[%log info] "%s started" node.pod_id ;
Malleable_error.return res
in
let seed_pod_ids =
seed_nodes
|> List.map ~f:(fun { Node.pod_id; _ } -> pod_id)
|> String.Set.of_list
in
let non_seed_nodes =
network |> all_nodes
|> List.filter ~f:(fun { Node.pod_id; _ } ->
not (String.Set.mem seed_pod_ids pod_id))
in
let seed_nodes = network |> seeds in
let non_seed_pods = network |> all_non_seed_pods in
(* TODO: parallelize (requires accumlative hard errors) *)
let%bind () = Malleable_error.List.iter seed_nodes ~f:start_print in
(* put a short delay before starting other nodes, to help avoid artifact generation races *)
let%bind () =
after (Time.Span.of_sec 30.0) |> Deferred.bind ~f:Malleable_error.return
in
Malleable_error.List.iter non_seed_nodes ~f:start_print
Malleable_error.List.iter non_seed_pods ~f:start_print
2 changes: 2 additions & 0 deletions src/lib/integration_test_lib/intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ module Dsl = struct

val node_to_initialize : Engine.Network.Node.t -> t

val nodes_to_initialize : Engine.Network.Node.t list -> t

val blocks_to_be_produced : int -> t

val nodes_to_synchronize : Engine.Network.Node.t list -> t
Expand Down
6 changes: 0 additions & 6 deletions src/lib/integration_test_lib/wait_condition.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ struct
; hard_timeout = Option.value hard_timeout ~default:t.hard_timeout
}

(* TODO: does this actually work if it's run twice? I think not *)
(*
* options:
* - assume nodes have not yet initialized by the time we get here
* - associate additional state to see when initialization was last checked
*)
let nodes_to_initialize nodes =
let open Network_state in
let check () (state : Network_state.t) =
Expand Down

0 comments on commit 90216e2

Please sign in to comment.