Skip to content

Commit

Permalink
Merge branch 'master' into ci/goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
snobbee authored Oct 31, 2023
2 parents e26427b + 39028c6 commit acc33d1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 15 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/integrationtest1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/integrationtest2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/integrationtest3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions test/integration/setup-linux-environment-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 4 additions & 6 deletions test/integration/setup-linux-environment-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ 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

. ~/.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
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 (.../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 (<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 acc33d1

Please sign in to comment.