From a41d8eea272334c06f8446c2a24130b5098e4001 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 25 Jun 2024 15:08:31 -0700 Subject: [PATCH] Add bridge test to CI --- .github/workflows/ci_zkevm.yml | 70 ++++++++++++++++++++++++++---- zk/tests/bridge/docker-compose.yml | 6 ++- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_zkevm.yml b/.github/workflows/ci_zkevm.yml index daea0279e52..777d68db0ec 100644 --- a/.github/workflows/ci_zkevm.yml +++ b/.github/workflows/ci_zkevm.yml @@ -67,7 +67,7 @@ jobs: uses: actions/checkout@v4 with: repository: 0xPolygon/kurtosis-cdk - ref: feat/cdk-erigon-zkevm + ref: main path: kurtosis-cdk - name: Install Kurtosis CDK tools @@ -77,20 +77,74 @@ jobs: working-directory: ./cdk-erigon run: docker build -t cdk-erigon:local --file Dockerfile . + - name: Install sed + run: sudo apt-get install sed + + - name: Install yq + run: | + sudo curl -L https://github.com/mikefarah/yq/releases/download/v4.44.2/yq_linux_amd64 -o /usr/local/bin/yq + sudo chmod +x /usr/local/bin/yq + /usr/local/bin/yq --version + - name: Configure Kurtosis CDK working-directory: ./kurtosis-cdk run: | - yq -Y --in-place '.args.data_availability_mode = "rollup"' params.yml - yq -Y --in-place '.args.cdk_erigon_node_image = "cdk-erigon:local"' params.yml + /usr/local/bin/yq -i '.args.data_availability_mode = "rollup"' cdk-erigon-sequencer-params.yml + /usr/local/bin/yq -i '.args.cdk_erigon_node_image = "cdk-erigon:local"' cdk-erigon-sequencer-params.yml - name: Deploy Kurtosis CDK package working-directory: ./kurtosis-cdk - run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . + run: kurtosis run --enclave cdk-v1 --args-file cdk-erigon-sequencer-params.yml --image-download always . - - name: Monitor verified batches - working-directory: ./kurtosis-cdk - shell: bash - run: .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh 20 600 cdk-erigon-node-001 + # - name: Monitor verified batches + # working-directory: ./kurtosis-cdk + # shell: bash + # run: .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh 20 600 cdk-erigon-node-001 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Set up envs + run: | + kurtosis files download cdk-v1 bridge-config-artifact + echo "BRIDGE_ADDRESS=$(/usr/local/bin/yq '.NetworkConfig.PolygonBridgeAddress' bridge-config-artifact/bridge-config.toml)" >> $GITHUB_ENV + export ETH_RPC_URL=$(kurtosis port print cdk-v1 el-1-geth-lighthouse rpc) + echo "ETH_RPC_URL=$ETH_RPC_URL" >> $GITHUB_ENV + echo "ETH_PRC_PORT=$(echo $ETH_RPC_URL | sed -n 's/.*:\([0-9]*\).*/\1/p')" >> $GITHUB_ENV + export BRIDGE_API_URL=$(kurtosis port print cdk-v1 zkevm-bridge-service-001 rpc) + echo "BRIDGE_API_URL=$BRIDGE_API_URL" >> $GITHUB_ENV + echo "BRIDGE_API_PORT=$(echo $BRIDGE_API_URL | sed -n 's/.*:\([0-9]*\).*/\1/p')" >> $GITHUB_ENV + echo ETH_RPC_URL $ETH_RPC_URL + echo BRIDGE_API_URL $BRIDGE_API_URL + echo BRIDGE_API_PORT $BRIDGE_API_PORT + echo ETH_PRC_PORT $ETH_PRC_PORT + + - name: Run bridge tests + working-directory: ./cdk-erigon + env: + RAW_PRIVATE_KEY: "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" + DESTINATION_NET: "10101" + DESTINATION_ADDRESS: "0xE34aaF64b29273B7D567FCFc40544c014EEe9970" + ETHER_VALUE: "2" + TOKEN_ADDRESS: "" + IS_FORCED: "true" + BRIDGE_ADDRESS: ${{ env.BRIDGE_ADDRESS }} + META_BYTES: "0x" + ETH_RPC_URL: ${{ env.ETH_RPC_URL }} + ETH_RPC_PORT: ${{ env.ETH_RPC_PORT }} + BRIDGE_API_URL: ${{ env.BRIDGE_API_URL }} + BRIDGE_API_PORT: ${{ env.BRIDGE_API_PORT }} + DRY_RUN: "false" + + run: | + cd zk/tests/bridge + docker-compose up --build --exit-code-from bridge-script + + - name: Upload logs + uses: actions/upload-artifact@v3 + with: + name: evm-rpc-tests-logs-${{ github.run_id }} + path: ./cdk-erigon/logs/evm-rpc-tests.log - name: Prepare logs working-directory: ./kurtosis-cdk diff --git a/zk/tests/bridge/docker-compose.yml b/zk/tests/bridge/docker-compose.yml index 47d31dfb2d1..4d3fdb7caef 100644 --- a/zk/tests/bridge/docker-compose.yml +++ b/zk/tests/bridge/docker-compose.yml @@ -14,4 +14,8 @@ services: META_BYTES: ${META_BYTES} ETH_RPC_URL: ${ETH_RPC_URL} BRIDGE_API_URL: ${BRIDGE_API_URL} - DRY_RUN: ${DRY_RUN} \ No newline at end of file + DRY_RUN: ${DRY_RUN} + + ports: + - "${ETH_RPC_PORT:-8545}:${ETH_RPC_PORT:-8545}" + - "${BRIDGE_API_PORT:-8080}:${BRIDGE_API_PORT:-8080}" \ No newline at end of file