Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jzvikart committed Oct 28, 2023
1 parent 56a508a commit 1039171
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 68 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/integrationtest2.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/integrationtest3.yml

This file was deleted.

2 changes: 1 addition & 1 deletion test/integration/setup-linux-environment-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +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 pytest==7.4.3 web3==6.11.1 grpcio-tools==1.59.0 toml==0.10.2 PyYAML==6.0.1
python3 -m pip install -r $(dirname $0)/framework/requirements.txt
18 changes: 17 additions & 1 deletion test/integration/src/py/test_ofac_blocklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<anonymous>)\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):
Expand Down

0 comments on commit 1039171

Please sign in to comment.