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

feat(evm): migrate to alloy-genesis, rm ethers-core #6880

Merged
merged 8 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions crates/cheatcodes/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,18 @@ impl Cheatcode for loadAllocsCall {
ensure!(path.exists(), "allocs file does not exist: {pathToAllocsJson}");

// Let's first assume we're reading a genesis.json file.
let allocs: HashMap<Address, GenesisAccount> = match read_json_file::<Genesis>(path) {
Ok(genesis) => genesis.alloc.into_iter().collect(),
// If that fails, let's try reading a file with just the genesis accounts.
let genesis = read_json_file::<Genesis>(path);
let allocs: HashMap<Address, GenesisAccount> = match genesis {
Ok(genesis) => genesis.alloc,
Err(_) => read_json_file(path)?,
};

// If allocs is empty, let's assume we're reading a genesis_accounts.json file.
let allocs = match allocs.is_empty() {
true => read_json_file::<HashMap<Address, GenesisAccount>>(path)?,
false => allocs,
};

// Then, load the allocs into the database.
ccx.data
.db
Expand Down