diff --git a/.github/workflows/build-contract-verifier-template.yml b/.github/workflows/build-contract-verifier-template.yml
index 9c53ca1dc484..973ed9edcb4d 100644
--- a/.github/workflows/build-contract-verifier-template.yml
+++ b/.github/workflows/build-contract-verifier-template.yml
@@ -100,7 +100,7 @@ jobs:
if: env.BUILD_CONTRACTS == 'true'
run: |
mkdir ./foundry-zksync
- curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-15bec2f861b3b4c71e58f85e2b2c9dd722585aa8/foundry_nightly_linux_amd64.tar.gz
+ curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-27360d4c8d12beddbb730dae07ad33a206b38f4b/foundry_nightly_linux_amd64.tar.gz
tar zxf foundry_nightly_linux_amd64.tar.gz -C ./foundry-zksync
chmod +x ./foundry-zksync/forge ./foundry-zksync/cast
echo "$PWD/foundry-zksync" >> $GITHUB_PATH
diff --git a/.github/workflows/build-core-template.yml b/.github/workflows/build-core-template.yml
index c76a75e9b3ea..122bbd747147 100644
--- a/.github/workflows/build-core-template.yml
+++ b/.github/workflows/build-core-template.yml
@@ -105,7 +105,7 @@ jobs:
if: env.BUILD_CONTRACTS == 'true'
run: |
mkdir ./foundry-zksync
- curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-15bec2f861b3b4c71e58f85e2b2c9dd722585aa8/foundry_nightly_linux_amd64.tar.gz
+ curl -LO https://github.com/matter-labs/foundry-zksync/releases/download/nightly-27360d4c8d12beddbb730dae07ad33a206b38f4b/foundry_nightly_linux_amd64.tar.gz
tar zxf foundry_nightly_linux_amd64.tar.gz -C ./foundry-zksync
chmod +x ./foundry-zksync/forge ./foundry-zksync/cast
echo "$PWD/foundry-zksync" >> $GITHUB_PATH
diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml
index d76bb776968d..25a0da838f42 100644
--- a/.github/workflows/ci-core-reusable.yml
+++ b/.github/workflows/ci-core-reusable.yml
@@ -65,15 +65,12 @@ jobs:
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup
- ci_run zkstackup -g --local
+ ci_run zkstackup -g --local --cargo-features gateway
- name: Build contracts
run: |
ci_run zkstack dev contracts
- - name: Contracts unit tests
- run: ci_run yarn l1-contracts test
-
- name: Download compilers for contract verifier tests
run: ci_run zkstack contract-verifier init --zksolc-version=v1.5.3 --zkvyper-version=v1.5.4 --solc-version=0.8.26 --vyper-version=v0.3.10 --era-vm-solc-version=0.8.26-1.0.1 --only --chain era
@@ -131,7 +128,7 @@ jobs:
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
- ci_run zkstackup -g --local
+ ci_run zkstackup -g --local --cargo-features gateway
- name: Create and initialize legacy chain
@@ -150,7 +147,7 @@ jobs:
--legacy-bridge \
--evm-emulator false
- ci_run zkstack ecosystem init --dev --verbose
+ ci_run zkstack ecosystem init --dev --support-l2-legacy-shared-bridge-test true --verbose
# `sleep 60` because we need to wait until server added all the tokens
- name: Run server
@@ -174,13 +171,22 @@ jobs:
integration-tests:
runs-on: [ matterlabs-ci-runner-ultra-performance ]
+ strategy:
+ # ----------------------------------------------
+ # Note, that while the contracts do support gateway chain
+ # in reality it won't exist for quite some time and so
+ # we will test both cases here
+ # ----------------------------------------------
+ matrix:
+ use_gateway_chain: [ "WITH_GATEWAY", "WITHOUT_GATEWAY" ]
+ # In some cases it's useful to continue one job even if another fails.
+ fail-fast: false
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
submodules: "recursive"
fetch-depth: 0
-
- name: Setup environment
run: |
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV
@@ -200,7 +206,7 @@ jobs:
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
- ci_run zkstackup -g --local
+ ci_run zkstackup -g --local --cargo-features gateway
- name: Create log directories
run: |
@@ -270,7 +276,8 @@ jobs:
--l1-rpc-url=http://localhost:8545 \
--server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--server-db-name=zksync_server_localhost_validium \
- --chain validium
+ --chain validium \
+ --validium-type no-da
- name: Create and initialize chain with Custom Token
run: |
@@ -292,7 +299,8 @@ jobs:
--l1-rpc-url=http://localhost:8545 \
--server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--server-db-name=zksync_server_localhost_custom_token \
- --chain custom_token
+ --chain custom_token \
+ --validium-type no-da
- name: Create and register chain with transactions signed "offline"
run: |
@@ -314,7 +322,7 @@ jobs:
governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml)
ci_run zkstack dev send-transactions \
- --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \
+ --file ./transactions/chain/offline_chain/register-zk-chain-txns.json \
--l1-rpc-url http://127.0.0.1:8545 \
--private-key $governor_pk
@@ -350,13 +358,67 @@ jobs:
--l1-rpc-url=http://localhost:8545 \
--server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
--server-db-name=zksync_server_localhost_consensus \
- --chain consensus
+ --chain consensus \
+ --validium-type no-da
- name: Export chain list to environment variable
run: |
CHAINS="era,validium,custom_token,consensus"
echo "CHAINS=$CHAINS" >> $GITHUB_ENV
+ # ----------------------------------------------------------------
+ # Only create/initialize the gateway chain *if* use_gateway_chain=WITH_GATEWAY
+ # ----------------------------------------------------------------
+ - name: Initialize gateway chain
+ if: matrix.use_gateway_chain == 'WITH_GATEWAY'
+ run: |
+ ci_run zkstack chain create \
+ --chain-name gateway \
+ --chain-id 505 \
+ --prover-mode no-proofs \
+ --wallet-creation localhost \
+ --l1-batch-commit-data-generator-mode rollup \
+ --base-token-address 0x0000000000000000000000000000000000000001 \
+ --base-token-price-nominator 1 \
+ --base-token-price-denominator 1 \
+ --set-as-default false \
+ --ignore-prerequisites \
+ --evm-emulator false
+
+ ci_run zkstack chain init \
+ --deploy-paymaster \
+ --l1-rpc-url=http://localhost:8545 \
+ --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \
+ --server-db-name=zksync_server_localhost_gateway \
+ --chain gateway \
+ --validium-type no-da
+
+ ci_run zkstack chain convert-to-gateway --chain gateway --ignore-prerequisites
+
+ - name: Run gateway
+ if: matrix.use_gateway_chain == 'WITH_GATEWAY'
+ run: |
+ ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
+ ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
+
+ - name: Migrate chains to gateway
+ if: matrix.use_gateway_chain == 'WITH_GATEWAY'
+ run: |
+ ci_run zkstack chain migrate-to-gateway --chain era --gateway-chain-name gateway
+ ci_run zkstack chain migrate-to-gateway --chain validium --gateway-chain-name gateway
+ ci_run zkstack chain migrate-to-gateway --chain custom_token --gateway-chain-name gateway
+ ci_run zkstack chain migrate-to-gateway --chain consensus --gateway-chain-name gateway
+
+ - name: Migrate back era
+ if: matrix.use_gateway_chain == 'WITH_GATEWAY'
+ run: |
+ ci_run zkstack chain migrate-from-gateway --chain era --gateway-chain-name gateway
+
+ - name: Migrate to gateway again
+ if: matrix.use_gateway_chain == 'WITH_GATEWAY'
+ run: |
+ ci_run zkstack chain migrate-to-gateway --chain era --gateway-chain-name gateway
+
- name: Build test dependencies
run: |
ci_run zkstack dev test build
@@ -402,20 +464,22 @@ jobs:
- name: Init external nodes
run: |
+ GATEWAY_RPC_URL="${{ matrix.use_gateway_chain == 'WITH_GATEWAY' && '--gateway-rpc-url=http://localhost:3550' || '' }}"
+
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
- --db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 --chain era
+ --db-name=zksync_en_localhost_era_rollup --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain era
ci_run zkstack external-node init --ignore-prerequisites --chain era
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
- --db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 --chain validium
+ --db-name=zksync_en_localhost_era_validium1 --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain validium
ci_run zkstack external-node init --ignore-prerequisites --chain validium
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
- --db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 --chain custom_token
+ --db-name=zksync_en_localhost_era_custom_token --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain custom_token
ci_run zkstack external-node init --ignore-prerequisites --chain custom_token
ci_run zkstack external-node configs --db-url=postgres://postgres:notsecurepassword@localhost:5432 \
- --db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 --chain consensus
+ --db-name=zksync_en_localhost_era_consensus --l1-rpc-url=http://localhost:8545 $GATEWAY_RPC_URL --chain consensus
ci_run zkstack external-node init --ignore-prerequisites --chain consensus
- name: Run recovery tests (from snapshot)
@@ -432,7 +496,7 @@ jobs:
ci_run zkstack external-node run --ignore-prerequisites --chain validium &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/validium.log &
ci_run zkstack external-node run --ignore-prerequisites --chain custom_token &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/custom_token.log &
ci_run zkstack external-node run --ignore-prerequisites --chain consensus --enable-consensus &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/consensus.log &
-
+
ci_run zkstack external-node wait --ignore-prerequisites --verbose --chain era
ci_run zkstack external-node wait --ignore-prerequisites --verbose --chain validium
ci_run zkstack external-node wait --ignore-prerequisites --verbose --chain custom_token
@@ -445,6 +509,14 @@ jobs:
- name: Fee projection tests
run: |
ci_run killall -INT zksync_server || true
+
+ # Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
+ if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
+ ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
+ ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
+ fi
+
+ # Always run the chain-specific fee tests
ci_run ./bin/run_on_all_chains.sh "zkstack dev test fees --no-deps --no-kill" ${{ env.CHAINS }} ${{ env.FEES_LOGS_DIR }}
- name: Run revert tests
@@ -452,6 +524,13 @@ jobs:
ci_run killall -INT zksync_server || true
ci_run killall -INT zksync_external_node || true
+ # Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
+ if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
+ ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
+ ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
+ fi
+
+ # Always run the chain-specific revert tests
ci_run ./bin/run_on_all_chains.sh "zkstack dev test revert --no-deps --external-node --no-kill --ignore-prerequisites" ${{ env.CHAINS }} ${{ env.INTEGRATION_TESTS_LOGS_DIR }}
# Upgrade tests should run last, because as soon as they
@@ -459,12 +538,20 @@ jobs:
# TODO make upgrade tests safe to run multiple times
- name: Run upgrade test
run: |
- ci_run zkstack dev test upgrade --no-deps --chain era
+ ci_run killall -INT zksync_server || true
+ # Only start & wait for the gateway server if use_gateway_chain == WITH_GATEWAY
+ if [ "${{ matrix.use_gateway_chain }}" == "WITH_GATEWAY" ]; then
+ ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
+ ci_run zkstack server wait --ignore-prerequisites --verbose --chain gateway
+ fi
+
+ # Always run the upgrade test against era
+ ci_run zkstack dev test upgrade --no-deps --chain era
- name: Upload logs
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
- name: logs
+ name: logs_${{matrix.use_gateway_chain}}
path: logs
diff --git a/.github/workflows/ci-prover-e2e.yml b/.github/workflows/ci-prover-e2e.yml
index 77d3e2da5758..0a09aee51315 100644
--- a/.github/workflows/ci-prover-e2e.yml
+++ b/.github/workflows/ci-prover-e2e.yml
@@ -43,10 +43,19 @@ jobs:
run: |
git fetch
# Checkout the commit with the DualVerifier contract to test FFLONK interface
- git checkout b4d5b984
+ git checkout bcdd1cb05e8f4d9ec2dd41e2cc668cdfe30ee535
git submodule update --init --recursive
git rev-parse HEAD
+ - name: Set new genesis for fflonk
+ # Note, that while `Verifier` is not explicitly a part of the genensis state,
+ # it affects it indirectly as it is a part of the repo.
+ working-directory: ./etc/env/file_based
+ if: matrix.compressor-mode == 'fflonk'
+ run: |
+ sudo sed -i 's/^genesis_root: .*/genesis_root: 0xc3fa60b6769a0c2f222053d7cbd1d6f63be7777e3c8d029cbd61cc075526ab81/' genesis.yaml
+ sudo sed -i "s/^genesis_batch_commitment: .*/genesis_batch_commitment: 0x17689e705b5749ed0bbd53c845988d17c419697c2cb29eabab8785f1cb775b4a/" genesis.yaml
+
- name: Init
run: |
ci_run chmod -R +x ./bin
@@ -88,13 +97,13 @@ jobs:
- name: Run server
run: |
ci_run zkstack server --uring --chain=proving_chain --components=api,tree,eth,state_keeper,commitment_generator,proof_data_handler,vm_runner_protective_reads,vm_runner_bwip &>prover_logs_${{matrix.compressor-mode}}/server.log &
- - name: Run Gateway
+ - name: Run prover gateway
run: |
ci_run zkstack prover run --component=gateway --docker=false &>prover_logs_${{matrix.compressor-mode}}/gateway.log &
- name: Run Prover Job Monitor
run: |
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs_${{matrix.compressor-mode}}/prover-job-monitor.log &
- - name: Wait for batch to be passed through gateway
+ - name: Wait for batch to be passed through prover gateway
env:
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
BATCH_NUMBER: 1
@@ -126,10 +135,10 @@ jobs:
- name: Wait for batch to be executed on L1
env:
- DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
- BATCH_NUMBER: 1
- INTERVAL: 30
- TIMEOUT: 1200
+ DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
+ BATCH_NUMBER: 1
+ INTERVAL: 30
+ TIMEOUT: 1200
run: |
PASSED_ENV_VARS="BATCH_NUMBER,DATABASE_URL,URL,INTERVAL,TIMEOUT" \
ci_run ./bin/prover_checkers/batch_l1_status_checker
diff --git a/.github/workflows/ci-prover-reusable.yml b/.github/workflows/ci-prover-reusable.yml
index 7f719b2240db..26679cb2232f 100644
--- a/.github/workflows/ci-prover-reusable.yml
+++ b/.github/workflows/ci-prover-reusable.yml
@@ -1,6 +1,7 @@
name: Workflow template for CI jobs for Prover Components
on:
workflow_call:
+
jobs:
lint:
runs-on: [ matterlabs-ci-runner-highmem-long ]
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c502a5f0c205..899eaea4b445 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -23,6 +23,7 @@ jobs:
docs: ${{ steps.changed-files.outputs.docs_any_changed }}
all: ${{ steps.changed-files.outputs.all_any_changed }}
steps:
+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
fetch-depth: 2
diff --git a/.github/workflows/vm-perf-comparison.yml b/.github/workflows/vm-perf-comparison.yml
index 3520419f1337..ac83485a2c12 100644
--- a/.github/workflows/vm-perf-comparison.yml
+++ b/.github/workflows/vm-perf-comparison.yml
@@ -47,25 +47,26 @@ jobs:
run: |
run_retried docker compose pull zk
docker compose up -d zk
-
+
- name: run benchmarks on base branch
shell: bash
run: |
ci_run zkstackup -g --local
- ci_run zkstack dev contracts --system-contracts
+ ci_run zkstack dev contracts
ci_run cargo bench --package vm-benchmark --bench instructions -- --verbose || echo "Instructions benchmark is missing"
ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee base-opcodes
- name: checkout PR
run: |
git checkout --force FETCH_HEAD --recurse-submodules
+ git submodule update --init --recursive
- name: run benchmarks on PR
shell: bash
id: comparison
run: |
ci_run zkstackup -g --local
- ci_run zkstack dev contracts --system-contracts
+ ci_run zkstack dev contracts
ci_run cargo bench --package vm-benchmark --bench instructions -- --verbose
ci_run cargo bench --package vm-benchmark --bench instructions -- --print > instructions.log 2>/dev/null
diff --git a/Cargo.lock b/Cargo.lock
index d6e7503bd20f..4744b424cea0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11810,6 +11810,7 @@ dependencies = [
"tokio-stream",
"tonic 0.11.0",
"tracing",
+ "url",
"zksync_basic_types",
"zksync_config",
"zksync_da_client",
@@ -11931,7 +11932,6 @@ dependencies = [
"assert_matches",
"async-trait",
"chrono",
- "once_cell",
"serde",
"test-casing",
"test-log",
diff --git a/contracts b/contracts
index 46d75088e7dd..16dedf6d7769 160000
--- a/contracts
+++ b/contracts
@@ -1 +1 @@
-Subproject commit 46d75088e7ddb534101874c3ec15b877da1cb417
+Subproject commit 16dedf6d77695ce00f81fce35a3066381b97fca1
diff --git a/core/bin/external_node/src/config/mod.rs b/core/bin/external_node/src/config/mod.rs
index db2c6eac9cf6..235802e1073b 100644
--- a/core/bin/external_node/src/config/mod.rs
+++ b/core/bin/external_node/src/config/mod.rs
@@ -128,6 +128,7 @@ pub(crate) struct RemoteENConfig {
pub l2_weth_bridge_addr: Option
,
pub l2_testnet_paymaster_addr: Option,
pub l2_timestamp_asserter_addr: Option,
+ pub l1_wrapped_base_token_store: Option,
pub base_token_addr: Address,
pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode,
pub dummy_verifier: bool,
@@ -195,6 +196,9 @@ impl RemoteENConfig {
l1_bytecodes_supplier_addr: ecosystem_contracts
.as_ref()
.and_then(|a| a.l1_bytecodes_supplier_addr),
+ l1_wrapped_base_token_store: ecosystem_contracts
+ .as_ref()
+ .and_then(|a| a.l1_wrapped_base_token_store),
l1_diamond_proxy_addr,
l2_testnet_paymaster_addr,
l1_erc20_bridge_proxy_addr: bridges.l1_erc20_default_bridge,
@@ -235,6 +239,7 @@ impl RemoteENConfig {
l2_shared_bridge_addr: Some(Address::repeat_byte(6)),
l2_legacy_shared_bridge_addr: Some(Address::repeat_byte(7)),
l1_batch_commit_data_generator_mode: L1BatchCommitmentMode::Rollup,
+ l1_wrapped_base_token_store: None,
dummy_verifier: true,
l2_timestamp_asserter_addr: None,
}
@@ -1477,6 +1482,7 @@ impl From<&ExternalNodeConfig> for InternalApiConfig {
l2_weth_bridge: config.remote.l2_weth_bridge_addr,
},
l1_bytecodes_supplier_addr: config.remote.l1_bytecodes_supplier_addr,
+ l1_wrapped_base_token_store: config.remote.l1_wrapped_base_token_store,
l1_bridgehub_proxy_addr: config.remote.l1_bridgehub_proxy_addr,
l1_state_transition_proxy_addr: config.remote.l1_state_transition_proxy_addr,
l1_transparent_proxy_admin_addr: config.remote.l1_transparent_proxy_admin_addr,
diff --git a/core/lib/basic_types/src/protocol_version.rs b/core/lib/basic_types/src/protocol_version.rs
index 89251b3a2a40..5d896040f760 100644
--- a/core/lib/basic_types/src/protocol_version.rs
+++ b/core/lib/basic_types/src/protocol_version.rs
@@ -75,11 +75,11 @@ pub enum ProtocolVersionId {
impl ProtocolVersionId {
pub const fn latest() -> Self {
- Self::Version25
+ Self::Version26
}
pub const fn next() -> Self {
- Self::Version26
+ Self::Version27
}
pub fn try_from_packed_semver(packed_semver: U256) -> Result {
@@ -123,7 +123,7 @@ impl ProtocolVersionId {
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
- ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
+ ProtocolVersionId::Version26 => VmVersion::VmGateway,
ProtocolVersionId::Version27 => VmVersion::VmGateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not yet supported"),
}
@@ -192,7 +192,7 @@ impl ProtocolVersionId {
}
pub const fn gateway_upgrade() -> Self {
- ProtocolVersionId::Version27
+ ProtocolVersionId::Version26
}
}
@@ -298,7 +298,7 @@ impl From for VmVersion {
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0SmallBootloaderMemory,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
ProtocolVersionId::Version25 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
- ProtocolVersionId::Version26 => VmVersion::Vm1_5_0IncreasedBootloaderMemory,
+ ProtocolVersionId::Version26 => VmVersion::VmGateway,
ProtocolVersionId::Version27 => VmVersion::VmGateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not yet supported"),
}
diff --git a/core/lib/basic_types/src/vm.rs b/core/lib/basic_types/src/vm.rs
index f11f98596f18..4469785c7411 100644
--- a/core/lib/basic_types/src/vm.rs
+++ b/core/lib/basic_types/src/vm.rs
@@ -22,7 +22,7 @@ pub enum VmVersion {
impl VmVersion {
/// Returns the latest supported VM version.
pub const fn latest() -> VmVersion {
- Self::Vm1_5_0IncreasedBootloaderMemory
+ Self::VmGateway
}
}
diff --git a/core/lib/config/src/configs/contracts.rs b/core/lib/config/src/configs/contracts.rs
index f6bd02f2dfae..561e51fa5dd5 100644
--- a/core/lib/config/src/configs/contracts.rs
+++ b/core/lib/config/src/configs/contracts.rs
@@ -9,6 +9,10 @@ pub struct EcosystemContracts {
pub state_transition_proxy_addr: Address,
pub transparent_proxy_admin_addr: Address,
pub l1_bytecodes_supplier_addr: Option,
+ // Note that on the contract side of things this contract is called `L2WrappedBaseTokenStore`,
+ // while on the server side for consistency with the conventions, where the prefix denotes
+ // the location of the contracts we call it `l1_wrapped_base_token_store`
+ pub l1_wrapped_base_token_store: Option,
}
impl EcosystemContracts {
@@ -18,6 +22,7 @@ impl EcosystemContracts {
state_transition_proxy_addr: Address::repeat_byte(0x15),
transparent_proxy_admin_addr: Address::repeat_byte(0x15),
l1_bytecodes_supplier_addr: Some(Address::repeat_byte(0x16)),
+ l1_wrapped_base_token_store: Some(Address::repeat_byte(0x17)),
}
}
}
@@ -50,8 +55,6 @@ pub struct ContractsConfig {
pub base_token_addr: Option,
pub l1_base_token_asset_id: Option,
- pub l2_predeployed_wrapped_base_token_address: Option,
-
pub chain_admin_addr: Option,
pub l2_da_validator_addr: Option,
}
@@ -76,7 +79,6 @@ impl ContractsConfig {
governance_addr: Address::repeat_byte(0x13),
base_token_addr: Some(Address::repeat_byte(0x14)),
l1_base_token_asset_id: Some(H256::repeat_byte(0x15)),
- l2_predeployed_wrapped_base_token_address: Some(Address::repeat_byte(0x1b)),
ecosystem_contracts: Some(EcosystemContracts::for_tests()),
chain_admin_addr: Some(Address::repeat_byte(0x18)),
l2_da_validator_addr: Some(Address::repeat_byte(0x1a)),
diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs
index 3472cf4e7d0a..431fa406d109 100644
--- a/core/lib/config/src/testonly.rs
+++ b/core/lib/config/src/testonly.rs
@@ -268,7 +268,6 @@ impl Distribution for EncodeDist {
ecosystem_contracts: self.sample(rng),
base_token_addr: self.sample_opt(|| rng.gen()),
l1_base_token_asset_id: self.sample_opt(|| rng.gen()),
- l2_predeployed_wrapped_base_token_address: self.sample_opt(|| rng.gen()),
chain_admin_addr: self.sample_opt(|| rng.gen()),
l2_da_validator_addr: self.sample_opt(|| rng.gen()),
}
@@ -763,6 +762,7 @@ impl Distribution for EncodeDist {
state_transition_proxy_addr: rng.gen(),
transparent_proxy_admin_addr: rng.gen(),
l1_bytecodes_supplier_addr: rng.gen(),
+ l1_wrapped_base_token_store: rng.gen(),
}
}
}
diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs
index 9ca679fef899..87f102be39d6 100644
--- a/core/lib/contracts/src/lib.rs
+++ b/core/lib/contracts/src/lib.rs
@@ -37,24 +37,39 @@ const FORGE_PATH_PREFIX: &str = "contracts/l1-contracts/out";
const BRIDGEHUB_CONTRACT_FILE: (&str, &str) = ("bridgehub", "IBridgehub.sol/IBridgehub.json");
const STATE_TRANSITION_CONTRACT_FILE: (&str, &str) = (
"state-transition",
- "StateTransitionManager.sol/StateTransitionManager.json",
+ "ChainTypeManager.sol/ChainTypeManager.json",
);
+const BYTECODE_SUPPLIER_CONTRACT_FILE: (&str, &str) =
+ ("upgrades", "BytecodesSupplier.sol/BytecodesSupplier.json");
const ZKSYNC_HYPERCHAIN_CONTRACT_FILE: (&str, &str) = (
"state-transition/chain-interfaces",
- "IZkSyncHyperchain.sol/IZkSyncHyperchain.json",
+ "IZKChain.sol/IZKChain.json",
);
const DIAMOND_INIT_CONTRACT_FILE: (&str, &str) = (
"state-transition",
"chain-interfaces/IDiamondInit.sol/IDiamondInit.json",
);
const GOVERNANCE_CONTRACT_FILE: (&str, &str) = ("governance", "IGovernance.sol/IGovernance.json");
-const CHAIN_ADMIN_CONTRACT_FILE: (&str, &str) = ("governance", "IChainAdmin.sol/IChainAdmin.json");
+// TODO(EVM-924): We currently only support the "Ownable" chain admin.
+const CHAIN_ADMIN_CONTRACT_FILE: (&str, &str) = (
+ "governance",
+ "IChainAdminOwnable.sol/IChainAdminOwnable.json",
+);
const GETTERS_FACET_CONTRACT_FILE: (&str, &str) = (
"state-transition/chain-interfaces",
"IGetters.sol/IGetters.json",
);
const MULTICALL3_CONTRACT_FILE: (&str, &str) = ("dev-contracts", "Multicall3.sol/Multicall3.json");
+const L1_ASSET_ROUTER_FILE: (&str, &str) = (
+ "bridge/asset-router",
+ "L1AssetRouter.sol/L1AssetRouter.json",
+);
+const L2_WRAPPED_BASE_TOKEN_STORE: (&str, &str) = (
+ "bridge",
+ "L2WrappedBaseTokenStore.sol/L2WrappedBaseTokenStore.json",
+);
+
const VERIFIER_CONTRACT_FILE: (&str, &str) = ("state-transition", "Verifier.sol/Verifier.json");
const DUAL_VERIFIER_CONTRACT_FILE: (&str, &str) = (
"state-transition/verifiers",
@@ -158,6 +173,10 @@ pub fn state_transition_manager_contract() -> Contract {
load_contract_for_both_compilers(STATE_TRANSITION_CONTRACT_FILE)
}
+pub fn bytecode_supplier_contract() -> Contract {
+ load_contract_for_both_compilers(BYTECODE_SUPPLIER_CONTRACT_FILE)
+}
+
pub fn hyperchain_contract() -> Contract {
load_contract_for_both_compilers(ZKSYNC_HYPERCHAIN_CONTRACT_FILE)
}
@@ -170,6 +189,14 @@ pub fn multicall_contract() -> Contract {
load_contract_for_both_compilers(MULTICALL3_CONTRACT_FILE)
}
+pub fn l1_asset_router_contract() -> Contract {
+ load_contract_for_both_compilers(L1_ASSET_ROUTER_FILE)
+}
+
+pub fn wrapped_base_token_store_contract() -> Contract {
+ load_contract_for_both_compilers(L2_WRAPPED_BASE_TOKEN_STORE)
+}
+
pub fn verifier_contract() -> Contract {
let path = format!("{}/{}", FORGE_PATH_PREFIX, DUAL_VERIFIER_CONTRACT_FILE.1);
let zksync_home = home_path();
@@ -190,6 +217,14 @@ pub fn l1_messenger_contract() -> Contract {
load_sys_contract("L1Messenger")
}
+pub fn l2_message_root() -> Contract {
+ load_contract("contracts/l1-contracts/out/MessageRoot.sol/MessageRoot.json")
+}
+
+pub fn l2_rollup_da_validator_bytecode() -> Vec {
+ read_bytecode("contracts/l2-contracts/zkout/RollupL2DAValidator.sol/RollupL2DAValidator.json")
+}
+
/// Reads bytecode from the path RELATIVE to the Cargo workspace location.
pub fn read_bytecode(relative_path: impl AsRef + std::fmt::Debug) -> Vec {
read_bytecode_from_path(relative_path).expect("Failed to open file")
@@ -719,14 +754,14 @@ pub static PRE_BOOJUM_COMMIT_FUNCTION: Lazy = Lazy::new(|| {
serde_json::from_str(abi).unwrap()
});
-pub static SET_CHAIN_ID_EVENT: Lazy = Lazy::new(|| {
+pub static GENESIS_UPGRADE_EVENT: Lazy = Lazy::new(|| {
let abi = r#"
{
"anonymous": false,
"inputs": [
{
"indexed": true,
- "name": "_stateTransitionChain",
+ "name": "_hyperchain",
"type": "address"
},
{
@@ -804,9 +839,14 @@ pub static SET_CHAIN_ID_EVENT: Lazy = Lazy::new(|| {
"indexed": true,
"name": "_protocolVersion",
"type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "_factoryDeps",
+ "type": "bytes[]"
}
],
- "name": "SetChainIdUpgrade",
+ "name": "GenesisUpgrade",
"type": "event"
}"#;
serde_json::from_str(abi).unwrap()
@@ -1422,28 +1462,3 @@ pub static POST_SHARED_BRIDGE_EXECUTE_FUNCTION: Lazy = Lazy::new(|| {
}"#;
serde_json::from_str(abi).unwrap()
});
-
-// Temporary thing, should be removed when new contracts are merged.
-pub static MESSAGE_ROOT_CONTRACT: Lazy = Lazy::new(|| {
- let abi = r#"
- [{
- "inputs": [
- {
- "internalType": "uint256",
- "name": "_chainId",
- "type": "uint256"
- }
- ],
- "name": "getChainRoot",
- "outputs": [
- {
- "internalType": "bytes32",
- "name": "",
- "type": "bytes32"
- }
- ],
- "stateMutability": "view",
- "type": "function"
- }]"#;
- serde_json::from_str(abi).unwrap()
-});
diff --git a/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json b/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json
new file mode 100644
index 000000000000..703a57ae0597
--- /dev/null
+++ b/core/lib/dal/.sqlx/query-33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n COUNT(*)\n FROM\n eth_txs\n WHERE\n confirmed_eth_tx_history_id IS NULL\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "33d49ec6028974fa8b46d7bf1f79e41923477ed8dc179ca0e1fe64b4700e6572"
+}
diff --git a/core/lib/dal/src/eth_sender_dal.rs b/core/lib/dal/src/eth_sender_dal.rs
index 191ea3231d1c..eecd102f395e 100644
--- a/core/lib/dal/src/eth_sender_dal.rs
+++ b/core/lib/dal/src/eth_sender_dal.rs
@@ -86,6 +86,25 @@ impl EthSenderDal<'_, '_> {
Ok(count.try_into().unwrap())
}
+ pub async fn get_unconfirmed_txs_count(&mut self) -> DalResult {
+ let count = sqlx::query!(
+ r#"
+ SELECT
+ COUNT(*)
+ FROM
+ eth_txs
+ WHERE
+ confirmed_eth_tx_history_id IS NULL
+ "#
+ )
+ .instrument("get_unconfirmed_txs_count")
+ .fetch_one(self.storage)
+ .await?
+ .count
+ .unwrap();
+ Ok(count.try_into().unwrap())
+ }
+
pub async fn get_eth_l1_batches(&mut self) -> sqlx::Result {
struct EthTxRow {
number: i64,
diff --git a/core/lib/env_config/src/contracts.rs b/core/lib/env_config/src/contracts.rs
index 457a946d9831..4cd0b021ff20 100644
--- a/core/lib/env_config/src/contracts.rs
+++ b/core/lib/env_config/src/contracts.rs
@@ -10,8 +10,14 @@ impl FromEnv for EcosystemContracts {
.parse()?,
transparent_proxy_admin_addr: std::env::var("CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR")?
.parse()?,
- // Not supported yet
- l1_bytecodes_supplier_addr: None,
+ l1_bytecodes_supplier_addr: std::env::var("CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR")?
+ .parse()
+ .ok(),
+ l1_wrapped_base_token_store: std::env::var(
+ "CONTRACTS_L1_WRAPPED_BASE_TOKEN_STORE_ADDR",
+ )?
+ .parse()
+ .ok(),
})
}
}
@@ -44,6 +50,9 @@ impl FromEnv for ContractsConfig {
#[cfg(test)]
mod tests {
+ use std::str::FromStr;
+
+ use zksync_basic_types::H256;
use zksync_config::configs::EcosystemContracts;
use zksync_system_constants::SHARED_BRIDGE_ETHER_TOKEN_ADDRESS;
@@ -72,11 +81,20 @@ mod tests {
bridgehub_proxy_addr: addr("0x35ea7f92f4c5f433efe15284e99c040110cf6297"),
state_transition_proxy_addr: addr("0xd90f1c081c6117241624e97cb6147257c3cb2097"),
transparent_proxy_admin_addr: addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"),
- l1_bytecodes_supplier_addr: None,
+ l1_bytecodes_supplier_addr: Some(addr(
+ "0x36ea7f92f4c5f433efe15284e99c040110cf6297",
+ )),
+ l1_wrapped_base_token_store: Some(addr(
+ "0x36ea7f92f4c5f433efe15284e99c040110cf6298",
+ )),
}),
base_token_addr: Some(SHARED_BRIDGE_ETHER_TOKEN_ADDRESS),
- l1_base_token_asset_id: None,
- l2_predeployed_wrapped_base_token_address: None,
+ l1_base_token_asset_id: Some(
+ H256::from_str(
+ "0x0000000000000000000000000000000000000001000000000000000000000000",
+ )
+ .unwrap(),
+ ),
chain_admin_addr: Some(addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_da_validator_addr: Some(addr("0xed6fa5c14e7550b4caf2aa2818d24c69cbc347ff")),
l2_timestamp_asserter_addr: Some(addr("0x0000000000000000000000000000000000000002")),
@@ -101,11 +119,16 @@ CONTRACTS_L2_CONSENSUS_REGISTRY_ADDR="D64e136566a9E04eb05B30184fF577F52682D182"
CONTRACTS_L1_MULTICALL3_ADDR="0xcA11bde05977b3631167028862bE2a173976CA11"
CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
+CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR="0x36ea7f92f4c5f433efe15284e99c040110cf6297"
CONTRACTS_L2_LEGACY_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_BRIDGEHUB_PROXY_ADDR="0x35ea7f92f4c5f433efe15284e99c040110cf6297"
CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb2097"
CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"
CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001"
+CONTRACTS_L1_BASE_TOKEN_ASSET_ID="0x0000000000000000000000000000000000000001000000000000000000000000"
+CONTRACTS_L1_WRAPPED_BASE_TOKEN_STORE_ADDR="0x36ea7f92f4c5f433efe15284e99c040110cf6298"
+CONTRACTS_L2_NATIVE_TOKEN_VAULT_PROXY_ADDR="0xfc073319977e314f251eae6ae6be76b0b3baeecf"
+CONTRACTS_PREDEPLOYED_L2_WRAPPED_BASE_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299"
CONTRACTS_CHAIN_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff"
CONTRACTS_L2_DA_VALIDATOR_ADDR="0xed6fa5c14e7550b4caf2aa2818d24c69cbc347ff"
CONTRACTS_L2_TIMESTAMP_ASSERTER_ADDR="0x0000000000000000000000000000000000000002"
diff --git a/core/lib/env_config/src/eth_sender.rs b/core/lib/env_config/src/eth_sender.rs
index b15a153c30c3..3030d4206812 100644
--- a/core/lib/env_config/src/eth_sender.rs
+++ b/core/lib/env_config/src/eth_sender.rs
@@ -61,7 +61,6 @@ mod tests {
aggregated_block_execute_deadline: 4_000,
max_aggregated_tx_gas: 4_000_000,
max_eth_tx_data_size: 120_000,
-
timestamp_criteria_max_allowed_lag: 30,
max_aggregated_blocks_to_commit: 3,
max_aggregated_blocks_to_execute: 4,
diff --git a/core/lib/env_config/src/wallets.rs b/core/lib/env_config/src/wallets.rs
index 3518d56f7b45..e9574be4456f 100644
--- a/core/lib/env_config/src/wallets.rs
+++ b/core/lib/env_config/src/wallets.rs
@@ -33,6 +33,7 @@ impl FromEnv for Wallets {
} else {
None
};
+
Some(EthSender {
operator,
blob_operator,
diff --git a/core/lib/l1_contract_interface/src/i_executor/methods/commit_batches.rs b/core/lib/l1_contract_interface/src/i_executor/methods/commit_batches.rs
index 01e362fb7d65..3487ad81a840 100644
--- a/core/lib/l1_contract_interface/src/i_executor/methods/commit_batches.rs
+++ b/core/lib/l1_contract_interface/src/i_executor/methods/commit_batches.rs
@@ -18,7 +18,7 @@ pub struct CommitBatches<'a> {
pub mode: L1BatchCommitmentMode,
}
-impl Tokenize for CommitBatches<'_> {
+impl Tokenize for &CommitBatches<'_> {
fn into_tokens(self) -> Vec {
let protocol_version = self.l1_batches[0].header.protocol_version.unwrap();
let stored_batch_info = StoredBatchInfo::from(self.last_committed_l1_batch).into_token();
@@ -27,6 +27,7 @@ impl Tokenize for CommitBatches<'_> {
.iter()
.map(|batch| CommitBatchInfo::new(self.mode, batch, self.pubdata_da).into_token())
.collect();
+
if protocol_version.is_pre_gateway() {
vec![stored_batch_info, Token::Array(l1_batches_to_commit)]
} else {
diff --git a/core/lib/l1_contract_interface/src/i_executor/methods/prove_batches.rs b/core/lib/l1_contract_interface/src/i_executor/methods/prove_batches.rs
index 2d02bd5a1764..817448cc1b62 100644
--- a/core/lib/l1_contract_interface/src/i_executor/methods/prove_batches.rs
+++ b/core/lib/l1_contract_interface/src/i_executor/methods/prove_batches.rs
@@ -58,8 +58,10 @@ impl ProveBatches {
}
};
+ let should_use_fflonk = !is_verifier_pre_fflonk || !protocol_version.is_pre_fflonk();
+
if protocol_version.is_pre_gateway() {
- let proof_input = if !is_verifier_pre_fflonk || !protocol_version.is_pre_fflonk() {
+ let proof_input = if should_use_fflonk {
Token::Tuple(vec![
Token::Array(vec![verifier_type.into_token()]),
Token::Array(proof.into_iter().map(Token::Uint).collect()),
@@ -73,7 +75,17 @@ impl ProveBatches {
vec![prev_l1_batch_info, batches_arg, proof_input]
} else {
- let proof_input = Token::Array(proof.into_iter().map(Token::Uint).collect());
+ let proof_input = if should_use_fflonk {
+ Token::Array(
+ vec![verifier_type]
+ .into_iter()
+ .chain(proof)
+ .map(Token::Uint)
+ .collect(),
+ )
+ } else {
+ Token::Array(proof.into_iter().map(Token::Uint).collect())
+ };
let encoded_data = encode(&[prev_l1_batch_info, batches_arg, proof_input]);
let prove_data = [[SUPPORTED_ENCODING_VERSION].to_vec(), encoded_data]
diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs
index 9583e0204f75..5035abf6af60 100644
--- a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs
+++ b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs
@@ -3,6 +3,8 @@
mod commit_batch_info;
mod stored_batch_info;
+pub const SUPPORTED_ENCODING_VERSION: u8 = 0;
+
#[cfg(test)]
mod tests;
@@ -13,5 +15,3 @@ pub use self::{
},
stored_batch_info::StoredBatchInfo,
};
-
-pub const SUPPORTED_ENCODING_VERSION: u8 = 0;
diff --git a/core/lib/multivm/src/versions/shadow/tests.rs b/core/lib/multivm/src/versions/shadow/tests.rs
index 354459853f11..2d3dd5d3ae30 100644
--- a/core/lib/multivm/src/versions/shadow/tests.rs
+++ b/core/lib/multivm/src/versions/shadow/tests.rs
@@ -308,7 +308,6 @@ mod l1_messenger {
use crate::versions::testonly::l1_messenger::*;
#[test]
- #[ignore] // Requires post-gateway system contracts
fn rollup_da_output_hash_match() {
test_rollup_da_output_hash_match::();
}
diff --git a/core/lib/multivm/src/versions/testonly/circuits.rs b/core/lib/multivm/src/versions/testonly/circuits.rs
index de987a8912db..c379372bc970 100644
--- a/core/lib/multivm/src/versions/testonly/circuits.rs
+++ b/core/lib/multivm/src/versions/testonly/circuits.rs
@@ -34,8 +34,19 @@ pub(crate) fn test_circuits() {
let s = res.statistics.circuit_statistic;
// Check `circuit_statistic`.
const EXPECTED: [f32; 13] = [
- 1.34935, 0.15026, 1.66666, 0.00315, 1.0594, 0.00058, 0.00348, 0.00076, 0.11945, 0.14285,
- 0.0, 0.0, 0.0,
+ 1.258627,
+ 0.13982475,
+ 1.6666666,
+ 0.003154238,
+ 0.9247803,
+ 0.00058723404,
+ 0.0034893616,
+ 0.00076709175,
+ 0.11945392,
+ 0.14285715,
+ 0.0,
+ 0.0,
+ 0.0,
];
let actual = [
(s.main_vm, "main_vm"),
diff --git a/core/lib/multivm/src/versions/testonly/l1_messenger.rs b/core/lib/multivm/src/versions/testonly/l1_messenger.rs
index dcbc432aafd0..c8b7b6bd8ed0 100644
--- a/core/lib/multivm/src/versions/testonly/l1_messenger.rs
+++ b/core/lib/multivm/src/versions/testonly/l1_messenger.rs
@@ -1,15 +1,14 @@
use std::rc::Rc;
use ethabi::Token;
-use zksync_contracts::l1_messenger_contract;
+use zksync_contracts::{l1_messenger_contract, l2_rollup_da_validator_bytecode};
use zksync_test_contracts::{TestContract, TxType};
use zksync_types::{
address_to_h256, u256_to_h256, web3::keccak256, Address, Execute, ProtocolVersionId,
L1_MESSENGER_ADDRESS, U256,
};
-use zksync_vm_interface::SystemEnv;
-use super::{default_system_env, ContractToDeploy, TestedVm, VmTesterBuilder};
+use super::{ContractToDeploy, TestedVm, VmTesterBuilder};
use crate::{
interface::{
pubdata::{PubdataBuilder, PubdataInput},
@@ -22,11 +21,6 @@ use crate::{
const L2_DA_VALIDATOR_OUTPUT_HASH_KEY: usize = 5;
const USED_L2_DA_VALIDATOR_ADDRESS_KEY: usize = 6;
-// Bytecode is temporary hardcoded, should be removed after contracts are merged.
-fn l2_rollup_da_validator_bytecode() -> Vec {
- hex::decode("0012000000000002000a000000000002000000000301001900000060043002700000012703400197000100000031035500020000003103550003000000310355000400000031035500050000003103550006000000310355000700000031035500080000003103550009000000310355000a000000310355000b000000310355000c000000310355000d000000310355000e000000310355000f00000031035500100000003103550011000000010355000001270040019d0000008004000039000000400040043f00000001002001900000005d0000c13d000000040030008c000000fe0000413d000000000201043b00000129022001970000012a0020009c000000fe0000c13d000000a40030008c000000fe0000413d0000000002000416000000000002004b000000fe0000c13d0000008402100370000000000202043b000300000002001d0000012b0020009c000000fe0000213d00000003020000290000002302200039000000000032004b000000fe0000813d00000003020000290000000402200039000000000421034f000000000604043b0000012b0060009c000000fe0000213d0000000304000029000700240040003d0000000704600029000000000034004b000000fe0000213d0000004403100370000000000303043b000400000003001d0000006403100370000000000303043b000200000003001d000000040060008c000000fe0000413d0000002002200039000000000221034f000000000202043b000000e00220027000000058022000c90000000804200039000000000064004b000000fe0000213d00000003022000290000002802200039000000000121034f000000000101043b000500e00010027a000600000006001d000000650000c13d00000000090000190000000403000029000000000039004b000000f10000c13d0000014e0040009c000000fb0000a13d0000014001000041000000000010043f0000001101000039000000040010043f00000138010000410000049a000104300000000001000416000000000001004b000000fe0000c13d0000002001000039000001000010044300000120000004430000012801000041000004990001042e000000000800001900000000090000190000014f0040009c000000570000813d0000000403400039000000000063004b000000fe0000213d00000007024000290000001101000367000000000221034f000000000502043b000000e004500270000000000034001a000000570000413d0000000007340019000000000067004b000000fe0000213d00000000020004140000012c0050009c0000007b0000813d0000000003000031000000840000013d000000070330002900000127053001970001000000510355000000000034001a000000570000413d0000000003340019000000000330007b000000570000413d000000000151034f000a00000009001d000800000008001d000900000007001d000001270330019700010000003103e50000012d0020009c000003c20000813d00000000013103df000000c0022002100000012e022001970000012c022001c700010000002103b500000000012103af0000801002000039049804930000040f0000000003010019000000600330027000000127033001970000000100200190000002450000613d0000001f0230003900000130052001970000003f025000390000013104200197000000400200043d0000000004420019000000000024004b000000000600003900000001060040390000012b0040009c0000023f0000213d00000001006001900000023f0000c13d000000400040043f0000000004320436000000000005004b000000b10000613d0000000005540019000000000600003100000011066003670000000007040019000000006806043c0000000007870436000000000057004b000000ad0000c13d0000012f063001980000000005640019000000ba0000613d000000000701034f0000000008040019000000007907043c0000000008980436000000000058004b000000b60000c13d0000001f03300190000000c70000613d000000000161034f0000000303300210000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f00000000001504350000000001020433000000200010008c0000000a05000029000004210000c13d0000000002040433000000400100043d000000400310003900000000002304350000002002100039000000000052043500000040030000390000000000310435000001320010009c0000023f0000213d0000006003100039000000400030043f000001270020009c000001270200804100000040022002100000000001010433000001270010009c00000127010080410000006001100210000000000121019f0000000002000414000001270020009c0000012702008041000000c002200210000000000112019f00000133011001c700008010020000390498048e0000040f0000000100200190000000060600002900000009040000290000000808000029000000fe0000613d000000000901043b0000000108800039000000050080006c000000670000413d000000520000013d000000400100043d000000440210003900000000009204350000002402100039000000000032043500000134020000410000000000210435000000040210003900000000000204350000042d0000013d0000000403400039000000000063004b000001000000a13d00000000010000190000049a0001043000000007014000290000001101100367000000000101043b000400e00010027a0000025d0000c13d000000000900001900000000050300190000000003090019000000020090006c000002f20000c13d000000060050006c000002fd0000813d00000007015000290000001102000367000000000112034f000000000101043b000000f801100270000000010010008c000003030000c13d00000000060500190000014e0060009c0000000604000029000000570000213d0000000403600039000000000043004b000000fe0000213d00000003016000290000002501100039000000000112034f000000000101043b000000000043004b000002fd0000813d000000e8011002700000000703300029000000000432034f0000000503500039000000000404043b000000000031001a0000000607000029000000570000413d000a00000031001d0000000a0070006b000000fe0000213d000000050600008a0000000a0060006b000000570000213d0000000a050000290000000405500039000000000075004b000000fe0000213d0000000a08000029000300070080002d0000000306200360000000000606043b000400000006001d000000e006600272000500000006001d00090110006000cd0000013f0000613d000000090800002900000005068000fa000001100060008c000000570000c13d000000090050002a000000570000413d000200090050002d000000020070006c000000fe0000413d000000f804400270000000400a00043d0000004406a00039000000800700003900000000007604350000002406a000390000000000460435000001410400004100000000004a043500000007055000290000008404a00039000000090900002900000000009404350000000404a0003900000005060000290000000000640435000000000752034f0000001f0890018f00080000000a001d000000a405a0003900000142099001980000000006950019000001610000613d000000000a07034f000000000b05001900000000ac0a043c000000000bcb043600000000006b004b0000015d0000c13d0000000703300029000000000008004b0000016f0000613d000000000797034f0000000308800210000000000906043300000000098901cf000000000989022f000000000707043b0000010008800089000000000787022f00000000078701cf000000000797019f00000000007604350000000907000029000000000675001900000000000604350000001f06700039000001430660019700000000066500190000000004460049000000080500002900000064055000390000000000450435000000000432034f0000001f0510018f000000000216043600000144061001980000000003620019000001850000613d000000000704034f0000000008020019000000007907043c0000000008980436000000000038004b000001810000c13d000000000005004b000001920000613d000000000464034f0000000305500210000000000603043300000000065601cf000000000656022f000000000404043b0000010005500089000000000454022f00000000045401cf000000000464019f0000000000430435000000000312001900000000000304350000001f011000390000014501100197000000080300002900000000013100490000000001210019000001270010009c00000127010080410000006001100210000001270030009c000001270200004100000000020340190000004002200210000000000121019f0000000002000414000001270020009c0000012702008041000000c002200210000000000112019f0000800e02000039049804890000040f000000000301001900000060033002700000012703300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000000805700029000001b80000613d000000000801034f0000000809000029000000008a08043c0000000009a90436000000000059004b000001b40000c13d000000000006004b000001c50000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f00000000006504350000000100200190000003480000613d0000001f01400039000000600110018f0000000802100029000000000012004b00000000010000390000000101004039000100000002001d0000012b0020009c0000023f0000213d00000001001001900000023f0000c13d0000000101000029000000400010043f000000200030008c0000000604000029000000fe0000413d00000008010000290000000001010433000800000001001d00000004010000290000012c0010009c000001e10000413d000000090200002900000005012000fa000001100010008c000000570000c13d0000000103000029000000440130003900000024023000390000000403300039000000020440006c000003660000c13d000001460400004100000001050000290000000000450435000000200400003900000000004304350000000a04000029000000000042043500000150034001980000001f0440018f000000000231001900000007050000290000001105500367000001fa0000613d000000000605034f0000000007010019000000006806043c0000000007870436000000000027004b000001f60000c13d000000000004004b000002070000613d000000000335034f0000000304400210000000000502043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f00000000003204350000000a030000290000001f023000390000015002200197000000000131001900000000000104350000004401200039000001270010009c000001270100804100000060011002100000000102000029000001270020009c00000127020080410000004002200210000000000112019f0000000002000414000001270020009c0000012702008041000000c002200210000000000112019f00008011020000390498048e0000040f000000000301001900000060033002700000001f0430018f0000012f0530019700000127033001970000000100200190000003720000613d0000000102500029000000000005004b0000022c0000613d000000000601034f0000000107000029000000006806043c0000000007870436000000000027004b000002280000c13d000000000004004b000002390000613d000000000151034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000001f0130003900000130011001970000000101100029000900000001001d0000012b0010009c0000038a0000a13d0000014001000041000000000010043f0000004101000039000000040010043f00000138010000410000049a000104300000001f0430018f0000012f023001980000024e0000613d000000000501034f0000000006000019000000005705043c0000000006760436000000000026004b0000024a0000c13d000000000004004b0000025b0000613d000000000121034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000049a00010430000000000800001900000000090000190000014e0030009c000000570000213d0000000402300039000000000062004b000000fe0000213d00000007033000290000001101000367000000000331034f000000000303043b000000e00a30027000000000002a001a000000570000413d00000000072a0019000000000067004b000000fe0000213d0000013600300198000003130000c13d000001390030009c000003190000813d0000013a003001980000031f0000613d000000070420002900000127034001970000000002000414000100000031035500000000004a001a000000570000413d00000000044a0019000000000440007b000000570000413d00090000000a001d000a00000009001d000500000008001d000800000007001d000000000131034f000001270340019700010000003103e5000001270020009c000003c20000213d00000000013103df000000c0022002100000012e022001970000012c022001c700010000002103b500000000012103af0000000202000039049804930000040f00000000030100190000006003300270000001270330019700000001002001900000032a0000613d0000001f0230003900000130052001970000003f025000390000013104200197000000400200043d0000000004420019000000000024004b000000000600003900000001060040390000012b0040009c0000023f0000213d00000001006001900000023f0000c13d000000400040043f0000000004320436000000000005004b000000090a000029000002ad0000613d0000000005540019000000000600003100000011066003670000000007040019000000006806043c0000000007870436000000000057004b000002a90000c13d0000012f063001980000000005640019000002b60000613d000000000701034f0000000008040019000000007907043c0000000008980436000000000058004b000002b20000c13d0000001f03300190000002c30000613d000000000161034f0000000303300210000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f0000000000150435000000400100043d0000000002020433000000200020008c0000000a05000029000003420000c13d00000000020404330000013d02200197000000db03a002100000013e03300197000000000223019f0000013f022001c7000000400310003900000000002304350000002002100039000000000052043500000040030000390000000000310435000001320010009c0000023f0000213d0000006003100039000000400030043f000001270020009c000001270200804100000040022002100000000001010433000001270010009c00000127010080410000006001100210000000000121019f0000000002000414000001270020009c0000012702008041000000c002200210000000000112019f00000133011001c700008010020000390498048e0000040f0000000100200190000000060600002900000008030000290000000508000029000000fe0000613d000000000901043b0000000108800039000000040080006c0000025f0000413d000001060000013d000000400100043d0000004402100039000000000032043500000024021000390000000203000029000000000032043500000134020000410000000000210435000000040210003900000001030000390000042c0000013d0000014001000041000000000010043f0000003201000039000000040010043f00000138010000410000049a00010430000000400200043d0000004403200039000000000013043500000024012000390000000103000039000000000031043500000134010000410000000000120435000000040120003900000002030000390000000000310435000001270020009c0000012702008041000000400120021000000135011001c70000049a00010430000000400100043d0000013702000041000000000021043500000004021000390000000203000039000003240000013d000000400100043d0000013702000041000000000021043500000004021000390000000103000039000003240000013d000000400100043d00000137020000410000000000210435000000040210003900000003030000390000000000320435000001270010009c0000012701008041000000400110021000000138011001c70000049a000104300000001f0430018f0000012f02300198000003330000613d000000000501034f0000000006000019000000005705043c0000000006760436000000000026004b0000032f0000c13d000000000004004b000003400000613d000000000121034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000049a0001043000000044021000390000013b03000041000000000032043500000024021000390000001903000039000004270000013d0000001f0530018f0000012f06300198000000400200043d0000000004620019000003530000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b0000034f0000c13d000000000005004b000003600000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000001270020009c00000127020080410000004002200210000000000112019f0000049a000104300000013405000041000000010600002900000000005604350000000305000039000000000053043500000000000204350000000000410435000001270060009c0000012706008041000000400160021000000135011001c70000049a00010430000000400200043d0000000006520019000000000005004b0000037c0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000068004b000003780000c13d000000000004004b000003600000613d000000000151034f0000000304400210000000000506043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f0000000000160435000003600000013d0000000901000029000000400010043f000000200030008c000000fe0000413d000000010100002900000000010104330000012b0010009c000000fe0000213d000000010230002900000001011000290000001f03100039000000000023004b000000fe0000813d00000000140104340000012b0040009c0000023f0000213d00000005034002100000003f05300039000001470550019700000009055000290000012b0050009c0000023f0000213d000000400050043f000000090500002900000000004504350000000003130019000000000023004b000000fe0000213d000000000004004b000003ae0000613d0000000902000029000000200220003900000000140104340000000000420435000000000031004b000003a90000413d000000000100041400000011020003670000000a0000006b000003b40000c13d0000000003000031000003be0000013d00000007030000290000012704300197000100000042035500000003050000290000000a0050006c000000570000413d0000000305000029000000000350007b000000570000413d000000000242034f000001270330019700010000003203e5000001270010009c000003c90000a13d000000400100043d00000044021000390000014d03000041000000000032043500000024021000390000000803000039000004270000013d00000000023203df000000c0011002100000012e011001970000012c011001c700010000001203b500000000011203af0000801002000039049804930000040f0000000003010019000000600330027000000127033001970000000100200190000004320000613d0000001f0230003900000130052001970000003f025000390000013104200197000000400200043d0000000004420019000000000024004b000000000600003900000001060040390000012b0040009c0000023f0000213d00000001006001900000023f0000c13d000000400040043f0000000004320436000000000005004b000003ef0000613d0000000005540019000000000600003100000011066003670000000007040019000000006806043c0000000007870436000000000057004b000003eb0000c13d0000001f0530018f0000012f063001980000000003640019000003f90000613d000000000701034f0000000008040019000000007907043c0000000008980436000000000038004b000003f50000c13d000000000005004b000004060000613d000000000161034f0000000305500210000000000603043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001304350000000001020433000000200010008c000004210000c13d000000400100043d00000009020000290000000002020433000001000020008c0000044a0000413d00000064021000390000014a03000041000000000032043500000044021000390000014b0300004100000000003204350000002402100039000000250300003900000000003204350000013c020000410000000000210435000000040210003900000020030000390000000000320435000001270010009c000001270100804100000040011002100000014c011001c70000049a00010430000000400100043d00000044021000390000014803000041000000000032043500000024021000390000001f0300003900000000003204350000013c020000410000000000210435000000040210003900000020030000390000000000320435000001270010009c0000012701008041000000400110021000000135011001c70000049a000104300000001f0430018f0000012f023001980000043b0000613d000000000501034f0000000006000019000000005705043c0000000006760436000000000026004b000004370000c13d000000000004004b000004480000613d000000000121034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f000000000012043500000060013002100000049a000104300000000003040433000000f8022002100000006004100039000000000024043500000040021000390000000000320435000000200210003900000008030000290000000000320435000000610310003900000009040000290000000004040433000000000004004b000004610000613d000000000500001900000009060000290000002006600039000900000006001d000000000606043300000000036304360000000105500039000000000045004b000004590000413d0000000003130049000000200430008a00000000004104350000001f0330003900000150043001970000000003140019000000000043004b000000000400003900000001040040390000012b0030009c0000023f0000213d00000001004001900000023f0000c13d000000400030043f000001270020009c000001270200804100000040022002100000000001010433000001270010009c00000127010080410000006001100210000000000121019f0000000002000414000001270020009c0000012702008041000000c002200210000000000112019f00000133011001c700008010020000390498048e0000040f0000000100200190000000fe0000613d000000000101043b000000400200043d0000000000120435000001270020009c0000012702008041000000400120021000000149011001c7000004990001042e0000048c002104210000000102000039000000000001042d0000000002000019000000000001042d00000491002104230000000102000039000000000001042d0000000002000019000000000001042d00000496002104230000000102000039000000000001042d0000000002000019000000000001042d0000049800000432000004990001042e0000049a00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000200000000000000000000000000000040000001000000000000000000ffffffff0000000000000000000000000000000000000000000000000000000089f9a07200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff0000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe000000000000000000000000000000000000000000000000000000001ffffffe000000000000000000000000000000000000000000000000000000003ffffffe0000000000000000000000000000000000000000000000000ffffffffffffff9f02000000000000000000000000000000000000000000000000000000000000007f7b0cf70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000001f0000000000000000000000000000000000000000000000000000000043e266b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000007368612072657475726e656420696e76616c696420646174610000000000000008c379a00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff06ffffff0000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004e487b71000000000000000000000000000000000000000000000000000000006006d8b500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001ffffffffe0000000000000000000000000000000000000000000000000000003ffffffffe00000000000000000000000000000000000000000000000000000000000ffffe00000000000000000000000000000000000000000000000000000000001ffffe018876a04000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06b656363616b3235362072657475726e656420696e76616c69642064617461000000000000000000000000000000000000000020000000000000000000000000206269747300000000000000000000000000000000000000000000000000000053616665436173743a2076616c756520646f65736e27742066697420696e203800000000000000000000000000000000000000840000000000000000000000004f766572666c6f77000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00000000000000000000000000000000000000000000000000000000000000000e901f5bd8811df26e614332e2110b9bc002e2cbadd82065c67e102f858079d5a").unwrap()
-}
-
fn encoded_uncompressed_state_diffs(input: &PubdataInput) -> Vec {
let mut result = vec![];
for state_diff in input.state_diffs.iter() {
@@ -78,15 +72,10 @@ pub(crate) fn test_rollup_da_output_hash_match() {
// In this test, we check whether the L2 DA output hash is as expected.
let l2_da_validator_address = Address::repeat_byte(0x12);
- let system_env = SystemEnv {
- version: ProtocolVersionId::Version27,
- ..default_system_env()
- };
let mut vm = VmTesterBuilder::new()
.with_empty_in_memory_storage()
.with_execution_mode(TxExecutionMode::VerifyExecute)
.with_rich_accounts(1)
- .with_system_env(system_env)
.with_custom_contracts(vec![ContractToDeploy {
bytecode: l2_rollup_da_validator_bytecode(),
address: l2_da_validator_address,
diff --git a/core/lib/multivm/src/versions/testonly/l2_blocks.rs b/core/lib/multivm/src/versions/testonly/l2_blocks.rs
index f8813231c9e1..ad14aeb60670 100644
--- a/core/lib/multivm/src/versions/testonly/l2_blocks.rs
+++ b/core/lib/multivm/src/versions/testonly/l2_blocks.rs
@@ -4,6 +4,7 @@
//!
use assert_matches::assert_matches;
+use ethabi::{ParamType, Token};
use zksync_system_constants::REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE;
use zksync_types::{
block::{pack_block_info, L2BlockHasher},
@@ -13,6 +14,7 @@ use zksync_types::{
SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION,
U256,
};
+use zksync_vm_interface::VmRevertReason;
use super::{default_l1_batch, get_empty_storage, tester::VmTesterBuilder, TestedVm};
use crate::{
@@ -27,6 +29,29 @@ use crate::{
},
};
+/// Encodes a Solidity function call with parameters into a Vec.
+fn encode_function_call(
+ name: &str,
+ types: &[ParamType],
+ params: &[Token],
+) -> Result {
+ let short_sig = ethabi::short_signature(name, types);
+
+ // Check if the provided number of parameters matches the function's expected inputs
+ if types.len() != params.len() {
+ return Err(ethabi::Error::InvalidData);
+ }
+
+ // Encode the function call with the provided parameters
+ let encoded_data = ethabi::encode(params);
+
+ Ok(VmRevertReason::Unknown {
+ function_selector: short_sig.to_vec(),
+ data: [short_sig.to_vec(), encoded_data].concat(),
+ }
+ .to_string())
+}
+
fn get_l1_noop() -> Transaction {
Transaction {
common_data: ExecuteTransactionCommon::L1(L1TxCommonData {
@@ -72,7 +97,7 @@ pub(crate) fn test_l2_block_initialization_timestamp() {
assert_matches!(
res.result,
ExecutionResult::Halt { reason: Halt::FailedToSetL2Block(msg) }
- if msg.contains("timestamp")
+ if msg.contains("0x5e9ad9b0")
);
}
@@ -107,7 +132,7 @@ pub(crate) fn test_l2_block_initialization_number_non_zero() {
res.result,
ExecutionResult::Halt {
reason: Halt::FailedToSetL2Block(
- "L2 block number is never expected to be zero".to_string()
+ encode_function_call("L2BlockNumberZero", &[], &[]).unwrap()
)
}
);
@@ -163,7 +188,15 @@ pub(crate) fn test_l2_block_same_l2_block() {
// Case 1: Incorrect timestamp
test_same_l2_block::(
Some(Halt::FailedToSetL2Block(
- "The timestamp of the same L2 block must be same".to_string(),
+ encode_function_call(
+ "IncorrectSameL2BlockTimestamp",
+ &[ParamType::Uint(128), ParamType::Uint(128)],
+ &[
+ Token::Uint(U256::zero()),
+ Token::Uint(U256::from(1_700_000_001)),
+ ],
+ )
+ .unwrap(),
)),
Some(0),
None,
@@ -172,7 +205,20 @@ pub(crate) fn test_l2_block_same_l2_block() {
// Case 2: Incorrect previous block hash
test_same_l2_block::(
Some(Halt::FailedToSetL2Block(
- "The previous hash of the same L2 block must be same".to_string(),
+ encode_function_call(
+ "IncorrectSameL2BlockPrevBlockHash",
+ &[ParamType::FixedBytes(32), ParamType::FixedBytes(32)],
+ &[
+ Token::FixedBytes(H256::zero().0.to_vec()),
+ Token::FixedBytes(
+ hex::decode(
+ "e8e77626586f73b955364c7b4bbf0bb7f7685ebd40e852b164633a4acbd3244c",
+ )
+ .unwrap(),
+ ),
+ ],
+ )
+ .unwrap(),
)),
None,
Some(H256::zero()),
@@ -249,7 +295,12 @@ pub(crate) fn test_l2_block_new_l2_block() {
None,
None,
Some(Halt::FailedToSetL2Block(
- "Invalid new L2 block number".to_string(),
+ encode_function_call(
+ "InvalidNewL2BlockNumber",
+ &[ParamType::Uint(256)],
+ &[Token::Uint(U256::from(3u32))],
+ )
+ .unwrap(),
)),
);
@@ -259,7 +310,14 @@ pub(crate) fn test_l2_block_new_l2_block() {
None,
Some(1),
None,
- Some(Halt::FailedToSetL2Block("The timestamp of the new L2 block must be greater than the timestamp of the previous L2 block".to_string())),
+ Some(Halt::FailedToSetL2Block(
+ encode_function_call(
+ "NonMonotonicL2BlockTimestamp",
+ &[ParamType::Uint(128), ParamType::Uint(128)],
+ &[Token::Uint(U256::from(1)), Token::Uint(U256::from(1))],
+ )
+ .unwrap(),
+ )),
);
// Case 3: Incorrect previous block hash
@@ -269,7 +327,20 @@ pub(crate) fn test_l2_block_new_l2_block() {
None,
Some(H256::zero()),
Some(Halt::FailedToSetL2Block(
- "The current L2 block hash is incorrect".to_string(),
+ encode_function_call(
+ "IncorrectL2BlockHash",
+ &[ParamType::FixedBytes(32), ParamType::FixedBytes(32)],
+ &[
+ Token::FixedBytes(H256::zero().0.to_vec()),
+ Token::FixedBytes(
+ hex::decode(
+ "de4c551714ad02a0a4f51252f966ef90c13376ea4c8a463eedfb242b97551c43",
+ )
+ .unwrap(),
+ ),
+ ],
+ )
+ .unwrap(),
)),
);
@@ -395,7 +466,14 @@ pub(crate) fn test_l2_block_first_in_batch() {
prev_block_hash,
max_virtual_blocks_to_create: 1,
},
- Some(Halt::FailedToSetL2Block("The timestamp of the L2 block must be greater than or equal to the timestamp of the current batch".to_string())),
+ Some(Halt::FailedToSetL2Block(
+ encode_function_call(
+ "L2BlockAndBatchTimestampMismatch",
+ &[ParamType::Uint(128), ParamType::Uint(128)],
+ &[Token::Uint(U256::from(9)), Token::Uint(U256::from(12))],
+ )
+ .unwrap(),
+ )),
);
}
diff --git a/core/lib/multivm/src/versions/testonly/refunds.rs b/core/lib/multivm/src/versions/testonly/refunds.rs
index 384a3edb7dbd..4d549f5a9be0 100644
--- a/core/lib/multivm/src/versions/testonly/refunds.rs
+++ b/core/lib/multivm/src/versions/testonly/refunds.rs
@@ -140,7 +140,7 @@ pub(crate) fn test_predetermined_refunded_gas() {
current_state_without_predefined_refunds.user_l2_to_l1_logs
);
- assert_ne!(
+ assert_eq!(
current_state_with_changed_predefined_refunds.system_logs,
current_state_without_predefined_refunds.system_logs
);
diff --git a/core/lib/multivm/src/versions/vm_fast/tests/l1_messenger.rs b/core/lib/multivm/src/versions/vm_fast/tests/l1_messenger.rs
index c7d4594d7692..0bd01c7de134 100644
--- a/core/lib/multivm/src/versions/vm_fast/tests/l1_messenger.rs
+++ b/core/lib/multivm/src/versions/vm_fast/tests/l1_messenger.rs
@@ -1,7 +1,6 @@
use crate::{versions::testonly::l1_messenger::test_rollup_da_output_hash_match, vm_fast::Vm};
#[test]
-#[ignore] // Requires post-gateway system contracts
fn rollup_da_output_hash_match() {
test_rollup_da_output_hash_match::>();
}
diff --git a/core/lib/multivm/src/versions/vm_latest/tests/l1_messenger.rs b/core/lib/multivm/src/versions/vm_latest/tests/l1_messenger.rs
index 7d301f33a131..f1dade9dd8e6 100644
--- a/core/lib/multivm/src/versions/vm_latest/tests/l1_messenger.rs
+++ b/core/lib/multivm/src/versions/vm_latest/tests/l1_messenger.rs
@@ -4,7 +4,6 @@ use crate::{
};
#[test]
-#[ignore] // Requires post-gateway system contracts
fn rollup_da_output_hash_match() {
test_rollup_da_output_hash_match::>();
}
diff --git a/core/lib/multivm/src/versions/vm_latest/vm.rs b/core/lib/multivm/src/versions/vm_latest/vm.rs
index 1db369d4ae20..3914bfca17a2 100644
--- a/core/lib/multivm/src/versions/vm_latest/vm.rs
+++ b/core/lib/multivm/src/versions/vm_latest/vm.rs
@@ -47,7 +47,7 @@ pub(crate) enum MultiVmSubversion {
impl MultiVmSubversion {
#[cfg(test)]
pub(crate) fn latest() -> Self {
- Self::IncreasedBootloaderMemory
+ Self::Gateway
}
}
diff --git a/core/lib/protobuf_config/src/contracts.rs b/core/lib/protobuf_config/src/contracts.rs
index 12cbf996697b..1c9711ef62d2 100644
--- a/core/lib/protobuf_config/src/contracts.rs
+++ b/core/lib/protobuf_config/src/contracts.rs
@@ -34,6 +34,10 @@ impl ProtoRepr for proto::Contracts {
.l1_bytecodes_supplier_addr
.as_ref()
.map(|x| parse_h160(x).expect("Invalid address")),
+ l1_wrapped_base_token_store: ecosystem_contracts
+ .l1_wrapped_base_token_store
+ .as_ref()
+ .map(|x| parse_h160(x).expect("Invalid address")),
})
} else {
None
@@ -123,12 +127,6 @@ impl ProtoRepr for proto::Contracts {
.map(|x| parse_h256(x))
.transpose()
.context("base_token_asset_id")?,
- l2_predeployed_wrapped_base_token_address: l2
- .predeployed_wrapped_base_token_address
- .as_ref()
- .map(|x| parse_h160(x))
- .transpose()
- .context("l2 predeployed_wrapped_base_token_address")?,
chain_admin_addr: l1
.chain_admin_addr
.as_ref()
@@ -164,6 +162,9 @@ impl ProtoRepr for proto::Contracts {
l1_bytecodes_supplier_addr: ecosystem_contracts
.l1_bytecodes_supplier_addr
.map(|x| format!("{:?}", x)),
+ l1_wrapped_base_token_store: ecosystem_contracts
+ .l1_wrapped_base_token_store
+ .map(|x| format!("{:?}", x)),
});
Self {
ecosystem_contracts,
@@ -184,9 +185,6 @@ impl ProtoRepr for proto::Contracts {
legacy_shared_bridge_addr: this
.l2_legacy_shared_bridge_addr
.map(|a| format!("{:?}", a)),
- predeployed_wrapped_base_token_address: this
- .l2_predeployed_wrapped_base_token_address
- .map(|x| format!("{:?}", x)),
timestamp_asserter_addr: this
.l2_timestamp_asserter_addr
.map(|a| format!("{:?}", a)),
diff --git a/core/lib/protobuf_config/src/proto/config/contracts.proto b/core/lib/protobuf_config/src/proto/config/contracts.proto
index febbc981478b..538f415ff408 100644
--- a/core/lib/protobuf_config/src/proto/config/contracts.proto
+++ b/core/lib/protobuf_config/src/proto/config/contracts.proto
@@ -7,6 +7,7 @@ message EcosystemContracts {
optional string state_transition_proxy_addr = 2; // optional; h160
optional string transparent_proxy_admin_addr = 3; // optional; h160
optional string l1_bytecodes_supplier_addr = 4; // optional; h160
+ optional string l1_wrapped_base_token_store = 5; // optional; h160
}
message L1 {
@@ -26,7 +27,7 @@ message L2 {
optional string da_validator_addr = 2; // optional; H160
optional string legacy_shared_bridge_addr = 3; // optional; H160
optional string timestamp_asserter_addr = 4; // optional; H160
- optional string predeployed_wrapped_base_token_address = 5; // optional; H160
+ reserved 5; reserved "predeployed_wrapped_base_token_address";
}
message Bridge {
diff --git a/core/lib/types/src/abi.rs b/core/lib/types/src/abi.rs
index b40aaaf882e2..da51c6297d4d 100644
--- a/core/lib/types/src/abi.rs
+++ b/core/lib/types/src/abi.rs
@@ -531,7 +531,7 @@ impl GatewayUpgradeEncodedInput {
pub struct ZkChainSpecificUpgradeData {
pub base_token_asset_id: H256,
pub l2_legacy_shared_bridge: Address,
- pub predeployed_l2_weth_address: Address,
+ pub l2_predeployed_wrapped_base_token: Address,
pub base_token_l1_address: Address,
pub base_token_name: String,
pub base_token_symbol: String,
@@ -551,7 +551,7 @@ impl ZkChainSpecificUpgradeData {
l2_legacy_shared_bridge: l2_legacy_shared_bridge?,
// Note, that some chains may not contain previous deployment of L2 wrapped base
// token. For those, zero address is used.
- predeployed_l2_weth_address: predeployed_l2_weth_address.unwrap_or_default(),
+ l2_predeployed_wrapped_base_token: predeployed_l2_weth_address.unwrap_or_default(),
base_token_l1_address: base_token_l1_address?,
base_token_name: base_token_name?,
base_token_symbol: base_token_symbol?,
@@ -572,7 +572,7 @@ impl ZkChainSpecificUpgradeData {
Token::Tuple(vec![
Token::FixedBytes(self.base_token_asset_id.0.to_vec()),
Token::Address(self.l2_legacy_shared_bridge),
- Token::Address(self.predeployed_l2_weth_address),
+ Token::Address(self.l2_predeployed_wrapped_base_token),
Token::Address(self.base_token_l1_address),
Token::String(self.base_token_name.clone()),
Token::String(self.base_token_symbol.clone()),
diff --git a/core/lib/types/src/commitment/mod.rs b/core/lib/types/src/commitment/mod.rs
index 6d73ad048774..9aef6b14a0f2 100644
--- a/core/lib/types/src/commitment/mod.rs
+++ b/core/lib/types/src/commitment/mod.rs
@@ -112,6 +112,7 @@ pub struct L1BatchMetadata {
pub aux_data_hash: H256,
pub meta_parameters_hash: H256,
pub pass_through_data_hash: H256,
+
/// The commitment to the final events queue state after the batch is committed.
/// Practically, it is a commitment to all events that happened on L2 during the batch execution.
pub events_queue_commitment: Option,
diff --git a/core/lib/types/src/protocol_upgrade.rs b/core/lib/types/src/protocol_upgrade.rs
index 3bd9e696ce1f..324650c97e21 100644
--- a/core/lib/types/src/protocol_upgrade.rs
+++ b/core/lib/types/src/protocol_upgrade.rs
@@ -255,12 +255,30 @@ impl ProtocolUpgrade {
}
}
-pub fn decode_set_chain_id_event(
+pub fn decode_genesis_upgrade_event(
event: Log,
) -> Result<(ProtocolVersionId, ProtocolUpgradeTx), ethabi::Error> {
- let tx = ethabi::decode(&[abi::L2CanonicalTransaction::schema()], &event.data.0)?;
- let tx = abi::L2CanonicalTransaction::decode(tx.into_iter().next().unwrap()).unwrap();
-
+ let tokens = ethabi::decode(
+ &[
+ abi::L2CanonicalTransaction::schema(),
+ ParamType::Array(Box::new(ParamType::Bytes)),
+ ],
+ &event.data.0,
+ )?;
+ let mut t: std::vec::IntoIter = tokens.into_iter();
+ let mut next = || t.next().unwrap();
+
+ let tx = abi::L2CanonicalTransaction::decode(next()).unwrap();
+ let factory_deps = next()
+ .into_array()
+ .context("factory_deps")
+ .map_err(|_| ethabi::Error::InvalidData)?
+ .into_iter()
+ .enumerate()
+ .map(|(i, t)| t.into_bytes().context(i))
+ .collect::>, _>>()
+ .context("factory_deps")
+ .map_err(|_| ethabi::Error::InvalidData)?;
let full_version_id = h256_to_u256(event.topics[2]);
let protocol_version = ProtocolVersionId::try_from_packed_semver(full_version_id)
.unwrap_or_else(|_| panic!("Version is not supported, packed version: {full_version_id}"));
@@ -269,8 +287,11 @@ pub fn decode_set_chain_id_event(
Transaction::from_abi(
abi::Transaction::L1 {
tx: tx.into(),
- eth_block: 0,
- factory_deps: vec![],
+ eth_block: event
+ .block_number
+ .expect("Event block number is missing")
+ .as_u64(),
+ factory_deps,
},
true,
)
diff --git a/core/lib/types/src/system_contracts.rs b/core/lib/types/src/system_contracts.rs
index 4d1ff9b554ea..28d8def59277 100644
--- a/core/lib/types/src/system_contracts.rs
+++ b/core/lib/types/src/system_contracts.rs
@@ -4,8 +4,10 @@ use zksync_basic_types::{AccountTreeId, Address, U256};
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, P256VERIFY_PRECOMPILE_ADDRESS,
- PUBDATA_CHUNK_PUBLISHER_ADDRESS,
+ EVENT_WRITER_ADDRESS, EVM_GAS_MANAGER_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_BRIDGEHUB_ADDRESS,
+ L2_GENESIS_UPGRADE_ADDRESS, L2_MESSAGE_ROOT_ADDRESS, L2_NATIVE_TOKEN_VAULT_ADDRESS,
+ L2_WRAPPED_BASE_TOKEN_IMPL, P256VERIFY_PRECOMPILE_ADDRESS, PUBDATA_CHUNK_PUBLISHER_ADDRESS,
+ SLOAD_CONTRACT_ADDRESS,
};
use crate::{
@@ -25,7 +27,7 @@ use crate::{
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); 26] = [
+static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 33] = [
(
"",
"AccountCodeStorage",
@@ -174,6 +176,48 @@ static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 26] = [
CREATE2_FACTORY_ADDRESS,
ContractLanguage::Sol,
),
+ (
+ "",
+ "L2GenesisUpgrade",
+ L2_GENESIS_UPGRADE_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "../../l1-contracts/zkout/",
+ "Bridgehub",
+ L2_BRIDGEHUB_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "../../l1-contracts/zkout/",
+ "MessageRoot",
+ L2_MESSAGE_ROOT_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "../../l1-contracts/zkout/",
+ "L2AssetRouter",
+ L2_ASSET_ROUTER_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "../../l1-contracts/zkout/",
+ "L2NativeTokenVault",
+ L2_NATIVE_TOKEN_VAULT_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "",
+ "SloadContract",
+ SLOAD_CONTRACT_ADDRESS,
+ ContractLanguage::Sol,
+ ),
+ (
+ "../../l1-contracts/zkout/",
+ "L2WrappedBaseToken",
+ L2_WRAPPED_BASE_TOKEN_IMPL,
+ ContractLanguage::Sol,
+ ),
];
/// Gets default set of system contracts, based on Cargo workspace location.
diff --git a/core/lib/vm_executor/src/batch/factory.rs b/core/lib/vm_executor/src/batch/factory.rs
index 9797e1681032..59b610426669 100644
--- a/core/lib/vm_executor/src/batch/factory.rs
+++ b/core/lib/vm_executor/src/batch/factory.rs
@@ -238,6 +238,7 @@ impl BatchVm {
.expect("failed extracting call traces")
.take()
.unwrap_or_default();
+
BatchTransactionExecutionResult {
tx_result: Box::new(tx_result),
compressed_bytecodes,
diff --git a/core/lib/vm_executor/src/oneshot/contracts.rs b/core/lib/vm_executor/src/oneshot/contracts.rs
index 257ede5a7c7c..d67d1dfbc662 100644
--- a/core/lib/vm_executor/src/oneshot/contracts.rs
+++ b/core/lib/vm_executor/src/oneshot/contracts.rs
@@ -106,10 +106,8 @@ impl MultiVmBaseSystemContracts {
ProtocolVersionId::Version21 | ProtocolVersionId::Version22 => &self.post_1_4_2,
ProtocolVersionId::Version23 => &self.vm_1_5_0_small_memory,
ProtocolVersionId::Version24 => &self.vm_1_5_0_increased_memory,
- ProtocolVersionId::Version25 | ProtocolVersionId::Version26 => {
- &self.vm_protocol_defense
- }
- ProtocolVersionId::Version27 => &self.gateway,
+ ProtocolVersionId::Version25 => &self.vm_protocol_defense,
+ ProtocolVersionId::Version26 | ProtocolVersionId::Version27 => &self.gateway,
ProtocolVersionId::Version28 => unreachable!("Version 28 is not supported yet"),
};
let base = base.clone();
diff --git a/core/lib/web3_decl/src/namespaces/unstable.rs b/core/lib/web3_decl/src/namespaces/unstable.rs
index f666f02f2811..da18806d126c 100644
--- a/core/lib/web3_decl/src/namespaces/unstable.rs
+++ b/core/lib/web3_decl/src/namespaces/unstable.rs
@@ -38,4 +38,7 @@ pub trait UnstableNamespace {
l1_batch_number: L1BatchNumber,
chain_id: L2ChainId,
) -> RpcResult