forked from yetanotherco/aligned_layer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
725 lines (584 loc) · 28.4 KB
/
Makefile
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
.PHONY: help tests
OS := $(shell uname -s)
CONFIG_FILE?=config-files/config.yaml
ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
endif
ifeq ($(OS),Darwin)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_macos
endif
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
submodules:
git submodule update --init --recursive
@echo "Updated submodules"
deps: submodules build_all_ffi ## Install deps
go_deps:
@echo "Installing Go dependencies..."
go install github.com/maoueh/zap-pretty@latest
go install github.com/ethereum/go-ethereum/cmd/abigen@latest
go install github.com/Layr-Labs/eigenlayer-cli/cmd/eigenlayer@latest
install_foundry:
curl -L https://foundry.paradigm.xyz | bash
anvil_deploy_eigen_contracts:
@echo "Deploying Eigen Contracts..."
. contracts/scripts/anvil/deploy_eigen_contracts.sh
anvil_deploy_aligned_contracts:
@echo "Deploying Aligned Contracts..."
. contracts/scripts/anvil/deploy_aligned_contracts.sh
anvil_upgrade_aligned_contracts:
@echo "Upgrading Aligned Contracts..."
. contracts/scripts/anvil/upgrade_aligned_contracts.sh
anvil_upgrade_registry_coordinator:
@echo "Upgrading Registry Coordinator Contracts..."
. contracts/scripts/anvil/upgrade_registry_coordinator.sh
anvil_upgrade_bls_apk_registry:
@echo "Upgrading Bls Apk Registry Contract..."
. contracts/scripts/anvil/upgrade_bls_apk_registry.sh
anvil_upgrade_stake_registry:
@echo "Upgrading Stake Registry Contract..."
. contracts/scripts/anvil/upgrade_stake_registry.sh
anvil_upgrade_index_registry:
@echo "Upgrading Index Registry Contracts..."
. contracts/scripts/anvil/upgrade_index_registry.sh
anvil_start:
@echo "Starting Anvil..."
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json
anvil_start_with_block_time:
@echo "Starting Anvil..."
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 3
# TODO: Allow enviroment variables / different configuration files
aggregator_start:
@echo "Starting Aggregator..."
@go run aggregator/cmd/main.go --config $(CONFIG_FILE) \
2>&1 | zap-pretty
aggregator_send_dummy_responses:
@echo "Sending dummy responses to Aggregator..."
@cd aggregator && go run dummy/submit_task_responses.go
operator_start:
@echo "Starting Operator..."
go run operator/cmd/main.go start --config $(CONFIG_FILE) \
2>&1 | zap-pretty
operator_register_and_start: operator_full_registration operator_start
build_operator: deps
@echo "Building Operator..."
@go build -o ./operator/build/aligned-operator ./operator/cmd/main.go
@echo "Operator built into /operator/build/aligned-operator"
bindings:
cd contracts && ./generate-go-bindings.sh
test:
go test ./...
get_delegation_manager_address:
@sed -n 's/.*"delegationManager": "\([^"]*\)".*/\1/p' contracts/script/output/devnet/eigenlayer_deployment_output.json
operator_generate_keys:
@echo "Generating BLS keys"
eigenlayer operator keys create --key-type bls --insecure operator
@echo "Generating ECDSA keys"
eigenlayer operator keys create --key-type ecdsa --insecure operator
operator_generate_config:
@echo "Generating operator config"
eigenlayer operator config create
operator_get_eth:
@echo "Sending funds to operator address on devnet"
@. ./scripts/fund_operator_devnet.sh
operator_register_with_eigen_layer:
@echo "Registering operator with EigenLayer"
@echo "" | eigenlayer operator register $(CONFIG_FILE)
operator_mint_mock_tokens:
@echo "Minting tokens"
. ./scripts/mint_mock_token.sh $(CONFIG_FILE) 1000
operator_whitelist_devnet:
@echo "Whitelisting operator"
$(eval OPERATOR_ADDRESS = $(shell yq -r '.operator.address' $(CONFIG_FILE)))
@echo "Operator address: $(OPERATOR_ADDRESS)"
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)
operator_whitelist:
@echo "Whitelisting operator $(OPERATOR_ADDRESS)"
@. contracts/scripts/.env && . contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)
operator_deposit_into_mock_strategy:
@echo "Depositing into strategy"
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.MOCK' contracts/script/output/devnet/eigenlayer_deployment_output.json))
@go run operator/cmd/main.go deposit-into-strategy \
--config $(CONFIG_FILE) \
--strategy-address $(STRATEGY_ADDRESS) \
--amount 1000
operator_deposit_into_strategy:
@echo "Depositing into strategy"
@go run operator/cmd/main.go deposit-into-strategy \
--config $(CONFIG_FILE) \
--amount 1000
operator_register_with_aligned_layer:
@echo "Registering operator with AlignedLayer"
@go run operator/cmd/main.go register \
--config $(CONFIG_FILE)
operator_deposit_and_register: operator_deposit_into_strategy operator_register_with_aligned_layer
operator_full_registration: operator_get_eth operator_register_with_eigen_layer operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_whitelist_devnet operator_register_with_aligned_layer
operator_start_docker:
@echo "Starting Operator..."
@docker-compose -f operator/docker/compose.yaml up
__BATCHER__:
BURST_SIZE=5
./batcher/aligned-batcher/.env:
@echo "To start the Batcher ./batcher/aligned-batcher/.env needs to be manually set"; false;
batcher_start: ./batcher/aligned-batcher/.env
@echo "Starting Batcher..."
@cargo +nightly-2024-04-17 run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/config.yaml --env-file ./batcher/aligned-batcher/.env
install_batcher:
@cargo +nightly-2024-04-17 install --path batcher/aligned-batcher
install_aligned:
@./batcher/aligned/install_aligned.sh
uninstall_aligned:
@rm -rf ~/.aligned && echo "Aligned uninstalled"
install_aligned_compiling:
@cargo +nightly-2024-04-17 install --path batcher/aligned
build_batcher_client:
@cd batcher/aligned && cargo b --release
batcher/target/release/aligned:
@cd batcher/aligned && cargo b --release
batcher_send_sp1_task:
@echo "Sending SP1 fibonacci task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system SP1 \
--proof test_files/sp1/sp1_fibonacci.proof \
--vm_program test_files/sp1/sp1_fibonacci-elf \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_sp1_burst:
@echo "Sending SP1 fibonacci task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system SP1 \
--proof test_files/sp1/sp1_fibonacci.proof \
--vm_program test_files/sp1/sp1_fibonacci-elf \
--repetitions 15 \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_infinite_sp1:
@echo "Sending infinite SP1 fibonacci task to Batcher..."
@./batcher/aligned/send_infinite_sp1_tasks/send_infinite_sp1_tasks.sh
batcher_send_plonk_bn254_task: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system GnarkPlonkBn254 \
--proof test_files/plonk_bn254/plonk.proof \
--public_input test_files/plonk_bn254/plonk_pub_input.pub \
--vk test_files/plonk_bn254/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_plonk_bn254_burst: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system GnarkPlonkBn254 \
--proof test_files/plonk_bn254/plonk.proof \
--public_input test_files/plonk_bn254/plonk_pub_input.pub \
--vk test_files/plonk_bn254/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--repetitions 15
batcher_send_plonk_bls12_381_task: batcher/target/release/aligned
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system GnarkPlonkBls12_381 \
--proof test_files/plonk_bls12_381/plonk.proof \
--public_input test_files/plonk_bls12_381/plonk_pub_input.pub \
--vk test_files/plonk_bls12_381/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_plonk_bls12_381_burst: batcher/target/release/aligned
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system GnarkPlonkBls12_381 \
--proof test_files/plonk_bls12_381/plonk.proof \
--public_input test_files/plonk_bls12_381/plonk_pub_input.pub \
--vk test_files/plonk_bls12_381/plonk.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657 \
--repetitions 15
batcher_send_groth16_bn254_task: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Groth16Bn254 \
--proof test_files/groth16/ineq_1_groth16.proof \
--public_input test_files/groth16/ineq_1_groth16.pub \
--vk test_files/groth16/ineq_1_groth16.vk \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_groth16_burst: batcher/target/release/aligned
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Groth16Bn254 \
--proof test_files/groth16/ineq_1_groth16.proof \
--public_input test_files/groth16/ineq_1_groth16.pub \
--vk test_files/groth16/ineq_1_groth16.vk \
--repetitions 15 \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_infinite_groth16: batcher/target/release/aligned ## Send a different Groth16 BN254 proof using the task sender every 3 seconds
@mkdir -p task_sender/test_examples/gnark_groth16_bn254_infinite_script/infinite_proofs
@echo "Sending a different GROTH16 BN254 proof in a loop every n seconds..."
@./batcher/aligned/send_infinite_tasks.sh 4
batcher_send_burst_groth16: batcher/target/release/aligned
@echo "Sending a burst of tasks to Batcher..."
@mkdir -p task_sender/test_examples/gnark_groth16_bn254_infinite_script/infinite_proofs
@./batcher/aligned/send_burst_tasks.sh $(BURST_SIZE) $(START_COUNTER)
batcher_send_halo2_ipa_task: batcher/target/release/aligned
@echo "Sending Halo2 IPA 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Halo2IPA \
--proof test_files/halo2_ipa/proof.bin \
--public_input test_files/halo2_ipa/pub_input.bin \
--vk test_files/halo2_ipa/params.bin \
batcher_send_halo2_ipa_task_burst_5: batcher/target/release/aligned
@echo "Sending Halo2 IPA 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Halo2IPA \
--proof test_files/halo2_ipa/proof.bin \
--public_input test_files/halo2_ipa/pub_input.bin \
--vk test_files/halo2_ipa/params.bin \
--repetitions 5
batcher_send_halo2_kzg_task: batcher/target/release/aligned
@echo "Sending Halo2 KZG 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Halo2KZG \
--proof test_files/halo2_kzg/proof.bin \
--public_input test_files/halo2_kzg/pub_input.bin \
--vk test_files/halo2_kzg/params.bin \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
batcher_send_halo2_kzg_task_burst_5: batcher/target/release/aligned
@echo "Sending Halo2 KZG 1!=0 task to Batcher..."
@cd batcher/aligned/ && cargo run --release -- submit \
--proving_system Halo2KZG \
--proof test_files/halo2_kzg/proof.bin \
--public_input test_files/halo2_kzg/pub_input.bin \
--vk test_files/halo2_kzg/params.bin \
--repetitions 5 \
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
__TASK_SENDERS__:
# TODO add a default proving system
send_plonk_bls12_381_proof: ## Send a PLONK BLS12_381 proof using the task sender
@echo "Sending PLONK BLS12_381 proof..."
@go run task_sender/cmd/main.go send-task \
--proving-system plonk_bls12_381 \
--proof task_sender/test_examples/gnark_plonk_bls12_381_script/plonk.proof \
--public-input task_sender/test_examples/gnark_plonk_bls12_381_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_plonk_bls12_381_script/plonk.vk \
--config config-files/config.yaml \
--quorum-threshold 98 \
2>&1 | zap-pretty
send_plonk_bls12_381_proof_loop: ## Send a PLONK BLS12_381 proof using the task sender every 10 seconds
@echo "Sending PLONK BLS12_381 proof in a loop every 10 seconds..."
@go run task_sender/cmd/main.go loop-tasks \
--proving-system plonk_bls12_381 \
--proof task_sender/test_examples/gnark_plonk_bls12_381_script/plonk.proof \
--public-input task_sender/test_examples/gnark_plonk_bls12_381_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_plonk_bls12_381_script/plonk.vk \
--config config-files/config.yaml \
--interval 10 \
2>&1 | zap-pretty
generate_plonk_bls12_381_proof: ## Run the gnark_plonk_bls12_381_script
@echo "Running gnark_plonk_bls12_381 script..."
@go run task_sender/test_examples/gnark_plonk_bls12_381_script/main.go
send_plonk_bn254_proof: ## Send a PLONK BN254 proof using the task sender
@echo "Sending PLONK BN254 proof..."
@go run task_sender/cmd/main.go send-task \
--proving-system plonk_bn254 \
--proof task_sender/test_examples/gnark_plonk_bn254_script/plonk.proof \
--public-input task_sender/test_examples/gnark_plonk_bn254_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_plonk_bn254_script/plonk.vk \
--config config-files/config.yaml \
2>&1 | zap-pretty
send_plonk_bn254_proof_loop: ## Send a PLONK BN254 proof using the task sender every 10 seconds
@echo "Sending PLONK BN254 proof in a loop every 10 seconds..."
@go run task_sender/cmd/main.go loop-tasks \
--proving-system plonk_bn254 \
--proof task_sender/test_examples/gnark_plonk_bn254_script/plonk.proof \
--public-input task_sender/test_examples/gnark_plonk_bn254_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_plonk_bn254_script/plonk.vk \
--config config-files/config.yaml \
--interval 10 \
2>&1 | zap-pretty
generate_plonk_bn254_proof: ## Run the gnark_plonk_bn254_script
@echo "Running gnark_plonk_bn254 script..."
@go run task_sender/test_examples/gnark_plonk_bn254_script/main.go
send_groth16_bn254_proof: ## Send a Groth16 BN254 proof using the task sender
@echo "Sending GROTH16 BN254 proof..."
@go run task_sender/cmd/main.go send-task \
--proving-system groth16_bn254 \
--proof task_sender/test_examples/gnark_groth16_bn254_script/plonk.proof \
--public-input task_sender/test_examples/gnark_groth16_bn254_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_groth16_bn254_script/plonk.vk \
--config config-files/config.yaml \
--quorum-threshold 98 \
2>&1 | zap-pretty
send_groth16_bn254_proof_loop: ## Send a Groth16 BN254 proof using the task sender every 10 seconds
@echo "Sending GROTH16 BN254 proof in a loop every 10 seconds..."
@go run task_sender/cmd/main.go loop-tasks \
--proving-system groth16_bn254 \
--proof task_sender/test_examples/gnark_groth16_bn254_script/plonk.proof \
--public-input task_sender/test_examples/gnark_groth16_bn254_script/plonk_pub_input.pub \
--verification-key task_sender/test_examples/gnark_groth16_bn254_script/plonk.vk \
--config config-files/config.yaml \
--interval 10 \
2>&1 | zap-pretty
send_infinite_groth16_bn254_proof: ## Send a different Groth16 BN254 proof using the task sender every 3 seconds
@echo "Sending a different GROTH16 BN254 proof in a loop every 3 seconds..."
@go run task_sender/cmd/main.go infinite-tasks \
--proving-system groth16_bn254 \
--config config-files/config.yaml \
--interval 3 \
2>&1 | zap-pretty
generate_groth16_proof: ## Run the gnark_plonk_bn254_script
@echo "Running gnark_groth_bn254 script..."
@go run task_sender/test_examples/gnark_groth16_bn254_script/main.go
generate_groth16_ineq_proof: ## Run the gnark_plonk_bn254_script
@echo "Running gnark_groth_bn254_ineq script..."
@go run task_sender/test_examples/gnark_groth16_bn254_infinite_script/main.go 1
send_sp1_proof:
@go run task_sender/cmd/main.go send-task \
--proving-system sp1 \
--proof task_sender/test_examples/sp1/sp1_fibonacci.proof \
--public-input task_sender/test_examples/sp1/elf/riscv32im-succinct-zkvm-elf \
--config config-files/config.yaml \
2>&1 | zap-pretty
send_halo2_ipa_proof: ## Send a Halo2 IPA proof using the task sender
@echo "Sending Halo2 IPA proof..."
@go run task_sender/cmd/main.go send-task \
--proving-system halo2_ipa \
--proof task_sender/test_examples/halo2_ipa/proof.bin \
--public-input task_sender/test_examples/halo2_ipa/pub_input.bin \
--verification-key task_sender/test_examples/halo2_ipa/params.bin \
--config config-files/config.yaml \
2>&1 | zap-pretty
send_halo2_ipa_proof_loop: ## Send a Halo2 IPA proof using the task sender every 10 seconds
@echo "Sending Halo2 IPA proof in a loop every 10 seconds..."
@go run task_sender/cmd/main.go loop-tasks \
--proving-system halo2_ipa \
--proof task_sender/test_examples/halo2_ipa/proof.bin \
--public-input task_sender/test_examples/halo2_ipa/pub_input.bin \
--verification-key task_sender/test_examples/halo2_ipa/params.bin \
--config config-files/config.yaml \
--interval 10 \
2>&1 | zap-pretty
send_halo2_kzg_proof: ## Send a Halo2 KZG proof using the task sender
@echo "Sending Halo2 KZG proof..."
@go run task_sender/cmd/main.go send-task \
--proving-system halo2_kzg \
--proof task_sender/test_examples/halo2_kzg/proof.bin \
--public-input task_sender/test_examples/halo2_kzg/pub_input.bin \
--verification-key task_sender/test_examples/halo2_kzg/params.bin \
--config config-files/config.yaml \
2>&1 | zap-pretty
send_halo2_kzg_proof_loop: ## Send a Halo2 KZG proof using the task sender every 10 seconds
@echo "Sending Halo2 KZG proof in a loop every 10 seconds..."
@go run task_sender/cmd/main.go loop-tasks \
--proving-system halo2_kzg \
--proof task_sender/test_examples/halo2_kzg/proof.bin \
--public-input task_sender/test_examples/halo2_kzg/pub_input.bin \
--verification-key task_sender/test_examples/halo2_kzg/params.bin \
--config config-files/config.yaml \
--interval 10 \
2>&1 | zap-pretty
__METRICS__:
run_metrics: ## Run metrics using metrics-docker-compose.yaml
@echo "Running metrics..."
@docker-compose -f metrics-docker-compose.yaml up
__DEPLOYMENT__:
deploy_aligned_contracts: ## Deploy Aligned Contracts
@echo "Deploying Aligned Contracts..."
@. contracts/scripts/.env && . contracts/scripts/deploy_aligned_contracts.sh
upgrade_aligned_contracts: ## Upgrade Aligned Contracts
@echo "Upgrading Aligned Contracts..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_aligned_contracts.sh
upgrade_registry_coordinator: ## Upgrade Registry Coordinator
@echo "Upgrading Registry Coordinator..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_registry_coordinator.sh
upgrade_bls_apk_registry: ## Upgrade Registry Coordinator
@echo "Upgrading BLS Apk Registry Coordinator..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_bls_apk_registry.sh
upgrade_index_registry: ## Upgrade Registry Coordinator
@echo "Upgrading Index Registry..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_index_registry.sh
upgrade_stake_registry: ## Upgrade Stake Registry
@echo "Upgrading Stake Registry..."
@. contracts/scripts/.env && . contracts/scripts/upgrade_stake_registry.sh
deploy_verify_batch_inclusion_caller:
@echo "Deploying VerifyBatchInclusionCaller contract..."
@. contracts/scripts/.env && . ./contracts/scripts/deploy_verify_batch_inclusion_caller.sh
build_aligned_contracts:
@cd contracts/src/core && forge build
__BUILD__:
build_binaries:
@echo "Building aggregator..."
@go build -o ./aggregator/build/aligned-aggregator ./aggregator/cmd/main.go
@echo "Aggregator built into /aggregator/build/aligned-aggregator"
@echo "Building aligned layer operator..."
@go build -o ./operator/build/aligned-operator ./operator/cmd/main.go
@echo "Aligned layer operator built into /operator/build/aligned-operator"
@echo "Building task sender.."
@go build -o ./task_sender/build/aligned-task-sender ./task_sender/cmd/main.go
@echo "Task sender built into /task_sender/build/aligned-task-sender"
__SP1_FFI__: ##
build_sp1_macos:
@cd operator/sp1/lib && cargo build --release
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.dylib operator/sp1/lib/libsp1_verifier.dylib
build_sp1_linux:
@cd operator/sp1/lib && cargo build --release
@cp operator/sp1/lib/target/release/libsp1_verifier_ffi.so operator/sp1/lib/libsp1_verifier.so
test_sp1_rust_ffi:
@echo "Testing SP1 Rust FFI source code..."
@cd operator/sp1/lib && RUST_MIN_STACK=83886080 cargo t --release
test_sp1_go_bindings_macos: build_sp1_macos
@echo "Testing SP1 Go bindings..."
go test ./operator/sp1/... -v
test_sp1_go_bindings_linux: build_sp1_linux
@echo "Testing SP1 Go bindings..."
go test ./operator/sp1/... -v
# @cp -r task_sender/test_examples/sp1/fibonacci_proof_generator/script/elf task_sender/test_examples/sp1/
generate_sp1_fibonacci_proof:
@cd task_sender/test_examples/sp1/fibonacci_proof_generator/script && RUST_LOG=info cargo run --release
@mv task_sender/test_examples/sp1/fibonacci_proof_generator/program/elf/riscv32im-succinct-zkvm-elf task_sender/test_examples/sp1/elf
@mv task_sender/test_examples/sp1/fibonacci_proof_generator/script/sp1_fibonacci.proof task_sender/test_examples/sp1/
@echo "Fibonacci proof and ELF generated in task_sender/test_examples/sp1 folder"
__RISC_ZERO_FFI__: ##
build_risc_zero_macos:
@cd operator/risc_zero/lib && cargo build --release
@cp operator/risc_zero/lib/target/release/librisc_zero_verifier_ffi.dylib operator/risc_zero/lib/librisc_zero_verifier_ffi.dylib
@cp operator/risc_zero/lib/target/release/librisc_zero_verifier_ffi.a operator/risc_zero/lib/librisc_zero_verifier_ffi.a
build_risc_zero_linux:
@cd operator/risc_zero/lib && cargo build --release
@cp operator/risc_zero/lib/target/release/librisc_zero_verifier_ffi.so operator/risc_zero/lib/librisc_zero_verifier_ffi.so
@cp operator/risc_zero/lib/target/release/librisc_zero_verifier_ffi.a operator/risc_zero/lib/librisc_zero_verifier_ffi.a
test_risc_zero_rust_ffi:
@echo "Testing RISC Zero Rust FFI source code..."
@cd operator/risc_zero/lib && cargo test --release
test_risc_zero_go_bindings_macos: build_risc_zero_macos
@echo "Testing RISC Zero Go bindings..."
go test ./operator/risc_zero/... -v
test_risc_zero_go_bindings_linux: build_risc_zero_linux
@echo "Testing RISC Zero Go bindings..."
go test ./operator/risc_zero/... -v
generate_risc_zero_fibonacci_proof:
@cd task_sender/test_examples/risc_zero/fibonacci_proof_generator && \
cargo clean && \
rm -f risc_zero_fibonacci.proof && \
RUST_LOG=info cargo run --release && \
echo "Fibonacci proof generated in task_sender/test_examples/risc_zero folder" && \
echo "Fibonacci proof image ID generated in task_sender/test_examples/risc_zero folder"
__MERKLE_TREE_FFI__: ##
build_merkle_tree_macos:
@cd operator/merkle_tree/lib && cargo build --release
@cp operator/merkle_tree/lib/target/release/libmerkle_tree.dylib operator/merkle_tree/lib/libmerkle_tree.dylib
@cp operator/merkle_tree/lib/target/release/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a
build_merkle_tree_linux:
@cd operator/merkle_tree/lib && cargo build --release
@cp operator/merkle_tree/lib/target/release/libmerkle_tree.so operator/merkle_tree/lib/libmerkle_tree.so
@cp operator/merkle_tree/lib/target/release/libmerkle_tree.a operator/merkle_tree/lib/libmerkle_tree.a
test_merkle_tree_rust_ffi:
@echo "Testing Merkle Tree Rust FFI source code..."
@cd operator/merkle_tree/lib && RUST_MIN_STACK=83886080 cargo t --release
test_merkle_tree_go_bindings_macos: build_merkle_tree_macos
@echo "Testing Merkle Tree Go bindings..."
go test ./operator/merkle_tree/... -v
test_merkle_tree_go_bindings_linux: build_merkle_tree_linux
@echo "Testing Merkle Tree Go bindings..."
go test ./operator/merkle_tree/... -v
__HALO2_KZG_FFI__: ##
build_halo2_kzg_macos:
@cd operator/halo2kzg/lib && cargo build --release
@cp operator/halo2kzg/lib/target/release/libhalo2kzg_verifier_ffi.dylib operator/halo2kzg/lib/libhalo2kzg_verifier.dylib
@cp operator/halo2kzg/lib/target/release/libhalo2kzg_verifier_ffi.a operator/halo2kzg/lib/libhalo2kzg_verifier.a
build_halo2_kzg_linux:
@cd operator/halo2kzg/lib && cargo build --release
@cp operator/halo2kzg/lib/target/release/libhalo2kzg_verifier_ffi.so operator/halo2kzg/lib/libhalo2kzg_verifier.so
@cp operator/halo2kzg/lib/target/release/libhalo2kzg_verifier_ffi.a operator/halo2kzg/lib/libhalo2kzg_verifier.a
test_halo2_kzg_rust_ffi:
@echo "Testing Halo2-KZG Rust FFI source code..."
@cd operator/halo2kzg/lib && cargo t --release
test_halo2_kzg_go_bindings_macos: build_halo2_kzg_macos
@echo "Testing Halo2-KZG Go bindings..."
go test ./operator/halo2kzg/... -v
test_halo2_kzg_go_bindings_linux: build_halo2_kzg_linux
@echo "Testing Halo2-KZG Go bindings..."
go test ./operator/halo2kzg/... -v
generate_halo2_kzg_proof:
@cd task_sender/test_examples/halo2_kzg && \
cargo clean && \
rm params.bin proof.bin pub_input.bin && \
RUST_LOG=info cargo run --release && \
echo "Generating halo2 plonk proof..." && \
echo "Generated halo2 plonk proof!"
__HALO2_IPA_FFI__: ##
build_halo2_ipa_macos:
@cd operator/halo2ipa/lib && cargo build --release
@cp operator/halo2ipa/lib/target/release/libhalo2ipa_verifier_ffi.dylib operator/halo2ipa/lib/libhalo2ipa_verifier.dylib
@cp operator/halo2ipa/lib/target/release/libhalo2ipa_verifier_ffi.a operator/halo2ipa/lib/libhalo2ipa_verifier.a
build_halo2_ipa_linux:
@cd operator/halo2ipa/lib && cargo build --release
@cp operator/halo2ipa/lib/target/release/libhalo2ipa_verifier_ffi.so operator/halo2ipa/lib/libhalo2ipa_verifier.so
@cp operator/halo2ipa/lib/target/release/libhalo2ipa_verifier_ffi.a operator/halo2ipa/lib/libhalo2ipa_verifier.a
test_halo2_ipa_rust_ffi:
@echo "Testing Halo2-KZG Rust FFI source code..."
@cd operator/halo2ipa/lib && cargo t --release
test_halo2_ipa_go_bindings_macos: build_halo2_ipa_macos
@echo "Testing Halo2-KZG Go bindings..."
go test ./operator/halo2ipa/... -v
test_halo2_ipa_go_bindings_linux: build_halo2_ipa_linux
@echo "Testing Halo2-KZG Go bindings..."
go test ./operator/halo2ipa/... -v
generate_halo2_ipa_proof:
@cd task_sender/test_examples/halo2_ipa && \
cargo clean && \
rm params.bin proof.bin pub_input.bin && \
RUST_LOG=info cargo run --release && \
echo "Generating halo2 plonk proof..." && \
echo "Generated halo2 plonk proof!"
__BUILD_ALL_FFI__:
build_all_ffi: ## Build all FFIs
$(BUILD_ALL_FFI)
@echo "Created FFIs"
build_all_ffi_macos: ## Build all FFIs for macOS
@echo "Building all FFIs for macOS..."
@$(MAKE) build_sp1_macos
# @$(MAKE) build_risc_zero_macos
# @$(MAKE) build_merkle_tree_macos
@$(MAKE) build_halo2_ipa_macos
@$(MAKE) build_halo2_kzg_macos
@echo "All macOS FFIs built successfully."
build_all_ffi_linux: ## Build all FFIs for Linux
@echo "Building all FFIs for Linux..."
@$(MAKE) build_sp1_linux
# @$(MAKE) build_risc_zero_linux
# @$(MAKE) build_merkle_tree_linux
@$(MAKE) build_halo2_ipa_linux
@$(MAKE) build_halo2_kzg_linux
@echo "All Linux FFIs built successfully."
__EXPLORER__:
run_devnet_explorer: run_db ecto_setup_db
@cd explorer/ && \
mix setup && \
cp .env.dev .env && \
./start.sh
run_explorer: run_db ecto_setup_db
@cd explorer/ && \
mix setup && \
./start.sh
build_db:
@cd explorer && \
docker build -t explorer-postgres-image .
run_db: remove_db_container
@cd explorer && \
docker run -d --name explorer-postgres-container -p 5432:5432 -v explorer-postgres-data:/var/lib/postgresql/data explorer-postgres-image
ecto_setup_db:
@cd explorer/ && \
./ecto_setup_db.sh
remove_db_container:
@cd explorer && \
docker stop explorer-postgres-container || true && \
docker rm explorer-postgres-container || true
clean_db: remove_db_container
@cd explorer && \
docker volume rm explorer-postgres-data || true
dump_db:
@cd explorer && \
docker exec -t explorer-postgres-container pg_dumpall -c -U explorer_user > dump.$$(date +\%Y\%m\%d_\%H\%M\%S).sql
@echo "Dumped database successfully to /explorer"
recover_db: run_db
@read -p $$'\e[32mEnter the dump file to recover (e.g., dump.20230607_123456.sql): \e[0m' DUMP_FILE && \
cd explorer && \
docker cp $$DUMP_FILE explorer-postgres-container:/dump.sql && \
docker exec -t explorer-postgres-container psql -U explorer_user -d explorer_db -f /dump.sql && \
echo "Recovered database successfully from $$DUMP_FILE"
explorer_fetch_old_batches:
@cd explorer && \
./scripts/fetch_old_batches.sh 1600000 1716277