Skip to content

Commit

Permalink
Tweak feature gating
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Sep 23, 2024
1 parent 2c0e447 commit c67e6fd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
41 changes: 20 additions & 21 deletions trace_decoder/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ fn middle<StateTrieT: StateTrie + Clone>(
Ok(out)
}

#[allow(unused_variables)]
/// Performs all the pre-txn execution rules of the targeted network.
fn do_pre_execution<StateTrieT: StateTrie + Clone>(
block: &BlockMetadata,
Expand All @@ -559,30 +558,31 @@ fn do_pre_execution<StateTrieT: StateTrie + Clone>(
state_trie: &mut StateTrieT,
) -> anyhow::Result<()> {
// Ethereum mainnet: EIP-4788
#[cfg(feature = "eth_mainnet")]
do_beacon_hook(
block.block_timestamp,
storage,
trim_storage,
block.parent_beacon_block_root,
trim_state,
state_trie,
)?;
if cfg!(feature = "eth_mainnet") {
return do_beacon_hook(
block.block_timestamp,
storage,
trim_storage,
block.parent_beacon_block_root,
trim_state,
state_trie,
);
}

#[cfg(feature = "cdk_erigon")]
do_scalable_hook(
block,
ger_data,
storage,
trim_storage,
trim_state,
state_trie,
)?;
if cfg!(feature = "cdk_erigon") {
return do_scalable_hook(
block,
ger_data,
storage,
trim_storage,
trim_state,
state_trie,
);
}

Ok(())
}

#[cfg(feature = "cdk_erigon")]
/// Updates the storage of the Scalable and GER contracts, according to
/// <https://docs.polygon.technology/zkEVM/architecture/proving-system/processing-l2-blocks/#etrog-upgrade-fork-id-6>.
///
Expand Down Expand Up @@ -683,7 +683,6 @@ fn do_scalable_hook<StateTrieT: StateTrie + Clone>(
Ok(())
}

#[cfg(feature = "eth_mainnet")]
/// Updates the storage of the beacon block root contract,
/// according to <https://eips.ethereum.org/EIPS/eip-4788>
///
Expand Down
6 changes: 3 additions & 3 deletions zero/src/rpc/native/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ pub fn process_states_access(
) -> anyhow::Result<HashMap<Address, HashSet<StorageKey>>> {
let mut state_access = HashMap::<Address, HashSet<StorageKey>>::new();

#[cfg(feature = "eth_mainnet")]
insert_beacon_roots_update(&mut state_access, block)?;
if cfg!(feature = "eth_mainnet") {
insert_beacon_roots_update(&mut state_access, block)?;
}

if let Some(w) = block.withdrawals.as_ref() {
w.iter().for_each(|w| {
Expand All @@ -89,7 +90,6 @@ pub fn process_states_access(
Ok(state_access)
}

#[cfg(feature = "eth_mainnet")]
/// Cancun HF specific, see <https://eips.ethereum.org/EIPS/eip-4788>.
fn insert_beacon_roots_update(
state_access: &mut HashMap<Address, HashSet<StorageKey>>,
Expand Down

0 comments on commit c67e6fd

Please sign in to comment.