From 0bfdc5a85bb55294f1d762164e1c00bab4c2b652 Mon Sep 17 00:00:00 2001 From: Gauthier SEBILLE Date: Thu, 14 Apr 2022 12:11:17 +0200 Subject: [PATCH 1/4] feat(broadcastNodeStatus): send node status to everyone --- lib/node/failure_detector.ml | 45 ++++++++++++++++++++++++++++------ lib/node/failure_detector.mli | 3 +++ test/failure_detector_tests.ml | 2 +- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/lib/node/failure_detector.ml b/lib/node/failure_detector.ml index fe0816d..10a7897 100644 --- a/lib/node/failure_detector.ml +++ b/lib/node/failure_detector.ml @@ -6,6 +6,9 @@ type message = | Ping | Acknowledge | PingRequest of Address.t + | Alive of Address.t + | Suspicion of Address.t + | Faulty of Address.t [@@deriving bin_io] let make config = @@ -103,6 +106,11 @@ let send_acknowledge_to node peer = send_message Acknowledge node peer let send_ping_request_to node (recipient : Peer.t) = send_message (PingRequest recipient.address) node recipient +let broadcast_message message node = + List.map + (fun p -> send_message message node p) + (Base.Hashtbl.data !node.peers) + let handle_message node message = let open Message in let peer = Peer.from message.sender in @@ -119,12 +127,30 @@ let handle_message node message = match%lwt wait_ack_timeout t new_seq_no t.config.protocol_period with | Ok _ -> Lwt.return () | Error _ -> send_acknowledge_to node peer)) - | Acknowledge -> - match Base.Hashtbl.find t.acknowledges t.sequence_number with - | Some cond -> - Lwt_condition.broadcast cond (); + | Acknowledge -> begin + match Base.Hashtbl.find t.acknowledges t.sequence_number with + | Some cond -> + Lwt_condition.broadcast cond (); + Lwt.return () + | None -> Lwt.return () + end + | Alive addr -> begin + match Base.Hashtbl.find !node.peers addr with + | Some peer -> + let _ = update_peer_status node peer Alive in + Lwt.return () + | None -> Lwt.return () + end + | Suspicion addr -> begin + match Base.Hashtbl.find !node.peers addr with + | Some peer -> + let _ = update_peer_status node peer Suspicious in + Lwt.return () + | None -> Lwt.return () + end + | Faulty addr -> + let _ = Base.Hashtbl.remove !node.peers addr in Lwt.return () - | None -> Lwt.return () (** This function will be called by failure_detection at each round of the protocol, and update the peers *) @@ -135,8 +161,7 @@ let probe_peer t node peer_to_update = | Ok _ -> (* if we received the ack, we should override peer status to Alive *) let _ = update_peer_status node peer_to_update Alive in - (* TODO: regarding SWIM protocol, a `peer_to_update is suspect` message must be sent - to every peers known by the node *) + let _ = broadcast_message (Alive peer_to_update.address) node in Lwt.return () | Error _ -> ( let pingers = @@ -151,7 +176,7 @@ let probe_peer t node peer_to_update = Lwt.return () | Error _ -> let _ = update_peer_status node peer_to_update Suspicious in - (* TODO: A `peer_to_update is suspect` message must be sent to every peers known by the node *) + let _ = broadcast_message (Suspicion peer_to_update.address) node in Lwt.return ()) let failure_detection node = @@ -192,6 +217,10 @@ let suspicious_detection node = List.iter (fun (p : Peer.t) -> Base.Hashtbl.remove !node.peers p.address) suspicious_peers in + let _ = + List.map + (fun p -> broadcast_message (Suspicion p.address) node) + suspicious_peers in (* TODO: this is where Faulty status is used We should then send a `peer_a is Faulty` message to every known_peers and each of these peers must remove it from its inner known_peers list *) diff --git a/lib/node/failure_detector.mli b/lib/node/failure_detector.mli index f324c03..1477798 100644 --- a/lib/node/failure_detector.mli +++ b/lib/node/failure_detector.mli @@ -6,6 +6,9 @@ type message = | Ping | Acknowledge | PingRequest of Address.t + | Alive of Address.t + | Suspicion of Address.t + | Faulty of Address.t [@@deriving bin_io] (** Initializes the failure detection component diff --git a/test/failure_detector_tests.ml b/test/failure_detector_tests.ml index 5e944d4..efe2842 100644 --- a/test/failure_detector_tests.ml +++ b/test/failure_detector_tests.ml @@ -22,7 +22,7 @@ let suspicion_detection () = let _ = Pollinate.Node.Client.peer_from !node_a in let _ = SUT.update_peer_status node_a peer_b Suspicious in (* Need to wait for the timeout to be reached An other way to do, would be to change the `last_suspicious_status` of the peer *) - let%lwt _ = Lwt_unix.sleep 9.1 in + let%lwt _ = Lwt_unix.sleep 9.01 in let%lwt _ = SUT.suspicious_detection node_a in Lwt.return (Base.Hashtbl.length !node_a.peers = 0) From ef6dacafa63ffce656fb857b51f5a44a95e9a96b Mon Sep 17 00:00:00 2001 From: Gauthier SEBILLE Date: Thu, 14 Apr 2022 12:14:51 +0200 Subject: [PATCH 2/4] feat(broadcastNodeStatus): respect SWIM vocabulary --- lib/node/failure_detector.ml | 9 +++------ lib/node/failure_detector.mli | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/node/failure_detector.ml b/lib/node/failure_detector.ml index 10a7897..af043d2 100644 --- a/lib/node/failure_detector.ml +++ b/lib/node/failure_detector.ml @@ -8,7 +8,7 @@ type message = | PingRequest of Address.t | Alive of Address.t | Suspicion of Address.t - | Faulty of Address.t + | Confirm of Address.t [@@deriving bin_io] let make config = @@ -148,7 +148,7 @@ let handle_message node message = Lwt.return () | None -> Lwt.return () end - | Faulty addr -> + | Confirm addr -> let _ = Base.Hashtbl.remove !node.peers addr in Lwt.return () @@ -219,9 +219,6 @@ let suspicious_detection node = suspicious_peers in let _ = List.map - (fun p -> broadcast_message (Suspicion p.address) node) + (fun p -> broadcast_message (Confirm p.address) node) suspicious_peers in - (* TODO: this is where Faulty status is used - We should then send a `peer_a is Faulty` message to every known_peers - and each of these peers must remove it from its inner known_peers list *) Lwt.return () diff --git a/lib/node/failure_detector.mli b/lib/node/failure_detector.mli index 1477798..012cfd4 100644 --- a/lib/node/failure_detector.mli +++ b/lib/node/failure_detector.mli @@ -8,7 +8,7 @@ type message = | PingRequest of Address.t | Alive of Address.t | Suspicion of Address.t - | Faulty of Address.t + | Confirm of Address.t [@@deriving bin_io] (** Initializes the failure detection component From 1b32950dc8a376c05bbc5b18bc6208ba50c18c15 Mon Sep 17 00:00:00 2001 From: Gauthier SEBILLE Date: Thu, 14 Apr 2022 16:29:37 +0200 Subject: [PATCH 3/4] feat(broadcasNodeStatus): add ping-ack unit test --- lib/node/dune | 2 +- lib/node/failure_detector.ml | 2 +- lib/node/failure_detector.mli | 4 +++- test/failure_detector_tests.ml | 16 ++++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/node/dune b/lib/node/dune index b91407a..d01a399 100644 --- a/lib/node/dune +++ b/lib/node/dune @@ -3,4 +3,4 @@ (public_name pollinate.node) (libraries bin_prot lwt lwt.unix pollinate.common) (preprocess - (pps ppx_bin_prot lwt_ppx))) + (pps ppx_bin_prot lwt_ppx ppx_deriving.show ppx_deriving.eq))) diff --git a/lib/node/failure_detector.ml b/lib/node/failure_detector.ml index af043d2..70b029c 100644 --- a/lib/node/failure_detector.ml +++ b/lib/node/failure_detector.ml @@ -9,7 +9,7 @@ type message = | Alive of Address.t | Suspicion of Address.t | Confirm of Address.t -[@@deriving bin_io] +[@@deriving bin_io, show { with_path = false }, eq] let make config = { config; acknowledges = Base.Hashtbl.Poly.create (); sequence_number = 0 } diff --git a/lib/node/failure_detector.mli b/lib/node/failure_detector.mli index 012cfd4..2651c2b 100644 --- a/lib/node/failure_detector.mli +++ b/lib/node/failure_detector.mli @@ -9,7 +9,7 @@ type message = | Alive of Address.t | Suspicion of Address.t | Confirm of Address.t -[@@deriving bin_io] +[@@deriving bin_io, show { with_path = false }, eq] (** Initializes the failure detection component with a default state and given config *) @@ -37,4 +37,6 @@ val update_peer_status : Common.Peer.status -> (unit, string) result +val send_ping_to : 'a node ref -> Peer.t -> unit Lwt.t + (**/**) diff --git a/test/failure_detector_tests.ml b/test/failure_detector_tests.ml index efe2842..a21a04f 100644 --- a/test/failure_detector_tests.ml +++ b/test/failure_detector_tests.ml @@ -33,12 +33,27 @@ let suspicion_detection_nothing_on_alive () = let%lwt _ = SUT.suspicious_detection node_a in Lwt.return (Base.Hashtbl.length !node_a.peers = 1) +let send_ping () = + let open Common.Util.Encoding in + let open Common.Peer in + let _ = add_neighbor (Pollinate.Node.Client.peer_from !node_a) peer_b in + let _ = SUT.send_ping_to node_a peer_b in + let%lwt message = Client.recv_next node_b in + let ping = unpack SUT.bin_read_message message.payload in + let%lwt response = Client.recv_next node_a in + let ack = unpack SUT.bin_read_message response.payload in + Lwt.return @@ (SUT.show_message ping, SUT.show_message ack) + let test_suspicion_detection _ () = suspicion_detection () >|= Alcotest.(check bool) "" true let test_suspicion_detection_nothing_on_alive _ () = suspicion_detection_nothing_on_alive () >|= Alcotest.(check bool) "" true +let test_send_ping _ () = + send_ping () + >|= Alcotest.(check (pair string string)) "" ("Ping", "Acknowledge") + let () = Lwt_main.run @@ Alcotest_lwt.run "Suspicion detector" @@ -49,5 +64,6 @@ let () = test_suspicion_detection; Alcotest_lwt.test_case "Do nothing on Alive peer" `Quick test_suspicion_detection_nothing_on_alive; + Alcotest_lwt.test_case "Sending Ping works" `Quick test_send_ping; ] ); ] From 61d257e8b16a8f2a0d77598dff2a6ba81c3f00df Mon Sep 17 00:00:00 2001 From: gsebil08 Date: Mon, 16 May 2022 15:38:21 +0000 Subject: [PATCH 4/4] feat(broadcastNodeStatus): delete wrong test --- esy.lock/index.json | 149 +++++++++++++----- .../opam | 48 +++--- esy.lock/opam/num.1.4/opam | 12 +- esy.lock/opam/odoc.2.1.0/opam | 60 +++++++ esy.lock/opam/{re.1.10.3 => re.1.10.4}/opam | 14 +- .../{spawn.v0.15.0 => spawn.v0.15.1}/opam | 8 +- esy.lock/opam/tyxml.4.5.0/opam | 42 +++++ .../package.json | 3 + lib/node/failure_detector.mli | 2 - test/failure_detector_tests.ml | 16 -- 10 files changed, 264 insertions(+), 90 deletions(-) rename esy.lock/opam/{easy-format.1.3.2 => easy-format.1.3.3}/opam (68%) create mode 100644 esy.lock/opam/odoc.2.1.0/opam rename esy.lock/opam/{re.1.10.3 => re.1.10.4}/opam (66%) rename esy.lock/opam/{spawn.v0.15.0 => spawn.v0.15.1}/opam (79%) create mode 100644 esy.lock/opam/tyxml.4.5.0/opam create mode 100644 esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override/package.json diff --git a/esy.lock/index.json b/esy.lock/index.json index a07cce0..8762477 100644 --- a/esy.lock/index.json +++ b/esy.lock/index.json @@ -1,5 +1,5 @@ { - "checksum": "ffe903d165082ab60be24550d1dae31b", + "checksum": "9d770610ebf28d090c00e576f71d8236", "root": "pollinate@link-dev:./package.json", "node": { "pollinate@link-dev:./package.json": { @@ -19,6 +19,7 @@ "@opam/ppx_deriving@opam:5.2.1@089e5dd3", "@opam/ppx_compare@opam:v0.14.0@fbd22977", "@opam/ppx_bin_prot@opam:v0.14.0@4a83bcd2", + "@opam/odoc@opam:2.1.0@d39daa6f", "@opam/lwt_ppx@opam:2.0.3@125707d0", "@opam/lwt@opam:5.5.0@30354e4c", "@opam/dune@opam:2.9.3@f57a6d69", "@opam/bin_prot@opam:v0.14.0@2d7601e9" @@ -64,13 +65,13 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987", + "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.3@5d74d95b", "@opam/dune@opam:2.9.3@f57a6d69", "@opam/cppo@opam:1.6.8@7e48217d", "@opam/biniou@opam:1.2.1@420bda02", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987", + "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.3@5d74d95b", "@opam/dune@opam:2.9.3@f57a6d69", "@opam/biniou@opam:1.2.1@420bda02" ] }, @@ -183,6 +184,34 @@ ], "devDependencies": [ "ocaml@4.13.1000@d41d8cd9" ] }, + "@opam/tyxml@opam:4.5.0@0a609297": { + "id": "@opam/tyxml@opam:4.5.0@0a609297", + "name": "@opam/tyxml", + "version": "opam:4.5.0", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/c6/c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068#sha256:c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068", + "archive:https://github.com/ocsigen/tyxml/releases/download/4.5.0/tyxml-4.5.0.tbz#sha256:c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068" + ], + "opam": { + "name": "tyxml", + "version": "4.5.0", + "path": "esy.lock/opam/tyxml.4.5.0" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", + "@opam/seq@opam:base@d8d7de1d", "@opam/re@opam:1.10.4@c4910ba6", + "@opam/dune@opam:2.9.3@f57a6d69", "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", + "@opam/seq@opam:base@d8d7de1d", "@opam/re@opam:1.10.4@c4910ba6", + "@opam/dune@opam:2.9.3@f57a6d69" + ] + }, "@opam/topkg@opam:1.0.5@0aa59f51": { "id": "@opam/topkg@opam:1.0.5@0aa59f51", "name": "@opam/topkg", @@ -301,20 +330,20 @@ "@opam/base@opam:v0.14.3@b3ddb868" ] }, - "@opam/spawn@opam:v0.15.0@4a27a4cb": { - "id": "@opam/spawn@opam:v0.15.0@4a27a4cb", + "@opam/spawn@opam:v0.15.1@85e9d6f1": { + "id": "@opam/spawn@opam:v0.15.1@85e9d6f1", "name": "@opam/spawn", - "version": "opam:v0.15.0", + "version": "opam:v0.15.1", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/31/310fb2a50ac7f64c738182cbabd9d27c1aeae1a08107fe14da8d35a87cbb57c7#sha256:310fb2a50ac7f64c738182cbabd9d27c1aeae1a08107fe14da8d35a87cbb57c7", - "archive:https://github.com/janestreet/spawn/archive/v0.15.0.tar.gz#sha256:310fb2a50ac7f64c738182cbabd9d27c1aeae1a08107fe14da8d35a87cbb57c7" + "archive:https://opam.ocaml.org/cache/sha256/9a/9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50#sha256:9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50", + "archive:https://github.com/janestreet/spawn/archive/v0.15.1.tar.gz#sha256:9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50" ], "opam": { "name": "spawn", - "version": "v0.15.0", - "path": "esy.lock/opam/spawn.v0.15.0" + "version": "v0.15.1", + "path": "esy.lock/opam/spawn.v0.15.1" } }, "overrides": [], @@ -370,12 +399,12 @@ "overrides": [], "dependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/sexplib0@opam:v0.14.0@155c136c", - "@opam/parsexp@opam:v0.14.2@1d15b9d2", "@opam/num@opam:1.4@15ff926d", + "@opam/parsexp@opam:v0.14.2@1d15b9d2", "@opam/num@opam:1.4@54b259a0", "@opam/dune@opam:2.9.3@f57a6d69", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/sexplib0@opam:v0.14.0@155c136c", - "@opam/parsexp@opam:v0.14.2@1d15b9d2", "@opam/num@opam:1.4@15ff926d", + "@opam/parsexp@opam:v0.14.2@1d15b9d2", "@opam/num@opam:1.4@54b259a0", "@opam/dune@opam:2.9.3@f57a6d69" ] }, @@ -448,20 +477,20 @@ "ocaml@4.13.1000@d41d8cd9", "@opam/dune@opam:2.9.3@f57a6d69" ] }, - "@opam/re@opam:1.10.3@0585c65d": { - "id": "@opam/re@opam:1.10.3@0585c65d", + "@opam/re@opam:1.10.4@c4910ba6": { + "id": "@opam/re@opam:1.10.4@c4910ba6", "name": "@opam/re", - "version": "opam:1.10.3", + "version": "opam:1.10.4", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/84/846546967f3fe31765935dd40a6460a9424337ecce7b12727fcba49480790ebb#sha256:846546967f3fe31765935dd40a6460a9424337ecce7b12727fcba49480790ebb", - "archive:https://github.com/ocaml/ocaml-re/releases/download/1.10.3/re-1.10.3.tbz#sha256:846546967f3fe31765935dd40a6460a9424337ecce7b12727fcba49480790ebb" + "archive:https://opam.ocaml.org/cache/sha256/83/83eb3e4300aa9b1dc7820749010f4362ea83524742130524d78c20ce99ca747c#sha256:83eb3e4300aa9b1dc7820749010f4362ea83524742130524d78c20ce99ca747c", + "archive:https://github.com/ocaml/ocaml-re/releases/download/1.10.4/re-1.10.4.tbz#sha256:83eb3e4300aa9b1dc7820749010f4362ea83524742130524d78c20ce99ca747c" ], "opam": { "name": "re", - "version": "1.10.3", - "path": "esy.lock/opam/re.1.10.3" + "version": "1.10.4", + "path": "esy.lock/opam/re.1.10.4" } }, "overrides": [], @@ -1279,6 +1308,43 @@ "@opam/dune@opam:2.9.3@f57a6d69", "@opam/astring@opam:0.8.5@1300cee8" ] }, + "@opam/odoc@opam:2.1.0@d39daa6f": { + "id": "@opam/odoc@opam:2.1.0@d39daa6f", + "name": "@opam/odoc", + "version": "opam:2.1.0", + "source": { + "type": "install", + "source": [ + "archive:https://opam.ocaml.org/cache/sha256/65/65a2523a50ee368164f1f24f75866a6a36cdb0d00039c3006ec824351d4e4967#sha256:65a2523a50ee368164f1f24f75866a6a36cdb0d00039c3006ec824351d4e4967", + "archive:https://github.com/ocaml/odoc/releases/download/2.1.0/odoc-2.1.0.tbz#sha256:65a2523a50ee368164f1f24f75866a6a36cdb0d00039c3006ec824351d4e4967" + ], + "opam": { + "name": "odoc", + "version": "2.1.0", + "path": "esy.lock/opam/odoc.2.1.0" + } + }, + "overrides": [], + "dependencies": [ + "ocaml@4.13.1000@d41d8cd9", "@opam/tyxml@opam:4.5.0@0a609297", + "@opam/result@opam:1.5@1c6a6533", + "@opam/odoc-parser@opam:1.0.0@b1029bdf", + "@opam/fpath@opam:0.7.3@674d8125", "@opam/fmt@opam:0.9.0@87213963", + "@opam/dune@opam:2.9.3@f57a6d69", "@opam/cppo@opam:1.6.8@7e48217d", + "@opam/cmdliner@opam:1.1.1@03763729", + "@opam/astring@opam:0.8.5@1300cee8", + "@esy-ocaml/substs@0.0.1@d41d8cd9" + ], + "devDependencies": [ + "ocaml@4.13.1000@d41d8cd9", "@opam/tyxml@opam:4.5.0@0a609297", + "@opam/result@opam:1.5@1c6a6533", + "@opam/odoc-parser@opam:1.0.0@b1029bdf", + "@opam/fpath@opam:0.7.3@674d8125", "@opam/fmt@opam:0.9.0@87213963", + "@opam/dune@opam:2.9.3@f57a6d69", + "@opam/cmdliner@opam:1.1.1@03763729", + "@opam/astring@opam:0.8.5@1300cee8" + ] + }, "@opam/octavius@opam:1.2.2@2205cc65": { "id": "@opam/octavius@opam:1.2.2@2205cc65", "name": "@opam/octavius", @@ -1410,7 +1476,7 @@ "dependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", "@opam/uuseg@opam:14.0.0@7d21466b", - "@opam/stdio@opam:v0.14.0@a5affb43", "@opam/re@opam:1.10.3@0585c65d", + "@opam/stdio@opam:v0.14.0@a5affb43", "@opam/re@opam:1.10.4@c4910ba6", "@opam/odoc-parser@opam:1.0.0@b1029bdf", "@opam/ocp-indent@opam:1.8.1@e32a3c50", "@opam/ocaml-version@opam:3.4.0@b6cd49e1", @@ -1429,7 +1495,7 @@ "devDependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", "@opam/uuseg@opam:14.0.0@7d21466b", - "@opam/stdio@opam:v0.14.0@a5affb43", "@opam/re@opam:1.10.3@0585c65d", + "@opam/stdio@opam:v0.14.0@a5affb43", "@opam/re@opam:1.10.4@c4910ba6", "@opam/odoc-parser@opam:1.0.0@b1029bdf", "@opam/ocp-indent@opam:1.8.1@e32a3c50", "@opam/ocaml-version@opam:3.4.0@b6cd49e1", @@ -1597,8 +1663,8 @@ "overrides": [], "dependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312", - "@opam/spawn@opam:v0.15.0@4a27a4cb", - "@opam/result@opam:1.5@1c6a6533", "@opam/re@opam:1.10.3@0585c65d", + "@opam/spawn@opam:v0.15.1@85e9d6f1", + "@opam/result@opam:1.5@1c6a6533", "@opam/re@opam:1.10.4@c4910ba6", "@opam/ppx_yojson_conv_lib@opam:v0.15.0@773058a7", "@opam/pp@opam:1.1.2@89ad03b5", "@opam/ocamlformat-rpc-lib@opam:0.19.0@125cf11d", @@ -1608,8 +1674,8 @@ ], "devDependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/yojson@opam:1.7.0@69d87312", - "@opam/spawn@opam:v0.15.0@4a27a4cb", - "@opam/result@opam:1.5@1c6a6533", "@opam/re@opam:1.10.3@0585c65d", + "@opam/spawn@opam:v0.15.1@85e9d6f1", + "@opam/result@opam:1.5@1c6a6533", "@opam/re@opam:1.10.4@c4910ba6", "@opam/ppx_yojson_conv_lib@opam:v0.15.0@773058a7", "@opam/pp@opam:1.1.2@89ad03b5", "@opam/ocamlformat-rpc-lib@opam:0.19.0@125cf11d", @@ -1642,8 +1708,8 @@ "ocaml@4.13.1000@d41d8cd9", "@opam/dune@opam:2.9.3@f57a6d69" ] }, - "@opam/num@opam:1.4@15ff926d": { - "id": "@opam/num@opam:1.4@15ff926d", + "@opam/num@opam:1.4@54b259a0": { + "id": "@opam/num@opam:1.4@54b259a0", "name": "@opam/num", "version": "opam:1.4", "source": { @@ -2054,23 +2120,28 @@ ], "devDependencies": [ "@opam/dune@opam:2.9.3@f57a6d69" ] }, - "@opam/easy-format@opam:1.3.2@1ea9f987": { - "id": "@opam/easy-format@opam:1.3.2@1ea9f987", + "@opam/easy-format@opam:1.3.3@5d74d95b": { + "id": "@opam/easy-format@opam:1.3.3@5d74d95b", "name": "@opam/easy-format", - "version": "opam:1.3.2", + "version": "opam:1.3.3", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/sha256/34/3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926", - "archive:https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz#sha256:3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926" + "archive:https://opam.ocaml.org/cache/sha256/ea/eafccae911c26ca23e4ddacee3eaa54654d20f973b8680f84b708cef43adc416#sha256:eafccae911c26ca23e4ddacee3eaa54654d20f973b8680f84b708cef43adc416", + "archive:https://github.com/mjambon/easy-format/releases/download/1.3.3/easy-format-1.3.3.tbz#sha256:eafccae911c26ca23e4ddacee3eaa54654d20f973b8680f84b708cef43adc416" ], "opam": { "name": "easy-format", - "version": "1.3.2", - "path": "esy.lock/opam/easy-format.1.3.2" + "version": "1.3.3", + "path": "esy.lock/opam/easy-format.1.3.3" } }, - "overrides": [], + "overrides": [ + { + "opamoverride": + "esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override" + } + ], "dependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/dune@opam:2.9.3@f57a6d69", "@esy-ocaml/substs@0.0.1@d41d8cd9" @@ -2283,11 +2354,11 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987", + "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.3@5d74d95b", "@opam/dune@opam:2.9.3@f57a6d69", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.2@1ea9f987", + "ocaml@4.13.1000@d41d8cd9", "@opam/easy-format@opam:1.3.3@5d74d95b", "@opam/dune@opam:2.9.3@f57a6d69" ] }, @@ -2515,7 +2586,7 @@ "dependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", "@opam/stdlib-shims@opam:0.3.0@72c7bc98", - "@opam/re@opam:1.10.3@0585c65d", + "@opam/re@opam:1.10.4@c4910ba6", "@opam/ocaml-syntax-shims@opam:1.0.0@9f361fbb", "@opam/fmt@opam:0.9.0@87213963", "@opam/dune@opam:2.9.3@f57a6d69", "@opam/cmdliner@opam:1.1.1@03763729", @@ -2525,7 +2596,7 @@ "devDependencies": [ "ocaml@4.13.1000@d41d8cd9", "@opam/uutf@opam:1.0.3@47c95a18", "@opam/stdlib-shims@opam:0.3.0@72c7bc98", - "@opam/re@opam:1.10.3@0585c65d", + "@opam/re@opam:1.10.4@c4910ba6", "@opam/ocaml-syntax-shims@opam:1.0.0@9f361fbb", "@opam/fmt@opam:0.9.0@87213963", "@opam/dune@opam:2.9.3@f57a6d69", "@opam/cmdliner@opam:1.1.1@03763729", diff --git a/esy.lock/opam/easy-format.1.3.2/opam b/esy.lock/opam/easy-format.1.3.3/opam similarity index 68% rename from esy.lock/opam/easy-format.1.3.2/opam rename to esy.lock/opam/easy-format.1.3.3/opam index f55c2c8..5926060 100644 --- a/esy.lock/opam/easy-format.1.3.2/opam +++ b/esy.lock/opam/easy-format.1.3.3/opam @@ -1,17 +1,4 @@ opam-version: "2.0" -build: [ - ["dune" "subst"] {dev} - ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name "-j" jobs] {with-test} - ["dune" "build" "-p" name "@doc"] {with-doc} -] -maintainer: ["martin@mjambon.com" "rudi.grinberg@gmail.com"] -authors: ["Martin Jambon"] -bug-reports: "https://github.com/mjambon/easy-format/issues" -homepage: "https://github.com/mjambon/easy-format" -doc: "https://mjambon.github.io/easy-format/" -license: "BSD-3-Clause" -dev-repo: "git+https://github.com/mjambon/easy-format.git" synopsis: "High-level and functional interface to the Format module of the OCaml standard library" description: """ @@ -32,15 +19,40 @@ nodes: Atoms represent any text that is guaranteed to be printed as-is. Lists can model any sequence of items such as arrays of data or lists of definitions that are labelled with something like "int main", "let x =" or "x:".""" +maintainer: ["martin@mjambon.com" "rudi.grinberg@gmail.com"] +authors: ["Martin Jambon"] +license: "BSD-3-Clause" +homepage: "https://github.com/mjambon/easy-format" +doc: "https://mjambon.github.io/easy-format/" +bug-reports: "https://github.com/mjambon/easy-format/issues" depends: [ - "dune" {>= "1.10"} - "ocaml" {>= "4.02.3"} + "dune" {>= "2.9"} + "ocaml" {>= "4.08"} + "odoc" {with-doc} ] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "--promote-install-files=false" + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ["dune" "install" "-p" name "--create-install-files" name] +] +dev-repo: "git+https://github.com/mjambon/easy-format.git" url { src: - "https://github.com/mjambon/easy-format/releases/download/1.3.2/easy-format-1.3.2.tbz" + "https://github.com/mjambon/easy-format/releases/download/1.3.3/easy-format-1.3.3.tbz" checksum: [ - "sha256=3440c2b882d537ae5e9011eb06abb53f5667e651ea4bb3b460ea8230fa8c1926" - "sha512=e39377a2ff020ceb9ac29e8515a89d9bdbc91dfcfa871c4e3baafa56753fac2896768e5d9822a050dc1e2ade43c8967afb69391a386c0a8ecd4e1f774e236135" + "sha256=eafccae911c26ca23e4ddacee3eaa54654d20f973b8680f84b708cef43adc416" + "sha512=611b3124f6a0ec6406b7bda8018a94c9c4a9da9d22495a5c34a6312bf7f0f0607a9529b276f7039ce3f3b15a955dac413d6d1229a55d5ac291302a3ddd5807e5" ] } +x-commit-hash: "56c57e69ef067d1cc4e31029d31e77e55b46be95" diff --git a/esy.lock/opam/num.1.4/opam b/esy.lock/opam/num.1.4/opam index 0e39879..253f84e 100644 --- a/esy.lock/opam/num.1.4/opam +++ b/esy.lock/opam/num.1.4/opam @@ -13,9 +13,13 @@ depends: [ conflicts: ["base-num"] build: make install: [ - make - "install" {!ocaml:preinstalled} - "findlib-install" {ocaml:preinstalled} + ["ocamlfind" "remove" "num"] + ["ocamlfind" "remove" "num-top"] + [ + make + "install" {!ocaml:preinstalled} + "findlib-install" {ocaml:preinstalled} + ] ] dev-repo: "git+https://github.com/ocaml/num.git" url { @@ -24,4 +28,4 @@ url { "md5=cda2b727e116a0b6a9c03902cc4b2415" "sha512=0cc9be8ad95704bb683b4bf6698bada1ee9a40dc05924b72adc7b969685c33eeb68ccf174cc09f6a228c48c18fe94af06f28bebc086a24973a066da620db8e6f" ] -} \ No newline at end of file +} diff --git a/esy.lock/opam/odoc.2.1.0/opam b/esy.lock/opam/odoc.2.1.0/opam new file mode 100644 index 0000000..6b1df40 --- /dev/null +++ b/esy.lock/opam/odoc.2.1.0/opam @@ -0,0 +1,60 @@ +opam-version: "2.0" +homepage: "http://github.com/ocaml/odoc" +doc: "https://ocaml.github.io/odoc/" +bug-reports: "https://github.com/ocaml/odoc/issues" +license: "ISC" + +authors: [ + "Thomas Refis " + "David Sheets " + "Leo White " + "Anton Bachin " + "Jon Ludlam " + "Jules Aguillon " + "Lubega Simon " +] +maintainer: "Jon Ludlam " +dev-repo: "git+https://github.com/ocaml/odoc.git" + +synopsis: "OCaml documentation generator" +description: """ +Odoc is a documentation generator for OCaml. It reads doc comments, +delimited with `(** ... *)`, and outputs HTML. +""" + +depends: [ + "odoc-parser" {>= "0.9.0"} + "astring" + "cmdliner" {>= "1.0.0"} + "cppo" {build & >= "1.1.0"} + "dune" {>= "2.9.1"} + "fpath" + "ocaml" {>= "4.02.0"} + "result" + "tyxml" {>= "4.3.0"} + "fmt" + + "ocamlfind" {with-test} + "yojson" {with-test} + ("ocaml" {< "4.04.1" & with-test} | "sexplib0" {with-test}) + "conf-jq" {with-test} + + "ppx_expect" {with-test} + "bos" {with-test} + + "bisect_ppx" {dev & > "2.5.0"} + ("ocaml" {< "4.03.0" & dev} | "mdx" {dev}) +] + +build: [ + ["dune" "subst"] {dev} + ["dune" "build" "-p" name "-j" jobs] +] +url { + src: "https://github.com/ocaml/odoc/releases/download/2.1.0/odoc-2.1.0.tbz" + checksum: [ + "sha256=65a2523a50ee368164f1f24f75866a6a36cdb0d00039c3006ec824351d4e4967" + "sha512=cf4d7e884b94a9b9c4bcb62d4423d7289d7bbbf2642c5eacf9577b76eb835cf6ecc79d2384d36d174d2e9d8f758b5082c0c4bf8f66b5c6db4e9805dc3fc9ee1a" + ] +} +x-commit-hash: "d654ee2a4ff3e1465dcf92b882c26de71f7a9986" diff --git a/esy.lock/opam/re.1.10.3/opam b/esy.lock/opam/re.1.10.4/opam similarity index 66% rename from esy.lock/opam/re.1.10.3/opam rename to esy.lock/opam/re.1.10.4/opam index c65d450..9dad661 100644 --- a/esy.lock/opam/re.1.10.3/opam +++ b/esy.lock/opam/re.1.10.4/opam @@ -8,19 +8,19 @@ authors: [ "Rudi Grinberg" "Gabriel Radanne" ] -license: "LGPL-2.0 with OCaml linking exception" +license: "LGPL-2.0-or-later WITH OCaml-LGPL-linking-exception" homepage: "https://github.com/ocaml/ocaml-re" bug-reports: "https://github.com/ocaml/ocaml-re/issues" dev-repo: "git+https://github.com/ocaml/ocaml-re.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} ] depends: [ - "ocaml" {>= "4.02"} + "ocaml" {>= "4.03"} "dune" {>= "2.0"} "ounit" {with-test} "seq" @@ -37,10 +37,10 @@ Pure OCaml regular expressions with: """ url { src: - "https://github.com/ocaml/ocaml-re/releases/download/1.10.3/re-1.10.3.tbz" + "https://github.com/ocaml/ocaml-re/releases/download/1.10.4/re-1.10.4.tbz" checksum: [ - "sha256=846546967f3fe31765935dd40a6460a9424337ecce7b12727fcba49480790ebb" - "sha512=d02103b7b8b8d8bc797341dcc933554745427f3c1b51b54b4ac9ff81badfd68c94726c57548b08e00ca99f3e09741b54b6500e97c19fc0e8fcefd6dfbe71da7f" + "sha256=83eb3e4300aa9b1dc7820749010f4362ea83524742130524d78c20ce99ca747c" + "sha512=92b05cf92c389fa8c753f2acca837b15dd05a4a2e8e2bec7a269d2e14c35b1a786d394258376648f80b4b99250ba1900cfe68230b8385aeac153149d9ce56099" ] } -x-commit-hash: "c5d5df80e128c3d7646b7d8b1322012c5fcc35f3" +x-commit-hash: "e9a4cecb8294c1839db18b1d0c30e755ec85ed5e" diff --git a/esy.lock/opam/spawn.v0.15.0/opam b/esy.lock/opam/spawn.v0.15.1/opam similarity index 79% rename from esy.lock/opam/spawn.v0.15.0/opam rename to esy.lock/opam/spawn.v0.15.1/opam index d8d1578..5be3a99 100644 --- a/esy.lock/opam/spawn.v0.15.0/opam +++ b/esy.lock/opam/spawn.v0.15.1/opam @@ -45,12 +45,12 @@ build: [ ] ] dev-repo: "git+https://github.com/janestreet/spawn.git" -x-commit-hash: "b5a25cab2f53a5ee9e10a7b8a96506cc61ce1198" +x-commit-hash: "13d279ebfa8c40d4bafe18cddfdff0de54b4eaff" url { src: - "https://github.com/janestreet/spawn/archive/v0.15.0.tar.gz" + "https://github.com/janestreet/spawn/archive/v0.15.1.tar.gz" checksum: [ - "sha256=310fb2a50ac7f64c738182cbabd9d27c1aeae1a08107fe14da8d35a87cbb57c7" - "sha512=3a775b57a73efee6adbc30b32fa779f27d11c7008a46f90fdb9da6288533e2d83fc49dbcd770c087f2e4560c5586ff72a9a2985d8929955773cc10d83f126013" + "sha256=9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50" + "sha512=efdb31d5ec5ea36d0bc80224d4ee04e46ce3428d1662870e6cebece92bc313d6eebee378802c0c059dd6e0cafea515308c31b7dfaf04a098eb4566583c1e9ed4" ] } diff --git a/esy.lock/opam/tyxml.4.5.0/opam b/esy.lock/opam/tyxml.4.5.0/opam new file mode 100644 index 0000000..22c7760 --- /dev/null +++ b/esy.lock/opam/tyxml.4.5.0/opam @@ -0,0 +1,42 @@ +opam-version: "2.0" +synopsis: "A library for building correct HTML and SVG documents" +description: + "TyXML provides a set of convenient combinators that uses the OCaml type system to ensure the validity of the generated documents. TyXML can be used with any representation of HTML and SVG: the textual one, provided directly by this package, or DOM trees (`js_of_ocaml-tyxml`) virtual DOM (`virtual-dom`) and reactive or replicated trees (`eliom`). You can also create your own representation and use it to instantiate a new set of combinators." +maintainer: ["dev@ocsigen.org"] +authors: ["The ocsigen team"] +license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" +homepage: "https://github.com/ocsigen/tyxml" +doc: "https://ocsigen.org/tyxml/latest/manual/intro" +bug-reports: "https://github.com/ocsigen/tyxml/issues" +depends: [ + "dune" {>= "2.0"} + "ocaml" {>= "4.02"} + "alcotest" {with-test} + "re" {>= "1.5.0"} + "seq" + "uutf" {>= "1.0.0"} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/ocsigen/tyxml.git" +x-commit-hash: "ef431a4bceaefb2d9248e79092e6c1a1a9420095" +url { + src: + "https://github.com/ocsigen/tyxml/releases/download/4.5.0/tyxml-4.5.0.tbz" + checksum: [ + "sha256=c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068" + "sha512=772535441b09c393d53c27152e65f404a0a541aa0cea1bda899a8d751ab64d1729237e583618c3ff33d75e3865d53503d1ea413c6bbc8c68c413347efd1709b3" + ] +} diff --git a/esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override/package.json b/esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override/package.json new file mode 100644 index 0000000..f9bd9e0 --- /dev/null +++ b/esy.lock/overrides/opam__s__easy_format_opam__c__1.3.3_opam_override/package.json @@ -0,0 +1,3 @@ +{ + "build": "dune build -p easy-format" +} diff --git a/lib/node/failure_detector.mli b/lib/node/failure_detector.mli index c2b3f41..05c7202 100644 --- a/lib/node/failure_detector.mli +++ b/lib/node/failure_detector.mli @@ -53,6 +53,4 @@ val update_peer_status : Common.Peer.status -> (unit, string) result -val send_ping_to : 'a node ref -> Peer.t -> unit Lwt.t - (**/**) diff --git a/test/failure_detector_tests.ml b/test/failure_detector_tests.ml index 168822d..6ec8a4e 100644 --- a/test/failure_detector_tests.ml +++ b/test/failure_detector_tests.ml @@ -33,27 +33,12 @@ let failure_detection_nothing_on_alive () = let%lwt _ = SUT.failure_detection node_a in Lwt.return (Base.Hashtbl.length !node_a.peers = 1) -let send_ping () = - let open Common.Util.Encoding in - let open Common.Peer in - let _ = add_neighbor (Pollinate.Node.Client.peer_from !node_a) peer_b in - let _ = SUT.send_ping_to node_a peer_b in - let%lwt message = Client.recv_next node_b in - let ping = unpack SUT.bin_read_message message.payload in - let%lwt response = Client.recv_next node_a in - let ack = unpack SUT.bin_read_message response.payload in - Lwt.return @@ (SUT.show_message ping, SUT.show_message ack) - let test_suspicion_detection _ () = failure_detection () >|= Alcotest.(check bool) "" true let test_failure_detection_nothing_on_alive _ () = failure_detection_nothing_on_alive () >|= Alcotest.(check bool) "" true -let test_send_ping _ () = - send_ping () - >|= Alcotest.(check (pair string string)) "" ("Ping", "Acknowledge") - let () = Lwt_main.run @@ Alcotest_lwt.run "Failure detector" @@ -64,6 +49,5 @@ let () = test_suspicion_detection; Alcotest_lwt.test_case "Do nothing on Alive peer" `Quick test_failure_detection_nothing_on_alive; - Alcotest_lwt.test_case "Sending Ping works" `Quick test_send_ping; ] ); ]