diff --git a/.github/workflows/integrationtest1.yml b/.github/workflows/integrationtest1.yml index 9b7d55d9dd..e120aad242 100644 --- a/.github/workflows/integrationtest1.yml +++ b/.github/workflows/integrationtest1.yml @@ -15,6 +15,18 @@ jobs: repository: Sifchain/sifchain-devops path: deploy token: "${{ secrets.GIT_PAT }}" + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.8.10' + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 'v16.20.2' + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.18.10' - name: Set up linux environment run: # installs development tools and updates .bash_profile bash test/integration/setup-linux-environment.sh diff --git a/.github/workflows/integrationtest2.yml b/.github/workflows/integrationtest2.yml index 458f11f72e..af4fe92197 100644 --- a/.github/workflows/integrationtest2.yml +++ b/.github/workflows/integrationtest2.yml @@ -15,6 +15,18 @@ jobs: repository: Sifchain/sifchain-devops path: deploy token: "${{ secrets.GIT_PAT }}" + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.8.10' + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 'v16.20.2' + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.18.10' - name: Set up linux environment run: # installs development tools and updates .bash_profile bash test/integration/setup-linux-environment.sh diff --git a/.github/workflows/integrationtest3.yml b/.github/workflows/integrationtest3.yml index ca335b6a46..e002c29926 100644 --- a/.github/workflows/integrationtest3.yml +++ b/.github/workflows/integrationtest3.yml @@ -15,6 +15,18 @@ jobs: repository: Sifchain/sifchain-devops path: deploy token: "${{ secrets.GIT_PAT }}" + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.8.10' + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 'v16.20.2' + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.18.10' - name: Set up linux environment run: # installs development tools and updates .bash_profile bash test/integration/setup-linux-environment.sh diff --git a/test/integration/setup-linux-environment-root.sh b/test/integration/setup-linux-environment-root.sh index 3cba68b18d..fcc32aff7e 100644 --- a/test/integration/setup-linux-environment-root.sh +++ b/test/integration/setup-linux-environment-root.sh @@ -18,10 +18,6 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis curl -fsSL https://download.docker.com/linux/ubuntu/gpg | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -# nodejs -curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - -sudo apt-get install -y nodejs - apt-get update apt-get install -y jq make rake docker-ce docker-ce-cli containerd.io libc6-dev gcc python3-venv python3-dev python3-pip parallel netcat uuid-runtime vim tmux rsync psmisc @@ -32,7 +28,3 @@ groupadd -f docker usermod -aG docker ${dockeruser} curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod a+x /usr/local/bin/docker-compose - -# install go -wget -O /tmp/go.tar.gz https://golang.org/dl/go1.18.4.linux-amd64.tar.gz -sudo tar -C /usr/local -xzf /tmp/go.tar.gz diff --git a/test/integration/setup-linux-environment-user.sh b/test/integration/setup-linux-environment-user.sh index f16264349c..03c6ef1cd1 100644 --- a/test/integration/setup-linux-environment-user.sh +++ b/test/integration/setup-linux-environment-user.sh @@ -15,11 +15,6 @@ npm install -g truffle @truffle/hdwallet-provider ganache-cli || true sudo npm install -g dotenv # set up environment vars in .bash_profile -echo 'export GOPATH=$HOME/go' >> ~/.bash_profile -echo 'export GOBIN=$GOPATH/bin' >> ~/.bash_profile -echo 'export GOROOT=/usr/local/go' >> ~/.bash_profile -echo 'export PATH=$GOROOT/bin:$PATH' >> ~/.bash_profile -echo 'export PATH=$GOBIN:$PATH' >> ~/.bash_profile echo 'export PATH=$HOME/.npm-global/bin:$PATH' >> ~/.bash_profile echo '. ~/.bash_profile' >> ~/.bashrc @@ -27,5 +22,8 @@ echo '. ~/.bash_profile' >> ~/.bashrc . ~/.bash_profile curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0 -python3 -m pip install -U pytest web3 grpcio-tools toml +python3 -m pip install -r $(dirname $0)/framework/requirements.txt +# Print versions to facilitate debugging +python3 --version +python3 -m pip freeze | sort diff --git a/test/integration/src/py/test_ofac_blocklist.py b/test/integration/src/py/test_ofac_blocklist.py index ec03a38043..10aff40ba6 100644 --- a/test/integration/src/py/test_ofac_blocklist.py +++ b/test/integration/src/py/test_ofac_blocklist.py @@ -27,7 +27,23 @@ def bridge_bank_lock_erc20(ctx, bridge_token, from_eth_acct, to_sif_acct, amount return ctx.bridge_bank_lock_erc20(bridge_token, from_eth_acct, to_sif_acct, amount) def is_blocklisted_exception(ctx, exception): - return ctx.eth.is_contract_logic_error(exception, "Address is blocklisted") + # web3 version 6.3.0 parses response OK. + # web3 version 6.11.1 (and possibly onwards) complain like this: + # The response was in an unexpected format and unable to be parsed. Response cannot include both "error" and "result". The raw response is: {'id': 208, 'jsonrpc': '2.0', 'result': '0x630fcdda0e8d746f5b4b676700f8109eee5970676cbda6d63792cf961c8aecfa', 'error': {'message': 'VM Exception while processing transaction: revert ', 'code': -32000, 'data': {'0x630fcdda0e8d746f5b4b676700f8109eee5970676cbda6d63792cf961c8aecfa': {'error': 'revert', 'program_counter': 889, 'return': '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000164164647265737320697320626c6f636b6c697374656400000000000000000000', 'reason': 'Address is blocklisted'}, 'stack': 'c: VM Exception while processing transaction: revert Address is blocklisted\n at Function.c.fromResults (.../smart-contracts/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:194812)\n at w.processBlock (.../smart-contracts/node_modules/ganache-cli/build/ganache-core.node.cli.js:42:53376)\n at runMicrotasks ()\n at processTicksAndRejections (node:internal/process/task_queues:96:5)', 'name': 'c'}}} + # This is most likely caused by using web3 that is too new relative to version of ganache. + import sys, packaging.version + web3_version = packaging.version.parse(sys.modules["web3"].__version__) + v_6_11_1 = packaging.version.parse("6.11.1") + if web3_version >= v_6_11_1: + from web3 import exceptions + if not isinstance(exception, exceptions.BadResponseFormat): + return False + exception_message = exception.args[0] + return \ + ("The response was in an unexpected format and unable to be parsed. Response cannot include both \"error\" and \"result\"." in exception_message) and \ + ("Address is blocklisted" in exception_message) + else: + return ctx.eth.is_contract_logic_error(exception, "Address is blocklisted") @pytest.mark.skipif("on_peggy2_branch") def test_blocklist_eth(ctx):