Skip to content

fix: address issue with filtering create2 address factory #1065

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

Merged
merged 2 commits into from
Jun 6, 2025
Merged
Changes from all commits
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
11 changes: 8 additions & 3 deletions crates/zksync/core/src/vm/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use zksync_basic_types::{L2ChainId, H160, H256, U256};
use zksync_types::{
get_code_key, get_nonce_key, get_system_context_init_logs, h256_to_u256,
utils::{decompose_full_nonce, storage_key_for_eth_balance},
StorageKey, StorageLog, StorageValue,
StorageKey, StorageLog, StorageValue, CREATE2_FACTORY_ADDRESS,
};
use zksync_vm_interface::storage::ReadStorage;

Expand All @@ -40,6 +40,7 @@ struct DeployedSystemContract {
deployed_contract: zksync_types::block::DeployedContract,
deployed_contract_hash: H256,
}

static DEPLOYED_SYSTEM_CONTRACTS: LazyLock<Vec<DeployedSystemContract>> = LazyLock::new(|| {
let contracts = anvil_zksync_core::deps::system_contracts::get_deployed_contracts(
anvil_zksync_config::types::SystemContractsOptions::BuiltInWithoutSecurity,
Expand All @@ -49,7 +50,12 @@ static DEPLOYED_SYSTEM_CONTRACTS: LazyLock<Vec<DeployedSystemContract>> = LazyLo

let filtered = contracts.into_iter().filter(|contract| {
let addr = contract.account_id.address();
// If `addr` matches any entry in NON_KERNEL_CONTRACT_LOCATIONS, drop it:

if *addr == CREATE2_FACTORY_ADDRESS {
return true;
}

// Drop anything that matches a non-kernel contract location.
!NON_KERNEL_CONTRACT_LOCATIONS.iter().any(|(_name, a, _ver)| *a == *addr)
});

Expand All @@ -60,7 +66,6 @@ static DEPLOYED_SYSTEM_CONTRACTS: LazyLock<Vec<DeployedSystemContract>> = LazyLo
})
.collect()
});

pub struct ZKVMData<'a, DB: Database> {
ecx: &'a mut InnerEvmContext<DB>,
pub factory_deps: HashMap<H256, Vec<u8>>,
Expand Down