diff --git a/.github/workflows/build-contract-verifier-template.yml b/.github/workflows/build-contract-verifier-template.yml index db7c4ba387f4..bb385b2797b2 100644 --- a/.github/workflows/build-contract-verifier-template.yml +++ b/.github/workflows/build-contract-verifier-template.yml @@ -113,18 +113,15 @@ jobs: ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen 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 || true - ci_run yarn zk build + ci_run ./bin/zkt || true + ci_run ./bin/zk || true ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key - name: build contracts if: env.BUILD_CONTRACTS == 'true' run: | - ci_run zk run yarn ci_run cp etc/tokens/{test,localhost}.json - ci_run zk compiler all - ci_run zk contract build - ci_run zk f yarn run l2-contracts build + ci_run zk_supervisor contracts - name: Login to Docker registries if: ${{ inputs.action == 'push' }} diff --git a/.github/workflows/build-core-template.yml b/.github/workflows/build-core-template.yml index 7e5dcc10a939..dc46c4ba95e9 100644 --- a/.github/workflows/build-core-template.yml +++ b/.github/workflows/build-core-template.yml @@ -71,11 +71,15 @@ jobs: if [ $(jq length <<<"$tags") -eq 0 ]; then echo "No tag found on all pages." echo "BUILD_CONTRACTS=true" >> "$GITHUB_ENV" + # TODO Remove it when we migrate to foundry inside contracts repository + mkdir -p contracts/l1-contracts/artifacts/ exit 0 fi filtered_tag=$(jq -r --arg commit_sha "$commit_sha" 'map(select(.commit.sha == $commit_sha)) | .[].name' <<<"$tags") if [[ ! -z "$filtered_tag" ]]; then echo "BUILD_CONTRACTS=false" >> "$GITHUB_ENV" + # TODO Remove it when we migrate to foundry inside contracts repository + mkdir -p contracts/l1-contracts/out break fi ((page++)) @@ -122,18 +126,15 @@ jobs: ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen 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 || true - ci_run yarn zk build + ci_run ./bin/zk || true + ci_run ./bin/zkt || true ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key - name: build contracts if: env.BUILD_CONTRACTS == 'true' run: | - ci_run zk run yarn ci_run cp etc/tokens/{test,localhost}.json - ci_run zk compiler all - ci_run zk contract build - ci_run zk f yarn run l2-contracts build + ci_run zk_supervisor contracts - name: Login to Docker registries if: ${{ inputs.action == 'push' }} diff --git a/.github/workflows/build-local-node-docker.yml b/.github/workflows/build-local-node-docker.yml index 7f36f28f2864..f664bfaaa00a 100644 --- a/.github/workflows/build-local-node-docker.yml +++ b/.github/workflows/build-local-node-docker.yml @@ -16,7 +16,7 @@ on: jobs: build-images: name: Local Node - Build and Push Docker Image - runs-on: [matterlabs-ci-runner-high-performance] + runs-on: [ matterlabs-ci-runner-high-performance ] steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 with: @@ -61,9 +61,9 @@ jobs: ci_run git config --global --add safe.directory /usr/src/zksync/contracts ci_run zk + ci_run zkt ci_run cp etc/tokens/{test,localhost}.json - ci_run zk compiler all - ci_run zk contract build + ci_run zk_supervisor contracts - name: update-image run: | diff --git a/.github/workflows/ci-common-reusable.yml b/.github/workflows/ci-common-reusable.yml index d4667a273ef4..d2f9e11348f0 100644 --- a/.github/workflows/ci-common-reusable.yml +++ b/.github/workflows/ci-common-reusable.yml @@ -28,11 +28,10 @@ jobs: - name: Init run: | - ci_run zk - ci_run run_retried rustup show - ci_run zk db setup + ci_run zkt # This does both linting and "building". We're using `zk lint prover` as it's common practice within our repo # `zk lint prover` = cargo clippy, which does cargo check behind the scenes, which is a lightweight version of cargo build - name: Lints - run: ci_run zk lint prover + run: ci_run zk_supervisor lint -t rs --check + diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml index a88a8fe3944e..898085a36784 100644 --- a/.github/workflows/ci-core-reusable.yml +++ b/.github/workflows/ci-core-reusable.yml @@ -145,304 +145,341 @@ jobs: ci_run sccache --show-stats || true ci_run cat /tmp/sccache_log.txt || true - integration: - name: Integration (consensus=${{ matrix.consensus }}, base_token=${{ matrix.base_token }}, deployment_mode=${{ matrix.deployment_mode }}) - 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 ] - base_token: [ "Eth", "Custom" ] - deployment_mode: [ "Rollup", "Validium" ] - env: - SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,vm_playground,da_dispatcher${{ matrix.consensus && ',consensus' || '' }}${{ matrix.base_token == 'Custom' && ',base_token_ratio_persister' || '' }}" - - runs-on: [ matterlabs-ci-runner-highmem-long ] + integration-tests: + runs-on: [ matterlabs-ci-runner-ultra-performance ] steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 with: submodules: "recursive" fetch-depth: 0 + - name: Setup environment run: | echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV echo $(pwd)/bin >> $GITHUB_PATH echo IN_DOCKER=1 >> .env - echo RUN_CONTRACT_VERIFICATION_TEST=true >> .env - echo ZKSYNC_DEBUG_LOGS=true >> .env - - - name: Download zksolc/solc and zkvyper/vyper - run: | - sudo apt update && sudo apt install wget -y - - mkdir -p $(pwd)/etc/solc-bin/0.8.23 - wget https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.23%2Bcommit.f704f362 - mv solc-linux-amd64-v0.8.23+commit.f704f362 $(pwd)/etc/solc-bin/0.8.23/solc - chmod +x $(pwd)/etc/solc-bin/0.8.23/solc - - mkdir -p $(pwd)/etc/solc-bin/zkVM-0.8.23-1.0.0 - wget https://github.com/matter-labs/era-solidity/releases/download/0.8.23-1.0.0/solc-linux-amd64-0.8.23-1.0.0 -O $(pwd)/etc/solc-bin/zkVM-0.8.23-1.0.0/solc - chmod +x $(pwd)/etc/solc-bin/zkVM-0.8.23-1.0.0/solc - - mkdir -p $(pwd)/etc/zksolc-bin/v1.3.21 - wget https://github.com/matter-labs/zksolc-bin/raw/main/linux-amd64/zksolc-linux-amd64-musl-v1.3.21 - mv zksolc-linux-amd64-musl-v1.3.21 $(pwd)/etc/zksolc-bin/v1.3.21/zksolc - chmod +x $(pwd)/etc/zksolc-bin/v1.3.21/zksolc - - mkdir -p $(pwd)/etc/vyper-bin/0.3.10 - wget -O vyper0.3.10 https://github.com/vyperlang/vyper/releases/download/v0.3.10/vyper.0.3.10%2Bcommit.91361694.linux - mv vyper0.3.10 $(pwd)/etc/vyper-bin/0.3.10/vyper - chmod +x $(pwd)/etc/vyper-bin/0.3.10/vyper - - mkdir -p $(pwd)/etc/zkvyper-bin/v1.3.13 - wget https://github.com/matter-labs/zkvyper-bin/raw/main/linux-amd64/zkvyper-linux-amd64-musl-v1.3.13 - mv zkvyper-linux-amd64-musl-v1.3.13 $(pwd)/etc/zkvyper-bin/v1.3.13/zkvyper - chmod +x $(pwd)/etc/zkvyper-bin/v1.3.13/zkvyper + echo RUN_CONTRACT_VERIFICATION_TEST=true >> $GITHUB_ENV - name: Start services run: | ci_localnet_up - ci_run pre_download_compilers.sh ci_run sccache --start-server - - name: Init + - name: Build zk_toolbox + run: ci_run bash -c "./bin/zkt" + + - name: Create log directories + run: | + SERVER_LOGS_DIR=logs/server + INTEGRATION_TESTS_LOGS_DIR=logs/integration_tests + INTEGRATION_TESTS_EN_LOGS_DIR=logs/integration_tests/en + SNAPSHOT_RECOVERY_LOGS_DIR=logs/snapshot_recovery/ + GENESIS_RECOVERY_LOGS_DIR=logs/genesis_recovery/ + EXTERNAL_NODE_LOGS_DIR=logs/external_node + REVERT_LOGS_DIR=logs/revert + + mkdir -p $SERVER_LOGS_DIR + mkdir -p $INTEGRATION_TESTS_LOGS_DIR + mkdir -p $INTEGRATION_TESTS_EN_LOGS_DIR + mkdir -p $SNAPSHOT_RECOVERY_LOGS_DIR + mkdir -p $GENESIS_RECOVERY_LOGS_DIR + mkdir -p $EXTERNAL_NODE_LOGS_DIR + mkdir -p $REVERT_LOGS_DIR + + echo "SERVER_LOGS_DIR=$SERVER_LOGS_DIR" >> $GITHUB_ENV + echo "INTEGRATION_TESTS_LOGS_DIR=$INTEGRATION_TESTS_LOGS_DIR" >> $GITHUB_ENV + echo "INTEGRATION_TESTS_EN_LOGS_DIR=$INTEGRATION_TESTS_EN_LOGS_DIR" >> $GITHUB_ENV + echo "SNAPSHOT_RECOVERY_LOGS_DIR=$SNAPSHOT_RECOVERY_LOGS_DIR" >> $GITHUB_ENV + echo "GENESIS_RECOVERY_LOGS_DIR=$GENESIS_RECOVERY_LOGS_DIR" >> $GITHUB_ENV + echo "EXTERNAL_NODE_LOGS_DIR=$EXTERNAL_NODE_LOGS_DIR" >> $GITHUB_ENV + echo "REVERT_LOGS_DIR=$REVERT_LOGS_DIR" >> $GITHUB_ENV + + - name: Initialize ecosystem run: | ci_run git config --global --add safe.directory /usr/src/zksync - ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen 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 - ci_run run_retried rustup show - if [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then - ci_run zk env dev_validium_docker - ci_run zk config compile dev_validium_docker - else - ci_run zk config compile - fi - ci_run zk init ${{ matrix.base_token == 'Custom' && '--base-token-name BAT' || ''}} ${{ matrix.deployment_mode == 'Validium' && '--validium-mode' || ''}} - # `sleep 5` because we need to wait until server started properly - - name: Run server + ci_run zk_inception ecosystem init --deploy-paymaster --deploy-erc20 \ + --deploy-ecosystem --l1-rpc-url=http://localhost:8545 \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_localhost_era \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_localhost_era \ + --ignore-prerequisites --verbose \ + --observability=false + + - name: Read Custom Token address and set as environment variable run: | - ci_run zk server --components=$SERVER_COMPONENTS &>server.log & - ci_run sleep 5 + address=$(awk -F": " '/tokens:/ {found_tokens=1} found_tokens && /DAI:/ {found_dai=1} found_dai && /address:/ {print $2; exit}' ./configs/erc20.yaml) + echo "address=$address" + echo "address=$address" >> $GITHUB_ENV - - name: Run contract verifier + - name: Create and initialize Validium chain run: | - ci_run zk contract_verifier &>contract_verifier.log & - ci_run sleep 2 - - - name: Server integration tests - run: ci_run zk test i server - - - name: Snapshot recovery test - # We use `yarn` directly because the test launches `zk` commands in both server and EN envs. - # An empty topmost environment helps avoid a mess when redefining env vars shared between both envs - # (e.g., DATABASE_URL). - # - # Since `base_token` doesn't meaningfully influence the test, we use it as a flag for - # enabling / disabling tree during pruning. + ci_run zk_inception chain create \ + --chain-name validium \ + --chain-id sequential \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address 0x0000000000000000000000000000000000000001 \ + --base-token-price-nominator 1 \ + --base-token-price-denominator 1 \ + --set-as-default false \ + --ignore-prerequisites + + ci_run zk_inception chain init \ + --deploy-paymaster \ + --l1-rpc-url=http://localhost:8545 \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_localhost_validium \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_localhost_validium \ + --port-offset 2000 \ + --chain validium + + - name: Create and initialize chain with Custom Token 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 }} \ - SNAPSHOTS_CREATOR_VERSION=${{ matrix.deployment_mode == 'Validium' && '0' || '1' }} \ - DISABLE_TREE_DURING_PRUNING=${{ matrix.base_token == 'Eth' }} \ - ETH_CLIENT_WEB3_URL="http://localhost:8545" \ - PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE,DISABLE_TREE_DURING_PRUNING,SNAPSHOTS_CREATOR_VERSION,ETH_CLIENT_WEB3_URL" \ - ci_run yarn recovery-test snapshot-recovery-test - - - name: Genesis recovery test + ci_run zk_inception chain create \ + --chain-name custom_token \ + --chain-id sequential \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode rollup \ + --base-token-address ${{ env.address }} \ + --base-token-price-nominator 3 \ + --base-token-price-denominator 2 \ + --set-as-default false \ + --ignore-prerequisites + + ci_run zk_inception chain init \ + --deploy-paymaster \ + --l1-rpc-url=http://localhost:8545 \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_localhost_custom_token \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_localhost_custom_token \ + --port-offset 3000 \ + --chain custom_token + + - name: Create and register chain with transactions signed "offline" run: | - ENABLE_CONSENSUS=${{ matrix.consensus }} \ - DEPLOYMENT_MODE=${{ matrix.deployment_mode }} \ - ETH_CLIENT_WEB3_URL="http://localhost:8545" \ - PASSED_ENV_VARS="ENABLE_CONSENSUS,DEPLOYMENT_MODE,ETH_CLIENT_WEB3_URL" \ - ci_run yarn recovery-test genesis-recovery-test + ci_run zk_inception chain create \ + --chain-name offline_chain \ + --chain-id sequential \ + --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 - - name: Fee projection tests - run: ci_run zk test i fees + ci_run zk_inception chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545 - - name: Run revert test - 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 + governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) + ci_run zk_supervisor send-transactions \ + --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ + --l1-rpc-url http://127.0.0.1:8545 \ + --private-key $governor_pk - # This test should be the last one as soon as it - # finished bootloader will be different - - name: Run upgrade test - run: | - ci_run pkill zksync_server || true - ci_run sleep 10 - ci_run zk test i upgrade + bridge_hub=$(awk '/bridgehub_proxy_addr/ {print $2}' ./configs/contracts.yaml) + chain_id=$(awk '/chain_id:/ {print $2}' ./chains/offline_chain/ZkStack.yaml) - - name: Show server.log logs - if: always() - run: ci_run cat server.log || true + hyperchain_output=$(ci_run cast call $bridge_hub "getHyperchain(uint256)" $chain_id) - - name: Show contract_verifier.log logs - if: always() - run: ci_run cat contract_verifier.log || true + if [[ $hyperchain_output == 0x* && ${#hyperchain_output} -eq 66 ]]; then + echo "Chain successfully registered: $hyperchain_output" + else + echo "Failed to register chain: $hyperchain_output" + exit 1 + fi - - name: Show snapshot-creator.log logs - if: always() - run: ci_run cat core/tests/recovery-test/snapshot-creator.log || true - - name: Show snapshot-recovery.log logs - if: always() - run: ci_run cat core/tests/recovery-test/snapshot-recovery.log || true - - name: Show genesis-recovery.log logs - if: always() - run: ci_run cat core/tests/recovery-test/genesis-recovery.log || true + - name: Create and initialize Consensus chain + run: | + ci_run zk_inception chain create \ + --chain-name consensus \ + --chain-id sequential \ + --prover-mode no-proofs \ + --wallet-creation localhost \ + --l1-batch-commit-data-generator-mode validium \ + --base-token-address ${{ env.address }} \ + --base-token-price-nominator 3 \ + --base-token-price-denominator 2 \ + --set-as-default false \ + --ignore-prerequisites + + ci_run zk_inception chain init \ + --deploy-paymaster \ + --l1-rpc-url=http://localhost:8545 \ + --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --server-db-name=zksync_server_localhost_consensus \ + --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ + --prover-db-name=zksync_prover_localhost_consensus \ + --port-offset 4000 \ + --chain consensus + + - name: Build test dependencies + run: | + ci_run zk_supervisor test build - - name: Show revert.log logs - if: always() - run: ci_run cat logs/revert/default/server.log || true + - name: Initialize Contract verifier + run: | + ci_run zk_inception 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.18-1.0.1 --only --chain era + ci_run zk_inception contract-verifier run --chain era &> ${{ env.SERVER_LOGS_DIR }}/contract-verifier-rollup.log & - - name: Show upgrade.log logs - if: always() - run: ci_run cat core/tests/upgrade-test/upgrade.log || true + - name: Run servers + run: | + ci_run zk_inception server --ignore-prerequisites --chain era &> ${{ env.SERVER_LOGS_DIR }}/rollup.log & + ci_run zk_inception server --ignore-prerequisites --chain validium &> ${{ env.SERVER_LOGS_DIR }}/validium.log & + ci_run zk_inception server --ignore-prerequisites --chain custom_token &> ${{ env.SERVER_LOGS_DIR }}/custom_token.log & + ci_run zk_inception server --ignore-prerequisites --chain consensus \ + --components=api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,vm_playground,da_dispatcher,consensus \ + &> ${{ env.SERVER_LOGS_DIR }}/consensus.log & - - name: Show fee-projection.log logs - if: always() - run: ci_run cat core/tests/ts-integration/fees.log || true + ci_run sleep 5 - - name: Show sccache logs - if: always() + - name: Run integration tests run: | - ci_run sccache --show-stats || true - ci_run cat /tmp/sccache_log.txt || true + PASSED_ENV_VARS="RUN_CONTRACT_VERIFICATION_TEST" \ + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain era &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/rollup.log & + PID1=$! - external-node: - name: External node (consensus=${{ matrix.consensus }}, base_token=${{ matrix.base_token }}, deployment_mode=${{ matrix.deployment_mode }}) - strategy: - fail-fast: false - matrix: - consensus: [ false, true ] - base_token: [ "Eth", "Custom" ] - deployment_mode: [ "Rollup", "Validium" ] - runs-on: [ matterlabs-ci-runner-highmem-long ] + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain validium &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/validium.log & + PID2=$! - env: - SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,da_dispatcher${{ matrix.consensus && ',consensus' || '' }}${{ matrix.base_token == 'Custom' && ',base_token_ratio_persister' || '' }}" - EXT_NODE_FLAGS: "${{ matrix.consensus && '-- --enable-consensus' || '' }}" + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain custom_token &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/custom_token.log & + PID3=$! + + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain consensus &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/consensus.log & + PID4=$! - steps: - - name: Checkout code # Checks out the repository under $GITHUB_WORKSPACE, so the job can access it. - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - with: - submodules: "recursive" - fetch-depth: 0 + wait $PID1 + wait $PID2 + wait $PID3 + wait $PID4 - - name: Setup environment + - name: Init external nodes run: | - echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV - echo $(pwd)/bin >> $GITHUB_PATH - echo IN_DOCKER=1 >> .env - echo RUN_CONTRACT_VERIFICATION_TEST=true >> .env - echo ZKSYNC_DEBUG_LOGS=true >> .env + ci_run zk_inception 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 + ci_run zk_inception external-node init --ignore-prerequisites --chain era + + ci_run zk_inception 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 + ci_run zk_inception external-node init --ignore-prerequisites --chain validium - - name: Start services - run: | - ci_localnet_up - ci_run pre_download_compilers.sh - ci_run sccache --start-server + ci_run zk_inception 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 + ci_run zk_inception external-node init --ignore-prerequisites --chain custom_token + + ci_run zk_inception 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 + ci_run zk_inception external-node init --ignore-prerequisites --chain consensus - - name: Init + - name: Run recovery tests (from snapshot) run: | - ci_run git config --global --add safe.directory /usr/src/zksync - ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen - 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 - ci_run run_retried rustup show - if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then - ci_run zk config compile - elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then - ci_run zk env dev_validium_docker - ci_run zk config compile dev_validium_docker - fi - ci_run zk init ${{ matrix.base_token == 'Custom' && '--base-token-name BAT' || ''}} ${{ matrix.deployment_mode == 'Validium' && '--validium-mode' || ''}} - # `sleep 30` because we need to wait until server started properly - - name: Run server - run: | - ci_run zk server --components=$SERVER_COMPONENTS &>>server.log & - ci_run sleep 30 + ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain era &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}/rollup.log & + PID1=$! + + ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain validium &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}/validium.log & + PID2=$! + + ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain custom_token &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}/custom_token.log & + PID3=$! + + ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain consensus &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}/consensus.log & + PID4=$! + + wait $PID1 + wait $PID2 + wait $PID3 + wait $PID4 - - name: Run external node + - name: Run recovery tests (from genesis) 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 db setup - ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log & - ci_run sleep 30 + ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain era &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/rollup.log & + PID1=$! - - name: Integration tests - run: ci_run zk test i server --testPathIgnorePatterns 'contract-verification|snapshots-creator' + ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain validium &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/validium.log & + PID2=$! - - 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 + ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain custom_token &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/custom_token.log & + PID3=$! - # 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 - ci_run sleep 30 + ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain consensus &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/consensus.log & + PID4=$! - - name: Run upgrade test + wait $PID1 + wait $PID2 + wait $PID3 + wait $PID4 + + - name: Run external node server 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 - CHECK_EN_URL="http://0.0.0.0:3060" ci_run zk test i upgrade + ci_run zk_inception external-node run --ignore-prerequisites --chain era &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/rollup.log & + ci_run zk_inception external-node run --ignore-prerequisites --chain validium &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/validium.log & + ci_run zk_inception external-node run --ignore-prerequisites --chain custom_token &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/custom_token.log & + ci_run zk_inception external-node run --ignore-prerequisites --chain consensus --enable-consensus &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/consensus.log & - - name: Show server.log logs - if: always() - run: ci_run cat server.log || true + - name: Run integration tests en + run: | + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain era &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/rollup.log & + PID1=$! - - name: Show ext-node.log logs - if: always() - run: ci_run cat ext-node.log || true + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain validium &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/validium.log & + PID2=$! - - name: Show contract_verifier.log logs - if: always() - run: ci_run cat ext-node.log || true + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain custom_token &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/custom_token.log & + PID3=$! - - name: Show revert logs (main node) - if: always() - run: ci_run cat logs/revert/en/default/server.log || true + ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain consensus &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/consensus.log & + PID4=$! - - name: Show revert logs (EN) - if: always() - run: ci_run cat logs/revert/en/default/external_node.log || true + wait $PID1 + wait $PID2 + wait $PID3 + wait $PID4 - - name: Show upgrade.log logs - if: always() - run: ci_run cat core/tests/upgrade-test/upgrade.log || true + - name: Run revert tests + run: | + ci_run killall -INT zksync_server || true + ci_run killall -INT zksync_external_node || true + + ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain era &> ${{ env.REVERT_LOGS_DIR }}/rollup.log & + PID1=$! - - name: Show sccache logs - if: always() + ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain validium &> ${{ env.REVERT_LOGS_DIR }}/validium.log & + PID2=$! + + ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain custom_token &> ${{ env.REVERT_LOGS_DIR }}/custom_token.log & + PID3=$! + + ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain consensus &> ${{ env.REVERT_LOGS_DIR }}/consensus.log & + PID4=$! + + wait $PID1 + wait $PID2 + wait $PID3 + wait $PID4 + + + # Upgrade tests should run last, because as soon as they + # finish the bootloader will be different + # TODO make upgrade tests safe to run multiple times + - name: Run upgrade test run: | - ci_run sccache --show-stats || true - ci_run cat /tmp/sccache_log.txt || true + ci_run zk_supervisor test upgrade --no-deps --chain era + + - name: Upload logs + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + if: always() + with: + name: logs + path: logs diff --git a/.github/workflows/ci-prover-reusable.yml b/.github/workflows/ci-prover-reusable.yml index d1d4a9ab96b2..ac971dafac99 100644 --- a/.github/workflows/ci-prover-reusable.yml +++ b/.github/workflows/ci-prover-reusable.yml @@ -3,7 +3,7 @@ on: workflow_call: jobs: lint: - runs-on: [matterlabs-ci-runner-highmem-long] + runs-on: [ matterlabs-ci-runner-highmem-long ] env: RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml" @@ -17,6 +17,8 @@ jobs: echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV echo $(pwd)/bin >> $GITHUB_PATH echo IN_DOCKER=1 >> .env + echo "prover_url=postgres://postgres:notsecurepassword@localhost:5432/zksync_local_prover" >> $GITHUB_ENV + echo "core_url=postgres://postgres:notsecurepassword@localhost:5432/zksync_local" >> $GITHUB_ENV - name: Start services run: | @@ -27,14 +29,14 @@ jobs: - name: Init run: | - ci_run zk - ci_run zk db setup + ci_run zkt + ci_run zk_supervisor db setup --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }} - name: Formatting run: ci_run bash -c "cd prover && cargo fmt --check" unit-tests: - runs-on: [matterlabs-ci-runner-highmem-long] + runs-on: [ matterlabs-ci-runner-highmem-long ] env: RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml" @@ -58,11 +60,10 @@ jobs: - name: Init run: | - ci_run zk + ci_run zkt ci_run run_retried rustup show - ci_run zk db setup - name: Prover unit tests run: | # Not all tests are enabled, since prover and setup_key_generator_and_server requires bellman-cuda to be present - ci_run zk test prover + ci_run zk_supervisor test prover diff --git a/.github/workflows/ci-zk-toolbox-reusable.yml b/.github/workflows/ci-zk-toolbox-reusable.yml deleted file mode 100644 index 98a44c443581..000000000000 --- a/.github/workflows/ci-zk-toolbox-reusable.yml +++ /dev/null @@ -1,346 +0,0 @@ -name: Workflow template for CI jobs for Core Components -on: - workflow_call: - -env: - CLICOLOR: 1 - # We run multiple binaries in parallel, and by default they will try to utilize all the - # available CPUs. In tests, there is not much CPU-intensive work (rayon), but a lot of - # async work (tokio), so we prioritize tokio. - TOKIO_WORKER_THREADS: 4 - RAYON_NUM_THREADS: 2 - -jobs: - lint: - name: lint - uses: ./.github/workflows/ci-core-lint-reusable.yml - - tests: - runs-on: [ matterlabs-ci-runner-ultra-performance ] - steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - with: - submodules: "recursive" - fetch-depth: 0 - - - name: Setup environment - run: | - echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV - echo $(pwd)/bin >> $GITHUB_PATH - echo IN_DOCKER=1 >> .env - - - name: Start services - run: | - ci_localnet_up - ci_run sccache --start-server - - - name: Build zk_toolbox - run: ci_run bash -c "./bin/zkt" - - - name: Create log directories - run: | - SERVER_LOGS_DIR=logs/server - INTEGRATION_TESTS_LOGS_DIR=logs/integration_tests - INTEGRATION_TESTS_EN_LOGS_DIR=logs/integration_tests/en - SNAPSHOT_RECOVERY_LOGS_DIR=logs/integration_tests/en - GENESIS_RECOVERY_LOGS_DIR=logs/integration_tests/en - EXTERNAL_NODE_LOGS_DIR=logs/external_node - REVERT_LOGS_DIR=logs/revert - - mkdir -p $SERVER_LOGS_DIR - mkdir -p $INTEGRATION_TESTS_LOGS_DIR - mkdir -p $INTEGRATION_TESTS_EN_LOGS_DIR - mkdir -p $SNAPSHOT_RECOVERY_LOGS_DIR - mkdir -p $GENESIS_RECOVERY_LOGS_DIR - mkdir -p $EXTERNAL_NODE_LOGS_DIR - mkdir -p $REVERT_LOGS_DIR - - echo "SERVER_LOGS_DIR=$SERVER_LOGS_DIR" >> $GITHUB_ENV - echo "INTEGRATION_TESTS_LOGS_DIR=$INTEGRATION_TESTS_LOGS_DIR" >> $GITHUB_ENV - echo "INTEGRATION_TESTS_EN_LOGS_DIR=$INTEGRATION_TESTS_EN_LOGS_DIR" >> $GITHUB_ENV - echo "SNAPSHOT_RECOVERY_LOGS_DIR=$SNAPSHOT_RECOVERY_LOGS_DIR" >> $GITHUB_ENV - echo "GENESIS_RECOVERY_LOGS_DIR=$GENESIS_RECOVERY_LOGS_DIR" >> $GITHUB_ENV - echo "EXTERNAL_NODE_LOGS_DIR=$EXTERNAL_NODE_LOGS_DIR" >> $GITHUB_ENV - echo "REVERT_LOGS_DIR=$REVERT_LOGS_DIR" >> $GITHUB_ENV - - - name: Initialize ecosystem - run: | - ci_run git config --global --add safe.directory /usr/src/zksync - 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_inception ecosystem init --deploy-paymaster --deploy-erc20 \ - --deploy-ecosystem --l1-rpc-url=http://localhost:8545 \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_localhost_era \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_localhost_era \ - --ignore-prerequisites --verbose \ - --observability=false - - - name: Create and register chain with transactions signed "offline" - run: | - ci_run zk_inception chain create \ - --chain-name offline_chain \ - --chain-id sequential \ - --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 - - ci_run zk_inception chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545 - - governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) - - ci_run zk_supervisor send-transactions \ - --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ - --l1-rpc-url http://127.0.0.1:8545 \ - --private-key $governor_pk - - bridge_hub=$(awk '/bridgehub_proxy_addr/ {print $2}' ./configs/contracts.yaml) - chain_id=$(awk '/chain_id:/ {print $2}' ./chains/offline_chain/ZkStack.yaml) - - hyperchain_output=$(ci_run cast call $bridge_hub "getHyperchain(uint256)" $chain_id) - - if [[ $hyperchain_output == 0x* && ${#hyperchain_output} -eq 66 ]]; then - echo "Chain successfully registered: $hyperchain_output" - else - echo "Failed to register chain: $hyperchain_output" - exit 1 - fi - - - name: Read Custom Token address and set as environment variable - run: | - address=$(awk -F": " '/tokens:/ {found_tokens=1} found_tokens && /DAI:/ {found_dai=1} found_dai && /address:/ {print $2; exit}' ./configs/erc20.yaml) - echo "address=$address" - echo "address=$address" >> $GITHUB_ENV - - - name: Create and initialize Validium chain - run: | - ci_run zk_inception chain create \ - --chain-name validium \ - --chain-id sequential \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode validium \ - --base-token-address 0x0000000000000000000000000000000000000001 \ - --base-token-price-nominator 1 \ - --base-token-price-denominator 1 \ - --set-as-default false \ - --ignore-prerequisites - - ci_run zk_inception chain init \ - --deploy-paymaster \ - --l1-rpc-url=http://localhost:8545 \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_localhost_validium \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_localhost_validium \ - --port-offset 2000 \ - --chain validium - - - name: Create and initialize chain with Custom Token - run: | - ci_run zk_inception chain create \ - --chain-name custom_token \ - --chain-id sequential \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode rollup \ - --base-token-address ${{ env.address }} \ - --base-token-price-nominator 3 \ - --base-token-price-denominator 2 \ - --set-as-default false \ - --ignore-prerequisites - - ci_run zk_inception chain init \ - --deploy-paymaster \ - --l1-rpc-url=http://localhost:8545 \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_localhost_custom_token \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_localhost_custom_token \ - --port-offset 3000 \ - --chain custom_token - - - name: Create and initialize Consensus chain - run: | - ci_run zk_inception chain create \ - --chain-name consensus \ - --chain-id sequential \ - --prover-mode no-proofs \ - --wallet-creation localhost \ - --l1-batch-commit-data-generator-mode validium \ - --base-token-address ${{ env.address }} \ - --base-token-price-nominator 3 \ - --base-token-price-denominator 2 \ - --set-as-default false \ - --ignore-prerequisites - - ci_run zk_inception chain init \ - --deploy-paymaster \ - --l1-rpc-url=http://localhost:8545 \ - --server-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --server-db-name=zksync_server_localhost_consensus \ - --prover-db-url=postgres://postgres:notsecurepassword@localhost:5432 \ - --prover-db-name=zksync_prover_localhost_consensus \ - --port-offset 4000 \ - --chain consensus - - - name: Build test dependencies - run: | - ci_run zk_supervisor test build - - - name: Run servers - run: | - ci_run zk_inception server --ignore-prerequisites --chain era &> ${{ env.SERVER_LOGS_DIR }}/rollup.log & - ci_run zk_inception server --ignore-prerequisites --chain validium &> ${{ env.SERVER_LOGS_DIR }}/validium.log & - ci_run zk_inception server --ignore-prerequisites --chain custom_token &> ${{ env.SERVER_LOGS_DIR }}/custom_token.log & - ci_run zk_inception server --ignore-prerequisites --chain consensus \ - --components=api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,vm_playground,da_dispatcher,consensus \ - &> ${{ env.SERVER_LOGS_DIR }}/consensus.log & - - ci_run sleep 5 - - - name: Run integration tests - run: | - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain era &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/rollup.log & - PID1=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain validium &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/validium.log & - PID2=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain custom_token &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/custom_token.log & - PID3=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --chain consensus &> ${{ env.INTEGRATION_TESTS_LOGS_DIR }}/consensus.log & - PID4=$! - - wait $PID1 - wait $PID2 - wait $PID3 - wait $PID4 - - - name: Init external nodes - run: | - ci_run zk_inception 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 - ci_run zk_inception external-node init --ignore-prerequisites --chain era - - ci_run zk_inception 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 - ci_run zk_inception external-node init --ignore-prerequisites --chain validium - - ci_run zk_inception 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 - ci_run zk_inception external-node init --ignore-prerequisites --chain custom_token - - ci_run zk_inception 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 - ci_run zk_inception external-node init --ignore-prerequisites --chain consensus - - - name: Run recovery tests (from snapshot) - run: | - - ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain era &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}/rollup.log & - PID1=$! - - ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain validium &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}//validium.log & - PID2=$! - - ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain custom_token &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}//custom_token.log & - PID3=$! - - ci_run zk_supervisor test recovery --snapshot --no-deps --ignore-prerequisites --verbose --chain consensus &> ${{ env.SNAPSHOT_RECOVERY_LOGS_DIR }}//consensus.log & - PID4=$! - - wait $PID1 - wait $PID2 - wait $PID3 - wait $PID4 - - - name: Run recovery tests (from genesis) - run: | - ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain era &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/rollup.log & - PID1=$! - - ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain validium &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/validium.log & - PID2=$! - - ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain custom_token &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/custom_token.log & - PID3=$! - - ci_run zk_supervisor test recovery --no-deps --no-kill --ignore-prerequisites --verbose --chain consensus &> ${{ env.GENESIS_RECOVERY_LOGS_DIR }}/consensus.log & - PID4=$! - - wait $PID1 - wait $PID2 - wait $PID3 - wait $PID4 - - - name: Run external node server - run: | - ci_run zk_inception external-node run --ignore-prerequisites --chain era &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/rollup.log & - ci_run zk_inception external-node run --ignore-prerequisites --chain validium &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/validium.log & - ci_run zk_inception external-node run --ignore-prerequisites --chain custom_token &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/custom_token.log & - ci_run zk_inception external-node run --ignore-prerequisites --chain consensus --enable-consensus &> ${{ env.EXTERNAL_NODE_LOGS_DIR }}/consensus.log & - ci_run sleep 5 - - - name: Run integration tests en - run: | - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain era &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/rollup.log & - PID1=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain validium &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/validium.log & - PID2=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain custom_token &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/custom_token.log & - PID3=$! - - ci_run zk_supervisor test integration --no-deps --ignore-prerequisites --external-node --chain consensus &> ${{ env.INTEGRATION_TESTS_EN_LOGS_DIR }}/consensus.log & - PID4=$! - - wait $PID1 - wait $PID2 - wait $PID3 - wait $PID4 - - - name: Run revert tests - run: | - ci_run killall -INT zksync_server || true - ci_run killall -INT zksync_external_node || true - - ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain era &> ${{ env.REVERT_LOGS_DIR }}/rollup.log & - PID1=$! - - ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain validium &> ${{ env.REVERT_LOGS_DIR }}/validium.log & - PID2=$! - - ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain custom_token &> ${{ env.REVERT_LOGS_DIR }}/custom_token.log & - PID3=$! - - ci_run zk_supervisor test revert --no-deps --external-node --no-kill --ignore-prerequisites --chain consensus &> ${{ env.REVERT_LOGS_DIR }}/consensus.log & - PID4=$! - - wait $PID1 - wait $PID2 - wait $PID3 - wait $PID4 - - # Upgrade tests should run last, because as soon as they - # finish the bootloader will be different - # TODO make upgrade tests safe to run multiple times - - name: Run upgrade test - run: | - ci_run zk_supervisor test upgrade --no-deps --chain era - - - name: Upload logs - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - if: always() - with: - name: logs - path: logs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e05b84cda971..291f9237ac52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,14 +58,10 @@ jobs: - '.github/workflows/ci-core-lint-reusable.yml' - 'Cargo.toml' - 'Cargo.lock' - - '!**/*.md' - - '!**/*.MD' - - 'docker-compose.yml' - zk_toolbox: - - '.github/workflows/ci-zk-toolbox-reusable.yml' - 'zk_toolbox/**' - '!**/*.md' - '!**/*.MD' + - 'docker-compose.yml' docs: - '**/*.md' - '**/*.MD' @@ -98,12 +94,6 @@ jobs: name: CI for Prover Components uses: ./.github/workflows/ci-prover-reusable.yml - ci-for-zk-toolbox: - needs: changed_files - if: ${{ (needs.changed_files.outputs.core == 'true' || needs.changed_files.outputs.zk_toolbox == 'true' || needs.changed_files.outputs.all == 'true') && !contains(github.ref_name, 'release-please--branches') }} - name: CI for zk_toolbox - uses: ./.github/workflows/ci-zk-toolbox-reusable.yml - ci-for-docs: needs: changed_files if: needs.changed_files.outputs.docs == 'true' @@ -187,7 +177,7 @@ jobs: name: Github Status Check runs-on: ubuntu-latest if: always() && !cancelled() - needs: [ci-for-core-lint, ci-for-common, ci-for-core, ci-for-prover, ci-for-docs, build-core-images, build-contract-verifier, build-prover-images] + needs: [ ci-for-core-lint, ci-for-common, ci-for-core, ci-for-prover, ci-for-docs, build-core-images, build-contract-verifier, build-prover-images ] steps: - name: Status run: | diff --git a/.github/workflows/vm-perf-comparison.yml b/.github/workflows/vm-perf-comparison.yml index cfcfff93037f..cd6f490b3368 100644 --- a/.github/workflows/vm-perf-comparison.yml +++ b/.github/workflows/vm-perf-comparison.yml @@ -8,7 +8,7 @@ on: jobs: vm-benchmarks: name: Run VM benchmarks - runs-on: [matterlabs-ci-runner-highmem-long] + runs-on: [ matterlabs-ci-runner-highmem-long ] steps: - name: checkout base branch @@ -44,20 +44,20 @@ jobs: - name: run benchmarks on base branch shell: bash run: | - ci_run zk - ci_run zk compiler system-contracts + ci_run zkt + ci_run zk_supervisor contracts --system-contracts ci_run cargo bench --package vm-benchmark --bench iai | tee base-iai ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee base-opcodes || touch base-opcodes - ci_run yarn workspace system-contracts clean - name: checkout PR - run: git checkout --force FETCH_HEAD --recurse-submodules + run: | + git checkout --force FETCH_HEAD --recurse-submodules - name: run benchmarks on PR shell: bash run: | - ci_run zk - ci_run zk compiler system-contracts + ci_run zkt + ci_run zk_supervisor contracts --system-contracts ci_run cargo bench --package vm-benchmark --bench iai | tee pr-iai ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee pr-opcodes || touch pr-opcodes diff --git a/.github/workflows/vm-perf-to-prometheus.yml b/.github/workflows/vm-perf-to-prometheus.yml index 4d90b2a24ebb..d201949b3ebe 100644 --- a/.github/workflows/vm-perf-to-prometheus.yml +++ b/.github/workflows/vm-perf-to-prometheus.yml @@ -12,7 +12,7 @@ concurrency: vm-benchmarks jobs: vm-benchmarks: name: Run VM benchmarks - runs-on: [matterlabs-ci-runner-highmem-long] + runs-on: [ matterlabs-ci-runner-highmem-long ] steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 @@ -30,8 +30,8 @@ jobs: run: | run_retried docker compose pull zk docker compose up -d zk - ci_run zk - ci_run zk compiler all + ci_run zkt + ci_run zks contracts all - name: run benchmarks run: | diff --git a/core/bin/system-constants-generator/src/utils.rs b/core/bin/system-constants-generator/src/utils.rs index 3775b3c0e243..e596208a7949 100644 --- a/core/bin/system-constants-generator/src/utils.rs +++ b/core/bin/system-constants-generator/src/utils.rs @@ -2,7 +2,7 @@ use std::{cell::RefCell, rc::Rc}; use once_cell::sync::Lazy; use zksync_contracts::{ - load_sys_contract, read_bootloader_code, read_sys_contract_bytecode, read_zbin_bytecode, + load_sys_contract, read_bootloader_code, read_bytecode_from_path, read_sys_contract_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode, }; use zksync_multivm::{ @@ -169,9 +169,8 @@ pub(super) fn get_l1_txs(number_of_txs: usize) -> (Vec, Vec Vec { - read_zbin_bytecode(format!( - "contracts/system-contracts/bootloader/tests/artifacts/{}.yul.zbin", - test + read_bytecode_from_path(format!( + "contracts/system-contracts/zkout/{test}.yul/contracts-preprocessed/bootloader/{test}.yul.json", )) } diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs index f57649c9d695..a60d9fbf1813 100644 --- a/core/lib/contracts/src/lib.rs +++ b/core/lib/contracts/src/lib.rs @@ -211,7 +211,7 @@ pub fn known_codes_contract() -> Contract { } /// Reads bytecode from a given path. -fn read_bytecode_from_path(artifact_path: impl AsRef + std::fmt::Debug) -> Vec { +pub fn read_bytecode_from_path(artifact_path: impl AsRef + std::fmt::Debug) -> Vec { let artifact = read_file_to_json_value(&artifact_path); let bytecode = artifact["bytecode"] diff --git a/core/tests/ts-integration/contracts/zkasm/deep_stak.zkasm b/core/tests/ts-integration/contracts/zkasm/deep_stak.zkasm index bdfb4e70de7c..4cdf8542cab7 100644 --- a/core/tests/ts-integration/contracts/zkasm/deep_stak.zkasm +++ b/core/tests/ts-integration/contracts/zkasm/deep_stak.zkasm @@ -1,26 +1,25 @@ .text - .file "loop.yul" - .globl __entry + .file "loop.yul" + .globl __entry __entry: .func_begin0: - and! 1, r2, r1 - jump.ne @.BB0_2 + and! 1, r2, r1 + jump.ne @.BB0_2 __LOOP: - near_call r0, @__LOOP, @__LOOP + call r0, @__LOOP, @__LOOP .BB0_1: - add 1, r0, r2 - ret + add 1, r0, r2 + ret .BB0_2: - add 32, r0, r1 - st.2 256, r1 - st.2 288, r0 - add @CPI0_0[0], r0, r1 - ret.ok.to_label r1, @DEFAULT_FAR_RETURN + add 32, r0, r1 + stm.ah 256, r1 + stm.ah 288, r0 + add code[@CPI0_0], r0, r1 + retl r1, @DEFAULT_FAR_RETURN .func_end0: - -.func_end1: - - .note.GNU-stack - .rodata +;; landing pad for returns +DEFAULT_FAR_RETURN: + retl @DEFAULT_FAR_RETURN + .rodata CPI0_0: - .cell 53919893334301279589334030174039261352344891250716429051063678533632 \ No newline at end of file + .cell 53919893334301279589334030174039261352344891250716429051063678533632 diff --git a/core/tests/ts-integration/hardhat.config.ts b/core/tests/ts-integration/hardhat.config.ts index 00abe2b32efb..42ee6bacf7ad 100644 --- a/core/tests/ts-integration/hardhat.config.ts +++ b/core/tests/ts-integration/hardhat.config.ts @@ -4,14 +4,14 @@ import '@matterlabs/hardhat-zksync-vyper'; export default { zksolc: { - version: '1.3.21', + version: '1.5.3', compilerSource: 'binary', settings: { - isSystem: true + enableEraVMExtensions: true } }, zkvyper: { - version: '1.3.13', + version: '1.5.4', compilerSource: 'binary' }, networks: { @@ -20,7 +20,8 @@ export default { } }, solidity: { - version: '0.8.23' + version: '0.8.18', + eraVersion: '1.0.1' }, vyper: { version: '0.3.10' diff --git a/core/tests/ts-integration/package.json b/core/tests/ts-integration/package.json index 0e9b863d8e16..9d53420edaad 100644 --- a/core/tests/ts-integration/package.json +++ b/core/tests/ts-integration/package.json @@ -13,9 +13,9 @@ "build-yul": "hardhat run scripts/compile-yul.ts" }, "devDependencies": { - "@matterlabs/hardhat-zksync-deploy": "^1.3.0", - "@matterlabs/hardhat-zksync-solc": "^1.1.4", - "@matterlabs/hardhat-zksync-vyper": "^1.0.8", + "@matterlabs/hardhat-zksync-deploy": "^1.5.0", + "@matterlabs/hardhat-zksync-solc": "^1.2.4", + "@matterlabs/hardhat-zksync-vyper": "^1.1.0", "@nomiclabs/hardhat-vyper": "^3.0.6", "@types/jest": "^29.0.3", "@types/node": "^18.19.15", diff --git a/core/tests/ts-integration/scripts/compile-yul.ts b/core/tests/ts-integration/scripts/compile-yul.ts index dda65456a6c6..876caacdfab3 100644 --- a/core/tests/ts-integration/scripts/compile-yul.ts +++ b/core/tests/ts-integration/scripts/compile-yul.ts @@ -7,7 +7,7 @@ import { getZksolcUrl, saltFromUrl } from '@matterlabs/hardhat-zksync-solc'; import { getCompilersDir } from 'hardhat/internal/util/global-dir'; import path from 'path'; -const COMPILER_VERSION = '1.3.21'; +const COMPILER_VERSION = '1.5.3'; const IS_COMPILER_PRE_RELEASE = false; async function compilerLocation(): Promise { @@ -48,18 +48,24 @@ export async function compile( } let paths = preparePaths(pathToHome, path, files, outputDirName); - let systemMode = type === 'yul' ? '--system-mode --optimization 3' : ''; + let eraVmExtensions = type === 'yul' ? '--enable-eravm-extensions --optimization 3' : ''; const zksolcLocation = await compilerLocation(); await spawn( - `${zksolcLocation} ${paths.absolutePathSources}/${paths.outputDir} ${systemMode} --${type} --bin --overwrite -o ${paths.absolutePathArtifacts}/${paths.outputDir}` + `${zksolcLocation} ${paths.absolutePathSources}/${paths.outputDir} ${eraVmExtensions} --${type} --bin --overwrite -o ${paths.absolutePathArtifacts}/${paths.outputDir}` ); } export async function compileFolder(pathToHome: string, path: string, type: string) { + let compilationMode; + if (type === 'zkasm') { + compilationMode = 'eravm-assembly'; + } else { + compilationMode = type; + } let files: string[] = (await fs.promises.readdir(path)).filter((fn) => fn.endsWith(`.${type}`)); for (const file of files) { - await compile(pathToHome, path, [file], `${file}`, type); + await compile(pathToHome, path, [file], `${file}`, compilationMode); } } diff --git a/core/tests/ts-integration/tests/api/contract-verification.test.ts b/core/tests/ts-integration/tests/api/contract-verification.test.ts index c0cd887bcf7d..77ab2e6ddfcb 100644 --- a/core/tests/ts-integration/tests/api/contract-verification.test.ts +++ b/core/tests/ts-integration/tests/api/contract-verification.test.ts @@ -10,11 +10,11 @@ import { NodeMode } from '../../src/types'; // Regular expression to match ISO dates. const DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{6})?/; -const ZKSOLC_VERSION = 'v1.3.21'; -const SOLC_VERSION = '0.8.23'; -const ZK_VM_SOLC_VERSION = 'zkVM-0.8.23-1.0.0'; +const ZKSOLC_VERSION = 'v1.5.3'; +const SOLC_VERSION = '0.8.26'; +const ZK_VM_SOLC_VERSION = 'zkVM-0.8.18-1.0.1'; -const ZKVYPER_VERSION = 'v1.3.13'; +const ZKVYPER_VERSION = 'v1.5.4'; const VYPER_VERSION = '0.3.10'; type HttpMethod = 'POST' | 'GET'; @@ -54,32 +54,6 @@ describe('Tests for the contract verification API', () => { const counterContract = await deployContract(alice, contracts.counter, []); const constructorArguments = counterContract.interface.encodeDeploy([]); - const requestBody = { - contractAddress: await counterContract.getAddress(), - contractName: 'contracts/counter/counter.sol:Counter', - sourceCode: getContractSource('counter/counter.sol'), - compilerZksolcVersion: ZKSOLC_VERSION, - compilerSolcVersion: SOLC_VERSION, - optimizationUsed: true, - constructorArguments, - isSystem: true - }; - let requestId = await query('POST', '/contract_verification', undefined, requestBody); - - await expectVerifyRequestToSucceed(requestId, requestBody); - }); - - test('should test zkVM solc contract verification', async () => { - let artifact = contracts.counter; - // TODO: use plugin compilation when it's ready instead of pre-compiled bytecode. - artifact.bytecode = fs.readFileSync( - `${testMaster.environment().pathToHome}/core/tests/ts-integration/contracts/counter/zkVM_bytecode.txt`, - 'utf8' - ); - - const counterContract = await deployContract(alice, artifact, []); - const constructorArguments = counterContract.interface.encodeDeploy([]); - const requestBody = { contractAddress: await counterContract.getAddress(), contractName: 'contracts/counter/counter.sol:Counter', @@ -127,7 +101,7 @@ describe('Tests for the contract verification API', () => { sourceCode: standardJsonInput, codeFormat: 'solidity-standard-json-input', compilerZksolcVersion: ZKSOLC_VERSION, - compilerSolcVersion: SOLC_VERSION, + compilerSolcVersion: ZK_VM_SOLC_VERSION, optimizationUsed: true, constructorArguments }; @@ -144,8 +118,8 @@ describe('Tests for the contract verification API', () => { const bytecodePath = `${ testMaster.environment().pathToHome - }/core/tests/ts-integration/contracts/yul/artifacts/Empty.yul/Empty.yul.zbin`; - const bytecode = fs.readFileSync(bytecodePath); + }/core/tests/ts-integration/contracts/yul/artifacts/Empty.yul/yul/Empty.yul.zbin`; + const bytecode = fs.readFileSync(bytecodePath, 'utf8'); const contractFactory = new zksync.ContractFactory([], bytecode, alice); const deployTx = await contractFactory.deploy(); @@ -157,7 +131,7 @@ describe('Tests for the contract verification API', () => { sourceCode, codeFormat: 'yul-single-file', compilerZksolcVersion: ZKSOLC_VERSION, - compilerSolcVersion: SOLC_VERSION, + compilerSolcVersion: ZK_VM_SOLC_VERSION, optimizationUsed: true, constructorArguments: '0x', isSystem: true diff --git a/core/tests/ts-integration/tests/api/debug.test.ts b/core/tests/ts-integration/tests/api/debug.test.ts index dd1ea141a419..054aa57cf64e 100644 --- a/core/tests/ts-integration/tests/api/debug.test.ts +++ b/core/tests/ts-integration/tests/api/debug.test.ts @@ -29,8 +29,8 @@ describe('Debug methods', () => { test('Should not fail for infinity recursion', async () => { const bytecodePath = `${ testMaster.environment().pathToHome - }/core/tests/ts-integration/contracts/zkasm/artifacts/deep_stak.zkasm/deep_stak.zkasm.zbin`; - const bytecode = fs.readFileSync(bytecodePath); + }/core/tests/ts-integration/contracts/zkasm/artifacts/deep_stak.zkasm/zkasm/deep_stak.zkasm.zbin`; + const bytecode = fs.readFileSync(bytecodePath, 'utf-8'); const contractFactory = new zksync.ContractFactory([], bytecode, testMaster.mainAccount()); const deployTx = await contractFactory.deploy(); diff --git a/docker/external-node/Dockerfile b/docker/external-node/Dockerfile index dc989f9ba4e7..7d276941dc42 100644 --- a/docker/external-node/Dockerfile +++ b/docker/external-node/Dockerfile @@ -18,6 +18,8 @@ COPY contracts/system-contracts/bootloader/build/artifacts/ /contracts/system-co COPY contracts/system-contracts/contracts-preprocessed/artifacts/ /contracts/system-contracts/contracts-preprocessed/artifacts/ COPY contracts/system-contracts/contracts-preprocessed/precompiles/artifacts/ /contracts/system-contracts/contracts-preprocessed/precompiles/artifacts/ COPY contracts/system-contracts/artifacts-zk /contracts/system-contracts/artifacts-zk +COPY contracts/l1-contracts/out/ /contracts/l1-contracts/out/ +# TODO Remove once we use foundry inside contracts repo COPY contracts/l1-contracts/artifacts/ /contracts/l1-contracts/artifacts/ COPY contracts/l2-contracts/artifacts-zk/ /contracts/l2-contracts/artifacts-zk/ COPY etc/tokens/ /etc/tokens/ diff --git a/docker/server-v2/Dockerfile b/docker/server-v2/Dockerfile index e5d378c3b6d8..07611a1d7b4d 100644 --- a/docker/server-v2/Dockerfile +++ b/docker/server-v2/Dockerfile @@ -24,6 +24,8 @@ COPY contracts/system-contracts/bootloader/build/artifacts/ /contracts/system-co COPY contracts/system-contracts/contracts-preprocessed/artifacts/ /contracts/system-contracts/contracts-preprocessed/artifacts/ COPY contracts/system-contracts/contracts-preprocessed/precompiles/artifacts/ /contracts/system-contracts/contracts-preprocessed/precompiles/artifacts/ COPY contracts/system-contracts/artifacts-zk /contracts/system-contracts/artifacts-zk +COPY contracts/l1-contracts/out/ /contracts/l1-contracts/out/ +# TODO Remove once we use foundry inside contracts repo COPY contracts/l1-contracts/artifacts/ /contracts/l1-contracts/artifacts/ COPY contracts/l2-contracts/artifacts-zk/ /contracts/l2-contracts/artifacts-zk/ COPY etc/tokens/ /etc/tokens/ diff --git a/docs/guides/external-node/building-from-scratch/Dockerfile b/docs/guides/external-node/building-from-scratch/Dockerfile index da098df91d51..5b015a4545b7 100644 --- a/docs/guides/external-node/building-from-scratch/Dockerfile +++ b/docs/guides/external-node/building-from-scratch/Dockerfile @@ -11,8 +11,7 @@ ENV ZKSYNC_HOME=/usr/src/zksync/zksync-era ENV PATH="${ZKSYNC_HOME}/bin:${PATH}" # build zk tool -RUN zk -RUN yarn zk build +RUN zkt # build rust RUN cargo build --release @@ -20,12 +19,7 @@ RUN cp target/release/zksync_external_node /usr/bin # build contracts RUN git submodule update --init --recursive -RUN zk run yarn -RUN zk compiler all || true -RUN rm /root/.cache/hardhat-nodejs/compilers-v2/linux-amd64/solc-*.does.not.work || true -RUN zk compiler all -RUN zk contract build -RUN zk f yarn run l2-contracts build +RUN zk_supervisor contracts # copy migrations (node expects them to be in specific directory) RUN cp -r core/lib/dal/migrations/ migrations diff --git a/prover/crates/bin/prover_cli/src/cli.rs b/prover/crates/bin/prover_cli/src/cli.rs index 41ef94980056..de5d2d2525b4 100644 --- a/prover/crates/bin/prover_cli/src/cli.rs +++ b/prover/crates/bin/prover_cli/src/cli.rs @@ -44,6 +44,8 @@ pub struct ProverCLIConfig { env("PLI__DB_URL") )] pub db_url: SensitiveUrl, + #[clap(default_value = "10")] + pub max_failure_attempts: u32, } #[derive(Subcommand)] diff --git a/prover/crates/bin/prover_cli/src/commands/status/batch.rs b/prover/crates/bin/prover_cli/src/commands/status/batch.rs index 797695b02278..dc63f6bf837c 100644 --- a/prover/crates/bin/prover_cli/src/commands/status/batch.rs +++ b/prover/crates/bin/prover_cli/src/commands/status/batch.rs @@ -4,8 +4,6 @@ use anyhow::Context as _; use circuit_definitions::zkevm_circuits::scheduler::aux::BaseLayerCircuitType; use clap::Args as ClapArgs; use colored::*; -use zksync_config::configs::FriProverConfig; -use zksync_env_config::FromEnv; use zksync_prover_dal::{Connection, ConnectionPool, Prover, ProverDal}; use zksync_types::{ basic_fri_types::AggregationRound, @@ -57,9 +55,9 @@ pub(crate) async fn run(args: Args, config: ProverCLIConfig) -> anyhow::Result<( } if !args.verbose { - display_batch_status(batch_data); + display_batch_status(batch_data, config.max_failure_attempts); } else { - display_batch_info(batch_data); + display_batch_info(batch_data, config.max_failure_attempts); } } @@ -200,19 +198,19 @@ async fn get_proof_compression_job_info_for_batch<'a>( .await } -fn display_batch_status(batch_data: BatchData) { - display_status_for_stage(batch_data.basic_witness_generator); - display_status_for_stage(batch_data.leaf_witness_generator); - display_status_for_stage(batch_data.node_witness_generator); - display_status_for_stage(batch_data.recursion_tip_witness_generator); - display_status_for_stage(batch_data.scheduler_witness_generator); - display_status_for_stage(batch_data.compressor); +fn display_batch_status(batch_data: BatchData, max_failure_attempts: u32) { + display_status_for_stage(batch_data.basic_witness_generator, max_failure_attempts); + display_status_for_stage(batch_data.leaf_witness_generator, max_failure_attempts); + display_status_for_stage(batch_data.node_witness_generator, max_failure_attempts); + display_status_for_stage( + batch_data.recursion_tip_witness_generator, + max_failure_attempts, + ); + display_status_for_stage(batch_data.scheduler_witness_generator, max_failure_attempts); + display_status_for_stage(batch_data.compressor, max_failure_attempts); } -fn display_status_for_stage(stage_info: StageInfo) { - let max_attempts = FriProverConfig::from_env() - .expect("Fail to read prover config.") - .max_attempts; +fn display_status_for_stage(stage_info: StageInfo, max_attempts: u32) { display_aggregation_round(&stage_info); let status = stage_info.witness_generator_jobs_status(max_attempts); match status { @@ -231,19 +229,19 @@ fn display_status_for_stage(stage_info: StageInfo) { } } -fn display_batch_info(batch_data: BatchData) { - display_info_for_stage(batch_data.basic_witness_generator); - display_info_for_stage(batch_data.leaf_witness_generator); - display_info_for_stage(batch_data.node_witness_generator); - display_info_for_stage(batch_data.recursion_tip_witness_generator); - display_info_for_stage(batch_data.scheduler_witness_generator); - display_info_for_stage(batch_data.compressor); +fn display_batch_info(batch_data: BatchData, max_failure_attempts: u32) { + display_info_for_stage(batch_data.basic_witness_generator, max_failure_attempts); + display_info_for_stage(batch_data.leaf_witness_generator, max_failure_attempts); + display_info_for_stage(batch_data.node_witness_generator, max_failure_attempts); + display_info_for_stage( + batch_data.recursion_tip_witness_generator, + max_failure_attempts, + ); + display_info_for_stage(batch_data.scheduler_witness_generator, max_failure_attempts); + display_info_for_stage(batch_data.compressor, max_failure_attempts); } -fn display_info_for_stage(stage_info: StageInfo) { - let max_attempts = FriProverConfig::from_env() - .expect("Fail to read prover config.") - .max_attempts; +fn display_info_for_stage(stage_info: StageInfo, max_attempts: u32) { display_aggregation_round(&stage_info); let status = stage_info.witness_generator_jobs_status(max_attempts); match status { diff --git a/yarn.lock b/yarn.lock index f400104b9c20..b70e64f148a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1703,20 +1703,20 @@ chalk "4.1.2" ts-morph "^19.0.0" -"@matterlabs/hardhat-zksync-deploy@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-1.3.0.tgz#5c2b723318ddf6c4d3929ec225401864ff54557a" - integrity sha512-4UHOgOwIBC4JA3W8DE9GHqbAuBhCPAjtM+Oew1aiYYGkIsPUAMYsH35+4I2FzJsYyE6mD6ATmoS/HfZweQHTlQ== +"@matterlabs/hardhat-zksync-deploy@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-1.5.0.tgz#40cb454fb187da4bb354f3acb48762a6657fcb36" + integrity sha512-7LAgYYwoKWHeR+3CyWEvA3NKBKtt7ktcr7SX6ZPgbEYqHAdXH02vxJZGwNADtMWpyYm8h+fEQkpPIgErD4NhmA== dependencies: - "@matterlabs/hardhat-zksync-solc" "^1.0.4" - chai "^4.3.6" - chalk "4.1.2" + "@matterlabs/hardhat-zksync-solc" "^1.2.0" + chai "^4.3.4" + chalk "^4.1.2" fs-extra "^11.2.0" - glob "^10.3.10" + glob "^10.4.1" lodash "^4.17.21" - sinon "^17.0.1" + sinon "^18.0.0" sinon-chai "^3.7.0" - ts-morph "^21.0.1" + ts-morph "^22.0.0" "@matterlabs/hardhat-zksync-node@^0.0.1-beta.7": version "0.0.1" @@ -1760,7 +1760,7 @@ chalk "4.1.2" dockerode "^3.3.4" -"@matterlabs/hardhat-zksync-solc@^1.0.4", "@matterlabs/hardhat-zksync-solc@^1.0.5", "@matterlabs/hardhat-zksync-solc@^1.1.4": +"@matterlabs/hardhat-zksync-solc@^1.0.5", "@matterlabs/hardhat-zksync-solc@^1.1.4": version "1.1.4" resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-1.1.4.tgz#04a2fad6fb6b6944c64ad969080ee65b9af3f617" integrity sha512-4/usbogh9neewR2/v8Dn2OzqVblZMUuT/iH2MyPZgPRZYQlL4SlZtMvokU9UQjZT6iSoaKCbbdWESHDHSzfUjA== @@ -1794,6 +1794,23 @@ sinon-chai "^3.7.0" undici "^6.18.2" +"@matterlabs/hardhat-zksync-solc@^1.2.4": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-1.2.4.tgz#b14a1dbfe751058bf2d79eab747b87c7ca7d2361" + integrity sha512-9Nk95kxOZ9rl26trP/pXDLw5MqFAd0CD8FMTGDvA5HBGk6CL2wg4tS0gmucYz5R4qj09KUYOO4FW4rgd/atcGg== + dependencies: + "@nomiclabs/hardhat-docker" "^2.0.2" + chai "^4.3.4" + chalk "^4.1.2" + debug "^4.3.5" + dockerode "^4.0.2" + fs-extra "^11.2.0" + proper-lockfile "^4.1.2" + semver "^7.6.2" + sinon "^18.0.0" + sinon-chai "^3.7.0" + undici "^6.18.2" + "@matterlabs/hardhat-zksync-verify@^0.2.0": version "0.2.2" resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-verify/-/hardhat-zksync-verify-0.2.2.tgz#daa34bc4404096ed0f44461ee366c1cb0e5a4f2f" @@ -1824,20 +1841,20 @@ sinon "^18.0.0" sinon-chai "^3.7.0" -"@matterlabs/hardhat-zksync-vyper@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-vyper/-/hardhat-zksync-vyper-1.0.8.tgz#d5bd496715a1e322b0bf3926b4146b4e18ab64ff" - integrity sha512-XR7rbfDuBG5/LZWYfhQTP9gD+U24hSJHDuZ9U55wgIfiQTOxPoztFwEbQNiC39vjT5MjP/Nv8/IDrlEBkaVCgw== +"@matterlabs/hardhat-zksync-vyper@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-vyper/-/hardhat-zksync-vyper-1.1.0.tgz#b3fb304429e88a84b4abc3fe4e5a83b2f5e907bd" + integrity sha512-zDjHPeIuHRpumXiWZUbhoji4UJe09jTDRn4xnxsuVkLH7qLAm0VDFzCXYNMvEuySZSdhbSbekxJsH9Kunc5ycA== dependencies: - "@nomiclabs/hardhat-docker" "^2.0.0" - chai "^4.3.6" - chalk "4.1.2" + "@nomiclabs/hardhat-docker" "^2.0.2" + chai "^4.3.4" + chalk "^4.1.2" dockerode "^4.0.2" - fs-extra "^11.1.1" - semver "^7.5.4" - sinon "^17.0.1" + fs-extra "^11.2.0" + semver "^7.6.2" + sinon "^18.0.0" sinon-chai "^3.7.0" - undici "^5.14.0" + undici "^6.18.2" "@matterlabs/prettier-config@^1.0.3": version "1.0.3" @@ -2531,10 +2548,10 @@ mkdirp "^2.1.6" path-browserify "^1.0.1" -"@ts-morph/common@~0.22.0": - version "0.22.0" - resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.22.0.tgz#8951d451622a26472fbc3a227d6c3a90e687a683" - integrity sha512-HqNBuV/oIlMKdkLshXd1zKBqNQCsuPEsgQOkfFQ/eUKjRlwndXW1AjN9LVkBEIukm00gGXSRmfkl0Wv5VXLnlw== +"@ts-morph/common@~0.23.0": + version "0.23.0" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.23.0.tgz#bd4ddbd3f484f29476c8bd985491592ae5fc147e" + integrity sha512-m7Lllj9n/S6sOkCkRftpM7L24uvmfXQFedlW/4hENcuJH1HHm9u5EgxZb9uVjQSCGrbBWBkOGgcTxNg36r6ywA== dependencies: fast-glob "^3.3.2" minimatch "^9.0.3" @@ -4053,6 +4070,11 @@ code-block-writer@^12.0.0: resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-12.0.0.tgz#4dd58946eb4234105aff7f0035977b2afdc2a770" integrity sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w== +code-block-writer@^13.0.1: + version "13.0.2" + resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-13.0.2.tgz#e1c6c3dbe5d38b4ac76fb62c4d4b2fc4bf04c9c1" + integrity sha512-XfXzAGiStXSmCIwrkdfvc7FS5Dtj8yelCtyOf2p2skCAfvLd6zu0rGzuS9NSCO3bq1JKpFZ7tbKdKlcd5occQA== + collect-v8-coverage@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" @@ -5925,16 +5947,17 @@ glob@8.1.0, glob@^8.0.3: minimatch "^5.0.1" once "^1.3.0" -glob@^10.3.10: - version "10.3.16" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.16.tgz#bf6679d5d51279c8cfae4febe0d051d2a4bf4c6f" - integrity sha512-JDKXl1DiuuHJ6fVS2FXjownaavciiHNUU4mOvV/B793RLh05vZL1rcPnCSaOgv1hDT6RDlY7AB7ZUvFYAtPgAw== +glob@^10.4.1: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== dependencies: foreground-child "^3.1.0" jackspeak "^3.1.2" - minimatch "^9.0.1" - minipass "^7.0.4" - path-scurry "^1.11.0" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" glob@^5.0.15: version "5.0.15" @@ -7951,13 +7974,20 @@ minimatch@^7.4.3: dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.1, minimatch@^9.0.3: +minimatch@^9.0.3: version "9.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimatch@~3.0.4: version "3.0.8" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" @@ -7970,11 +8000,16 @@ minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.8, minimist@~1. resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.4: +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": version "7.1.1" resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.1.tgz#f7f85aff59aa22f110b20e27692465cf3bf89481" integrity sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA== +minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + mkdirp-classic@^0.5.2: version "0.5.3" resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" @@ -8447,6 +8482,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json-from-dist@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" + integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -8512,7 +8552,7 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-scurry@^1.11.0: +path-scurry@^1.11.1: version "1.11.1" resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== @@ -10258,13 +10298,13 @@ ts-morph@^19.0.0: "@ts-morph/common" "~0.20.0" code-block-writer "^12.0.0" -ts-morph@^21.0.1: - version "21.0.1" - resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-21.0.1.tgz#712302a0f6e9dbf1aa8d9cf33a4386c4b18c2006" - integrity sha512-dbDtVdEAncKctzrVZ+Nr7kHpHkv+0JDJb2MjjpBaj8bFeCkePU9rHfMklmhuLFnpeq/EJZk2IhStY6NzqgjOkg== +ts-morph@^22.0.0: + version "22.0.0" + resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-22.0.0.tgz#5532c592fb6dddae08846f12c9ab0fc590b1d42e" + integrity sha512-M9MqFGZREyeb5fTl6gNHKZLqBQA0TjA1lea+CR48R8EBTDuWrNqW6ccC5QvjNR4s6wDumD3LTCjOFSp9iwlzaw== dependencies: - "@ts-morph/common" "~0.22.0" - code-block-writer "^12.0.0" + "@ts-morph/common" "~0.23.0" + code-block-writer "^13.0.1" ts-node@^10.1.0, ts-node@^10.7.0: version "10.9.2" diff --git a/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/args/init.rs b/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/args/init.rs index c74e4a4f765e..7ba7d3cb40cf 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/args/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/args/init.rs @@ -5,12 +5,13 @@ use xshell::Shell; use super::releases::{get_releases_with_arch, Arch, Version}; use crate::messages::{ - MSG_ARCH_NOT_SUPPORTED_ERR, MSG_FETCHING_VYPER_RELEASES_SPINNER, - MSG_FETCHING_ZKSOLC_RELEASES_SPINNER, MSG_FETCHING_ZKVYPER_RELEASES_SPINNER, - MSG_FETCH_SOLC_RELEASES_SPINNER, MSG_GET_SOLC_RELEASES_ERR, MSG_GET_VYPER_RELEASES_ERR, - MSG_GET_ZKSOLC_RELEASES_ERR, MSG_GET_ZKVYPER_RELEASES_ERR, MSG_NO_VERSION_FOUND_ERR, - MSG_OS_NOT_SUPPORTED_ERR, MSG_SOLC_VERSION_PROMPT, MSG_VYPER_VERSION_PROMPT, - MSG_ZKSOLC_VERSION_PROMPT, MSG_ZKVYPER_VERSION_PROMPT, + MSG_ARCH_NOT_SUPPORTED_ERR, MSG_ERA_VM_SOLC_VERSION_PROMPT, + MSG_FETCHING_VYPER_RELEASES_SPINNER, MSG_FETCHING_ZKSOLC_RELEASES_SPINNER, + MSG_FETCHING_ZKVYPER_RELEASES_SPINNER, MSG_FETCH_ERA_VM_SOLC_RELEASES_SPINNER, + MSG_FETCH_SOLC_RELEASES_SPINNER, MSG_GET_ERA_VM_SOLC_RELEASES_ERR, MSG_GET_SOLC_RELEASES_ERR, + MSG_GET_VYPER_RELEASES_ERR, MSG_GET_ZKSOLC_RELEASES_ERR, MSG_GET_ZKVYPER_RELEASES_ERR, + MSG_NO_VERSION_FOUND_ERR, MSG_OS_NOT_SUPPORTED_ERR, MSG_SOLC_VERSION_PROMPT, + MSG_VYPER_VERSION_PROMPT, MSG_ZKSOLC_VERSION_PROMPT, MSG_ZKVYPER_VERSION_PROMPT, }; #[derive(Debug, Clone, Parser, Default)] @@ -24,9 +25,15 @@ pub struct InitContractVerifierArgs { /// Version of solc to install #[clap(long)] pub solc_version: Option, + /// Version of era vm solc to install + #[clap(long)] + pub era_vm_solc_version: Option, /// Version of vyper to install #[clap(long)] pub vyper_version: Option, + /// Install only provided compilers + #[clap(long, default_missing_value = "true")] + pub only: bool, } #[derive(Debug, Clone)] @@ -34,6 +41,7 @@ pub struct InitContractVerifierArgsFinal { pub zksolc_releases: Vec, pub zkvyper_releases: Vec, pub solc_releases: Vec, + pub era_vm_solc_releases: Vec, pub vyper_releases: Vec, } @@ -68,6 +76,14 @@ impl InitContractVerifierArgs { ) .context(MSG_GET_SOLC_RELEASES_ERR)?; + let era_vm_solc_releases = get_releases_with_arch( + shell, + "matter-labs/era-solidity", + arch, + MSG_FETCH_ERA_VM_SOLC_RELEASES_SPINNER, + ) + .context(MSG_GET_ERA_VM_SOLC_RELEASES_ERR)?; + let vyper_releases = get_releases_with_arch( shell, "vyperlang/vyper", @@ -81,33 +97,42 @@ impl InitContractVerifierArgs { zksolc_releases.clone(), MSG_ZKSOLC_VERSION_PROMPT, )?; - let zksolc_releases = get_releases_above_version(zksolc_releases, zksolc_version)?; + let zksolc_releases = get_final_releases(zksolc_releases, zksolc_version, self.only)?; let zkvyper_version = select_min_version( self.zkvyper_version, zkvyper_releases.clone(), MSG_ZKVYPER_VERSION_PROMPT, )?; - let zkvyper_releases = get_releases_above_version(zkvyper_releases, zkvyper_version)?; + let zkvyper_releases = get_final_releases(zkvyper_releases, zkvyper_version, self.only)?; let solc_version = select_min_version( self.solc_version, solc_releases.clone(), MSG_SOLC_VERSION_PROMPT, )?; - let solc_releases = get_releases_above_version(solc_releases, solc_version)?; + let solc_releases = get_final_releases(solc_releases, solc_version, self.only)?; + + let era_vm_solc_version = select_min_version( + self.era_vm_solc_version, + era_vm_solc_releases.clone(), + MSG_ERA_VM_SOLC_VERSION_PROMPT, + )?; + let era_vm_solc_releases = + get_final_releases(era_vm_solc_releases, era_vm_solc_version, self.only)?; let vyper_version = select_min_version( self.vyper_version, vyper_releases.clone(), MSG_VYPER_VERSION_PROMPT, )?; - let vyper_releases = get_releases_above_version(vyper_releases, vyper_version)?; + let vyper_releases = get_final_releases(vyper_releases, vyper_version, self.only)?; Ok(InitContractVerifierArgsFinal { zksolc_releases, zkvyper_releases, solc_releases, + era_vm_solc_releases, vyper_releases, }) } @@ -156,14 +181,20 @@ fn select_min_version( Ok(selected) } -fn get_releases_above_version( +fn get_final_releases( releases: Vec, version: Version, + only: bool, ) -> anyhow::Result> { let pos = releases .iter() .position(|r| r.version == version.version) .context(MSG_NO_VERSION_FOUND_ERR)?; - Ok(releases[..=pos].to_vec()) + let result = if only { + vec![releases[pos].clone()] + } else { + releases[..=pos].to_vec() + }; + Ok(result) } diff --git a/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/init.rs b/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/init.rs index 5fd482ae5fff..f376a0d36eca 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/contract_verifier/init.rs @@ -36,6 +36,14 @@ pub(crate) async fn run(shell: &Shell, args: InitContractVerifierArgs) -> anyhow "solc", )?; + download_binaries( + shell, + args.era_vm_solc_releases, + get_era_vm_solc_path, + &link_to_code, + "solc", + )?; + download_binaries( shell, args.vyper_releases, @@ -105,3 +113,9 @@ fn get_vyper_path(link_to_code: &Path, version: &str) -> PathBuf { fn get_solc_path(link_to_code: &Path, version: &str) -> PathBuf { link_to_code.join("etc/solc-bin/").join(version) } + +fn get_era_vm_solc_path(link_to_code: &Path, version: &str) -> PathBuf { + link_to_code + .join("etc/solc-bin/") + .join(format!("zkVM-{version}")) +} diff --git a/zk_toolbox/crates/zk_inception/src/messages.rs b/zk_toolbox/crates/zk_inception/src/messages.rs index b20e8edf8ad9..5f398f4b8a3b 100644 --- a/zk_toolbox/crates/zk_inception/src/messages.rs +++ b/zk_toolbox/crates/zk_inception/src/messages.rs @@ -414,10 +414,12 @@ pub(super) const MSG_GET_ZKSOLC_RELEASES_ERR: &str = "Failed to get zksolc relea pub(super) const MSG_FETCHING_ZKSOLC_RELEASES_SPINNER: &str = "Fetching zksolc releases..."; pub(super) const MSG_FETCHING_ZKVYPER_RELEASES_SPINNER: &str = "Fetching zkvyper releases..."; pub(super) const MSG_FETCH_SOLC_RELEASES_SPINNER: &str = "Fetching solc releases..."; +pub(super) const MSG_FETCH_ERA_VM_SOLC_RELEASES_SPINNER: &str = "Fetching era vm solc releases..."; pub(super) const MSG_FETCHING_VYPER_RELEASES_SPINNER: &str = "Fetching vyper releases..."; pub(super) const MSG_ZKSOLC_VERSION_PROMPT: &str = "Select the minimal zksolc version:"; pub(super) const MSG_ZKVYPER_VERSION_PROMPT: &str = "Select the minimal zkvyper version:"; pub(super) const MSG_SOLC_VERSION_PROMPT: &str = "Select the minimal solc version:"; +pub(super) const MSG_ERA_VM_SOLC_VERSION_PROMPT: &str = "Select the minimal era vm solc version:"; pub(super) const MSG_VYPER_VERSION_PROMPT: &str = "Select the minimal vyper version:"; pub(super) const MSG_NO_RELEASES_FOUND_ERR: &str = "No releases found for current architecture"; pub(super) const MSG_NO_VERSION_FOUND_ERR: &str = "No version found"; @@ -425,6 +427,7 @@ pub(super) const MSG_ARCH_NOT_SUPPORTED_ERR: &str = "Architecture not supported" pub(super) const MSG_OS_NOT_SUPPORTED_ERR: &str = "OS not supported"; pub(super) const MSG_GET_VYPER_RELEASES_ERR: &str = "Failed to get vyper releases"; pub(super) const MSG_GET_SOLC_RELEASES_ERR: &str = "Failed to get solc releases"; +pub(super) const MSG_GET_ERA_VM_SOLC_RELEASES_ERR: &str = "Failed to get era vm solc releases"; pub(super) const MSG_GET_ZKVYPER_RELEASES_ERR: &str = "Failed to get zkvyper releases"; pub(super) fn msg_binary_already_exists(name: &str, version: &str) -> String { diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/clean/mod.rs b/zk_toolbox/crates/zk_supervisor/src/commands/clean/mod.rs index 92c8a0f1086e..803e962c0ff8 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/clean/mod.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/clean/mod.rs @@ -43,6 +43,7 @@ pub fn containers(shell: &Shell) -> anyhow::Result<()> { pub fn contracts(shell: &Shell, ecosystem_config: &EcosystemConfig) -> anyhow::Result<()> { let path_to_foundry = ecosystem_config.path_to_foundry(); + let contracts_path = ecosystem_config.link_to_code.join("contracts"); logger::info(MSG_CONTRACTS_CLEANING); shell .remove_path(path_to_foundry.join("broadcast")) @@ -62,18 +63,35 @@ pub fn contracts(shell: &Shell, ecosystem_config: &EcosystemConfig) -> anyhow::R shell .remove_path(path_to_foundry.join("typechain")) .context("typechain")?; + shell + .remove_path(contracts_path.join("l2-contracts/cache-forge")) + .context("l2-contracts/cache-forge")?; + shell + .remove_path(contracts_path.join("l2-contracts/zkout")) + .context("l2-contracts/zkout")?; + shell + .remove_path(contracts_path.join("system-contracts/cache-forge")) + .context("system-contracts/cache-forge")?; + shell + .remove_path(contracts_path.join("system-contracts/zkout")) + .context("system-contracts/zkout")?; + shell + .remove_path(contracts_path.join("system-contracts/contracts-preprocessed")) + .context("system-contracts/contracts-preprocessed")?; shell .remove_path(path_to_foundry.join("script-config")) .context("remove script-config")?; shell .create_dir(path_to_foundry.join("script-config")) .context("create script-config")?; + shell.write_file(path_to_foundry.join("script-config/.gitkeep"), "")?; shell .remove_path(path_to_foundry.join("script-out")) .context("remove script-out")?; shell .create_dir(path_to_foundry.join("script-out")) .context("create script-out")?; + shell.write_file(path_to_foundry.join("script-out/.gitkeep"), "")?; logger::info(MSG_CONTRACTS_CLEANING_FINISHED); Ok(()) } diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/db.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/db.rs new file mode 100644 index 000000000000..a08b0404605e --- /dev/null +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/db.rs @@ -0,0 +1,34 @@ +use std::path::Path; + +use common::{cmd::Cmd, db::wait_for_db, logger}; +use xshell::{cmd, Shell}; + +use crate::{commands::database, dals::Dal, messages::MSG_RESETTING_TEST_DATABASES}; + +pub async fn reset_test_databases( + shell: &Shell, + link_to_code: &Path, + dals: Vec, +) -> anyhow::Result<()> { + logger::info(MSG_RESETTING_TEST_DATABASES); + + Cmd::new(cmd!( + shell, + "docker compose -f docker-compose-unit-tests.yml down" + )) + .run()?; + Cmd::new(cmd!( + shell, + "docker compose -f docker-compose-unit-tests.yml up -d" + )) + .run()?; + + for dal in dals { + let mut url = dal.url.clone(); + url.set_path(""); + wait_for_db(&url, 3).await?; + database::reset::reset_database(shell, link_to_code, dal.clone()).await?; + } + + Ok(()) +} diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/integration.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/integration.rs index fb3e1436acc3..fc3ba974118c 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/test/integration.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/integration.rs @@ -42,7 +42,7 @@ pub async fn run(shell: &Shell, args: IntegrationArgs) -> anyhow::Result<()> { let test_pattern = args.test_pattern; let mut command = cmd!( shell, - "yarn jest --forceExit --testTimeout 120000 -t {test_pattern...}" + "yarn jest api/contract-verification.test.ts --forceExit --testTimeout 120000 -t {test_pattern...}" ) .env("CHAIN_NAME", ecosystem_config.current_chain()) .env("MASTER_WALLET_PK", wallets.get_test_pk(&chain_config)?); diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs index 712e2f75eefd..7d2af71ae9ce 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs @@ -13,6 +13,7 @@ use crate::messages::{ mod args; mod build; +mod db; mod integration; mod l1_contracts; mod loadtest; @@ -57,7 +58,7 @@ pub async fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> { TestCommands::Build => build::run(shell), TestCommands::Rust(args) => rust::run(shell, args).await, TestCommands::L1Contracts => l1_contracts::run(shell), - TestCommands::Prover => prover::run(shell), + TestCommands::Prover => prover::run(shell).await, TestCommands::Wallet => wallet::run(shell), TestCommands::Loadtest => loadtest::run(shell), } diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/prover.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/prover.rs index 4e9c4fc25283..f48b359a9357 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/test/prover.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/prover.rs @@ -1,15 +1,29 @@ +use std::str::FromStr; + use common::{cmd::Cmd, logger}; use config::EcosystemConfig; +use url::Url; use xshell::{cmd, Shell}; -use crate::messages::MSG_PROVER_TEST_SUCCESS; +use crate::{ + commands::test::db::reset_test_databases, + dals::{Dal, PROVER_DAL_PATH}, + defaults::TEST_DATABASE_PROVER_URL, + messages::MSG_PROVER_TEST_SUCCESS, +}; -pub fn run(shell: &Shell) -> anyhow::Result<()> { +pub async fn run(shell: &Shell) -> anyhow::Result<()> { let ecosystem = EcosystemConfig::from_file(shell)?; - let _dir_guard = shell.push_dir(ecosystem.link_to_code.join("prover")); + let dals = vec![Dal { + url: Url::from_str(TEST_DATABASE_PROVER_URL)?, + path: PROVER_DAL_PATH.to_string(), + }]; + reset_test_databases(shell, &ecosystem.link_to_code, dals).await?; + let _dir_guard = shell.push_dir(ecosystem.link_to_code.join("prover")); Cmd::new(cmd!(shell, "cargo test --release --workspace --locked")) .with_force_run() + .env("TEST_DATABASE_PROVER_URL", TEST_DATABASE_PROVER_URL) .run()?; logger::outro(MSG_PROVER_TEST_SUCCESS); diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/rust.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/rust.rs index 3ac331becc9f..fdee03fe63ea 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/test/rust.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/rust.rs @@ -1,19 +1,19 @@ -use std::{path::Path, str::FromStr}; +use std::str::FromStr; use anyhow::Context; -use common::{cmd::Cmd, db::wait_for_db, logger}; +use common::{cmd::Cmd, logger}; use config::EcosystemConfig; use url::Url; use xshell::{cmd, Shell}; use super::args::rust::RustArgs; use crate::{ - commands::database, + commands::test::db::reset_test_databases, dals::{Dal, CORE_DAL_PATH, PROVER_DAL_PATH}, defaults::{TEST_DATABASE_PROVER_URL, TEST_DATABASE_SERVER_URL}, messages::{ - MSG_CHAIN_NOT_FOUND_ERR, MSG_POSTGRES_CONFIG_NOT_FOUND_ERR, MSG_RESETTING_TEST_DATABASES, - MSG_UNIT_TESTS_RUN_SUCCESS, MSG_USING_CARGO_NEXTEST, + MSG_CHAIN_NOT_FOUND_ERR, MSG_POSTGRES_CONFIG_NOT_FOUND_ERR, MSG_UNIT_TESTS_RUN_SUCCESS, + MSG_USING_CARGO_NEXTEST, }, }; @@ -78,31 +78,3 @@ pub async fn run(shell: &Shell, args: RustArgs) -> anyhow::Result<()> { logger::outro(MSG_UNIT_TESTS_RUN_SUCCESS); Ok(()) } - -async fn reset_test_databases( - shell: &Shell, - link_to_code: &Path, - dals: Vec, -) -> anyhow::Result<()> { - logger::info(MSG_RESETTING_TEST_DATABASES); - - Cmd::new(cmd!( - shell, - "docker compose -f docker-compose-unit-tests.yml down" - )) - .run()?; - Cmd::new(cmd!( - shell, - "docker compose -f docker-compose-unit-tests.yml up -d" - )) - .run()?; - - for dal in dals { - let mut url = dal.url.clone(); - url.set_path(""); - wait_for_db(&url, 3).await?; - database::reset::reset_database(shell, link_to_code, dal.clone()).await?; - } - - Ok(()) -}