Skip to content

Commit

Permalink
Merge pull request #1604 from matter-labs/kl-factory-ci
Browse files Browse the repository at this point in the history
ci: CI for shared bridge
  • Loading branch information
ly0va authored Apr 12, 2024
2 parents dd4a6fd + c547df3 commit 5c65c93
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 132 deletions.
60 changes: 17 additions & 43 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
ci_run zk contract build
- name: Contracts unit tests
run: ci_run zk test l1-contracts
run: ci_run yarn l1-contracts test

- name: Rust unit tests
run: ci_run zk test rust
Expand Down Expand Up @@ -119,15 +119,16 @@ jobs:
run: |
ci_run sccache --show-stats
ci_run cat /tmp/sccache_log.txt
integration:
name: Integration (consensus=${{ matrix.consensus }}, deployment_mode=${{ matrix.deployment_mode }})
name: Integration (consensus=${{ matrix.consensus }}, base_token=${{ matrix.base_token }})
strategy:
# In matrix jobs, fail-fast is true by default.
# To be consistent with the rest of the workflow we disable it explicitly.
fail-fast: false
matrix:
consensus: [false, true]
deployment_mode: ["Rollup", "Validium"]
base_token: ["Eth", "Custom"]
env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer,commitment_generator${{ matrix.consensus && ',consensus' || '' }}"

