-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
op-node: Engine P2P sync #6243
op-node: Engine P2P sync #6243
Conversation
- Add new flag and sync.Config struct for engine p2p sync - Fix EngineQueue to support engine p2p sync - Add op-e2e test casees - Fix related components to pass sync config - Fix execution engine specs
|
✅ Deploy Preview for opstack-docs canceled.
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #6243 +/- ##
===========================================
- Coverage 44.31% 44.25% -0.07%
===========================================
Files 436 436
Lines 29025 29091 +66
Branches 709 709
===========================================
+ Hits 12863 12873 +10
- Misses 15085 15135 +50
- Partials 1077 1083 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I have a few suggestions to make the functionality/flags clearer to the user. Can you implement those?
Co-Authored-By: protolambda <19571989+protolambda@users.noreply.github.com>
@protolambda Thank you for the review! I have applied your suggestions :) |
This PR has been added to the merge queue, and will be merged soon. |
Hey @ImTei, this pull request failed to merge and has been dequeued from the merge train. If you believe your PR failed in the merge train because of a flaky test, requeue it by commenting with |
@ImTei @protolambda How do I enable this feature, seems like it is not documented yet? |
It's been enabled by default for a fair few releases now. Just make sure you're using the latest release and then don't disable it or disable networking in op-node and it will work. |
@ajsutton The sync process on op-geth will not conflict with op-node right? |
@ajsutton I have found that if snap sync would be possible, it will require any kind of bootnodes or static nodes to connect and sync right? Is there any? |
@kaliubuntu0206 My apologies - there are two similarly named features and I was thinking of the wrong one. p2p sync in op-node has been enabled by default to fill in any missed unsafe blocks. This is actually the op-geth snap sync functionality which is not yet enabled by default. The two systems don't interfere with each other. To enable snap sync (this feature), for op-geth, set Then for op-node set Bootnodes can be shared across networks so the default op-geth boot nodes should work fine. However it is worth noting that currently there are extremely few peers available on most OP stack networks so it may be difficult to find peers that you can snap sync from. |
@ajsutton Is there any bootnodes available for optimism mainnet to connect op-geth nodes? Also, I think it is important feature since no one wants to spend extra dollars for waiting the chain retrieval from L1 |
Bootnodes are designed so that they can be shared between networks so you don't need different boot nodes and are most likely to find peers using the default boot nodes. However there are just very very few peers available on OP stack networks currently. |
@ajsutton Yes but with my understanding in order to sync between L1 nodes you will need a bootnode to find each other, and I see none here https://github.com/ethereum-optimism/op-geth/blob/optimism/params/bootnodes.go |
Geth also has an history of very poor P2P discovery and many users aren't able to find even with the default bootnode exists. It would be great to have a list of optimism foundation op-geth nodes listed somewhere |
The Mainnet boot nodes are used by default: https://github.com/ethereum-optimism/op-geth/blob/ceb5f3201eb74e9c32594596ea15755ec94f99c1/cmd/utils/flags.go#L1098-L1124 |
@ajsutton They are for |
They are also mainnet running nodes, you can see |
Yes, boot nodes are designed to be able to be shared across networks and the sets of peers almost always winds up being shared across bootnodes for different networks just from the way the distributed hash table works for discovery. That's why the network ID is checked by clients as part of finding peers - to quickly detect peers that are found from the boot nodes that aren't on the same chain. There are a number of other other checks that happen like that as part of the initial handshake process. There are very very few peers available on OP stack networks currently, you will see a lot of peers being immediately connected as irrelevant and it may take a long time to find ones that are useful because the vast majority of OP stack nodes currently are configured to disable the peer to peer networking. |
@ajsutton I see, since I haven't really read the specification for P2P communication of ethereum nodes. I hope the feature could be enabled by default and the exclusive bootnodes could be provided for faster synchronization. ( And I think it is crucial since fetching blocks and transactions from Geth is very, very slow ). Thank you for answering my question |
Good morning! This is Tei from Test in Prod. This PR contains two topics:
And there is another related PR in op-geth repository to support snap sync.
Triggering Execution Engine’s P2P Sync
Specs
--l2.engine-p2p.enabled=false|true
false
sync.Config.EngineP2PEnabled
struct, and passed toEngineQueue
EngineQueue
syncCfg sync.Config
EngineP2PEnabled
andSkipSanityCheck
engineSyncTarget eth.L2BlockRef
unsafeHead
. Otherwise, it must be the same withunsafeHead
.SyncStatus
EngineQueue
is reset, setengineSyncTarget
to unsafe head.EngineP2PEnabled
flag istrue
,EngineQueue.tryNextUnsafePayload()
should behave as follows:SYNCING
andACCEPTED
status fromengine_newPayloadV1
SYNCING
status fromengine_forkchoiceUpdatedV1
engine_forkchoiceUpdatedV1
returnsSYNCING
orVALID
, updateeq.engineSyncTarget
to the new unsafe block.engine_forkchoiceUpdatedV1
returnsVALID
, updateeq.unsafeHead
to the new unsafe block.eq.unsafeHead
andeq.engineSyncTarget
are not matched, consider the engine currently syncing.EngineQueue
does not do anything except notify new unsafe payloads to the engine.EngineP2PSyncing
error if there’s no unsafe payload in the queue. This error makes the pipeline goes idle.EngineQueue
tries to apply the next unsafe head before applying the next safe attributes ineq.Step()
function.eq.tryNextUnsafePayload()
returns an EOF error, do not return immediately, and continue remaining tasks inStep()
, such as safe sync.Test
Fixing UX Issues
This part might be better to open up as another PR. Please let me know if you prefer that way!
Background
reorg is too deep
error comes out while resetting the pipeline.Details & Solution
sync.FindL2Heads()
function.FindL2Heads()
function has two purposes: Finding unsafe and safe heads to start the sync.FindL2Heads()
function has one main loop as follows:reorg is too deep
error.Remaining issues
FindL2Heads()
iterates every block between unsafe and safe heads to find the safe starting point, which delays the process starts. We speculated intentions for the iteration:--skip-sanity-check
flag to avoid the issue and accelerate the process start speed.