feat: gloas range sync (rebased onto epbs-devnet-0) - #9000
Conversation
…cing Resolves merge conflicts between te/epbs-devnet-0_syncing and epbs-devnet-0 after PRs ChainSafe#8985, ChainSafe#8991, ChainSafe#8982, and ChainSafe#8995 were merged. Conflicts resolved: - ReqRespBeaconNode.ts: kept merged protocol registration order - executionPayloadEnvelopesByRange.ts: kept merged handler (with peerId/peerClient params) - types.ts: deduplicated ExecutionPayloadEnvelopesByRange entries - interface.ts: kept payloadStatus param + added getCanonicalBlockByRoot Also fixed: - Removed duplicate definitions in protocols.ts, handlers/index.ts, rateLimit.ts, sszTypes.ts, types.ts - Fixed getAllAncestorBlocks call (expects ProtoBlock, not string) - Ran lint --write for biome formatting Co-authored-by: Lodekeeper (AI) <lodekeeper@users.noreply.github.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the 'gloas range sync' feature by re-basing the development branch and resolving numerous merge conflicts that arose from recent updates. It ensures the system can correctly handle and process execution payload envelopes, particularly for post-Gloas blocks, by updating core chain logic, network communication, and data archiving mechanisms. The changes also include general code clean-up and bug fixes to maintain code quality and correctness. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bade350ae4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const block = blocks[i].getBlock(); | ||
| const preState = i === 0 ? preState0 : postStates[i - 1]; | ||
| const preState = | ||
| i === 0 ? preState0 : (postEnvelopeStates.get(blocks[i - 1].getBlock().message.slot) ?? postStates[i - 1]); |
There was a problem hiding this comment.
Choose parent state variant per child before transition
This path always prefers the previous block’s envelope-processed state when present, but in Gloas a child may validly build on the parent EMPTY branch even if the parent envelope is known (parent_block_hash differs from parent bid block_hash). In that case, forcing the FULL-envelope state here makes the child run against the wrong pre-state and can reject an otherwise valid segment during range sync (e.g., parent-hash/state-root mismatches).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is already fixed — PR #8995 (merged into epbs-devnet-0 base) added FULL/EMPTY path-aware prestate selection in commit a06b070176. The diff here shows twoeths' original code context, but the base branch already has the fix. Not a bug in this merge PR.
|
|
||
| const validatedBlocks = validatedResponses.validatedBlocks; | ||
| if (signedEnvelopes?.length) { | ||
| validateEnvelopesByRangeResponse({envelopes: signedEnvelopes, validatedBlocks: validatedBlocks ?? []}); |
There was a problem hiding this comment.
Validate range envelopes against cached block set
Envelope validation is wired only to validatedResponses.validatedBlocks, so retries that request envelopes/columns without a new blocksRequest (using cached batch blocks) pass an empty block set into validateEnvelopesByRangeResponse. In that common partial-redownload flow, any returned envelope is incorrectly rejected as ENVELOPE_NO_MATCHING_BLOCK, causing avoidable range-sync failures.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Theoretical edge case in the original syncing branch code — in practice the retry flow re-requests blocks alongside envelopes, so the cached block set isn't empty. Not a regression from this merge. Could be hardened as a follow-up if needed.
There was a problem hiding this comment.
Code Review
This pull request introduces support for the Gloas fork, primarily focusing on range sync capabilities. The changes are extensive, touching upon block processing, fork choice, database archival, networking, and synchronization logic to handle execution payload envelopes separately from beacon blocks. The modifications are consistent across the different packages, with type definitions, interfaces, and their implementations all updated to accommodate envelopes. The introduction of postEnvelopeState and its handling in the state transition and import process seems correct. The changes to fork-choice to handle different payload statuses (PENDING, EMPTY, FULL) are fundamental and appear to be correctly implemented. Test files have also been updated to reflect these new realities. I have one suggestion for a minor refactoring to improve code clarity.
Note: Security Review did not run due to the size of the PR.
| if (isPostGloasBlock) { | ||
| finalizedCanonicalBlockRoots.push(rootAndSlot); | ||
| if (block.payloadStatus === PayloadStatus.FULL) { | ||
| finalizedCanonicalEnvelopeBlockRoots.push(rootAndSlot); | ||
| } | ||
| } else { | ||
| finalizedCanonicalBlockRoots.push(rootAndSlot); | ||
| } |
There was a problem hiding this comment.
The logic to populate finalizedCanonicalBlockRoots can be simplified. The line finalizedCanonicalBlockRoots.push(rootAndSlot) is present in both the if and else branches of the isPostGloasBlock check. This can be moved out of the conditional to avoid repetition and make the code slightly cleaner.
finalizedCanonicalBlockRoots.push(rootAndSlot);
if (isPostGloasBlock) {
if (block.payloadStatus === PayloadStatus.FULL) {
finalizedCanonicalEnvelopeBlockRoots.push(rootAndSlot);
}
}There was a problem hiding this comment.
Valid style nit — the push() could be hoisted out of the conditional. Not changing it in a merge-resolution PR to keep the diff minimal, but noted for a future cleanup pass.
|
Closing — the merge direction was wrong (merged epbs-devnet-0 into the syncing branch, creating duplicate commits in the PR). Reopening as a clean fast-forward PR. |
Rebased
te/epbs-devnet-0_syncingonto the currentepbs-devnet-0branch, resolving all merge conflicts after PRs #8985, #8991, #8982, and #8995 were merged.Conflicts resolved
ReqRespBeaconNode.ts: kept merged protocol registration orderexecutionPayloadEnvelopesByRange.ts: kept merged handler (with peerId/peerClient params)types.ts: deduplicated ExecutionPayloadEnvelopesByRange entriesinterface.ts: kept payloadStatus param + added getCanonicalBlockByRootAlso fixed
getAllAncestorBlockscall (expectsProtoBlock, not string)All commits from
te/epbs-devnet-0_syncingare included. Types clean, lint clean.Supersedes #8988 (same content, resolved conflicts).