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

Fix flake in detecting reorg by nodes #15289

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions integration-tests/ccip-tests/smoke/ccip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ func TestSmokeCCIPReorgBelowFinality(t *testing.T) {

// Test creates above finality reorg at destination and
// expects ccip transactions in-flight and the one initiated after reorg
// doesn't go through and verifies every node is able to detect reorg.
// doesn't go through and verifies at least half of the nodes is able to detect reorg.
// Note: LogPollInterval interval is set as 1s to detect the reorg immediately
func TestSmokeCCIPReorgAboveFinalityAtDestination(t *testing.T) {
t.Parallel()
Expand All @@ -896,7 +896,7 @@ func TestSmokeCCIPReorgAboveFinalityAtDestination(t *testing.T) {

// Test creates above finality reorg at destination and
// expects ccip transactions in-flight doesn't go through, the transaction initiated after reorg
// shouldn't even get initiated and verifies every node is able to detect reorg.
// shouldn't even get initiated and verifies at least half of the nodes is able to detect reorg.
// Note: LogPollInterval interval is set as 1s to detect the reorg immediately
func TestSmokeCCIPReorgAboveFinalityAtSource(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -936,7 +936,8 @@ func performAboveFinalityReorgAndValidate(t *testing.T, network string) {
rs.RunReorg(rs.SrcClient, int(rs.Cfg.SrcFinalityDepth)+rs.Cfg.FinalityDelta, network, 2*time.Second)
}
clNodes := setUpOutput.Env.CLNodes
// assert every node is detecting the reorg (LogPollInterval is set as 1s for faster detection)
// assert at least half of the nodes is detecting the reorg (LogPollInterval is set as 1s for faster detection)
// expecting to detect reorg by every node is flake. So, checking with at least half of the nodes.
nodesDetectedViolation := make(map[string]bool)
assert.Eventually(t, func() bool {
for _, node := range clNodes {
Expand All @@ -952,8 +953,8 @@ func performAboveFinalityReorgAndValidate(t *testing.T, network string) {
}
}
}
return len(nodesDetectedViolation) == len(clNodes)
}, 3*time.Minute, 20*time.Second, "Reorg above finality depth is not detected by every node")
return len(nodesDetectedViolation) >= len(clNodes)/2
}, 3*time.Minute, 20*time.Second, "Reorg above finality depth is not detected by half of the nodes")
log.Debug().Interface("Nodes", nodesDetectedViolation).Msg("Violation detection details")
// send another request and verify it fails
err = lane.SendRequests(1, gasLimit)
Expand Down
Loading