-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: implement fast node #75
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yutianwu
force-pushed
the
fastNode
branch
2 times, most recently
from
April 7, 2024 09:05
40e4ecb
to
c2b6a2e
Compare
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
reviewed
Apr 8, 2024
unclezoro
previously approved these changes
Apr 10, 2024
owen-reorg
previously approved these changes
Apr 24, 2024
redhdx
previously approved these changes
Apr 24, 2024
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.
LGTM
welkin22
approved these changes
Apr 25, 2024
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.
LGTM
owen-reorg
approved these changes
Apr 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently a op-geth node has two kinds of state world: MPT and snapshot. MPT(Merkle Patricia Tries) is a tree-structured state world. The key function of MPT is to generate the state root to ensure state consistency, while the query/commit on MPT is quite slow. Snapshot is a flattened key-value-based state world. Snapshot provides fast queries and commits. The storage size of the snapshot increases slowly even with a large transaction volume. Snapshot is usually used for block processing, while MPT is used for state verification.
In order to lower the hardware requirement, we introduce the fast node. The fast node will do block processing with snapshot, it will do all verification against blocks except state root.
The fast node doesn’t need to store MPT, so the storage and computation requirement will be much lower.
Since the fast node don'st store the MPT, we can't verify the state root mentioned above. We called it
insecure-no-tries
. But it should be reliable since we compared the diff layers of the fast node and normal node, it's identical.It's only encouraged to use the fast node for the normal rpc nodes to reduce costs and improce the syncing performance.
Command
If you want to enable the fast node, you can add
--allow-insecure-no-tries
in the command.If you want to prune the MPT state, you can also prune the node:
Performance
We compared the performance of the fast node and normal node by starting two nodes in full sync mode from the genesis of mainnet.
You can refer to the above image, the fast node finish the sync before the normal node more than two days.
Rationale
To lower the cost of the geth nodes and improve the syncing performance.
Example
N/A
Changes
Notable changes:
--allow-insecure-no-tries
in command lineinsecure-prune-all
command to prune MPT state