-
Notifications
You must be signed in to change notification settings - Fork 834
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
Bonsai archive feature #7475
Open
matthew1001
wants to merge
43
commits into
hyperledger:main
Choose a base branch
from
matthew1001:multi-version-flat-db-rebase
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bonsai archive feature #7475
matthew1001
wants to merge
43
commits into
hyperledger:main
from
matthew1001:multi-version-flat-db-rebase
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
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
2 times, most recently
from
August 20, 2024 10:19
88f3968
to
7d4a524
Compare
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
7 times, most recently
from
October 2, 2024 17:10
782ae60
to
5752732
Compare
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
4 times, most recently
from
October 4, 2024 16:11
5b06b50
to
dce531e
Compare
Signed-off-by: Jason Frame <[email protected]>
…se constructor that reuses worldStateStorage so that we don't lose values in the EvmToolSpecTests Signed-off-by: Jason Frame <[email protected]>
Signed-off-by: Jason Frame <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…d state, and freeze it Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…ten for blocks and move account state to new DB segment Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…t block state has been frozen for Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…age from the freezer segment Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…Use the term archive, not freezer Signed-off-by: Matthew Whitehead <[email protected]>
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
from
October 8, 2024 07:39
9b10812
to
38cfdd9
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
…to fail the block Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
from
October 9, 2024 09:50
9a4c6b8
to
329da00
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
8 tasks
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
from
November 4, 2024 17:07
b32ec31
to
d53c104
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
from
November 4, 2024 17:19
d53c104
to
c1f239f
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
matthew1001
force-pushed
the
multi-version-flat-db-rebase
branch
from
November 5, 2024 11:06
3af0e37
to
c4a9516
Compare
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Reviewing now. What networks have you synced with this method? Do you have block execution performance metrics? I will kick off a full sync of mainnet alongside a regular bonsai full sync so we can get a signal about performance comparison. 👍 |
If you're able to try syncing as well it would be useful as a comparison. |
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.
PR description
Introduces a new (experimental) "Bonsai Archive" DB mode which creates a full archive of the chain it syncs with. This allows JSON/RPC calls to be made with historic blocks as context, for example
eth_getBalance
to get the balance of an account at a historic block, oreth_call
to simulate a transaction at a given block in history.The PR is intended to provide part of the function currently offered by the (now deprecated)
FOREST
DB mode. Specifically it allows state to be queried at an arbitrary block in history, but does not currently offereth_getProof
for said state. A subsequent PR will implementeth_getProof
for historic blocks.Summary of the overall design & changes
This PR builds on PR #5865 which proved the basic concept of archiving state in the Bonsai flat DB by suffixing entries with the block in which they were changed.
For example the state for account
0x0e79065B5F11b5BD1e62B935A600976ffF3754B9
at block37834
is stored asIn order to minimise performance degradation over time, historic state and storage entries in the DB are "archived" by moving them into a separate DB segment.
Where account state is stored in segment
ACCOUNT_INFO_STATE
, state that has been archived is stored inACCOUNT_INFO_STATE_ARCHIVE
. Likewise where storage is held in segmentACCOUNT_STORAGE_STORAGE
, archived storage entries are stored inACCOUNT_STORAGE_ARCHIVE
.An example Rocks DB query to retrieve the state of the example account above would be:
Creating a Bonsai Archive node
The PR introduces an entirely new data storage format (as opposed to making it a configuration option of the existing
BONSAI
storage format.To create a bonsai archive node simply set
--data-storage-format=x_bonsai_archive
when creating it.An existing
FOREST
orBONSAI
node cannot be migrated toBONSAI_ARCHIVE
mode.Storage requirements
An archive node intrinsically requires more storage space than a non-archive node. Every state update is retained in the archive DB segments as outlined above. An archive node for the
holesky
testnet as of the raising of this PR requires approximately160Gi
of storage.Sync time
In order to create an archive of an entire chain,
FULL
sync mode must be used. This PR does not preventSNAP
syncing an archive node, but this will result in only a partial archive of the chain.While the node is performing a
FULL
sync with the chain it is also migrating entries from the regular DB segments to the archive DB segments. Overall this increases the time to create the archive node. For a public chain this might require 1 week or more to complete syncing and archiving.