|
| 1 | +# OP Stack L2 Rollup Makefile |
| 2 | + |
| 3 | +.PHONY: help setup up down logs clean reset |
| 4 | + |
| 5 | +# Default target |
| 6 | +help: ## Show this help message |
| 7 | + @echo "OP Stack L2 Rollup Management Commands:" |
| 8 | + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
| 9 | + |
| 10 | +setup: ## Deploy L1 contracts and configure rollup components |
| 11 | + mkdir -p deployer |
| 12 | + @if [ ! -f op-deployer ]; then \ |
| 13 | + echo "❌ Error: op-deployer not found. Run 'make download' first."; \ |
| 14 | + exit 1; \ |
| 15 | + fi |
| 16 | + @if [ ! -f .env ]; then \ |
| 17 | + echo "❌ Error: .env file not found. Copy .example.env to .env and configure it."; \ |
| 18 | + exit 1; \ |
| 19 | + fi |
| 20 | + @echo "Running setup script..." |
| 21 | + @./scripts/setup-rollup.sh |
| 22 | + |
| 23 | +up: ## Start all services |
| 24 | + docker-compose up -d --wait |
| 25 | + @make test-l2 |
| 26 | + |
| 27 | +down: ## Stop all services |
| 28 | + docker-compose down |
| 29 | + |
| 30 | +logs: ## View logs from all services |
| 31 | + docker-compose logs -f |
| 32 | + |
| 33 | +logs-%: ## View logs from a specific service (e.g., make logs-sequencer) |
| 34 | + docker-compose logs -f $* |
| 35 | + |
| 36 | +status: ## Show status of all services |
| 37 | + docker-compose ps |
| 38 | + |
| 39 | +restart: ## Restart all services |
| 40 | + docker-compose restart |
| 41 | + |
| 42 | +restart-%: ## Restart a specific service (e.g., make restart-batcher) |
| 43 | + docker-compose restart $* |
| 44 | + |
| 45 | +clean: ## Remove all containers and volumes |
| 46 | + @# Create minimal env files if they don't exist to avoid docker-compose errors |
| 47 | + @mkdir -p batcher proposer challenger sequencer |
| 48 | + @echo "# Minimal env for cleanup" > batcher/.env 2>/dev/null || true |
| 49 | + @echo "# Minimal env for cleanup" > proposer/.env 2>/dev/null || true |
| 50 | + @echo "# Minimal env for cleanup" > challenger/.env 2>/dev/null || true |
| 51 | + docker-compose down -v --remove-orphans 2>/dev/null || true |
| 52 | + |
| 53 | +reset: ## Complete reset - removes all data and redeploys |
| 54 | + @echo "This will completely reset your L2 rollup deployment!" |
| 55 | + @read -p "Are you sure? (y/N) " confirm && [ "$$confirm" = "y" ] || exit 1 |
| 56 | + make clean |
| 57 | + rm -rf deployer sequencer batcher proposer challenger |
| 58 | + @echo "Reset complete. Run 'make setup' to redeploy." |
| 59 | + |
| 60 | +test-l2: ## Test L2 connectivity |
| 61 | + @echo "Testing L2 RPC connection..." |
| 62 | + @curl -s -X POST -H "Content-Type: application/json" \ |
| 63 | + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ |
| 64 | + http://localhost:8545 | jq -r '.result' 2>/dev/null && echo "✅ L2 connection successful" || echo "❌ L2 connection failed" |
| 65 | + |
| 66 | +test-l1: ## Test L1 connectivity |
| 67 | + @echo "Testing L1 RPC connection..." |
| 68 | + @if [ -f .env ]; then \ |
| 69 | + set -a; source .env; set +a; \ |
| 70 | + fi; \ |
| 71 | + curl -s -X POST -H "Content-Type: application/json" \ |
| 72 | + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ |
| 73 | + "$$L1_RPC_URL" | jq -r '.result' 2>/dev/null && echo "✅ L1 connection successful" || echo "❌ L1 connection failed" |
| 74 | + |
| 75 | +deps: ## Install development dependencies with mise (optional) |
| 76 | + mise install |
| 77 | + |
| 78 | +download: ## Download op-deployer binary |
| 79 | + ./scripts/download-op-deployer.sh |
| 80 | + |
| 81 | +init: ## Initialize the project |
| 82 | + ./scripts/download-op-deployer.sh |
| 83 | + @if [ ! -f .env ]; then \ |
| 84 | + cp .example.env .env; \ |
| 85 | + echo "Please edit .env with your actual configuration values"; \ |
| 86 | + else \ |
| 87 | + echo ".env already exists, skipping copy"; \ |
| 88 | + fi |
| 89 | + @echo "Then run: make setup" |
0 commit comments