Skip to content

eth/eventhandler: deflake slashing-protection stamp assertions - #2969

Open
momosh-ssv wants to merge 1 commit into
stagefrom
fix/eventhandler-slot-race
Open

eth/eventhandler: deflake slashing-protection stamp assertions#2969
momosh-ssv wants to merge 1 commit into
stagefrom
fix/eventhandler-slot-race

Conversation

@momosh-ssv

Copy link
Copy Markdown
Contributor

TestHandleBlockEventsStream asserted the stored highest-attestation epochs and highest-proposal slot against EstimatedCurrentSlot() re-evaluated at assertion time. The stamp itself is written during event processing (BumpSlashingProtectionTxn reads the clock then), so a slot boundary crossing between stamp and assertion fails the equality spuriously — seen on CI as expected: 0x64 / actual: 0x65 in the ClusterLiquidated subtest (run); the whole test takes ~25s on CI, so with 12s slots a crossing is routine.

Fix: capture the wall-clock slot window around the event processing that writes the stamp, and assert the stored values fall inside [from, to] (with source == target − 1 preserved). Applied to both racy subtests (ClusterLiquidated, whose stamp happens back in the second ValidatorAdded subtest, and ClusterReactivated). The third reactivation subtest's Greater-than assertions span a deliberate ~900-slot genesis jump and are race-safe, so they're untouched.

Test-only; no production code changed. Part of a broader CI-flake cleanup (issue to follow).

TestHandleBlockEventsStream asserted the stored highest attestation
epochs and highest proposal slot against EstimatedCurrentSlot()
re-evaluated at assertion time. The stamp is written during event
processing (BumpSlashingProtectionTxn reads the clock then), so any
slot boundary crossing between stamp and assertion fails the equality
spuriously - seen on CI as expected 100 / actual 101 in the
ClusterLiquidated subtest (e.g. run 29833681337).

Capture the wall-clock slot window around the event processing that
writes the stamp and assert the stored values fall inside it. The
ClusterReactivated subtest had the same race; the third reactivation
subtest's Greater-than assertions span a ~900-slot jump and are left
as is.
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.1%. Comparing base (670cfb4) to head (7c1c63b).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates slashing-protection test assertions to use slot windows captured around event processing, preserving source/target epoch relationships while avoiding wall-clock boundary flakes.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The captured intervals enclose the relevant slashing-protection writes, use the same beacon clock as production stamping, and preserve the expected attestation and proposal invariants.

Important Files Changed

Filename Overview
eth/eventhandler/event_handler_test.go Captures the slot range surrounding each relevant stamp operation and validates attestation and proposal values against that range.

Reviews (1): Last reviewed commit: "eth/eventhandler: deflake slashing-prote..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant