Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Execution Layer syncing #164

Closed
wants to merge 6 commits into from

Conversation

mininny
Copy link
Member

@mininny mininny commented Apr 23, 2024

This PR adds support for execution layer syncing through the op-node. Instead of deriving every block through the op-node, EL sync allows the execution client to retrieve blocks from other P2P peers to speed up the process of syncing. This leverages the existing staged sync infrastructure and require very minimal diff on op-erigon compared to the upstream erigon.

Changes

Add bootnodes

Add OP bootnodes. See op-geth for existing set of bootnodes for reference.

Fixed an issue where NewPayload will return VALID without validating

When the op-erigon and op-node is performing execution-layer syncing, op-erigon performs existing p2p sync logic while op-node sends l2 payloads to drive EL sync. This NewPayload and ForkchoiceUpdated informs op-erigon where to begin syncing, and the response for these engine apis are used to determine whether the EL sync is complete.

When op-erigon is first initialized from genesis, it downloads the block headers from gensis to the latest chain head in order to retrieve ancestor data when it's not known. After downloading the block headers, because the amount of headers downloaded is too large, erigon skips validation of the downloaded blocks (see this commit). Instead, it just returns VALID as a response for the NewPayload, even though erigon client hasn't completely synced or validated the blocks.

However, this VALID signal incorrectly informs op-node that the EL sync is complete. op-node then retrieves the current head of the op-erigon, which pretended to be the chain head, while there actually isn't any validated blocks.

Diagram Apr 23 2024

an illustration of the problematic flow

In order to fix this, the engine server now attempts to validate the chain at the head block, and returns SYNCING if the block validation was skipped. The engine will return VALID only after initial sync is complete and actually validated the chain.

Update TTD calculation for bedrock

For OP-stack chains, we use bedrock activation number for op-stack for determining when TTD has been reached.


Tested on op-sepolia(about 3 hours for complete sync) and will be tested on mainnet as well.

@mininny mininny requested review from pcw109550 and ImTei April 23, 2024 14:39
@mininny mininny force-pushed the feature/mininny/staged-sync branch from a4af987 to cfc21a0 Compare April 23, 2024 14:44
@pcw109550 pcw109550 marked this pull request as draft April 25, 2024 22:35
@pcw109550 pcw109550 marked this pull request as ready for review April 25, 2024 22:35
@mininny mininny force-pushed the feature/mininny/staged-sync branch from cfc21a0 to 6148445 Compare April 26, 2024 10:43
@mininny
Copy link
Member Author

mininny commented Jul 28, 2024

Resolved in previous PRs

@mininny mininny closed this Jul 28, 2024
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