forked from OffchainLabs/nitro-testnode
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsmoke-test-caff-node.bash
executable file
·40 lines (28 loc) · 1.21 KB
/
smoke-test-caff-node.bash
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
36
37
38
39
40
#!/usr/bin/env bash
set -euo pipefail
user=user_l2user
caff_url="ws://caff-node:8548"
./test-node.bash --espresso --latest-espresso-image --validate --tokenbridge --init-force --detach --caff-node
# Start the caff node
docker compose up -d caff-node --wait --detach
echo "Sending L2 transaction through sequencer"
./test-node.bash script send-l2 --ethamount 10 --to $user --wait
# Check the balance from caff node's api
userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n')
while true; do
# Check if the balance on Caff node is greater than 0
balance=$(cast balance $userAddress --rpc-url ws://127.0.0.1:8552)
# Using bc here because it supports bigint
if [ "$(echo "$balance > 0" | bc)" -eq 1 ]; then
break
fi
sleep 1
done
echo "Sending L2 transaction through caff node"
./test-node.bash script send-l2 --ethamount 10 --to $user --l2url $caff_url --wait
echo "Sending L2 transaction through sequencer"
./test-node.bash script send-l2 --ethamount 10 --to $user --wait
echo "Sending L2 transaction through caff node"
./test-node.bash script send-l2 --ethamount 10 --to $user --l2url $caff_url --wait
echo "Smoke test succeeded."
docker compose down