From 8a0ce9f1c092997fc903b7880ff14082eb64e0b5 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Tue, 6 Aug 2024 12:25:10 +0200 Subject: [PATCH 01/17] Change test-transfers to be able to use testnet-most0 env --- .github/workflows/test-transfers.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 15887ec8..a3d7fee9 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -7,6 +7,12 @@ on: branches: - master workflow_dispatch: + inputs: + environment: + description: Environment in which the test should be executed + default: 'local' + required: false + type: string jobs: test: @@ -20,6 +26,7 @@ jobs: uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6 - name: Run tests + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} timeout-minutes: 30 shell: bash run: | @@ -29,7 +36,34 @@ jobs: DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers make e2e-tests + - name: Create token config for testnet + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + run: | + cat cfg/tokens_testnet_example.json > cfg/tokens_testnet.json + + - name: Create azero env file for testnet + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + env: + AZERO1: ${{ secrets.DEVENV_TESTNET_AZERO1_ACCOUNT_NUMBER }} + AZERO2: ${{ secrets.DEVENV_TESTNET_AZERO2_ACCOUNT_NUMBER }} + AZERO3: ${{ secrets.DEVENV_TESTNET_AZERO3_ACCOUNT_NUMBER }} + AZERO1_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} + run: | + cat azero/env/testnet.json.example | \ + jq '.relayers = ["${{ env.AZERO1 }}", "${{ env.AZERO2 }}", "${{ env.AZERO3 }}"]' | \ + jq '.deployer_seed = "${{ env.AZERO1_SEED }}"' | jq '.dev = true' > azero/env/testnet.json + + - name: Run tests for 'testnet-most0' env + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + timeout-minutes: 30 + run: | + AZERO_ENV=testnet make e2e-tests + slack-notification: + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} name: Slack notification runs-on: ubuntu-20.04 needs: [test] From 9fee2f7a2fda1a4d488e46ec35c5d00d5fc093c0 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Tue, 6 Aug 2024 14:37:20 +0200 Subject: [PATCH 02/17] Temporarily remove code to test its triggering --- .github/workflows/test-transfers.yml | 53 ---------------------------- 1 file changed, 53 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index a3d7fee9..75191018 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -24,56 +24,3 @@ jobs: - name: "Install Rust toolchain" uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6 - - - name: Run tests - if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} - timeout-minutes: 30 - shell: bash - run: | - make local-bridgenet - sleep 60 # wait 1 minute for everything to be running - make deploy-docker - DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers - make e2e-tests - - - name: Create token config for testnet - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - run: | - cat cfg/tokens_testnet_example.json > cfg/tokens_testnet.json - - - name: Create azero env file for testnet - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - env: - AZERO1: ${{ secrets.DEVENV_TESTNET_AZERO1_ACCOUNT_NUMBER }} - AZERO2: ${{ secrets.DEVENV_TESTNET_AZERO2_ACCOUNT_NUMBER }} - AZERO3: ${{ secrets.DEVENV_TESTNET_AZERO3_ACCOUNT_NUMBER }} - AZERO1_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} - run: | - cat azero/env/testnet.json.example | \ - jq '.relayers = ["${{ env.AZERO1 }}", "${{ env.AZERO2 }}", "${{ env.AZERO3 }}"]' | \ - jq '.deployer_seed = "${{ env.AZERO1_SEED }}"' | jq '.dev = true' > azero/env/testnet.json - - - name: Run tests for 'testnet-most0' env - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - timeout-minutes: 30 - run: | - AZERO_ENV=testnet make e2e-tests - - slack-notification: - if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} - name: Slack notification - runs-on: ubuntu-20.04 - needs: [test] - if: > - !cancelled() && - github.event_name != 'workflow_dispatch' - steps: - - name: Send Slack message - uses: Cardinal-Cryptography/github-actions/slack-notification@v7 - with: - notify-on: "failure" - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_MOST_CI_NOTIFICATIONS }} From c3925dc98a0a4ccd65d28bff1898dc76a5251f6e Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Tue, 6 Aug 2024 14:40:01 +0200 Subject: [PATCH 03/17] Revert changes --- .github/workflows/test-transfers.yml | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 75191018..a3d7fee9 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -24,3 +24,56 @@ jobs: - name: "Install Rust toolchain" uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6 + + - name: Run tests + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} + timeout-minutes: 30 + shell: bash + run: | + make local-bridgenet + sleep 60 # wait 1 minute for everything to be running + make deploy-docker + DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers + make e2e-tests + + - name: Create token config for testnet + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + run: | + cat cfg/tokens_testnet_example.json > cfg/tokens_testnet.json + + - name: Create azero env file for testnet + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + env: + AZERO1: ${{ secrets.DEVENV_TESTNET_AZERO1_ACCOUNT_NUMBER }} + AZERO2: ${{ secrets.DEVENV_TESTNET_AZERO2_ACCOUNT_NUMBER }} + AZERO3: ${{ secrets.DEVENV_TESTNET_AZERO3_ACCOUNT_NUMBER }} + AZERO1_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} + run: | + cat azero/env/testnet.json.example | \ + jq '.relayers = ["${{ env.AZERO1 }}", "${{ env.AZERO2 }}", "${{ env.AZERO3 }}"]' | \ + jq '.deployer_seed = "${{ env.AZERO1_SEED }}"' | jq '.dev = true' > azero/env/testnet.json + + - name: Run tests for 'testnet-most0' env + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + timeout-minutes: 30 + run: | + AZERO_ENV=testnet make e2e-tests + + slack-notification: + if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} + name: Slack notification + runs-on: ubuntu-20.04 + needs: [test] + if: > + !cancelled() && + github.event_name != 'workflow_dispatch' + steps: + - name: Send Slack message + uses: Cardinal-Cryptography/github-actions/slack-notification@v7 + with: + notify-on: "failure" + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_MOST_CI_NOTIFICATIONS }} From cd5a893c875bb9e8e50da4adf1cca3068b537b12 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Tue, 6 Aug 2024 14:40:56 +0200 Subject: [PATCH 04/17] Remove double 'if' condition --- .github/workflows/test-transfers.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index a3d7fee9..ff633559 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -63,7 +63,6 @@ jobs: AZERO_ENV=testnet make e2e-tests slack-notification: - if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} name: Slack notification runs-on: ubuntu-20.04 needs: [test] From ad78dc2d156c3c484e6e141e12046ddb8746aa70 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:07:43 +0200 Subject: [PATCH 05/17] Add downloading addresses and artifacts from testnet --- .github/workflows/test-transfers.yml | 118 +++++++++++++++++++++++---- 1 file changed, 100 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index ff633559..1d73cf18 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -15,8 +15,83 @@ on: type: string jobs: + get-testnet-addresses: + name: Download testnet contract addresses + runs-on: [self-hosted, Linux, X64, small] + outputs: + commit-sha: ${{ steps.addresses.outputs.commit-sha }} + steps: + - name: Download addresses for 'testnet-most0' env + id: addresses + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + shell: bash + run: | + wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/most/addresses/testnet/most0.json + commit_hash=$(cat most0.json | jq '.contract_version') + for net in eth azero; do + mkdir -p "$net" + sudo cat "most0.json" | \ + sudo jq --arg NET "$net" '.addresses | to_entries | map(select(.key | contains($NET + "_"))) | map({(.key | sub($NET + "_";"")): .value.address}) | add' \ + | sudo tee "$net"/addresses.json + done + echo "commit-sha=$commit_hash" > $GITHUB_OUTPUT + - uses: actions/upload-artifact@v4 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + with: + name: testnet-addresses + if-no-files-found: error + retention-days: 1 + path: | + eth/addresses.json + azero/addresses.json + + get-testnet-contracts: + name: Download testnet contracts + needs: [get-testnet-addresses] + runs-on: [self-hosted, Linux, X64, small] + strategy: + matrix: + contract_path: + - azero_most/most.json + - azero_token/token.json + - azero_wrapped_azero/wrapped_azero.json + - eth_most/Most.json + - eth_weth9/WETH9.json + - eth_tethertoken/TetherToken.json + - eth_wrappedtoken/WrappedToken.json + steps: + - name: Create dirs for artifacts + shell: bash + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + run: | + mkdir -p testnet-artifacts/"$(dirname ${{ matrix.contract_path }})" + + - name: Download most artifact from S3 bucket + uses: Cardinal-Cryptography/github-actions/download-contract-artifact@v6 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + with: + aws-access-key-id: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.CONTRACTS_S3BUCKET_REGION }} + s3-bucket: ${{ secrets.CONTRACTS_S3BUCKET_NAME }} + project: most + version: ${{ needs.get-testnet-addresses.outputs.commit-sha }} + contract: ${{ matrix.contract_path }} + if-not-exist: fallback + dst-artifact: testnet-artifacts/${{ matrix.contract_path }} + + - uses: actions/upload-artifact@v4 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + with: + name: testnet-artifacts + if-no-files-found: error + retention-days: 1 + path: | + testnet-artifacts + test: name: Test transfers + needs: [get-testnet-contracts] runs-on: [self-hosted, Linux, X64, large] steps: - name: Checkout code @@ -36,31 +111,38 @@ jobs: DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers make e2e-tests - - name: Create token config for testnet + - uses: actions/download-artifact@v4 if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - run: | - cat cfg/tokens_testnet_example.json > cfg/tokens_testnet.json + with: + name: testnet-addresses + path: eth - - name: Create azero env file for testnet + - uses: actions/download-artifact@v4 if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - env: - AZERO1: ${{ secrets.DEVENV_TESTNET_AZERO1_ACCOUNT_NUMBER }} - AZERO2: ${{ secrets.DEVENV_TESTNET_AZERO2_ACCOUNT_NUMBER }} - AZERO3: ${{ secrets.DEVENV_TESTNET_AZERO3_ACCOUNT_NUMBER }} - AZERO1_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} - run: | - cat azero/env/testnet.json.example | \ - jq '.relayers = ["${{ env.AZERO1 }}", "${{ env.AZERO2 }}", "${{ env.AZERO3 }}"]' | \ - jq '.deployer_seed = "${{ env.AZERO1_SEED }}"' | jq '.dev = true' > azero/env/testnet.json + with: + name: testnet-addresses + path: azero - - name: Run tests for 'testnet-most0' env + - uses: actions/download-artifact@v4 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + with: + name: testnet-artifacts + path: testnet-artifacts + + - name: List downloaded files if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} shell: bash - timeout-minutes: 30 run: | - AZERO_ENV=testnet make e2e-tests + find eth/ + find azero/ + find testnet-artifacts/ + + #- name: Run tests for 'testnet-most0' env + # if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} + # shell: bash + # timeout-minutes: 30 + # run: | + # make e2e-tests slack-notification: name: Slack notification From 40bae4a333fbd201bf6a720c188fb6f3a21c7891 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:11:11 +0200 Subject: [PATCH 06/17] Fix invalid contract path --- .github/workflows/test-transfers.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 1d73cf18..dfc3ba9f 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -52,13 +52,13 @@ jobs: strategy: matrix: contract_path: - - azero_most/most.json - - azero_token/token.json - - azero_wrapped_azero/wrapped_azero.json - - eth_most/Most.json - - eth_weth9/WETH9.json - - eth_tethertoken/TetherToken.json - - eth_wrappedtoken/WrappedToken.json + - azero_most + - azero_token + - azero_wrapped_azero + - eth_most + - eth_weth9 + - eth_tethertoken + - eth_wrappedtoken steps: - name: Create dirs for artifacts shell: bash From 2bb85117c297aba08a5d9695993eb441fe8d9b84 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:13:05 +0200 Subject: [PATCH 07/17] Fix invalid quote --- .github/workflows/test-transfers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index dfc3ba9f..fabff077 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -27,7 +27,7 @@ jobs: shell: bash run: | wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/most/addresses/testnet/most0.json - commit_hash=$(cat most0.json | jq '.contract_version') + commit_hash=$(cat most0.json | jq -r '.contract_version') for net in eth azero; do mkdir -p "$net" sudo cat "most0.json" | \ From 314188cef2a32712ac303ed5906343eca57075cf Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:15:54 +0200 Subject: [PATCH 08/17] Fix contract paths --- .github/workflows/test-transfers.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index fabff077..c38d3e90 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -52,13 +52,13 @@ jobs: strategy: matrix: contract_path: - - azero_most - - azero_token - - azero_wrapped_azero - - eth_most - - eth_weth9 - - eth_tethertoken - - eth_wrappedtoken + - azero_most/ + - azero_token/ + - azero_wrapped_azero/ + - eth_most/ + - eth_weth9/ + - eth_tethertoken/ + - eth_wrappedtoken/ steps: - name: Create dirs for artifacts shell: bash From 13a997fedd82017278c0082d72fd2dc8291f502c Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:28:26 +0200 Subject: [PATCH 09/17] Replace jobs with simple bash steps --- .github/workflows/test-transfers.yml | 119 +++++++-------------------- 1 file changed, 31 insertions(+), 88 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index c38d3e90..bca482dd 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -15,83 +15,8 @@ on: type: string jobs: - get-testnet-addresses: - name: Download testnet contract addresses - runs-on: [self-hosted, Linux, X64, small] - outputs: - commit-sha: ${{ steps.addresses.outputs.commit-sha }} - steps: - - name: Download addresses for 'testnet-most0' env - id: addresses - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - shell: bash - run: | - wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/most/addresses/testnet/most0.json - commit_hash=$(cat most0.json | jq -r '.contract_version') - for net in eth azero; do - mkdir -p "$net" - sudo cat "most0.json" | \ - sudo jq --arg NET "$net" '.addresses | to_entries | map(select(.key | contains($NET + "_"))) | map({(.key | sub($NET + "_";"")): .value.address}) | add' \ - | sudo tee "$net"/addresses.json - done - echo "commit-sha=$commit_hash" > $GITHUB_OUTPUT - - uses: actions/upload-artifact@v4 - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - name: testnet-addresses - if-no-files-found: error - retention-days: 1 - path: | - eth/addresses.json - azero/addresses.json - - get-testnet-contracts: - name: Download testnet contracts - needs: [get-testnet-addresses] - runs-on: [self-hosted, Linux, X64, small] - strategy: - matrix: - contract_path: - - azero_most/ - - azero_token/ - - azero_wrapped_azero/ - - eth_most/ - - eth_weth9/ - - eth_tethertoken/ - - eth_wrappedtoken/ - steps: - - name: Create dirs for artifacts - shell: bash - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - run: | - mkdir -p testnet-artifacts/"$(dirname ${{ matrix.contract_path }})" - - - name: Download most artifact from S3 bucket - uses: Cardinal-Cryptography/github-actions/download-contract-artifact@v6 - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - aws-access-key-id: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.CONTRACTS_S3BUCKET_REGION }} - s3-bucket: ${{ secrets.CONTRACTS_S3BUCKET_NAME }} - project: most - version: ${{ needs.get-testnet-addresses.outputs.commit-sha }} - contract: ${{ matrix.contract_path }} - if-not-exist: fallback - dst-artifact: testnet-artifacts/${{ matrix.contract_path }} - - - uses: actions/upload-artifact@v4 - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - name: testnet-artifacts - if-no-files-found: error - retention-days: 1 - path: | - testnet-artifacts - test: name: Test transfers - needs: [get-testnet-contracts] runs-on: [self-hosted, Linux, X64, large] steps: - name: Checkout code @@ -111,23 +36,41 @@ jobs: DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers make e2e-tests - - uses: actions/download-artifact@v4 - if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - name: testnet-addresses - path: eth - - uses: actions/download-artifact@v4 + - name: Download addresses for 'testnet-most0' env + id: addresses if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - name: testnet-addresses - path: azero + shell: bash + run: | + wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/most/addresses/testnet/most0.json + commit_hash=$(cat most0.json | jq -r '.contract_version') + for net in eth azero; do + mkdir -p "$net" + sudo cat "most0.json" | \ + sudo jq --arg NET "$net" '.addresses | to_entries | map(select(.key | contains($NET + "_"))) | map({(.key | sub($NET + "_";"")): .value.address}) | add' \ + | sudo tee "$net"/addresses.json + done + echo "commit-sha=$commit_hash" > $GITHUB_OUTPUT - - uses: actions/download-artifact@v4 + - name: Download contract artifacts from AWS S3 bucket if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - with: - name: testnet-artifacts - path: testnet-artifacts + env: + AWS_ACCESS_KEY_ID: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.CONTRACTS_MOST_ARTIFACTS_RW_AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.CONTRACTS_S3BUCKET_REGION }} + shell: bash + run: | + mkdir -p azero/artifacts + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_most/most.json azero/artifacts/most.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_token/token.json azero/artifacts/token.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_wrapped_azero/wrapped_azero.json azero/artifacts/wrapped_azero.json + + mkdir -p eth/artifacts/contracts/{Most.sol,WETH9.sol,USDT.sol,WrappedToken.sol} + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_most/Most.json eth/artifacts/contracts/Most.sol/Most.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_weth9/WETH9.json eth/artifacts/contracts/WETH9.sol/WETH9.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_tethertoken/TetherToken.json eth/artifacts/contracts/USDT.sol/TetherToken.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_wrappedtoken/WrappedToken.json eth/artifacts/contracts/WrappedToken.sol/WrappedToken.json + - name: List downloaded files if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} From 806c7cd465bcc630a320468e9a194ea855523aa0 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:33:06 +0200 Subject: [PATCH 10/17] Fix invalid path --- .github/workflows/test-transfers.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index bca482dd..71743e18 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -36,13 +36,14 @@ jobs: DOCKER_RELAYER_COMPILE_CONTRACTS=no-compile make run-relayers make e2e-tests - - name: Download addresses for 'testnet-most0' env id: addresses if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} shell: bash run: | wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/most/addresses/testnet/most0.json + + # Unfortunately, contract spec JSON must be split into two separate addresses.json files commit_hash=$(cat most0.json | jq -r '.contract_version') for net in eth azero; do mkdir -p "$net" @@ -61,16 +62,15 @@ jobs: shell: bash run: | mkdir -p azero/artifacts - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_most/most.json azero/artifacts/most.json - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_token/token.json azero/artifacts/token.json - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_wrapped_azero/wrapped_azero.json azero/artifacts/wrapped_azero.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_most/most.json azero/artifacts/most.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_token/token.json azero/artifacts/token.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/azero_wrapped_azero/wrapped_azero.json azero/artifacts/wrapped_azero.json mkdir -p eth/artifacts/contracts/{Most.sol,WETH9.sol,USDT.sol,WrappedToken.sol} - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_most/Most.json eth/artifacts/contracts/Most.sol/Most.json - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_weth9/WETH9.json eth/artifacts/contracts/WETH9.sol/WETH9.json - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_tethertoken/TetherToken.json eth/artifacts/contracts/USDT.sol/TetherToken.json - aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_REGION }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_wrappedtoken/WrappedToken.json eth/artifacts/contracts/WrappedToken.sol/WrappedToken.json - + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_most/Most.json eth/artifacts/contracts/Most.sol/Most.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_weth9/WETH9.json eth/artifacts/contracts/WETH9.sol/WETH9.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_tethertoken/TetherToken.json eth/artifacts/contracts/USDT.sol/TetherToken.json + aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_wrappedtoken/WrappedToken.json eth/artifacts/contracts/WrappedToken.sol/WrappedToken.json - name: List downloaded files if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} From 724733d01273c13d6947a7eb60cc9fa3f2ce89c2 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:41:38 +0200 Subject: [PATCH 11/17] Add env vars to run-tests step --- .github/workflows/test-transfers.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 71743e18..12f961b0 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -22,10 +22,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: "Install Rust toolchain" + - name: Install Rust toolchain uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6 - - name: Run tests + - name: Run tests on local env if: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.environment != 'testnet-most0') }} timeout-minutes: 30 shell: bash @@ -72,20 +72,18 @@ jobs: aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_tethertoken/TetherToken.json eth/artifacts/contracts/USDT.sol/TetherToken.json aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_wrappedtoken/WrappedToken.json eth/artifacts/contracts/WrappedToken.sol/WrappedToken.json - - name: List downloaded files + - name: Run tests for 'testnet-most0' env if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} shell: bash + timeout-minutes: 30 + env: + AZERO_NODE_WS: wss://test.azero.dev:443 + ETH_NODE_HTTP: ${{ secrets.DEVENV_RPC_ETH_ENDPOINT }} + ETH_DEV_ACCOUNT_INDEX: 0 + AZERO_ACCOUNT_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} + ETH_MNEMONIC: ${{ secrets.DEVENV_TESTNET_SEPOLIA_KEY }} run: | - find eth/ - find azero/ - find testnet-artifacts/ - - #- name: Run tests for 'testnet-most0' env - # if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} - # shell: bash - # timeout-minutes: 30 - # run: | - # make e2e-tests + make e2e-tests slack-notification: name: Slack notification From 0ec491f6e7ec5e469b1ff0f6d0b02c6bdf461b0b Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:50:00 +0200 Subject: [PATCH 12/17] Fix invalid ws host --- .github/workflows/test-transfers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 12f961b0..9f809d38 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -77,7 +77,7 @@ jobs: shell: bash timeout-minutes: 30 env: - AZERO_NODE_WS: wss://test.azero.dev:443 + AZERO_NODE_WS: wss://ws.test.azero.dev ETH_NODE_HTTP: ${{ secrets.DEVENV_RPC_ETH_ENDPOINT }} ETH_DEV_ACCOUNT_INDEX: 0 AZERO_ACCOUNT_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} From a77b32238c5143dc86d62440618aa4a95be9eac4 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Wed, 7 Aug 2024 23:54:28 +0200 Subject: [PATCH 13/17] Add missing port --- .github/workflows/test-transfers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 9f809d38..6e90615d 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -77,7 +77,7 @@ jobs: shell: bash timeout-minutes: 30 env: - AZERO_NODE_WS: wss://ws.test.azero.dev + AZERO_NODE_WS: wss://ws.test.azero.dev:443 ETH_NODE_HTTP: ${{ secrets.DEVENV_RPC_ETH_ENDPOINT }} ETH_DEV_ACCOUNT_INDEX: 0 AZERO_ACCOUNT_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} From 5e4172c076df6ace6b1e75944c6f0a7803c6085f Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Thu, 8 Aug 2024 00:13:26 +0200 Subject: [PATCH 14/17] Add RUST_LOG --- .github/workflows/test-transfers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 6e90615d..6a87409e 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -82,6 +82,7 @@ jobs: ETH_DEV_ACCOUNT_INDEX: 0 AZERO_ACCOUNT_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} ETH_MNEMONIC: ${{ secrets.DEVENV_TESTNET_SEPOLIA_KEY }} + RUST_LOG: info run: | make e2e-tests From 6e9e5a0c70439b4ff6e379f3068a578f996c44a3 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Thu, 8 Aug 2024 00:36:36 +0200 Subject: [PATCH 15/17] Add debugging --- .github/workflows/test-transfers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 6a87409e..44e01167 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -83,6 +83,7 @@ jobs: AZERO_ACCOUNT_SEED: ${{ secrets.DEVENV_TESTNET_AZERO1_KEY }} ETH_MNEMONIC: ${{ secrets.DEVENV_TESTNET_SEPOLIA_KEY }} RUST_LOG: info + RUST_BACKTRACE: 1 run: | make e2e-tests From 00cc2865af9c289f73cef176b82aa4cceaf4fc42 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Thu, 8 Aug 2024 00:53:16 +0200 Subject: [PATCH 16/17] List files --- .github/workflows/test-transfers.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 44e01167..5b322b35 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -72,6 +72,12 @@ jobs: aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_tethertoken/TetherToken.json eth/artifacts/contracts/USDT.sol/TetherToken.json aws s3 cp s3://${{ secrets.CONTRACTS_S3BUCKET_NAME }}/most/artifacts/${{ steps.addresses.outputs.commit-sha }}/eth_wrappedtoken/WrappedToken.json eth/artifacts/contracts/WrappedToken.sol/WrappedToken.json + - name: List files + shell: bash + run: | + find azero/ + find eth/ + - name: Run tests for 'testnet-most0' env if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }} shell: bash From 74a662e8137120f077a6e0165639c2b08954a420 Mon Sep 17 00:00:00 2001 From: Mikolaj Gasior Date: Thu, 8 Aug 2024 01:01:45 +0200 Subject: [PATCH 17/17] Cat addresses.json --- .github/workflows/test-transfers.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-transfers.yml b/.github/workflows/test-transfers.yml index 5b322b35..6bcde1d9 100644 --- a/.github/workflows/test-transfers.yml +++ b/.github/workflows/test-transfers.yml @@ -77,6 +77,7 @@ jobs: run: | find azero/ find eth/ + cat azero/addresses.json - name: Run tests for 'testnet-most0' env if: ${{ github.event_name == 'workflow_dispatch' && inputs.environment == 'testnet-most0' }}