diff --git a/trace_decoder/src/core.rs b/trace_decoder/src/core.rs index 64c0dc2ee..355237148 100644 --- a/trace_decoder/src/core.rs +++ b/trace_decoder/src/core.rs @@ -1,3 +1,4 @@ +use std::ops::Range; use std::{ cmp, collections::{BTreeMap, BTreeSet, HashMap}, @@ -455,24 +456,25 @@ fn middle( } state_trie.insert_by_address(addr, acct)?; + state_mask.insert(TrieKey::from_address(addr)); + } else { + // Simple state access + const PRECOMPILE_ADDRESSES: Range = + address!("0000000000000000000000000000000000000001") + ..address!("000000000000000000000000000000000000000a"); + + if receipt.status || !PRECOMPILE_ADDRESSES.contains(&addr.compat()) { + // 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)); + } } if self_destructed { storage_tries.remove(&keccak_hash::keccak(addr)); state_mask.extend(state_trie.reporting_remove(addr)?) } - - let precompiled_addresses = address!("0000000000000000000000000000000000000001") - ..address!("000000000000000000000000000000000000000a"); - - if !precompiled_addresses.contains(&addr.compat()) { - // 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)); - } // else we don't even need to include them, - // because nodes will only emit a precompiled address if - // the transaction calling them reverted. } if do_increment_txn_ix {