-
Notifications
You must be signed in to change notification settings - Fork 882
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
Optimized Keccak Hashing for Account Storage Slots #6452
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
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
|
garyschulte
reviewed
Jan 24, 2024
datatypes/src/main/java/org/hyperledger/besu/datatypes/StorageSlotKey.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: ahamlat <[email protected]>
Signed-off-by: Ameziane H <[email protected]>
...a/org/hyperledger/besu/ethereum/trie/bonsai/worldview/BonsaiWorldStateUpdateAccumulator.java
Fixed
Show fixed
Hide fixed
Signed-off-by: Ameziane H <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Karim Taam <[email protected]>
ahamlat
approved these changes
Jan 30, 2024
Signed-off-by: Karim Taam <[email protected]>
changed to Mergeable after @ahamlat confirmed testing regressions were unrelated to this PR |
Signed-off-by: garyschulte <[email protected]>
jflo
pushed a commit
to jflo/besu
that referenced
this pull request
Jan 30, 2024
* not recompute hash if not needed * Add memoize for the Supplier * Modify hashcode to only process keccak when slotkey is not defined * use single cache for keccak Signed-off-by: Karim Taam <[email protected]> Signed-off-by: Ameziane H <[email protected]> Signed-off-by: ahamlat <[email protected]> Signed-off-by: garyschulte <[email protected]>
jflo
pushed a commit
to jflo/besu
that referenced
this pull request
Jan 30, 2024
* not recompute hash if not needed * Add memoize for the Supplier * Modify hashcode to only process keccak when slotkey is not defined * use single cache for keccak Signed-off-by: Karim Taam <[email protected]> Signed-off-by: Ameziane H <[email protected]> Signed-off-by: ahamlat <[email protected]> Signed-off-by: garyschulte <[email protected]>
jflo
pushed a commit
to jflo/besu
that referenced
this pull request
Jan 30, 2024
* not recompute hash if not needed * Add memoize for the Supplier * Modify hashcode to only process keccak when slotkey is not defined * use single cache for keccak Signed-off-by: Karim Taam <[email protected]> Signed-off-by: Ameziane H <[email protected]> Signed-off-by: ahamlat <[email protected]> Signed-off-by: garyschulte <[email protected]> Signed-off-by: Justin Florentine <[email protected]>
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
The purpose of this PR is to avoid unnecessary recomputations of the Keccak hash for account storage slots during the commit phase. In most cases, we have already calculated the hashes during the transaction processing phase and can reuse these values. The idea is to add this information to the accumulator, storing each key-to-hash mapping as it's generated during the transaction. At the end of the block, during the commit phase, we will first check the cache before attempting to recalculate the hash.
The cache size should not pose a problem as it will inevitably contain fewer elements than the other maps in the accumulator. This PR also has an added benefit in cases where we need to access the same slot key for two different accounts during the transaction processing phase. In such cases, the hash will only be calculated once.
Fixed Issue(s)