Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Thumbs.db
# Environment variables
.env
.env.docker
.env.playground
/ui/.env

# Claude
Expand Down
2 changes: 1 addition & 1 deletion crates/simulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \

FROM debian:bookworm

RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libssl3 ca-certificates curl && rm -rf /var/lib/apt/lists/*

WORKDIR /app

Expand Down
12 changes: 8 additions & 4 deletions docker-compose.tips.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ services:
context: .
dockerfile: crates/simulator/Dockerfile
container_name: tips-simulator
ports:
# Listen on the loopback interface to fail fast if the ports are already in use by op-rbuilder
- "127.0.0.1:2222:2222"
- "127.0.0.1:4444:4444"
volumes:
- ${TIPS_SIMULATOR_DATADIR}:/data
- ${TIPS_SIMULATOR_BUILDER_PLAYGROUND_DIR}:/playground
env_file:
- .env.docker
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "[ \"$(curl -s -w '%{http_code}' -o /dev/null \"localhost:4444\")\" = \"401\" ]" ]
interval: 10s
timeout: 5s
retries: 10
profiles:
- simulator
70 changes: 69 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,72 @@ services:
/usr/bin/mc mb minio/tips;
/usr/bin/mc anonymous set public minio/tips;
exit 0;
"
"

simulator-cl:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.13.7
container_name: tips-simulator-cl
depends_on:
simulator:
condition: service_healthy
profiles:
- simulator
ports:
- "18545:8545" # RPC
- "19222:9222" # P2P TCP
- "19222:9222/udp" # P2P UDP
- "17300:7300" # metrics
- "16060:6060" # pprof
volumes:
- ~/.playground/devnet/jwtsecret:/data/jwtsecret:ro
- ~/.playground/devnet/rollup.json:/data/rollup.json:ro
environment:
# NETWORK CONFIGURATION
OP_NODE_NETWORK: ""
OP_NODE_ROLLUP_CONFIG: /data/rollup.json

# BASE SEQUENCER ENDPOINTS
RETH_SEQUENCER_HTTP: http://host.docker.internal:8547
OP_SEQUENCER_HTTP: http://host.docker.internal:8547
OP_RETH_SEQUENCER_HTTP: http://host.docker.internal:8547

# SYNC CONFIGURATION
OP_NODE_SYNCMODE: consensus-layer
OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS: "true"

# L1 CONFIGURATION
OP_NODE_L1_ETH_RPC: http://host.docker.internal:8545
OP_NODE_L1_BEACON: http://host.docker.internal:3500
OP_NODE_L1_RPC_KIND: debug_geth
OP_NODE_L1_TRUST_RPC: "false"

# ENGINE CONFIGURATION
OP_NODE_L2_ENGINE_KIND: reth
OP_NODE_L2_ENGINE_RPC: http://simulator:4444
OP_NODE_L2_ENGINE_AUTH: /data/jwtsecret

# P2P CONFIGURATION
OP_NODE_P2P_LISTEN_IP: 0.0.0.0
OP_NODE_P2P_LISTEN_TCP_PORT: "9222"
OP_NODE_P2P_LISTEN_UDP_PORT: "9222"
OP_NODE_INTERNAL_IP: "true"
OP_NODE_P2P_ADVERTISE_IP: host.docker.internal
OP_NODE_P2P_ADVERTISE_TCP: "19222"
OP_NODE_P2P_ADVERTISE_UDP: "19222"
# Only connect to the sequencer in playground mode
OP_NODE_P2P_NO_DISCOVERY: "true"

# RPC CONFIGURATION
OP_NODE_RPC_ADDR: 0.0.0.0
OP_NODE_RPC_PORT: "8545"

# LOGGING & MONITORING
OP_NODE_LOG_LEVEL: debug
OP_NODE_LOG_FORMAT: json
OP_NODE_SNAPSHOT_LOG: /tmp/op-node-snapshot-log
OP_NODE_METRICS_ENABLED: "true"
OP_NODE_METRICS_ADDR: 0.0.0.0
OP_NODE_METRICS_PORT: "7300"
STATSD_ADDRESS: "172.17.0.1"
env_file:
- .env.playground
17 changes: 12 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ sync-env:
# Change other dependencies
sed -i '' 's/localhost/host.docker.internal/g' ./.env.docker

stop-all:
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && docker compose down && docker compose rm && rm -rf data/
stop-all profile="default":
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && docker compose --profile {{ profile }} down && docker compose --profile {{ profile }} rm && rm -rf data/

# Start every service running in docker, useful for demos
start-all: stop-all
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && mkdir -p data/postgres data/kafka data/minio && docker compose build && docker compose up -d
start-all profile="default": (stop-all profile)
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && mkdir -p data/postgres data/kafka data/minio && docker compose --profile {{ profile }} build && docker compose --profile {{ profile }} up -d

# Stop only the specified service without stopping the other services or removing the data directories
stop-only program:
Expand Down Expand Up @@ -101,7 +101,14 @@ simulator:
cargo run --bin tips-simulator node

simulator-playground:
cargo run --bin tips-simulator node --builder.playground --datadir ~/.playground/devnet/tips-simulator
RUST_LOG=debug cargo run --bin tips-simulator node --builder.playground --datadir ~/.playground/devnet/tips-simulator --authrpc.port=8554

ui:
cd ui && yarn dev

playground-env:
echo "BUILDER_PLAYGROUND_HOST_IP=$(docker run --rm alpine nslookup host.docker.internal | awk '/Address: / && $2 !~ /:/ {print $2; exit}')" > .env.playground
echo "BUILDER_PLAYGROUND_PEER_ID=$(grep 'started p2p host' ~/.playground/devnet/logs/op-node.log | sed -n 's/.*peerID=\([^ ]*\).*/\1/p' | head -1)" >> .env.playground
echo "OP_NODE_P2P_STATIC=/ip4/\$BUILDER_PLAYGROUND_HOST_IP/tcp/9003/p2p/\$BUILDER_PLAYGROUND_PEER_ID" >> .env.playground

start-playground: playground-env (start-all "simulator")