forked from vianetwork/via-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
327 lines (283 loc) · 13.2 KB
/
Copy pathMakefile
File metadata and controls
327 lines (283 loc) · 13.2 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# Colors
YELLOW = \033[0;33m
RESET = \033[0m
# CLI tool
CLI_TOOL = via
CMD := $(firstword $(MAKECMDGOALS))
VIA_ENV ?= via
DIFF ?= 0
MODE ?= sequencer
PROFILE ?= ""
# Select the via env
ifeq ($(CMD), via-verifier)
VIA_ENV := via_verifier
DIFF := 1
MODE := verifier
else ifeq ($(CMD), via-restart)
VIA_ENV := via
else ifeq ($(CMD), via-restart-verifier)
VIA_ENV := via_verifier
else ifeq ($(CMD), via-coordinator)
VIA_ENV := via_coordinator
DIFF := 2
MODE := coordinator
else ifeq ($(CMD), via-restart-coordinator)
VIA_ENV := via_coordinator
else ifeq ($(CMD), via-indexer)
VIA_ENV := via_indexer
DIFF := 3
MODE := indexer
else ifeq ($(CMD), via-restart-indexer)
VIA_ENV := via_indexer
else ifeq ($(CMD), via-ext-node)
VIA_ENV := via_ext_node
else ifeq ($(CMD), via-multi)
PROFILE := reorg
endif
# Default target: Show help message
.PHONY: help
help:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)VIA Protocol Makefile$(RESET)"
@echo "------------------------------------------------------------------------------------"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Available Targets:"
@echo " via - Run the basic VIA setup workflow (without Bitcoin explorer)."
@echo " all - Run the full VIA setup workflow (with Bitcoin explorer)."
@echo " env - Set the correct environment for VIA protocol."
@echo " config - Create the basic configuration files for VIA."
@echo " init - Initialize the project by pulling Docker images and running migrations."
@echo " transactions - Send random transactions on the Bitcoin regtest network."
@echo " celestia - Update Celestia config and obtain test tokens."
@echo " btc-explorer - Run a Bitcoin explorer."
@echo " bootstrap-dev -- Send the bootstrapping inscription to Bitcoin (Development)."
@echo " server-genesis - Populate the genesis block data if no genesis block exists."
@echo " server - Run the sequencer software."
@echo " clean - Clean the project, remove Docker images, volumes, and generated files."
@echo " rollback - Initiate a sequencer rollback by specifying the target 'to_batch' number."
@echo " help - Show this help message (default target)."
@echo ""
@echo "Requirements:"
@echo " - Set up the VIA_HOME and PATH environment variables."
@echo " - Compile the 'via' command for the first time."
@echo " - Install Docker."
@echo "------------------------------------------------------------------------------------"
# Default target: Redirect to help
.DEFAULT_GOAL := help
# Restart the sequence
.PHONY: via-restart
via-restart: env-soft server
# Run the basic setup workflow in sequence
.PHONY: setup
setup: base transactions bootstrap-dev server-genesis
# Run the basic setup workflow in sequence and server
.PHONY: via
via: base transactions da-proxy-setup da-proxy bootstrap-dev server-genesis server
# Run the basic setup workflow in sequence and server with profile "reorg" for docker compose profile
.PHONY: via-multi
via-multi: via
# Run the basic setup workflow in sequence and server with profile "reorg" for docker compose profile
.PHONY: via-multi
via-multi: via
# Run the full setup workflow in sequence
.PHONY: all
all: base transactions btc-explorer bootstrap-dev server-genesis server
# Run the basic setup workflow in verifier
.PHONY: via-verifier
via-verifier: base verifier
# Restart the verifier
.PHONY: via-restart-verifier
via-restart-verifier: env-soft verifier
# Run the basic setup workflow for the coordinator
.PHONY: via-coordinator
via-coordinator: base verifier
# Restart the coordinator
.PHONY: via-restart-coordinator
via-restart-coordinator: env-soft verifier
# Run the L1 indexer
.PHONY: via-indexer
via-indexer: base l1-indexer
# Restart the L1 indexer
.PHONY: via-restart-indexer
via-restart-indexer: env-soft l1-indexer
# Run the external node
.PHONY: via-external-node
via-external-node: setup-external-node
# Run minimal required setup
.PHONY: base
base: env config init
# Run 'via env via'
.PHONY: env
env:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Setting the environment...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) env ${VIA_ENV}
# Run 'via env via --soft'
.PHONY: env-soft
env-soft:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Setting the environment...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) env ${VIA_ENV} --soft
# Run 'via config compile'
.PHONY: config
config:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Creating environment configuration file...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) config compile ${VIA_ENV} ${DIFF}
# Run 'via init'
.PHONY: init
init:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Initializing the project...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) init --mode ${MODE} --profile ${PROFILE}
# Run 'via transactions'
.PHONY: transactions
transactions:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Sending random transactions on the regtest network...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) transactions
# Run 'via celestia'
.PHONY: celestia
celestia:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Updating Celestia configuration and obtaining TIA test tokens...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) celestia
# Run 'via celestia --backend http'
.PHONY: da-proxy-setup
da-proxy-setup:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Setup da-proxy...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) celestia --backend http
.PHONY: da-proxy
da-proxy:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Start da-proxy...$(RESET)"
@echo "------------------------------------------------------------------------------------"
docker compose -f docker-compose-via.yml up -d da-proxy --build
# Run 'via btc-explorer'
.PHONY: btc-explorer
btc-explorer:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running a Bitcoin explorer...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) btc-explorer
# Run 'via bootstrap-dev'
.PHONY: bootstrap-dev
bootstrap-dev:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Sending bootstrapping inscription to Bitcoin...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) bootstrap system-bootstrapping \
--private-key cVZduZu265sWeAqFYygoDEE1FZ7wV9rpW5qdqjRkUehjaUMWLT1R \
--start-block 1 \
--verifiers-pub-keys 03d8e2443ef58aa80fb6256bf3b94d2ecf9117f19cb17661ec60ad35fd84ff4a8b,02043f839b8ecd9ffd79f26ec7d05750555cd0d1e0777cfc84a29b7e38e6324662 \
--governance-address bcrt1q92gkfme6k9dkpagrkwt76etkaq29hvf02w5m38f6shs4ddpw7hzqp347zm \
--bridge-wallet-path etc/test_config/via/regtest/bridge_address.json \
--sequencer-address bcrt1qx2lk0unukm80qmepjp49hwf9z6xnz0s73k9j56
@echo "$(YELLOW)Update ENVs...$(RESET)"
@$(CLI_TOOL) bootstrap update-bootstrap-tx
# Run 'via server --genesis'
.PHONY: server-genesis
server-genesis:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Populating data for the genesis block...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) server --genesis
# Run 'via server'
.PHONY: server
server:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) server
# Run 'via server --components state_keeper'
.PHONY: server-core
server-core:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer 'core' component...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) server --components state_keeper
# Run 'via server --components tree_api,tree'
.PHONY: server-tree
server-tree:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer 'tree' component software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@API_HEALTHCHECK_PORT=3080 API_PROMETHEUS_LISTENER_PORT=3330 $(CLI_TOOL) server --components tree_api,tree
# Run 'via server --components vm_runner_protective_reads'
.PHONY: server-protective-reads
server-protective-reads:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer 'vm_runner_protective_reads' component software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@API_HEALTHCHECK_PORT=3081 API_PROMETHEUS_LISTENER_PORT=3331 $(CLI_TOOL) server --components vm_runner_protective_reads
# Run 'via server --components vm_runner_bwip'
.PHONY: server-housekeeper
server-bwip:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer 'vm_runner_bwip' component software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@API_HEALTHCHECK_PORT=3082 API_PROMETHEUS_LISTENER_PORT=3332 $(CLI_TOOL) server --components vm_runner_bwip
# Run 'via server --components "api,btc,housekeeper,proof_data_handler,commitment_generator,celestia,da_dispatcher,vm_runner_bwip"'
.PHONY: server-rest
server-rest:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the sequencer '"api,btc,housekeeper,proof_data_handler,commitment_generator,celestia,da_dispatcher"' component software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@API_HEALTHCHECK_PORT=3083 API_PROMETHEUS_LISTENER_PORT=3333 $(CLI_TOOL) server --components "api,btc,housekeeper,proof_data_handler,commitment_generator,celestia,da_dispatcher"
# Run 'via verifier'
.PHONY: verifier
verifier:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the verifier/coordinator software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) verifier
# Run 'via clean'
.PHONY: clean
clean:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Cleaning the project, removing images, volumes, and generated files...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) clean --profile ${PROFILE} && \
docker compose -f docker-compose-via.yml down da-proxy
# Run 'via clean-multi'
.PHONY: clean-multi
clean-multi:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Cleaning the project, removing images, volumes, and generated files...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) clean --profile reorg && \
docker compose -f docker-compose-via.yml down da-proxy
# Run 'via l1-indexer'
.PHONY: l1-indexer
l1-indexer:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Running the L1 indexer software...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) indexer
# Run 'via setup-external-node'
.PHONY: setup-external-node
setup-external-node:
@echo "------------------------------------------------------------------------------------"
@echo "$(YELLOW)Configuring the external node...$(RESET)"
@echo "------------------------------------------------------------------------------------"
@$(CLI_TOOL) setup-external-node
# Require 'to_batch' args as input, ex: `make rollback to_batch=2`
.PHONY: rollback
rollback:
cargo run --bin via_block_reverter_cli -- rollback-db \
--rollback-postgres \
--l1-batch-number $(to_batch) \
--rollback-tree \
--rollback-sk-cache \
--rollback-vm-runners-cache \
--rollback-snapshots