Skip to content
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

fix(fuzz) - consistent snapshot results between runs #7951

Merged
merged 3 commits into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions crates/evm/fuzz/src/strategies/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ use revm::{
interpreter::opcode::{self, spec_opcode_gas},
primitives::{AccountInfo, SpecId},
};
use std::{collections::HashMap, fmt, sync::Arc};
use std::{
collections::{BTreeMap, HashMap},
fmt,
sync::Arc,
};

/// A set of arbitrary 32 byte data from the VM used to generate values for the strategy.
///
Expand Down Expand Up @@ -113,7 +117,9 @@ impl FuzzDictionary {
self.insert_push_bytes_values(address, &account.info, false);
// Insert storage values.
if self.config.include_storage {
for (slot, value) in &account.storage {
// Sort storage values before inserting to ensure deterministic dictionary.
let values = account.storage.iter().collect::<BTreeMap<_, _>>();
for (slot, value) in values {
self.insert_storage_value(slot, value, false);
}
}
Expand Down
Loading