Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,9 @@ jobs:
- run:
name: Test the stack
command: make devnet-test
- run:
name: Run Celo e2e tests
command: op-e2e/celo/run_all_tests.sh
- run:
name: Dump op-node logs
command: |
Expand Down
54 changes: 54 additions & 0 deletions op-e2e/celo/run_all_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -eo pipefail

SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
source "$SCRIPT_DIR/shared.sh"

## Start geth
cd "$SCRIPT_DIR/../.." || exit 1
trap 'cd "$SCRIPT_DIR/../.." && make devnet-down' EXIT # kill bg job at exit
make devnet-up

# Wait for geth to be ready
for _ in {1..10}
do
if cast block &> /dev/null
then
break
fi
sleep 0.2
done

## Run tests
echo Geth ready, start tests
failures=0
tests=0
cd "$SCRIPT_DIR" || exit 1
for f in test_*
do
echo -e "\nRun $f"
if "./$f"
then
tput setaf 2 || true
echo "PASS $f"
else
tput setaf 1 || true
echo "FAIL $f ❌"
((failures++)) || true
fi
tput init || true
((tests++)) || true
done

## Final summary
echo
if [[ $failures -eq 0 ]]
then
tput setaf 2 || true
echo All tests succeeded!
else
tput setaf 1 || true
echo $failures/$tests failed.
fi
tput init || true
exit $failures
9 changes: 9 additions & 0 deletions op-e2e/celo/shared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
#shellcheck disable=SC2034 # unused vars make sense in a shared file

export ETH_RPC_URL=http://127.0.0.1:9545

ACC_PRIVKEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
ACC_ADDR=$(cast wallet address $ACC_PRIVKEY)
REGISTRY_ADDR=0x000000000000000000000000000000000000ce10
TOKEN_ADDR=0x471ece3750da237f93b8e339c536989b8978a438
12 changes: 12 additions & 0 deletions op-e2e/celo/test_token_duality.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#shellcheck disable=SC2086
set -eo pipefail

source shared.sh

# Send token and check balance
balance_before=$(cast balance 0x000000000000000000000000000000000000dEaD)
cast send --private-key $ACC_PRIVKEY $TOKEN_ADDR 'function transfer(address to, uint256 value) external returns (bool)' 0x000000000000000000000000000000000000dEaD 100
balance_after=$(cast balance 0x000000000000000000000000000000000000dEaD)
echo "Balance change: $balance_before -> $balance_after"
[[ $((balance_before + 100)) -eq $balance_after ]] || (echo "Balance did not change as expected"; exit 1)