Skip to content

fix(message_validator): align slot-anchored QBFT round spread with Go - #1371

Merged
shane-moore merged 1 commit into
sigp:unstablefrom
shane-moore:fix/1370-qbft-round-spread
Dec 3, 2026
Merged

shane-moore merged 1 commit into
sigp:unstablefrom
shane-moore:fix/1370-qbft-round-spread

Conversation

@shane-moore

Copy link
Copy Markdown
Member

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 + 1 to 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 IGNORE path without a peer penalty.

Validation

Tested the patch against unstable at 5c88382355e7ff1894e5d5a5ebc6d8923a6b2394. 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 and git diff --check passed.

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 --check

Rollback

Reverting this patch restores the previous inbound round window. Rollback uses the same config and database formats.

Estimate slot-anchored rounds from the duty slot and role so peers running Anchor and go-ssv make the same round-spread decision.
@mergify

mergify Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.23077% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.66%. Comparing base (5c88382) to head (34d6805).

Files with missing lines Patch % Lines
anchor/message_validator/src/consensus_message.rs 99.23% 1 Missing ⚠️
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     
Flag Coverage Δ
rust 80.66% <99.23%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@shane-moore shane-moore left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_spread tests. 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. The v2.5.2 tag carries the same rule at consensus_validation.go:573-611 and 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.

@shane-moore
shane-moore merged commit 1804535 into sigp:unstable Dec 3, 2026
18 checks passed
@shane-moore

Copy link
Copy Markdown
Member Author

All six signed-message timing fixtures passed on Anchor d4bb09e8. At estimated round 4, the receiver accepted rounds 2 and 5 and ignored 1 and 6. A Fulu duty received after Gloas activation still used the Fulu window.

With two Anchor and two Go #3142 (74397840) operators, a Fulu proposal completed at slot 55. In the first Gloas epoch all ten managed aggregations published in round 1, with all four operators leading. Late-round verdicts were observed with the fixture clock. Timing fixtures

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.

2 participants