-
Notifications
You must be signed in to change notification settings - Fork 201
perf(levm): replace BTreeMap/BTreeSet with FxHashMap/FxHashSet for accessed storage slots #6185
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -266,8 +266,8 @@ impl Substate { | |
| /// Returns all accessed storage slots for a given address. | ||
| /// Used by SELFDESTRUCT to record storage reads in BAL per EIP-7928: | ||
| /// "SELFDESTRUCT: Include modified/read storage keys as storage_read" | ||
| pub fn get_accessed_storage_slots(&self, address: &Address) -> BTreeSet<H256> { | ||
| let mut slots = BTreeSet::new(); | ||
| pub fn get_accessed_storage_slots(&self, address: &Address) -> FxHashSet<H256> { | ||
| let mut slots = FxHashSet::default(); | ||
|
Comment on lines
266
to
+270
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. Return type change breaks callers
Prompt To Fix With AIThis is a comment left during a code review.
Path: crates/vm/levm/src/vm.rs
Line: 252:256
Comment:
**Return type change breaks callers**
`get_accessed_storage_slots` now returns `FxHashSet<H256>` (was `BTreeSet<H256>`). Any caller that relied on deterministic ordering (common for receipts/tracing/encoding) will now see non-deterministic iteration order. If the result is later serialized/hashed/compared, this can cause flaky tests or consensus-sensitive differences. Consider either keeping the public API ordered (return `BTreeSet`/sorted `Vec`) or sorting at the call site(s) where determinism is required.
How can I resolve this? If you propose a fix, please make it concise. |
||
|
|
||
| // Collect from current substate | ||
| if let Some(slot_set) = self.accessed_storage_slots.get(address) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.