forked from OffchainLabs/nitro-testnode
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsmoke-test-l3.bash
More file actions
executable file
·35 lines (27 loc) · 1.17 KB
/
smoke-test-l3.bash
File metadata and controls
executable file
·35 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -euo pipefail
source ./regression-tests/common.bash
./test-node.bash --init-force --espresso $(get_espresso_image_flag) --l3node --l3-token-bridge --l3-fee-token --detach
rollupAddress=$(docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_l3_chain_info.json | tail -n 1 | tr -d '\r\n'")
previousConfirmed=$(cast call --rpc-url http://localhost:8547 $rollupAddress 'latestConfirmed()(bytes32)')
echo "latest confirmed hash: $previousConfirmed"
echo "Sending L3 transaction"
user=user_l3
./test-node.bash script send-l3 --ethamount 5 --to $user --wait
userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n')
balance=$(cast balance $userAddress --rpc-url http://localhost:3347)
if [ "$balance" -eq 0 ]; then
echo "Transfer failed in l3 node"
exit 1
fi
while true; do
confirmed=$(cast call --rpc-url http://localhost:8547 $rollupAddress 'latestConfirmed()(bytes32)')
if [ -n "$confirmed" ] && [ "$confirmed" != "$previousConfirmed" ]; then
break
else
echo "Waiting for more confirmed nodes ...$confirmed"
fi
sleep 5
done
echo "Smoke test succeeded."
docker compose down