Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 207 files
27 changes: 27 additions & 0 deletions core/lib/constants/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,33 @@ pub const L2_CHAIN_ASSET_HANDLER_ADDRESS: Address = H160([
0x00, 0x01, 0x00, 0x0a,
]);

pub const UPGRADEABLE_BEACON_DEPLOYER_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x0b,
]);

/// todo FIXME, deploy normally instead using DUMMY_ADDRESS and deploying on genesis

pub const DUMMY_ADDRESS_1: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x00, 0x0b,
]);

pub const DUMMY_ADDRESS_2: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x02, 0x01, 0x00, 0x0b,
]);

pub const DUMMY_ADDRESS_3: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x03, 0x01, 0x00, 0x0b,
]);

pub const DUMMY_ADDRESS_4: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x04, 0x01, 0x00, 0x0b,
]);

pub const ERC20_TRANSFER_TOPIC: H256 = H256([
221, 242, 82, 173, 27, 226, 200, 155, 105, 194, 176, 104, 252, 55, 141, 170, 149, 43, 167, 241,
99, 196, 161, 22, 40, 245, 90, 77, 245, 35, 179, 239,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn l1_messenger_contract() -> Contract {
}

pub fn l2_message_root() -> Contract {
load_l1_zk_contract("MessageRoot")
load_l1_zk_contract("L2MessageRoot")
}

pub fn l2_asset_router() -> Contract {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/multivm/src/versions/testonly/upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use zksync_contracts::{deployer_contract, load_sys_contract};
use zksync_contracts::{deployer_contract, load_l1_zk_contract};
use zksync_test_contracts::{TestContract, TxType};
use zksync_types::{
bytecode::BytecodeHash,
Expand Down Expand Up @@ -318,5 +318,5 @@ fn get_complex_upgrade_tx(
}

fn get_complex_upgrader_abi() -> Contract {
load_sys_contract("ComplexUpgrader")
load_l1_zk_contract("L2ComplexUpgrader")
}
19 changes: 18 additions & 1 deletion core/lib/types/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,24 @@ impl Transaction {
.iter()
.map(|b| BytecodeHash::for_bytecode(b).value_u256())
.collect();
anyhow::ensure!(tx.factory_deps == factory_deps_hashes);

// Check factory dependencies with detailed error output
if tx.factory_deps != factory_deps_hashes {
anyhow::bail!(
"ABI Factory dependencies mismatch!\n\
Transaction expects {} deps: {:?}\n\
But provided {} deps: {:?}\n\
Count match: {}\n\
Content match: {}",
tx.factory_deps.len(),
tx.factory_deps,
factory_deps_hashes.len(),
factory_deps_hashes,
tx.factory_deps.len() == factory_deps_hashes.len(),
tx.factory_deps == factory_deps_hashes
);
}

tx.hash()
}
Self::L2(raw) => TransactionRequest::from_bytes_unverified(raw)?.1,
Expand Down
18 changes: 17 additions & 1 deletion core/lib/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,23 @@ impl Transaction {
.iter()
.map(|b| BytecodeHash::for_bytecode(b).value_u256())
.collect();
anyhow::ensure!(tx.factory_deps == factory_deps_hashes);

// Check factory dependencies with detailed error output
if tx.factory_deps != factory_deps_hashes {
anyhow::bail!(
"Factory dependencies mismatch!\n\
Transaction expects {} deps: {:?}\n\
But provided {} deps: {:?}\n\
Count match: {}\n\
Content match: {}",
tx.factory_deps.len(),
tx.factory_deps,
factory_deps_hashes.len(),
factory_deps_hashes,
tx.factory_deps.len() == factory_deps_hashes.len(),
tx.factory_deps == factory_deps_hashes
);
}
for item in &tx.reserved[2..] {
anyhow::ensure!(item == &U256::zero());
}
Expand Down
59 changes: 46 additions & 13 deletions core/lib/types/src/system_contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
use zksync_contracts::{read_sys_contract_bytecode, ContractLanguage, SystemContractsRepo};
use zksync_system_constants::{
BOOTLOADER_UTILITIES_ADDRESS, CODE_ORACLE_ADDRESS, COMPRESSOR_ADDRESS, CREATE2_FACTORY_ADDRESS,
EVENT_WRITER_ADDRESS, EVM_GAS_MANAGER_ADDRESS, EVM_HASHES_STORAGE_ADDRESS,
EVM_PREDEPLOYS_MANAGER_ADDRESS, IDENTITY_ADDRESS, L2_ASSET_ROUTER_ADDRESS,
L2_BRIDGEHUB_ADDRESS, L2_CHAIN_ASSET_HANDLER_ADDRESS, L2_GENESIS_UPGRADE_ADDRESS,
L2_INTEROP_ROOT_STORAGE_ADDRESS, L2_MESSAGE_ROOT_ADDRESS, L2_MESSAGE_VERIFICATION_ADDRESS,
L2_NATIVE_TOKEN_VAULT_ADDRESS, L2_WRAPPED_BASE_TOKEN_IMPL, MODEXP_PRECOMPILE_ADDRESS,
PUBDATA_CHUNK_PUBLISHER_ADDRESS, SECP256R1_VERIFY_PRECOMPILE_ADDRESS, SLOAD_CONTRACT_ADDRESS,
DUMMY_ADDRESS_1, DUMMY_ADDRESS_2, DUMMY_ADDRESS_3, DUMMY_ADDRESS_4, EVENT_WRITER_ADDRESS,
EVM_GAS_MANAGER_ADDRESS, EVM_HASHES_STORAGE_ADDRESS, EVM_PREDEPLOYS_MANAGER_ADDRESS,
IDENTITY_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BRIDGEHUB_ADDRESS,
L2_CHAIN_ASSET_HANDLER_ADDRESS, L2_GENESIS_UPGRADE_ADDRESS, L2_INTEROP_ROOT_STORAGE_ADDRESS,
L2_MESSAGE_ROOT_ADDRESS, L2_MESSAGE_VERIFICATION_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS,
L2_WRAPPED_BASE_TOKEN_IMPL, MODEXP_PRECOMPILE_ADDRESS, PUBDATA_CHUNK_PUBLISHER_ADDRESS,
SECP256R1_VERIFY_PRECOMPILE_ADDRESS, SLOAD_CONTRACT_ADDRESS,
UPGRADEABLE_BEACON_DEPLOYER_ADDRESS,
};

use crate::{
Expand All @@ -29,7 +31,7 @@
pub const TX_NONCE_INCREMENT: U256 = U256([1, 0, 0, 0]); // 1
pub const DEPLOYMENT_NONCE_INCREMENT: U256 = U256([0, 0, 1, 0]); // 2^128

static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 40] = [
static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 45] = [
(
"",
"AccountCodeStorage",
Expand Down Expand Up @@ -158,8 +160,8 @@
),
("", "Compressor", COMPRESSOR_ADDRESS, ContractLanguage::Sol),
(
"",
"ComplexUpgrader",
"../../l1-contracts/zkout/",
"L2ComplexUpgrader",
COMPLEX_UPGRADER_ADDRESS,
ContractLanguage::Sol,
),
Expand Down Expand Up @@ -203,20 +205,20 @@
ContractLanguage::Sol,
),
(
"",
"../../l1-contracts/zkout/",
"L2GenesisUpgrade",
L2_GENESIS_UPGRADE_ADDRESS,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"Bridgehub",
"L2Bridgehub",
L2_BRIDGEHUB_ADDRESS,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"MessageRoot",
"L2MessageRoot",
L2_MESSAGE_ROOT_ADDRESS,
ContractLanguage::Sol,
),
Expand Down Expand Up @@ -258,10 +260,41 @@
),
(
"../../l1-contracts/zkout/",
"ChainAssetHandler",
"L2ChainAssetHandler",
L2_CHAIN_ASSET_HANDLER_ADDRESS,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"UpgradeableBeaconDeployer",
UPGRADEABLE_BEACON_DEPLOYER_ADDRESS,
ContractLanguage::Sol,
),
/// todo FIXME, deploy normally instead using DUMMY_ADDRESS and deploying on genesis

Check failure on line 273 in core/lib/types/src/system_contracts.rs

View workflow job for this annotation

GitHub Actions / Build contract verifier / Prepare contracts

unused doc comment

Check failure on line 273 in core/lib/types/src/system_contracts.rs

View workflow job for this annotation

GitHub Actions / Build core images / Prepare contracts

unused doc comment

Check failure on line 273 in core/lib/types/src/system_contracts.rs

View workflow job for this annotation

GitHub Actions / Build prover images / Get protocol version

unused doc comment
(
"../../l1-contracts/zkout/",
"TransparentUpgradeableProxy",
DUMMY_ADDRESS_1,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"BridgedStandardERC20",
DUMMY_ADDRESS_2,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"UpgradeableBeacon",
DUMMY_ADDRESS_3,
ContractLanguage::Sol,
),
(
"../../l1-contracts/zkout/",
"BeaconProxy",
DUMMY_ADDRESS_4,
ContractLanguage::Sol,
),
];

/// Gets default set of system contracts, based on Cargo workspace location.
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ts-integration/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function readContract(path: string, fileName: string, contractName?: string) {
contractName = contractName || fileName;
return JSON.parse(fs.readFileSync(`${path}/${fileName}.sol/${contractName}.json`, { encoding: 'utf-8' }));
}
export const ArtifactBridgeHub = readContract(`${ARTIFACTS_PATH}`, 'Bridgehub');
export const ArtifactL1BridgeHub = readContract(`${ARTIFACTS_PATH}`, 'L1Bridgehub');
export const ArtifactL2InteropRootStorage = readContract(`${SYSTEM_ARTIFACTS_PATH}`, 'L2InteropRootStorage');
export const ArtifactL2MessageVerification = readContract(`${ARTIFACTS_PATH}`, 'L2MessageVerification');
export const ArtifactNativeTokenVault = readContract(`${ARTIFACTS_PATH}`, 'L2NativeTokenVault');
Expand Down
4 changes: 2 additions & 2 deletions core/tests/ts-integration/tests/interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
L2_INTEROP_ROOT_STORAGE_ADDRESS,
ArtifactL2MessageVerification,
ArtifactL2InteropRootStorage,
ArtifactBridgeHub,
ArtifactL1BridgeHub,
GATEWAY_CHAIN_ID
} from '../src/constants';
import { FinalizeWithdrawalParams } from 'zksync-ethers/build/types';
Expand All @@ -37,7 +37,7 @@ describe('Interop behavior checks', () => {
// Skip interop tests if the SL is the same as the L1.
const bridgehub = new ethers.Contract(
await alice.provider.getBridgehubContractAddress(),
ArtifactBridgeHub.abi,
ArtifactL1BridgeHub.abi,
alice.providerL1
);

Expand Down
4 changes: 2 additions & 2 deletions core/tests/upgrade-test/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts {
require(`${CONTRACTS_FOLDER}/l2-contracts/zkout/ForceDeployUpgrader.sol/ForceDeployUpgrader.json`).abi
),
complexUpgraderAbi: new ethers.Interface(
require(`${CONTRACTS_FOLDER}/system-contracts/zkout/ComplexUpgrader.sol/ComplexUpgrader.json`).abi
require(`${CONTRACTS_FOLDER}/l1-contracts/zkout/L2ComplexUpgrader.sol/L2ComplexUpgrader.json`).abi
),
counterBytecode: require(
`${pathToHome}/core/tests/ts-integration/artifacts-zk/contracts/counter/counter.sol/Counter.json`
Expand Down Expand Up @@ -93,7 +93,7 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts {
).abi
),
complexUpgraderAbi: new ethers.Interface(
require(`${pathToHome}/contracts/system-contracts/zkout/ComplexUpgrader.sol/ComplexUpgrader.json`).abi
require(`${pathToHome}/contracts/l1-contracts/zkout/L2ComplexUpgrader.sol/L2ComplexUpgrader.json`).abi
),
counterBytecode: require(`${pathToHome}/core/tests/ts-integration/zkout/counter.sol/Counter.json`)
.deployedBytecode,
Expand Down
10 changes: 5 additions & 5 deletions etc/env/file_based/genesis.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
genesis_protocol_semantic_version: 0.30.0
genesis_protocol_version: null
genesis_root: 0x1bdeda5b7b0e74c74678421c0ecd626647406edcef2c4c68507e2276442fe9ac
genesis_rollup_leaf_index: 84
genesis_batch_commitment: 0x67ca7a4c10155b6501285ea0615c032d7769dd3d7e6efcbbcc67abfac804ab5e
genesis_root: 0x5f7fde2daf08a8037edf3f4f2d45cd6d178835c2b6df9aaf3db8d3cd9ebd82af
genesis_rollup_leaf_index: 94
genesis_batch_commitment: 0x2e9156d503241c1155f94a797bdf332c8767b2e39f3bc28aac974900529656ec
bootloader_hash: 0x0100091118d2d6c46d8e646b67026ef848826845d0aff1cb72cddb6b98e4e90c
default_aa_hash: 0x010005f7e776333ac3ade732ccdc91816d895597b0727934404c484ae5bbec0f
default_aa_hash: 0x010005f7fc2bd2320582602ba8e850df381b4ada8c613b4efc7883be575083e9
evm_emulator_hash: 0x01000d8bae37b82f311186426184866498b357f41d7a02ced11f3e3fbfbacd63
l1_chain_id: 9
l2_chain_id: 270
fee_account: '0x0000000000000000000000000000000000000001'
l1_batch_commit_data_generator_mode: Rollup
prover:
snark_wrapper_vk_hash: 0x1ffc56111a5cfaf5db387f6a31408ad20217e9bc1f31f2f5c1bd38b0d6d7968b
snark_wrapper_vk_hash: 0x458e1f1070854a8e1befedc26ead1d6964c330ddf78aab9c13915e0f500f85b0
fflonk_snark_wrapper_vk_hash: 0x49eae0bf5c7ea580f4979b366e52b386adc5f42e2ce50fc1d3c4de9a86052bff
dummy_verifier: true
custom_genesis_state_path: null
2 changes: 1 addition & 1 deletion infrastructure/scripts/interop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ zkstack ecosystem init --deploy-paymaster --deploy-erc20 \
--ignore-prerequisites --observability=false \
--chain era \
--update-submodules false

zkstack dev generate-genesis

zkstack ecosystem init --deploy-paymaster --deploy-erc20 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct GatewayVotePreparationConfig {
pub owner_address: Address,
pub testnet_verifier: bool,
pub support_l2_legacy_shared_bridge_test: bool,
pub is_zk_sync_os: bool,
pub contracts: GatewayContractsConfig,
pub tokens: TokensConfig,
pub refund_recipient: Address,
Expand All @@ -66,6 +67,7 @@ impl GatewayVotePreparationConfig {
gateway_chain_id: U256,
owner_address: Address,
testnet_verifier: bool,
is_zk_sync_os: bool,
refund_recipient: Address,
) -> Self {
let contracts = GatewayContractsConfig {
Expand Down Expand Up @@ -123,6 +125,7 @@ impl GatewayVotePreparationConfig {
owner_address,
testnet_verifier,
support_l2_legacy_shared_bridge_test: false,
is_zk_sync_os,
contracts,
tokens,
refund_recipient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub async fn run(convert_to_gw_args: ConvertToGatewayArgs, shell: &Shell) -> any
chain_config.chain_id.as_u64().into(),
ecosystem_config.get_contracts_config()?.l1.governance_addr,
ecosystem_config.prover_version == ProverMode::NoProofs,
chain_config.zksync_os,
chain_deployer_wallet.address,
),
l1_url.clone(),
Expand Down
Loading