-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
159 lines (136 loc) · 9.45 KB
/
Makefile
File metadata and controls
159 lines (136 loc) · 9.45 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
include contracts/makefile-contracts.mk
docker-pull-images-external-to-monorepo:
docker compose -f docker/compose-tracing-v2-ci-extension.yml --profile external-to-monorepo pull
clean-local-folders:
make clean-smc-folders
rm -rf tmp/local/* || true # ignore failure if folders do not exist already
clean-testnet-folders:
make clean-smc-folders
rm -rf tmp/testnet/* || true # ignore failure if folders do not exist already
clean-environment:
docker compose -f docker/compose-tracing-v2-ci-fleet-extension.yml -f docker/compose-tracing-v2-staterecovery-extension.yml --profile l1 --profile l2 --profile debug --profile staterecovery kill -s 9 || true;
docker compose -f docker/compose-tracing-v2-ci-fleet-extension.yml -f docker/compose-tracing-v2-staterecovery-extension.yml --profile l1 --profile l2 --profile debug --profile staterecovery down || true;
# Ensure RLN stack containers are stopped as well
docker rm -f rln-prover sequencer postgres-replica l2-node-besu-follower || true;
make clean-local-folders;
# Remove both legacy and RLN stack volumes (ignore failures if they don't exist)
docker volume rm linea-local-dev linea-logs docker_local-dev docker_logs docker_rln-data || true; # ignore failure if volumes do not exist already
docker system prune -f || true;
start-env: COMPOSE_PROFILES:=l1,l2
start-env: CLEAN_PREVIOUS_ENV:=true
start-env: COMPOSE_FILE:=docker/compose-tracing-v2.yml
start-env: L1_CONTRACT_VERSION:=7_1
start-env: SKIP_CONTRACTS_DEPLOYMENT:=false
start-env: SKIP_L1_L2_NODE_HEALTH_CHECK:=false
start-env: LINEA_PROTOCOL_CONTRACTS_ONLY:=false
start-env: LINEA_L1_CONTRACT_DEPLOYMENT_TARGET:=deploy-linea-rollup-v$(L1_CONTRACT_VERSION)
start-env:
@if [ "$(CLEAN_PREVIOUS_ENV)" = "true" ]; then \
$(MAKE) clean-environment; \
else \
echo "Starting stack reusing previous state"; \
fi; \
mkdir -p tmp/local; \
COMPOSE_PROFILES=$(COMPOSE_PROFILES) docker compose -f $(COMPOSE_FILE) up -d; \
while [ "$(SKIP_L1_L2_NODE_HEALTH_CHECK)" = "false" ] && \
{ [ "$$(docker compose -f $(COMPOSE_FILE) ps -q l1-el-node | xargs -r docker inspect -f '{{.State.Health.Status}}')" != "healthy" ] || \
[ "$$(docker compose -f $(COMPOSE_FILE) ps -q l1-cl-node | xargs -r docker inspect -f '{{.State.Health.Status}}')" != "healthy" ] || \
[ "$$(docker compose -f $(COMPOSE_FILE) ps -q sequencer | xargs -r docker inspect -f '{{.State.Health.Status}}')" != "healthy" ]; }; do \
sleep 2; \
echo "Checking health status of: l1-el-node, l1-cl-node and l2 sequencer..."; \
done; \
if [ "$(SKIP_L1_L2_NODE_HEALTH_CHECK)" = "false" ]; then \
echo "Container health checks passed"; \
echo "Performing network readiness verification..."; \
./scripts/verify-network-ready.sh || { echo "❌ Network readiness verification failed"; exit 1; }; \
fi
if [ "$(SKIP_CONTRACTS_DEPLOYMENT)" = "true" ]; then \
echo "Skipping contracts deployment"; \
else \
$(MAKE) deploy-contracts L1_CONTRACT_VERSION=$(L1_CONTRACT_VERSION) LINEA_PROTOCOL_CONTRACTS_ONLY=$(LINEA_PROTOCOL_CONTRACTS_ONLY) STATUS_NETWORK_CONTRACTS_ENABLED=$${STATUS_NETWORK_CONTRACTS_ENABLED:-false}; \
fi
start-env-with-validium:
$(MAKE) start-env L1_CONTRACT_VERSION=1 LINEA_COORDINATOR_DATA_AVAILABILITY=VALIDIUM LINEA_L1_CONTRACT_DEPLOYMENT_TARGET=deploy-validium
start-l1:
make start-env COMPOSE_PROFILES:=l1 COMPOSE_FILE:=docker/compose-tracing-v2.yml SKIP_CONTRACTS_DEPLOYMENT:=true SKIP_L1_L2_NODE_HEALTH_CHECK:=true
start-l1-l2:
make start-env COMPOSE_PROFILES:=l1,l2 COMPOSE_FILE:=docker/compose-tracing-v2.yml SKIP_CONTRACTS_DEPLOYMENT:=true SKIP_L1_L2_NODE_HEALTH_CHECK:=true
start-l2-blockchain-only:
make start-env COMPOSE_PROFILES:=l2-bc COMPOSE_FILE:=docker/compose-tracing-v2.yml SKIP_CONTRACTS_DEPLOYMENT:=true SKIP_L1_L2_NODE_HEALTH_CHECK:=true
fresh-start-l2-blockchain-only:
make clean-environment
make start-l2-blockchain-only
##
## Creating new targets to avoid conflicts with existing targets
## Redundant targets above will cleanup once this get's merged
##
start-env-with-tracing-v2:
make start-env COMPOSE_FILE=docker/compose-tracing-v2.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true
## Enable L2 geth node
start-env-with-tracing-v2-extra:
make start-env COMPOSE_PROFILES:=l1,l2 COMPOSE_FILE:=docker/compose-tracing-v2-extra-extension.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true LINEA_COORDINATOR_DISABLE_TYPE2_STATE_PROOF_PROVIDER=false LINEA_COORDINATOR_SIGNER_TYPE=web3signer
start-env-with-tracing-v2-ci:
make start-env COMPOSE_FILE=docker/compose-tracing-v2-ci-extension.yml LINEA_COORDINATOR_DISABLE_TYPE2_STATE_PROOF_PROVIDER=false LINEA_COORDINATOR_SIGNER_TYPE=web3signer
start-env-with-validium-and-tracing-v2-ci:
make start-env-with-validium COMPOSE_FILE=docker/compose-tracing-v2-ci-extension.yml LINEA_COORDINATOR_DISABLE_TYPE2_STATE_PROOF_PROVIDER=false LINEA_COORDINATOR_SIGNER_TYPE=web3signer
## Enable Fleet leader and follower besu nodes
start-env-with-tracing-v2-ci-fleet:
make start-env COMPOSE_FILE=docker/compose-tracing-v2-ci-fleet-extension.yml LINEA_USE_MARU_OVERRIDE_CONFIG=true LINEA_COORDINATOR_DISABLE_TYPE2_STATE_PROOF_PROVIDER=false LINEA_COORDINATOR_SIGNER_TYPE=web3signer
start-env-with-staterecovery: COMPOSE_PROFILES:=l1,l2,staterecovery
start-env-with-staterecovery: L1_CONTRACT_VERSION:=6
start-env-with-staterecovery:
make start-env COMPOSE_FILE=docker/compose-tracing-v2-staterecovery-extension.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true L1_CONTRACT_VERSION=$(L1_CONTRACT_VERSION) COMPOSE_PROFILES=$(COMPOSE_PROFILES)
start-env-with-rln:
make start-env COMPOSE_FILE=docker/compose-tracing-v2-rln.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
start-env-with-rln-and-contracts:
@echo "Starting complete RLN environment with automated contract deployment..."
make start-env COMPOSE_FILE=docker/compose-tracing-v2-rln.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
@echo "Complete RLN environment with contracts is ready!"
# Production mode: RLN prover connects to real smart contracts
# This starts the network in mock mode first, deploys contracts, initializes tiers, then restarts RLN services in production mode
start-env-with-rln-production:
@echo "🚀 Starting RLN environment in PRODUCTION mode..."
@echo "Step 1: Starting network with mock RLN (to allow contract deployment)..."
make start-env COMPOSE_FILE=docker/compose-tracing-v2-rln.yml LINEA_PROTOCOL_CONTRACTS_ONLY=true STATUS_NETWORK_CONTRACTS_ENABLED=true
@echo "Step 2: Extracting deployed contract addresses..."
@KARMA_ADDR=$$(cat status-network-contracts/deployments/karma_address.txt 2>/dev/null) && \
RLN_ADDR=$$(cat status-network-contracts/deployments/rln_address.txt 2>/dev/null) && \
TIERS_ADDR=$$(cat status-network-contracts/deployments/karma_tiers_address.txt 2>/dev/null) && \
echo " Karma: $$KARMA_ADDR" && \
echo " RLN: $$RLN_ADDR" && \
echo " KarmaTiers: $$TIERS_ADDR" && \
echo "Step 3: Initializing karma tiers via Foundry..." && \
(cd status-network-contracts && KARMA_TIERS_ADDRESS=$$TIERS_ADDR forge script script/InitializeKarmaTiers.s.sol:InitializeKarmaTiersScript \
--rpc-url http://localhost:8545 \
--private-key 0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
--broadcast --legacy --with-gas-price 110000000000) && \
echo "Step 3.5: Minting Karma to deployer for admin tier access..." && \
(cast send --legacy --gas-price 110000000000 \
--private-key 0x1dd171cec7e2995408b5513004e8207fe88d6820aeff0d82463b3e41df251aae \
--rpc-url http://localhost:8545 \
$$KARMA_ADDR "mint(address,uint256)" \
0x1B9AbEeC3215D8AdE8a33607f2cF0f4F60e5F0D0 $$(cast --to-wei 100000 ether) || true) && \
echo "Step 4: Setting up prover account permissions..." && \
(cd e2e && NODE_PATH=../contracts/node_modules KARMA_CONTRACT_ADDRESS=$$KARMA_ADDR RLN_CONTRACT_ADDRESS=$$RLN_ADDR node ../scripts/setup-prover-account.js || true) && \
(cd e2e && NODE_PATH=../contracts/node_modules KARMA_CONTRACT_ADDRESS=$$KARMA_ADDR node ../scripts/grant-operator-role.js || true) && \
echo "Step 5: Restarting RLN prover in production mode (via docker compose)..." && \
RLN_PROVER_CMD="--no-config --ip 0.0.0.0 --port 50051 --ws-rpc-url ws://sequencer:8546 --ksc $$KARMA_ADDR --rlnsc $$RLN_ADDR --tsc $$TIERS_ADDR --registration-min 1 --db postgres://postgres:postgres@postgres:5432/prover_db --registration-gas-price-gwei 12 --spam-limit 1000000 --epoch-duration-secs 60" \
RLN_PROVER_PRIVATE_KEY=0x8f5a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a \
docker compose -f docker/compose-tracing-v2-rln.yml up -d --force-recreate rln-prover && \
echo "✅ RLN environment running in PRODUCTION mode!" && \
echo " - RLN Prover connected to real smart contracts" && \
echo " - Karma tiers initialized" && \
echo " - Users must have Karma to use gasless transactions"
staterecovery-replay-from-block: L1_ROLLUP_CONTRACT_ADDRESS:=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
staterecovery-replay-from-block: STATERECOVERY_OVERRIDE_START_BLOCK_NUMBER:=1
staterecovery-replay-from-block:
docker compose -f docker/compose-tracing-v2-staterecovery-extension.yml down zkbesu-shomei-sr shomei-sr
L1_ROLLUP_CONTRACT_ADDRESS=$(L1_ROLLUP_CONTRACT_ADDRESS) STATERECOVERY_OVERRIDE_START_BLOCK_NUMBER=$(STATERECOVERY_OVERRIDE_START_BLOCK_NUMBER) docker compose -f docker/compose-tracing-v2-staterecovery-extension.yml up zkbesu-shomei-sr shomei-sr -d
stop_pid:
if [ -f $(PID_FILE) ]; then \
kill `cat $(PID_FILE)`; \
echo "Stopped process with PID `cat $(PID_FILE)`"; \
rm $(PID_FILE); \
else \
echo "$(PID_FILE) does not exist. No process to stop."; \
fi