Expand Down Expand Up @@ -186,13 +187,8 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ci_run zk init
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env dev_validium_docker
ci_run zk config compile dev_validium_docker
ci_run zk init --validium-mode
fi
ci_run zk config compile
ci_run zk init ${{ matrix.base_token == 'Custom' && '--base-token-name BAT' || ''}}
# `sleep 5` because we need to wait until server started properly
- name: Run server
Expand All @@ -213,11 +209,7 @@ jobs:
# An empty topmost environment helps avoid a mess when redefining env vars shared between both envs
# (e.g., DATABASE_URL).
run: |
if [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk config compile ext-node-validium
ci_run zk config compile ext-node-validium-docker
fi
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=${{ matrix.deployment_mode }} PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run yarn snapshot-recovery-test snapshot-recovery-test
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=Rollup PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run yarn snapshot-recovery-test snapshot-recovery-test
- name: Fee projection tests
run: ci_run zk test i fees
Expand All @@ -226,7 +218,7 @@ jobs:
run: |
ci_run pkill zksync_server || true
ci_run sleep 2
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=${{ matrix.deployment_mode }} PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run zk test i revert
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=Rollup PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run zk test i revert
# This test should be the last one as soon as it
# finished bootloader will be different
Expand Down Expand Up @@ -266,12 +258,12 @@ jobs:
ci_run cat /tmp/sccache_log.txt
external-node:
name: External node (consensus=${{ matrix.consensus }}, deployment_mode=${{ matrix.deployment_mode }})
name: External node (consensus=${{ matrix.consensus }}, base_token=${{ matrix.base_token }})
strategy:
fail-fast: false
matrix:
consensus: [false, true]
deployment_mode: ["Rollup", "Validium"]
base_token: ["Eth", "Custom"]
runs-on: [matterlabs-ci-runner]

env:
Expand Down Expand Up @@ -305,13 +297,8 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ci_run zk init
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env dev_validium_docker
ci_run zk config compile dev_validium_docker
ci_run zk init --validium-mode
fi
ci_run zk config compile
ci_run zk init ${{ matrix.base_token == 'Custom' && '--base-token-name BAT' || ''}}
# `sleep 30` because we need to wait until server started properly
- name: Run server
Expand All @@ -321,11 +308,7 @@ jobs:
- name: Run external node
run: |
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ci_run zk env ext-node-docker
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env ext-node-validium-docker
fi
ci_run zk env ext-node-docker
ci_run zk db setup
ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log &
ci_run sleep 30
Expand All @@ -335,24 +318,15 @@ jobs:

- name: Run revert test
run: |
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=${{ matrix.deployment_mode }} PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run zk test i revert-en
ENABLE_CONSENSUS=${{ matrix.consensus }} DEPLOYMENT_MODE=Rollup PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE" ci_run zk test i revert-en
# test terminates the nodes, so we restart them.
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ZKSYNC_ENV=docker ci_run zk server --components=$SERVER_COMPONENTS &>>server.log &
ZKSYNC_ENV=ext-node-docker ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log &
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ZKSYNC_ENV=dev_validium_docker ci_run zk server --components=$SERVER_COMPONENTS &>>server.log &
ZKSYNC_ENV=ext-node-validium-docker ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log &
fi
ZKSYNC_ENV=docker ci_run zk server --components=$SERVER_COMPONENTS &>>server.log &
ZKSYNC_ENV=ext-node-docker ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log &
ci_run sleep 30
- name: Run upgrade test
run: |
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ci_run zk env docker
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env dev_validium_docker
fi
ci_run zk env docker
CHECK_EN_URL="http://0.0.0.0:3060" ci_run zk test i upgrade
- name: Show server.log logs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- staging
- trying
- kl-factory # adding this branch here to run CI on it regardless of the conflicts
- kl-factory-ci
- '!release-please--branches--**'

concurrency:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ Cargo.lock
/etc/env/target/*
/etc/env/.current
/etc/env/configs
!/etc/env/configs/dev.toml
!/etc/env/configs/dev_validium.toml
!/etc/env/configs/dev_validium_docker.toml
!/etc/env/configs/ext-node.toml
!/etc/env/configs/ext-node-docker.toml
/etc/env/l1-inits
!/etc/env/l1-inits/.init.env
/etc/env/l2-inits
Expand Down
2 changes: 1 addition & 1 deletion core/lib/basic_types/src/protocol_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub enum ProtocolVersionId {
Version21,
Version22,
Version23,
Version24,
Local,
Version24,
}

impl ProtocolVersionId {
Expand Down
8 changes: 4 additions & 4 deletions core/lib/commitment_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ pub fn events_queue_commitment(
.collect(),
),
)),
VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 | VmVersion::Local => Some(H256(
VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 => Some(H256(
circuit_sequencer_api_1_4_1::commitments::events_queue_commitment_fixed(
&events_queue
.iter()
.map(|x| to_log_query_1_4_1(*x))
.collect(),
),
)),
VmVersion::Vm1_5_0 => Some(H256(
VmVersion::Vm1_5_0 | VmVersion::Local => Some(H256(
circuit_sequencer_api_1_5_0::commitments::events_queue_commitment_fixed(
&events_queue
.iter()
Expand Down Expand Up @@ -67,12 +67,12 @@ pub fn bootloader_initial_content_commitment(
&full_bootloader_memory,
),
)),
VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 | VmVersion::Local => Some(H256(
VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 => Some(H256(
circuit_sequencer_api_1_4_1::commitments::initial_heap_content_commitment_fixed(
&full_bootloader_memory,
),
)),
VmVersion::Vm1_5_0 => Some(H256(
VmVersion::Vm1_5_0 | VmVersion::Local => Some(H256(
circuit_sequencer_api_1_5_0::commitments::initial_heap_content_commitment_fixed(
&full_bootloader_memory,
),
Expand Down
36 changes: 6 additions & 30 deletions core/lib/env_config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,19 @@ mod tests {
let mut lock = MUTEX.lock();
let config = r#"
CONTRACTS_GOVERNANCE_ADDR="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
CONTRACTS_MAILBOX_FACET_ADDR="0x0f6Fa881EF414Fc6E818180657c2d5CD7Ac6cCAd"
CONTRACTS_EXECUTOR_FACET_ADDR="0x18B631537801963A964211C0E86645c1aBfbB2d3"
CONTRACTS_ADMIN_FACET_ADDR="0x1e12b20BE86bEc3A0aC95aA52ade345cB9AE7a32"
CONTRACTS_GETTERS_FACET_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_VERIFIER_ADDR="0x34782eE00206EAB6478F2692caa800e4A581687b"
CONTRACTS_DIAMOND_INIT_ADDR="0xFFC35A5e767BE36057c34586303498e3de7C62Ba"
CONTRACTS_DIAMOND_UPGRADE_INIT_ADDR="0xFFC35A5e767BE36057c34586303498e3de7C62Ba"
CONTRACTS_DEFAULT_UPGRADE_ADDR="0x5e6d086f5ec079adff4fb3774cdf3e8d6a34f7e9"
CONTRACTS_DIAMOND_PROXY_ADDR="0xF00B988a98Ca742e7958DeF9F7823b5908715f4a"
CONTRACTS_VALIDATOR_TIMELOCK_ADDR="0xF00B988a98Ca742e7958DeF9F7823b5908715f4a"
CONTRACTS_GENESIS_TX_HASH="0xb99ebfea46cbe05a21cd80fe5597d97b204befc52a16303f579c607dc1ac2e2e"
CONTRACTS_L1_ERC20_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L1_ERC20_BRIDGE_IMPL_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L1_ALLOW_LIST_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L1_SHARED_BRIDGE_IMPL_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_ERC20_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L1_WETH_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_WETH_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_TESTNET_PAYMASTER_ADDR="FC073319977e314F251EAE6ae6bE76B0B3BAeeCF"
CONTRACTS_RECURSION_SCHEDULER_LEVEL_VK_HASH="0x1186ec268d49f1905f8d9c1e9d39fc33e98c74f91d91a21b8f7ef78bd09a8db8"
CONTRACTS_RECURSION_NODE_LEVEL_VK_HASH="0x1186ec268d49f1905f8d9c1e9d39fc33e98c74f91d91a21b8f7ef78bd09a8db8"
CONTRACTS_RECURSION_LEAF_LEVEL_VK_HASH="0x101e08b00193e529145ee09823378ef51a3bc8966504064f1f6ba3f1ba863210"
CONTRACTS_RECURSION_CIRCUITS_SET_VKS_HASH="0x142a364ef2073132eaf07aa7f3d8495065be5b92a2dc14fda09b4216affed9c0"
CONTRACTS_L1_MULTICALL3_ADDR="0xcA11bde05977b3631167028862bE2a173976CA11"
CONTRACTS_FRI_RECURSION_SCHEDULER_LEVEL_VK_HASH="0x201d4c7d8e781d51a3bbd451a43a8f45240bb765b565ae6ce69192d918c3563d"
CONTRACTS_FRI_RECURSION_NODE_LEVEL_VK_HASH="0x5a3ef282b21e12fe1f4438e5bb158fc5060b160559c5158c6389d62d9fe3d080"
CONTRACTS_FRI_RECURSION_LEAF_LEVEL_VK_HASH="0x72167c43a46cf38875b267d67716edc4563861364a3c03ab7aee73498421e828"
CONTRACTS_PROVER_AT_GENESIS="fri"
CONTRACTS_SNARK_WRAPPER_VK_HASH="0x4be443afd605a782b6e56d199df2460a025c81b3dea144e135bece83612563f2"
CONTRACTS_BASE_TOKEN_ADDR=0x0000000000000000000000000000000000000001
CONTRACTS_BRIDGEHUB_PROXY_ADDR="0x35ea7f92f4c5f433efe15284e99c040110cf6297"
CONTRACTS_BRIDGEHUB_IMPL_ADDR="0x87d456da9ed212eb49d80d96afb44afddf36adf8"
CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb2097"
CONTRACTS_STATE_TRANSITION_IMPL_ADDR="0xc957c0e82d3bafb5ad46ffbcc66900648784eb05"
CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5"
CONTRACTS_GENESIS_ROOT=0x1f50e4eda06a68d96a0272ba4581a342df2227ad12c23759ab7d78157950e69a
CONTRACTS_GENESIS_BATCH_COMMITMENT=0x84d7b576b9374729e0b38439c97aaf5074335e2a8d1c7a2e4581c1c1ec611631
CONTRACTS_GENESIS_ROLLUP_LEAF_INDEX=46
CONTRACTS_L1_SHARED_BRIDGE_PROXY_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_L2_SHARED_BRIDGE_ADDR="0x8656770FA78c830456B00B4fFCeE6b1De0e1b888"
CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001"
"#;
lock.set_env(config);

Expand Down
7 changes: 4 additions & 3 deletions core/lib/multivm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,14 @@ pub fn get_max_batch_base_layer_circuits(version: VmVersion) -> usize {
| VmVersion::VmVirtualBlocksRefundsEnhancement
| VmVersion::VmBoojumIntegration
| VmVersion::Vm1_4_1
| VmVersion::Vm1_4_2
| VmVersion::Local => {
| VmVersion::Vm1_4_2 => {
// For pre-v1.4.2 the maximal number of circuits has not been calculated, but since
// these are used only for replaying transactions, we'll reuse the same value as for v1.4.2.
// We avoid providing `0` for the old versions to avoid potential errors when working with old versions.
crate::vm_1_4_2::constants::MAX_BASE_LAYER_CIRCUITS
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::MAX_BASE_LAYER_CIRCUITS,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::MAX_BASE_LAYER_CIRCUITS
}
}
}
3 changes: 1 addition & 2 deletions core/lib/protobuf_config/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ impl ProtoRepr for proto::Contracts {
let shared = required(&bridges.shared).context("shared")?;
let erc20 = required(&bridges.erc20).context("erc20")?;
let weth_bridge = required(&bridges.weth).context("weth_bridge")?;
// let base_token_address = &self.l2.
Ok(Self::Type {
governance_addr: required(&l1.governance_addr)
.and_then(|x| parse_h160(x))
Expand Down Expand Up @@ -88,7 +87,7 @@ impl ProtoRepr for proto::Contracts {
validator_timelock_addr: Some(format!("{:?}", this.validator_timelock_addr)),
default_upgrade_addr: Some(format!("{:?}", this.default_upgrade_addr)),
multicall3_addr: Some(format!("{:?}", this.l1_multicall3_addr)),
base_token_addr: Some(format!("{:?}", this.base_token_addr)),
base_token_addr: this.base_token_addr.map(|a| format!("{:?}", a)),
}),
l2: Some(proto::L2 {
testnet_paymaster_addr: this.l2_testnet_paymaster_addr.map(|a| format!("{:?}", a)),
Expand Down
12 changes: 6 additions & 6 deletions core/lib/zksync_core/src/eth_sender/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ async fn confirm_many(
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&DUMMY_OPERATION,
true,
false,
)
.await?;
let hash = tester
Expand Down Expand Up @@ -332,7 +332,7 @@ async fn resend_each_block(deployment_mode: DeploymentMode) -> anyhow::Result<()
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&DUMMY_OPERATION,
true,
false,
)
.await?;

Expand Down Expand Up @@ -437,7 +437,7 @@ async fn dont_resend_already_mined(deployment_mode: DeploymentMode) -> anyhow::R
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&DUMMY_OPERATION,
true,
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -519,7 +519,7 @@ async fn three_scenarios(deployment_mode: DeploymentMode) -> anyhow::Result<()>
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&DUMMY_OPERATION,
true,
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -596,7 +596,7 @@ async fn failed_eth_tx(deployment_mode: DeploymentMode) {
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&DUMMY_OPERATION,
true,
false,
)
.await
.unwrap();
Expand Down Expand Up @@ -1070,7 +1070,7 @@ async fn send_operation(
.save_eth_tx(
&mut tester.conn.connection().await.unwrap(),
&aggregated_operation,
true,
false,
)
.await
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions etc/env/configs/dev.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__imports__ = [ "base", "l1-inits/.init.env", "l2-inits/dev.init.env" ]
ETH_SENDER_SENDER_PUBDATA_SENDING_MODE="Calldata"
#ZKSYNC_DEBUG_LOGS=true

ETH_SENDER_SENDER_PUBDATA_SENDING_MODE = "Calldata"
4 changes: 4 additions & 0 deletions etc/env/configs/docker.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__imports__ = [ "base", "l1-inits/.init.env", "l2-inits/docker.init.env" ]

ETH_SENDER_SENDER_PUBDATA_SENDING_MODE = "Calldata"

sqlx_offline = true
database_url = "postgres://postgres:notsecurepassword@postgres/zksync_local"
database_prover_url = "postgres://postgres:notsecurepassword@postgres/prover_local"
Expand Down
2 changes: 2 additions & 0 deletions etc/env/configs/ext-node-docker.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__imports__ = [ "configs/ext-node.toml" ]

database_url = "postgres://postgres:notsecurepassword@postgres/_ext_node"
template_database_url = "postgres://postgres:notsecurepassword@postgres/zksync_local"
test_database_url = "postgres://postgres:notsecurepassword@host:5433/zksync_local_test_ext_node"
Expand Down
Loading

0 comments on commit 5c65c93

Please sign in to comment.