From 83457e7cc3c2879dc6b469ad6b16e473a4071aa5 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 6 Aug 2026 15:38:44 +0100 Subject: [PATCH 1/2] test: Make Drop50 message drop deterministic in LedgerReplayer test The 'network drops 50% messages' testcase dropped each request with an independent random 50% probability. A subtask permanently fails after 1 + kSubTaskMaxTimeouts (11) consecutive dropped sends, so each run had a ~1/512 chance of failure, causing intermittent CI failures at LedgerReplay_test.cpp(1340) and (1342). Drop every other message via a counter instead. This still exercises the timeout/retry path but guarantees every subtask eventually gets a reply. --- src/test/app/LedgerReplay_test.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index 7b521402a40..ab4dbe72849 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -53,6 +52,7 @@ #include #include +#include #include #include #include @@ -443,17 +443,16 @@ struct TestPeerSet : public PeerSet protocol::MessageType type, std::shared_ptr const& peer) override { - int dropRate = 0; - if (behavior == PeerSetBehavior::Drop50) - { - dropRate = 50; - } - else if (behavior == PeerSetBehavior::DropAll) - { - dropRate = 100; - } + if (behavior == PeerSetBehavior::DropAll) + return; - if (randInt(1, 100) <= dropRate) + // Drop every other message deterministically. A random 50% drop + // could drop all (1 + kSubTaskMaxTimeouts) sends of a subtask + // (probability (1/2)^11 per subtask), failing the whole task and + // making the test flaky. Alternating drops still exercise the + // timeout/retry path while guaranteeing every subtask eventually + // gets a reply. + if (behavior == PeerSetBehavior::Drop50 && sendCount++ % 2 == 0) return; switch (type) @@ -498,6 +497,7 @@ struct TestPeerSet : public PeerSet LedgerReplayMsgHandler& remote; std::shared_ptr dummyPeer; PeerSetBehavior behavior; + std::atomic sendCount{0}; }; /** From 54547c76fdcacf1d4a9954736c8b385dd2c97840 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Fri, 7 Aug 2026 11:25:48 +0100 Subject: [PATCH 2/2] minor comment update Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- src/test/app/LedgerReplay_test.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test/app/LedgerReplay_test.cpp b/src/test/app/LedgerReplay_test.cpp index ab4dbe72849..adc8c7b3241 100644 --- a/src/test/app/LedgerReplay_test.cpp +++ b/src/test/app/LedgerReplay_test.cpp @@ -446,12 +446,9 @@ struct TestPeerSet : public PeerSet if (behavior == PeerSetBehavior::DropAll) return; - // Drop every other message deterministically. A random 50% drop - // could drop all (1 + kSubTaskMaxTimeouts) sends of a subtask - // (probability (1/2)^11 per subtask), failing the whole task and - // making the test flaky. Alternating drops still exercise the - // timeout/retry path while guaranteeing every subtask eventually - // gets a reply. + // Drop every other message deterministically. Alternating drops + // still exercise the timeout/retry path while guaranteeing every + // subtask eventually gets a reply. if (behavior == PeerSetBehavior::Drop50 && sendCount++ % 2 == 0) return;