Skip to content

Commit

Permalink
Add full node example and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe committed Sep 4, 2024
1 parent 98187ea commit 7fa849a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,30 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"

full-node:
pid: host # allow debugging
image: nitro-node-dev-testnode
ports:
- "127.0.0.1:8947:8547"
- "127.0.0.1:8948:8548"
entrypoint: /usr/local/bin/nitro
volumes:
- "config:/config"
- "l1keystore:/home/user/l1keystore"
# use the sequencer_config.json but override the sequencer settings and the forwarding settings.
command: --conf.file /config/sequencer_config.json --node.sequencer=false --node.batch-poster.enable=false --execution.sequencer.enable=false --execution.forwarding-target http://sequencer:8547 --node.delayed-sequencer.enable=false --node.feed.input.url ws://sequencer:9642 --http.port 8547 --http.api net,web3,arb,debug,net,eth --ws.port 8548
depends_on:
- geth
- sequencer
healthcheck:
test: ["CMD-SHELL", "curl -fL http://localhost:8947 || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
extra_hosts:
- "host.docker.internal:host-gateway"

volumes:
l1data:
consensus:
Expand Down
21 changes: 21 additions & 0 deletions smoke-test-full-node.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

./test-node.bash --init-force --simple --detach

docker compose up -d full-node --detach

# Sending L2 transaction through the full-node's api
user=user_l2user
./test-node.bash script send-l2 --l2url ws://host.docker.internal:8948 --ethamount 100 --to $user --wait

# Check the balance from full-node's api
userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n')

while true; do
balance=$(cast balance $userAddress --rpc-url http://localhost:8947)
if [ ${#balance} -gt 0 ]; then
break
fi
sleep 1
done

0 comments on commit 7fa849a

Please sign in to comment.