-
Notifications
You must be signed in to change notification settings - Fork 849
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
worldstate refactor #6209
Merged
garyschulte
merged 32 commits into
hyperledger:main
from
matkt:feature/worldstate-refactor
Mar 8, 2024
Merged
worldstate refactor #6209
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
657a78e
worldstate storage refactor
matkt 6d4a4bb
fix unit tests
matkt d8a411e
fix unit tests
matkt e9558d3
fix unit tests
matkt 18e1899
merge main
matkt 4a3ea8a
merge main
matkt a368a35
fix tests
matkt ccdb980
merge main
matkt 41fc466
fix review
matkt 513734f
Merge branch 'main' into feature/worldstate-refactor
matkt 61e985b
Merge branch 'main' into feature/worldstate-refactor
matkt 9f4cd99
Merge branch 'main' into feature/worldstate-refactor
matkt 772efd7
merge main
matkt 78f64f2
Merge branch 'main' into feature/worldstate-refactor
matkt 36ee939
merge main
matkt d0ed277
fix build
matkt 93f0476
Merge branch 'main' into feature/worldstate-refactor
matkt 6620e1d
Merge branch 'main' into feature/worldstate-refactor
matkt 1ca3362
Merge branch 'main' into feature/worldstate-refactor
matkt 44df1e9
merge main
matkt e3ae5d1
fix ref tests
matkt 9dfadc4
fix tests
matkt 0f24e3a
fix build
matkt 3f34e01
fix build
matkt bb66627
fix failed tests
matkt fadc9c4
Merge branch 'main' into feature/worldstate-refactor
matkt 228a794
fix test to use BonsaiWSKVStorage
gfukushima 7824da4
Merge branch 'main' into feature/worldstate-refactor
gfukushima b9ffdcf
spotless
gfukushima 4e045c6
Merge remote-tracking branch 'matkt/feature/worldstate-refactor' into…
gfukushima 47e97c0
Merge branch 'main' into feature/worldstate-refactor
matkt 574fac1
fiw review
matkt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,8 +37,8 @@ | |
import org.hyperledger.besu.ethereum.trie.PersistVisitor; | ||
import org.hyperledger.besu.ethereum.trie.RestoreVisitor; | ||
import org.hyperledger.besu.ethereum.trie.forest.ForestWorldStateArchive; | ||
import org.hyperledger.besu.ethereum.trie.forest.storage.ForestWorldStateKeyValueStorage; | ||
import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; | ||
import org.hyperledger.besu.ethereum.worldstate.WorldStateStorage; | ||
import org.hyperledger.besu.util.io.RollingFileReader; | ||
|
||
import java.io.IOException; | ||
|
@@ -83,7 +83,7 @@ public class RestoreState implements Runnable { | |
private long trieNodeCount; | ||
private boolean compressed; | ||
private BesuController besuController; | ||
private WorldStateStorage.Updater updater; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, non-blocking. forest is deprecated and we should deprecate these commands too |
||
private ForestWorldStateKeyValueStorage.Updater updater; | ||
|
||
private Path accountFileName(final int fileNumber, final boolean compressed) { | ||
return StateBackupService.accountFileName(backupDir, targetBlock, fileNumber, compressed); | ||
|
@@ -249,10 +249,10 @@ private void newWorldStateUpdater() { | |
if (updater != null) { | ||
updater.commit(); | ||
} | ||
final WorldStateStorage worldStateStorage = | ||
final ForestWorldStateKeyValueStorage worldStateKeyValueStorage = | ||
((ForestWorldStateArchive) besuController.getProtocolContext().getWorldStateArchive()) | ||
.getWorldStateStorage(); | ||
updater = worldStateStorage.updater(); | ||
updater = worldStateKeyValueStorage.updater(); | ||
} | ||
|
||
private void maybeCommitUpdater() { | ||
|
@@ -263,20 +263,20 @@ private void maybeCommitUpdater() { | |
|
||
private void updateCode(final Bytes code) { | ||
maybeCommitUpdater(); | ||
updater.putCode(null, code); | ||
updater.putCode(code); | ||
} | ||
|
||
private void updateAccountState(final Bytes32 key, final Bytes value) { | ||
maybeCommitUpdater(); | ||
// restore by path not supported | ||
updater.putAccountStateTrieNode(null, key, value); | ||
updater.putAccountStateTrieNode(key, value); | ||
trieNodeCount++; | ||
} | ||
|
||
private void updateAccountStorage(final Bytes32 key, final Bytes value) { | ||
maybeCommitUpdater(); | ||
// restore by path not supported | ||
updater.putAccountStorageTrieNode(null, null, key, value); | ||
updater.putAccountStorageTrieNode(key, value); | ||
trieNodeCount++; | ||
} | ||
|
||
|
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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 has been an undocumented experimental feature for 3 years. we should get rid of it. probably in a different PR