-
Notifications
You must be signed in to change notification settings - Fork 639
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
Snap Sync: DepositNonce Data Correction #237
Conversation
29a43a1
to
e4306de
Compare
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.
Changes look generally good, but one request: can this diff be documented in fork.yaml
? Adding a category for "historical data" or something would be helpful. It will then automatically render it on https://op-geth.optimism.io/
Also, please squash the commits, since we don't have auto-squashing enabled in the op-geth repository. (since upstream commits need to be preserved).
016dc0d
to
9a08123
Compare
9a08123
to
fdf0da8
Compare
What
Enables snap sync with untrusted parties by supplying a data source for DepositNonces.
Prior to Canyon Hard Fork, Deposit Nonces were not cryptographically verified. This PR supplies the Deposit Nonce data for most Superchain Registered Chains for the affected time period, and implements a correction function.
Why
We want Snap Sync to work without concern about trusting your peers. Today, a user could supply blocks with incorrect Deposit Nonces, and Snap Sync would not have a way of verifying. With this PR, nodes will be able to repair blocks with incorrect data, closing the attack vector.
How
gob
, go binary format for data compression//go:embed
directiveIf at any point the deposit nonces are not as expected, warnings are emitted to logs. More detailed activity is emitted to Trace Logs.
Testing
A unit test set is included to demonstrate that Nonces are Corrected when they are wrong.
I also Snap Synced Goerli with this code (a version with louder logs), and observed that over the range of blocks, Deposit Nonces were all checked.
Extending
This PR includes the required data for
[OP, Base, Lyra, Mode, Orderly, Zora] Mainnet
, as well asOP Goerli
. To extend this correction to more chains, all that is required is that a newgob
be checked into the data directory.The file format created by the receipt reference tool should be used, as each gob is prefixed by its chainID, which is used to only load required files, keeping memory low.