Repository navigation
fix(beacon): give the gloas fork epoch's PTC duties their own dependent root - #849
Open
MegaRedHand wants to merge 3 commits into
Open
MegaRedHand wants to merge 3 commits into
MegaRedHand wants to merge 3 commits into
Conversation
…nt root The payload timeliness committee of GLOAS_FORK_EPOCH is computed at the fork, by upgrade_to_gloas, from the effective balances the last pre-gloas epoch ends with. beacon-APIs (apis/validator/duties/ptc.yaml) therefore gives that epoch its own dependent root, the block root at compute_start_slot_at_epoch(epoch) - 1 (the genesis block root on underflow), and says its duties are not available before the fork. The node used the generic rule, compute_start_slot_at_epoch(epoch - 1) - 1, for every epoch, and asked about the fork epoch during the epoch before it, served a committee from the pre-gloas head advanced to the fork, missing every block still to come in that epoch. The validator client fetched it then as lookahead, and at the fork epoch's first slot fetched it again, but DutiesService keeps a held schedule while its dependent root is unchanged. The wrong root never changed, so the client kept the stale early committee for the whole first gloas epoch. Node: the fork epoch's dependent slot is now its start slot minus one, and the epoch is refused with a 400 until its first slot has started by the wall clock, allowing MAXIMUM_GOSSIP_CLOCK_DISPARITY, while the head is still before it (so a chain with gloas at genesis is still served before genesis). Pre-gloas epochs still answer 200 with no duties. Validator client: the fork epoch's duties are no longer fetched as the previous epoch's lookahead, which against Lighthouse drew a 400 and a misleading "may miss its votes" warning. They are fetched at the fork epoch's first slot, with the next epoch as the lookahead. Lighthouse does the same: it refuses the fork epoch until the tolerant current epoch reaches it, and takes its dependent root from the block at the fork's start slot minus one.
…duties The gloas fork epoch's payload timeliness committee is now fetched once, at the fork epoch's first slot, since a node cannot know it before the fork. refresh_ptc logs a failed fetch and moves on, and nothing retried it within the epoch, so one failed request there left the client with no PTC duties for the whole first gloas epoch. Every other epoch has two chances, the lookahead and the current fetch. After each slot's duties, the duty loop now fetches the current epoch's schedule again when it is a gloas epoch and none is held, bounded by the end of the slot so it never delays a duty. It runs only once the epoch's refresh has succeeded, since a failed refresh is retried every slot anyway. A schedule that came back empty counts as held. Failed retries log at debug, as refresh_ptc has already warned.
Collaborator
Author
|
/review |
AI security review: 0 finding(s) to checkReviewed by Opus, GPT, Kimi, GLM, DeepSeek. A judge model checked every one of the findings against the code. No findings to check. Duplicates folded into another finding: 1
Pre-existing (real, but already on the base branch): 2
Cost of this review: ~$2.98 of a $30 budget (estimated from token counts). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description / Motivation
At the gloas fork epoch F, the validator client can keep a stale payload timeliness committee (PTC) schedule for all of F. Some validators then vote in a slot where they are not on the committee and miss the slot where they are. This happens once per network, at the fork, so it still matters for Hoodi and mainnet.
The spec treats this epoch specially. F's PTC is computed at the fork, from the effective balances the last pre-gloas epoch ends with, so it can change until the last slot before the fork. beacon-APIs (
apis/validator/duties/ptc.yaml) therefore says:epoch == GLOAS_FORK_EPOCH,dependent_rootis the block root atcompute_start_slot_at_epoch(epoch) - 1, or the genesis block root on underflow;What we did instead:
compute_start_slot_at_epoch(epoch - 1) - 1, for F too. Asked about F during F-1, it advanced a copy of the pre-gloas head to F and served a committee computed without any of F-1's later blocks.DutiesService::refresh_ptckeeps a held schedule while its dependent root is unchanged, and the wrong root never changed, so the early committee stayed in use for the whole epoch.Lighthouse (
unstable@11813cfb) already follows the spec:beacon_node/http_api/src/ptc_duties.rs:44-50refuses F with a 400 until the tolerant current epoch reaches it;beacon_node/beacon_chain/src/beacon_chain.rs:1782-1793takes F's dependent root from the block atstart_slot(F) - 1.Against a Lighthouse node, our client's lookahead fetch got that 400 and logged a misleading "Payload committee duties fetch failed; this client may miss its votes".
What Changed
crates/net/rpc/src/beacon/ptc.rscompute_start_slot_at_epoch(F).saturating_sub(1). When gloas starts at genesis, that saturates to the genesis block. Every other epoch keeps the generic rule.MAXIMUM_GOSSIP_CLOCK_DISPARITY(500 ms) of tolerance. This reusesgossip::is_future_slot, and only applies while the head is still before the fork.now_mstoptc_duties, so the 500 ms edge is testable.fulu_state()andeveryone()test helpers.crates/validator/src/lib.rs:refresh_ptcskips the fork epoch whileepoch < target, so F is fetched at its own first slot, with F+1 as the lookahead.the_committee_schedule_is_fetched_for_gloas_epochs_onlyasserted the old behaviour and is rewritten.crates/validator/src/lib.rs,duties.rs(second commit):retry_missing_ptcruns after each slot's duties, andDutiesService::holds_ptcreports whether a schedule is held.crates/validator/src/beacon_node/mock.rs: the mock records which epochs were requested (ptc_requested_epochs()).ptc_call_count()is kept.crates/validator/src/duties.rs: doc comments only.docs/rpc.md,docs/cli.md: the fork epoch's 400, its dependent root, and when the client fetches it.Correctness / Behavior Guarantees
refresh_ptchas already warned. Without this, a failed fetch at slot 0 of F (for example from a beacon node whose clock is more than 500 ms behind the client's) would have cost every PTC vote in F.Tests Added / Run
start_slot(F) - 1, as is F+1's, while a pre-gloas epoch keeps the old rule.[4, 5].cargo test -p ethlambda-rpc -p ethlambda-validator --profile release-fast: 504 rpc lib, 6http_servers, 8test_driver_e2e, 624 validator lib; 0 failed.cargo clippy -p ethlambda-rpc -p ethlambda-validator --all-targets -- -D warnings: clean.Related Issues / PRs
✅ Verification Checklist
make fmt: cleanmake lint(clippy with-D warnings): ran forethlambda-rpcandethlambda-validatoronly, the two crates touched, and it is cleanmake test(test-consensusplustest-node, atrelease-fast): ran those two crates' tests only, all passing