diff --git a/test/integration/setup-linux-environment-user.sh b/test/integration/setup-linux-environment-user.sh index f16264349c..7809bcca54 100644 --- a/test/integration/setup-linux-environment-user.sh +++ b/test/integration/setup-linux-environment-user.sh @@ -27,5 +27,4 @@ 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 diff --git a/test/integration/src/py/test_ofac_blocklist.py b/test/integration/src/py/test_ofac_blocklist.py index ec03a38043..753291b6c0 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 (/home/jurez/work/projects/sif/sifnode/local/smart-contracts/node_modules/ganache-cli/build/ganache-core.node.cli.js:4:194812)\n at w.processBlock (/home/jurez/work/projects/sif/sifnode/local/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):