diff --git a/.circleci/config.yml b/.circleci/config.yml index 68a0cfbd..975db93c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ orbs: sudo apt-get clean sudo apt-get update sudo apt-get install dpkg - - run: + - run: name: Install Chrome command: | wget -O chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_77.0.3865.120-1_amd64.deb @@ -89,29 +89,29 @@ jobs: - checkout - run: git submodule update --init - restore_cache: - name: Restore Yarn Package Cache - keys: - - yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} - - run: git submodule status > submodule.status + name: Restore Yarn Package Cache + keys: + - yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} + - run: git submodule status > submodule.status - restore_cache: - name: Restore contracts submodule with compiled contracts - keys: - - contracts-{{ checksum "submodule.status" }} + name: Restore contracts submodule with compiled contracts + keys: + - contracts-{{ checksum "submodule.status" }} - run: yarn install --frozen-lockfile - save_cache: - name: Save Yarn Package Cache - key: yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} - paths: - - ~/.cache/yarn + name: Save Yarn Package Cache + key: yarn-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn - run: touch install_deploy.log; test -d contracts/build/contracts || yarn install:deploy &> install_deploy.log - store_artifacts: path: install_deploy.log - run: test -d contracts/build/contracts || yarn compile:contracts - save_cache: - name: Save contracts submodule with compiled contracts - key: contracts-{{ checksum "submodule.status" }} - paths: - - contracts + name: Save contracts submodule with compiled contracts + key: contracts-{{ checksum "submodule.status" }} + paths: + - contracts - save_cache: name: Save initialized project for subsequent jobs key: initialize-{{ .Environment.CIRCLE_SHA1 }} @@ -143,11 +143,11 @@ jobs: oracle-e2e: executor: tokenbridge-orb/docker-node steps: - - checkout - - run: git submodule update --init - - setup_remote_docker: - docker_layer_caching: true - - run: yarn run oracle-e2e + - checkout + - run: git submodule update --init + - setup_remote_docker: + docker_layer_caching: true + - run: yarn run oracle-e2e ui-e2e: executor: tokenbridge-orb/machine-with-docker-caching steps: @@ -161,9 +161,9 @@ jobs: monitor-e2e: executor: tokenbridge-orb/machine-with-docker-caching steps: - - checkout - - run: git submodule update --init - - run: ./monitor-e2e/run-tests.sh + - checkout + - run: git submodule update --init + - run: ./monitor-e2e/run-tests.sh cover: executor: tokenbridge-orb/docker-node steps: @@ -194,7 +194,7 @@ jobs: steps: - checkout - run: git submodule update --init - - run: + - run: name: Run the scenario command: deployment-e2e/molecule.sh monitor no_output_timeout: 40m @@ -219,7 +219,6 @@ jobs: name: Run the scenario command: deployment-e2e/molecule.sh multiple no_output_timeout: 40m - ultimate: executor: tokenbridge-orb/machine-with-docker-caching parameters: @@ -231,6 +230,11 @@ jobs: type: string ui-e2e-grep: description: "Mocha grep string used to run ui-e2e tests specific to given type of bridge" + default: '' + type: string + oracle-e2e-script: + description: "Yarn script string used to run oracle-e2e tests specific to given type of bridge" + default: '' type: string steps: - checkout @@ -245,12 +249,21 @@ jobs: no_output_timeout: 50m - tokenbridge-orb/wait-for-oracle: redis-key: << parameters.redis-key >> - - run: - name: Run the ui-e2e tests - command: | - nvm use default; - node ./e2e-commons/scripts/blocks.js & - cd ui-e2e; yarn mocha -g "<< parameters.ui-e2e-grep >>" -b ./test.js + - when: + condition: << parameters.ui-e2e-grep >> + steps: + - run: + name: Run the ui-e2e tests + command: | + nvm use default; + node ./e2e-commons/scripts/blocks.js & + cd ui-e2e; yarn mocha -g "<< parameters.ui-e2e-grep >>" -b ./test.js + - when: + condition: << parameters.oracle-e2e-script >> + steps: + - run: + name: Run the oracle-e2e tests + command: cd e2e-commons && docker-compose run e2e yarn workspace oracle-e2e run << parameters.oracle-e2e-script >> workflows: tokenbridge: jobs: @@ -283,17 +296,22 @@ workflows: - deployment-repo - deployment-multiple - ultimate: - name: "ultimate: native to erc" + name: "ultimate: native to erc" scenario-name: native-to-erc redis-key: native-erc-collected-signatures:lastProcessedBlock ui-e2e-grep: "NATIVE TO ERC" - ultimate: - name: "ultimate: erc to native" + name: "ultimate: erc to native" scenario-name: erc-to-native redis-key: erc-native-collected-signatures:lastProcessedBlock ui-e2e-grep: "ERC TO NATIVE" - ultimate: - name: "ultimate: erc to erc" + name: "ultimate: erc to erc" scenario-name: erc-to-erc redis-key: erc-erc-collected-signatures:lastProcessedBlock ui-e2e-grep: "ERC TO ERC" + - ultimate: + name: "ultimate: amb" + scenario-name: amb + redis-key: amb-collected-signatures:lastProcessedBlock + oracle-e2e-script: "amb" diff --git a/deployment-e2e/molecule/ultimate-amb/Dockerfile.j2 b/deployment-e2e/molecule/ultimate-amb/Dockerfile.j2 new file mode 100644 index 00000000..e6aa95d3 --- /dev/null +++ b/deployment-e2e/molecule/ultimate-amb/Dockerfile.j2 @@ -0,0 +1,14 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/deployment-e2e/molecule/ultimate-amb/molecule.yml b/deployment-e2e/molecule/ultimate-amb/molecule.yml new file mode 100644 index 00000000..d0330420 --- /dev/null +++ b/deployment-e2e/molecule/ultimate-amb/molecule.yml @@ -0,0 +1,40 @@ +--- +driver: + name: docker +platforms: + - name: oracle-amb-host + groups: + - ultimate + - amb + children: + - oracle + image: ubuntu:16.04 + privileged: true + network_mode: host + volumes: + - /var/run/docker.sock:/var/run/docker.sock +provisioner: + name: ansible + playbooks: + prepare: ../prepare.yml + converge: ../ultimate-commons/converge.yml + inventory: + host_vars: + oracle-amb-host: + COMMON_HOME_RPC_URL: "http://parity1:8545" + COMMON_FOREIGN_RPC_URL: "http://parity2:8545" + ORACLE_VALIDATOR_ADDRESS: "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b" + ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY: "8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" +verifier: + name: testinfra + lint: + name: flake8 +scenario: + name: ultimate-amb + test_sequence: + - cleanup + - destroy + - syntax + - create + - prepare + - converge diff --git a/deployment/group_vars/amb.yml b/deployment/group_vars/amb.yml new file mode 100644 index 00000000..b2329e72 --- /dev/null +++ b/deployment/group_vars/amb.yml @@ -0,0 +1,5 @@ +--- +ORACLE_BRIDGE_MODE: "ARBITRARY_MESSAGE" +COMMON_HOME_BRIDGE_ADDRESS: "0x0AEe1FCD12dDFab6265F7f8956e6E012A9Fe4Aa0" +COMMON_FOREIGN_BRIDGE_ADDRESS: "0x0AEe1FCD12dDFab6265F7f8956e6E012A9Fe4Aa0" +MONITOR_PORT: 3013 diff --git a/e2e-commons/up.sh b/e2e-commons/up.sh index b7554dbf..d30d0656 100755 --- a/e2e-commons/up.sh +++ b/e2e-commons/up.sh @@ -100,5 +100,9 @@ while [ "$1" != "" ]; do ../deployment-e2e/molecule.sh ultimate-erc-to-erc fi + if [ "$1" == "amb" ]; then + ../deployment-e2e/molecule.sh ultimate-amb + fi + shift # Shift all the parameters down by one done diff --git a/oracle-e2e/package.json b/oracle-e2e/package.json index 3deef31d..53bd2ed0 100644 --- a/oracle-e2e/package.json +++ b/oracle-e2e/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "mocha", "lint": "eslint . --ignore-path ../.eslintignore", - "native-to-erc": "mocha test/nativeToErc.js" + "amb": "ULTIMATE=true mocha test/amb.js" }, "author": "", "license": "ISC", diff --git a/oracle-e2e/test/amb.js b/oracle-e2e/test/amb.js index d3b27da2..f1b24ea4 100644 --- a/oracle-e2e/test/amb.js +++ b/oracle-e2e/test/amb.js @@ -26,27 +26,30 @@ const foreignBridge = new foreignWeb3.eth.Contract(FOREIGN_AMB_ABI, COMMON_FOREI describe('arbitrary message bridging', () => { before(async () => { - // Set 2 required signatures for home bridge - await setRequiredSignatures({ - bridgeContract: homeBridge, - web3: homeWeb3, - requiredSignatures: 2, - options: { - from: validator.address, - gas: '4000000' - } - }) + // Only 1 validator is used in ultimate tests + if (process.env.ULTIMATE !== 'true') { + // Set 2 required signatures for home bridge + await setRequiredSignatures({ + bridgeContract: homeBridge, + web3: homeWeb3, + requiredSignatures: 2, + options: { + from: validator.address, + gas: '4000000' + } + }) - // Set 2 required signatures for foreign bridge - await setRequiredSignatures({ - bridgeContract: foreignBridge, - web3: foreignWeb3, - requiredSignatures: 2, - options: { - from: validator.address, - gas: '4000000' - } - }) + // Set 2 required signatures for foreign bridge + await setRequiredSignatures({ + bridgeContract: foreignBridge, + web3: foreignWeb3, + requiredSignatures: 2, + options: { + from: validator.address, + gas: '4000000' + } + }) + } }) describe('Home to Foreign', () => { describe('Subsidized Mode', () => {