Skip to content

Commit

Permalink
feat(levm): add precompiled contracts addresses to cache (#1473)
Browse files Browse the repository at this point in the history
**Motivation**

Precompiles are not implemented yet, but some tests test sideways those
addresses are cached, so this makes those tests (8 tests) pass.

**Description**

Just adds addresses between 1 and 9 to the cached addresses.
  • Loading branch information
maximopalopoli authored Dec 11, 2024
1 parent df63326 commit 3611c41
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/vm/levm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl VM {

let mut default_touched_storage_slots: HashMap<Address, HashSet<H256>> = HashMap::new();

// Add access lists contents to cache
for (address, keys) in access_list.clone() {
default_touched_accounts.insert(address);
let mut warm_slots = HashSet::new();
Expand All @@ -147,6 +148,12 @@ impl VM {
default_touched_storage_slots.insert(address, warm_slots);
}

// Add precompiled contracts addresses to cache.
// TODO: Use the addresses from precompiles.rs in a future
for i in 1..10 {
default_touched_accounts.insert(Address::from_low_u64_be(i));
}

match to {
TxKind::Call(address_to) => {
default_touched_accounts.insert(address_to);
Expand Down

0 comments on commit 3611c41

Please sign in to comment.