Skip to content

Commit

Permalink
Fix address marking for state reads (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Oct 3, 2024
1 parent 8f1f05a commit 6410905
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions trace_decoder/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ use std::{
mem,
};

use alloy::primitives::address;
use alloy_compat::Compat as _;
use anyhow::{anyhow, bail, ensure, Context as _};
use ethereum_types::{Address, H160, U256};
use ethereum_types::{Address, U256};
use evm_arithmetization::{
generation::{mpt::AccountRlp, TrieInputs},
proof::{BlockMetadata, TrieRoots},
Expand Down Expand Up @@ -474,30 +473,7 @@ fn middle<StateTrieT: StateTrie + Clone>(
state_mask.insert(TrieKey::from_address(addr));
} else {
// Simple state access

fn is_precompile(addr: H160) -> bool {
let precompiled_addresses = if cfg!(feature = "eth_mainnet") {
address!("0000000000000000000000000000000000000001")
..address!("000000000000000000000000000000000000000a")
} else {
// Remove KZG Peval for non-Eth mainnet networks
address!("0000000000000000000000000000000000000001")
..address!("0000000000000000000000000000000000000009")
};

precompiled_addresses.contains(&addr.compat())
|| (cfg!(feature = "polygon_pos")
// Include P256Verify for Polygon PoS
&& addr.compat()
== address!("0000000000000000000000000000000000000100"))
}

if receipt.status || !is_precompile(addr) {
// TODO(0xaatif): https://github.com/0xPolygonZero/zk_evm/pull/613
// masking like this SHOULD be a space-saving optimization,
// BUT if it's omitted, we actually get state root mismatches
state_mask.insert(TrieKey::from_address(addr));
}
state_mask.insert(TrieKey::from_address(addr));
}

if self_destructed {
Expand Down

0 comments on commit 6410905

Please sign in to comment.