Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Topos Integration Tests #525

Topos Integration Tests

Topos Integration Tests #525

name: Topos Integration Tests
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
local-erc20-messaging-infra-ref:
description: "Git ref of local-erc20-messaging-infra"
required: false
topos-docker-tag:
description: "Docker tag of topos"
required: false
topos-smart-contracts-docker-tag:
description: "Docker tag of topos-smart-contracts"
required: false
env:
TOPOS_DOCKER_TAG: ${{ inputs.topos-docker-tag || 'latest' }}
CONTRACTS_DOCKER_TAG: ${{ inputs.topos-smart-contracts-docker-tag || 'latest' }}
jobs:
infra-metadata:
uses: ./.github/workflows/util:get-latest-release.yml
with:
organization: topos-protocol
repository: local-erc20-messaging-infra
e2e:
runs-on: ubuntu-latest-16-core
environment: devnet-1
env:
INFRA_REF: ${{ inputs.local-erc20-messaging-infra-ref || needs.infra-metadata.outputs.latest-release }}
needs:
- infra-metadata
steps:
- name: Display stack component versions
run: |
echo "infra ref: ${{ env.INFRA_REF }}"
echo "topos docker tag: ${{ env.TOPOS_DOCKER_TAG }}"
echo "contracts docker tag: ${{ env.CONTRACTS_DOCKER_TAG }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Checkout local-erc20-messaging-infra repo
uses: actions/checkout@v3
with:
repository: topos-protocol/local-erc20-messaging-infra
ref: ${{ env.INFRA_REF }}
path: infra
- name: Install node dependencies
run: |
cd infra &&
npm install
- name: Setup environment
run: |
cd infra
cat .env | grep -v '^\s*$\|^\s*\#' | xargs -I {} echo "{}" >> $GITHUB_ENV
echo "LOCAL_ERC20_HOME=${PWD}" >> $GITHUB_ENV
echo "TOPOS_MESSAGING_PROTOCOL_CONTRACTS_VERSION=${{ env.CONTRACTS_DOCKER_TAG }}" >> $GITHUB_ENV
echo "TOPOS_VERSION=${{ env.TOPOS_DOCKER_TAG }}" >> $GITHUB_ENV
- name: Start local ERC20 messaging infra containers
run: >
cd infra &&
./tests/network.sh start
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Debug containers
if: failure()
run: docker inspect contracts-topos | grep Image && docker logs contracts-topos
- name: Get contracts .env file and expose contract addresses for test scripts
run: |
mkdir ./contracts
docker cp contracts-topos:/contracts/.env ./contracts/.env
source ./contracts/.env
echo "SUBNET_REGISTRATOR_CONTRACT_ADDRESS=${SUBNET_REGISTRATOR_CONTRACT_ADDRESS}" >> $GITHUB_ENV
echo "ERC20_MESSAGING_CONTRACT_ADDRESS=${ERC20_MESSAGING_CONTRACT_ADDRESS}" >> $GITHUB_ENV
echo "TOPOS_CORE_PROXY_CONTRACT_ADDRESS=${TOPOS_CORE_PROXY_CONTRACT_ADDRESS}" >> $GITHUB_ENV
- name: Run network health check tests
run: >
cd infra &&
./tests/test_network_health.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Run certificates production tests
run: >
cd infra &&
./tests/test_cert_production.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Run certificate delivery test
run: >
cd infra &&
./tests/test_cert_delivery.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Run transaction included in certificate test
run: >
cd infra &&
./tests/test_transaction_in_certificate.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Run target sequencer cert delivery test
run: >
cd infra &&
./tests/test_cert_sequencer_delivery.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Run certificate inclusion test
run: >
cd infra &&
./tests/test_cert_inclusion.sh
env:
DOCKER_DEFAULT_PLATFORM: linux/amd64
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
TOKEN_DEPLOYER_SALT: ${{ secrets.TOKEN_DEPLOYER_SALT }}
TOPOS_CORE_SALT: ${{ secrets.TOPOS_CORE_SALT }}
TOPOS_CORE_PROXY_SALT: ${{ secrets.TOPOS_CORE_PROXY_SALT }}
ERC20_MESSAGING_SALT: ${{ secrets.ERC20_MESSAGING_SALT }}
SUBNET_REGISTRATOR_SALT: ${{ secrets.SUBNET_REGISTRATOR_SALT }}
- name: Debug docker show infra containers
if: failure()
run: docker ps
- name: Debug sending sequencer
if: failure()
run: docker logs topos-sequencer
- name: Debug receiving sequencer
if: failure()
run: docker logs incal-sequencer
- name: Debug TCE boot node
if: failure()
run: docker logs topos-node-1 || docker logs infra-tce-boot-1
- name: Debug TCE peer node 2
if: failure()
run: docker logs topos-node-2 || docker logs infra-tce-peer-1
- name: Debug TCE peer node 3
if: failure()
run: docker logs topos-node-3 || docker logs infra-tce-peer-2
- name: Debug TCE peer node 4
if: failure()
run: docker logs topos-node-4 || docker logs infra-tce-peer-3
- name: Debug Incal node 1
if: failure()
run: docker logs incal-node-1