Repository navigation
fix(message_validator): align slot-anchored QBFT round spread with Go - #1371
Conversation
Estimate slot-anchored rounds from the duty slot and role so peers running Anchor and go-ssv make the same round-spread decision.
|
This pull request is merged. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1371 +/- ##
============================================
+ Coverage 80.57% 80.66% +0.08%
============================================
Files 180 180
Lines 42507 42619 +112
============================================
+ Hits 34252 34378 +126
+ Misses 8255 8241 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
shane-moore
left a comment
There was a problem hiding this comment.
Fable 5.2 review of 34d68059 against unstable at 5c883823. No merge blockers and no findings. I would approve the code at this head.
What I checked
| Boundary | Result |
|---|---|
| Window: 2 back, 1 ahead, clamped to round 1 | Matches Go v2.5.2 (message/validation/const.go:18-19, consensus_validation.go:595-601) |
| Round estimate from the head start | Matches roundtimer.EstimatedRoundAt (timer.go:193-210). Flooring to seconds and dividing by two equals Go's division on nanoseconds. A message received before the head start, or before slot start, gives round 1 in both |
| Head start: committee 1 interval, aggregation roles 2 | Matches round1HeadStart (timer.go:168-177) |
| Interval: slot/3, or slot/4 when the duty slot is in Gloas | Matches IntervalDuration(slot) (networkconfig/beacon.go:145-151) |
| Exemptions: proposer, quorum commits | Matches RoundRelativeRole and the single-signer gate (consensus_validation.go:361, :583) |
| Position: after slot-advance, beacon duty and slot time, before duty count | Same order as Go (consensus_validation.go:335-376) |
The rule also matches the validation text in SIPs #105 at d2cc9f88.
Honest senders stay inside the narrower window. Anchor's slot-anchored instances time rounds from a fixed origin at the role's deadline (anchor/qbft_manager/src/timeout.rs:30-34), and the same code is in v1.4.1, so older Anchor peers are not affected. Go senders use the same schedule (timer.go:147-155).
The four non-QBFT roles in the exempt arm cannot reach this function; validate_consensus_message_semantics rejects them first.
Executed
On an export of this head with rustc 1.100.1 (macOS):
cargo +1.100.1 test --locked -p message_validator -p network --lib: 159 and 64 passed, none failed.- Eight single-point mutations of the exported copy, each run against the
round_spreadtests. All eight were caught: past 2 to 3, future 1 to 2, fork taken from the current slot, committee at 2 intervals, aggregation roles at 1 interval, Gloas on thirds, signer gate removed, proposer exemption removed.
CI is green except run-local-testnet, which was still pending when I checked.
Notes, none blocking
- No mixed Anchor and Go run exists for this head yet.
- SIPs #105 defines the Gloas interval as
SLOT_DURATION_MS × ATTESTATION_DUE_BPS_GLOAS / 10000. This PR and Go use slot/4. They are equal at the default 2500. On a network that overrides the constant, Anchor's sender (Lighthouse deadline helpers) and receiver would use different head starts. The SIP is still a draft. - The description links Go at
84ab67b0, the head of an open PR. Thev2.5.2tag carries the same rule atconsensus_validation.go:573-611and is a more durable link. - Unrelated to this diff: before Gloas, Anchor's committee sender origin is 3999 ms (
anchor/validator_store/src/lib.rs:2046), where SIPs #105 and Go use 4000 ms. That belongs with #916.
Considered and dropped: the receive timestamp is taken when the validation job runs, so queue wait counts against the new lower bound. Go stamps at the same point, and a message only falls out after 4 to 6 seconds of wait.
|
All six signed-message timing fixtures passed on Anchor With two Anchor and two Go #3142 ( |
Problem, Evidence, and Context
Anchor estimates incoming QBFT rounds from slot start and admits rounds 1 through the estimate plus three. Go allows two rounds back and one ahead of its duty-slot estimate. At 9.5s into a Gloas committee duty, a first-seen round-1 commit passes Anchor's spread check. Go estimates round 4 and ignores it, so the clients can forward different messages for the same duty. SIPs #105 · Go receiver
Closes #1370.
Change Overview
Select the head start by role and the message's duty slot. Use one interval for committee and two for aggregation and contribution roles. The interval is one third of a slot in Fulu and one quarter from Gloas. Apply the inclusive window
max(1, estimate - 2)..=estimate + 1to single-signer, slot-anchored QBFT messages after validating slot time. Proposer messages and quorum commits bypass this window and still pass the existing semantic checks.Risks, Trade-offs, and Mitigations
The narrower window takes effect on binary upgrade, including for Fulu traffic. Honest packets near the window boundary can be ignored when they arrive late. Check the duty slot when choosing the fork so a Fulu message received after activation still gets Fulu timing. An out-of-window message takes the existing
IGNOREpath without a peer penalty.Validation
Tested the patch against
unstableat5c88382355e7ff1894e5d5a5ebc6d8923a6b2394. All 159 message-validator tests and 64 network tests passed, including six signed-message regressions. The regressions cover both receive-window bounds, Fulu traffic received after activation, role offsets, the quick-to-slow boundary, both exemptions, and expired-slot attribution. Formatting andgit diff --checkpassed.CARGO_PROFILE_DEV_DEBUG=0 CARGO_INCREMENTAL=0 cargo +1.100.1 test --locked -p message_validator -p network --lib cargo +nightly fmt --all --check git diff --checkRollback
Reverting this patch restores the previous inbound round window. Rollback uses the same config and database formats.