-
Notifications
You must be signed in to change notification settings - Fork 166
chore: add sync strategies #437
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
chore: add sync strategies #437
Conversation
Hi @shane-moore,
ℹ️ How to fix this error:
ℹ️ Checking for typos locally
for f in **/*.md ; do echo $f ; aspell --lang=en_US --mode=markdown --home-dir=. --personal=wordlist.txt --ignore-case=true --camel-case --add-sgml-skip nospellcheck list < $f | sort | uniq -c ; done |
5c398ed
to
3bdda2b
Compare
Hi @shane-moore,
ℹ️ How to fix this error:
ℹ️ Checking for typos locally
for f in **/*.md ; do echo $f ; aspell --lang=en_US --mode=markdown --home-dir=. --personal=wordlist.txt --ignore-case=true --camel-case --add-sgml-skip nospellcheck list < $f | sort | uniq -c ; done |
@taxmeifyoucan @raxhvl, this PR is ready for review whenever you get a chance. I recall from the wiki contributors call a couple weeks ago that we wanted to split up PR reviewers by categories, but I don't remember who was assigned to which category, i.e. EL like for this PR |
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.
Thanks Shane!
docs/wiki/EL/el-architecture.md
Outdated
Let's look at how the flows of both **full sync** and **snap sync** work. | ||
|
||
### Full Sync | ||
Full Sync trades absolute trustlessness for time and resources. You replay every block and transaction from genesis to tip, rebuilding the state trie step by step: |
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.
Full Sync trades absolute trustlessness for time and resources. You replay every block and transaction from genesis to tip, rebuilding the state trie step by step: | |
Full Sync trades absolute trustlessness for time and resources. The client replays every block and transaction from genesis to tip, rebuilding the state trie step by step: |
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.
I would maybe add that full sync is the default naive strategy and because it's starting from genesis, it's not sustainable for the future (4444)
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.
solid point! added 4444 context in latest commit 2bde312
Other thoughts I didn't include in the PR:
On top of 4444, once we get statelessness, syncing should be significantly sped up, since each block will have execution witnesses, containing each account and storage slots accessed, and block validation can just run txs against an in-memory state trie created from those accessed accounts and storage slots.
^^ maybe too early to add this context to the sync wiki section but def going to be a game changer
docs/wiki/EL/el-architecture.md
Outdated
5. Send `GetByteCodes` for every code hash found in the account bodies to get back the contract code for that account | ||
6. Locally insert every fetched leaf into a fresh trie, verifying each batch against the pivot root via Merkle proofs. | ||
|
||
After step 6, we have a snapshot of the pivot block's state. However, the blockchain is also progressing at the same time and invalidating some of the regenerated state data. This means it is also necessary to have a healing phase where errors in the state are fixed. During healing, the client walks the reconstructed trie and verifies that it hashes to the pivot block’s stateRoot. Any missing or inconsistent trie nodes or bytecode blobs are fetched using targeted snap requests. Healing ensures the final state is complete and cryptographically valid, even if parts of the snapshot were stale, incomplete, or assembled from mixed sources. |
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.
One small thing I would highlight here is that snapshot has a specific database like format, different from state merkle so it needs to be converted
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.
no doubt @taxmeifyoucan, added this context in 2bde312
- [Engine Api Spec](https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#payload-validation) • [archived](https://web.archive.org/web/20250318111700/https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#payload-validation) | ||
- [Engine API: A Visual Guide](https://hackmd.io/@danielrachi/engine_api) • [archived](https://web.archive.org/web/20241006232802/https://hackmd.io/@danielrachi/engine_api) | ||
- [Engine API | Mikhail | Lecture 21](https://youtu.be/fR7LBXAMH7g) | ||
- ["Snapping Snap Sync: Practical Attacks on Go Ethereum Synchronising Nodes" (ETH Zurich)](https://appliedcrypto.ethz.ch/content/dam/ethz/special-interest/infk/inst-infsec/appliedcrypto/research/TavernaPaterson-SnappingSnapSync.pdf) |
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.
also eth.org has these https://ethereum.org/en/developers/docs/nodes-and-clients/#execution-layer-sync-modes
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.
nice source, added as well 2bde312
3bdda2b
to
f169c17
Compare
Changes
Note