Skip to content

Commit 75297ce

Browse files
klaus993entropidelicsamoht9277
authored
feat(CI): Docker compose for all components (#1044)
Co-authored-by: Mariano Nicolini <[email protected]> Co-authored-by: samoht9277 <[email protected]>
1 parent 192a535 commit 75297ce

18 files changed

+830
-21
lines changed

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
docker/*
2+
**/.DS_Store
3+
**/.idea
4+
out
5+
cache
6+
**/build
7+
**/target
8+
**/aligned_verification_data
9+
**/broadcast
10+
volume
11+
nonce_*.bin
12+
docker-compose.yaml
13+
.github/**
14+
**.md
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "[CI] Send proofs to network"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
paths-ignore:
9+
- '**.md'
10+
11+
concurrency:
12+
group: pull_request-${{ github.event.pull_request.number }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
network-test-docker-compose:
17+
name: "Test network with Docker Compose"
18+
runs-on: aligned-runner-ci
19+
permissions:
20+
contents: read
21+
packages: write
22+
pull-requests: write
23+
24+
steps:
25+
- name: Log in to GitHub Container Registry
26+
uses: docker/login-action@v2
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
submodules: recursive
36+
37+
- name: Build containers
38+
run: make docker_build
39+
40+
- name: Start containers and initialize network
41+
run: make docker_up && sleep 15
42+
43+
- name: Send proofs batches
44+
run: make docker_batcher_send_all_proofs_burst
45+
46+
- name: Verify all sent proofs
47+
run: make docker_verify_proof_submission_success
48+
49+
- name: Stop containers
50+
continue-on-error: true
51+
if: always()
52+
run: make docker_down
53+
54+
- name: Ensure admin permissions in _work
55+
if: always()
56+
run: sudo chown admin:admin -R /home/admin/actions-runner/_work/

Makefile

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,224 @@ tracker_dump_db:
698698
docker exec -t tracker-postgres-container pg_dumpall -c -U tracker_user > dump.$$(date +\%Y\%m\%d_\%H\%M\%S).sql
699699
@echo "Dumped database successfully to /operator_tracker"
700700

701+
DOCKER_RPC_URL=http://anvil:8545
702+
PROOF_GENERATOR_ADDRESS=0x66f9664f97F2b50F62D13eA064982f936dE76657
703+
704+
docker_build_base_image:
705+
docker compose -f docker-compose.yaml --profile aligned_base build
706+
707+
docker_build_aggregator:
708+
docker compose -f docker-compose.yaml --profile aggregator build
709+
710+
docker_build_operator:
711+
docker compose -f docker-compose.yaml --profile operator build
712+
713+
docker_build_batcher:
714+
docker compose -f docker-compose.yaml --profile batcher build
715+
716+
docker_restart_aggregator:
717+
docker compose -f docker-compose.yaml --profile aggregator down
718+
docker compose -f docker-compose.yaml --profile aggregator up -d --remove-orphans --force-recreate
719+
720+
docker_restart_operator:
721+
docker compose -f docker-compose.yaml --profile operator down
722+
docker compose -f docker-compose.yaml --profile operator up -d --remove-orphans --force-recreate
723+
724+
docker_restart_batcher:
725+
docker compose -f docker-compose.yaml --profile batcher down
726+
docker compose -f docker-compose.yaml --profile batcher up -d --remove-orphans --force-recreate
727+
728+
docker_build:
729+
docker compose -f docker-compose.yaml --profile aligned_base build
730+
docker compose -f docker-compose.yaml --profile eigenlayer-cli build
731+
docker compose -f docker-compose.yaml --profile foundry build
732+
docker compose -f docker-compose.yaml --profile base build
733+
docker compose -f docker-compose.yaml --profile operator build
734+
docker compose -f docker-compose.yaml --profile batcher build
735+
docker compose -f docker-compose.yaml --profile aggregator build
736+
737+
docker_up:
738+
docker compose -f docker-compose.yaml --profile base up -d --remove-orphans --force-recreate
739+
@until [ "$$(docker inspect $$(docker ps | grep anvil | awk '{print $$1}') | jq -r '.[0].State.Health.Status')" = "healthy" ]; do sleep .5; done; sleep 2
740+
docker compose -f docker-compose.yaml --profile aggregator up -d --remove-orphans --force-recreate
741+
docker compose -f docker-compose.yaml run --rm fund-operator
742+
docker compose -f docker-compose.yaml run --rm register-operator-eigenlayer
743+
docker compose -f docker-compose.yaml run --rm mint-mock-tokens
744+
docker compose -f docker-compose.yaml run --rm operator-deposit-into-mock-strategy
745+
docker compose -f docker-compose.yaml run --rm operator-whitelist-devnet
746+
docker compose -f docker-compose.yaml run --rm operator-register-with-aligned-layer
747+
docker compose -f docker-compose.yaml --profile operator up -d --remove-orphans --force-recreate
748+
docker compose -f docker-compose.yaml run --rm user-fund-payment-service-devnet
749+
docker compose -f docker-compose.yaml --profile batcher up -d --remove-orphans --force-recreate
750+
@echo "Up and running"
751+
752+
docker_down:
753+
docker compose -f docker-compose.yaml --profile batcher down
754+
docker compose -f docker-compose.yaml --profile operator down
755+
docker compose -f docker-compose.yaml --profile base down
756+
@echo "Everything down"
757+
docker ps
758+
759+
DOCKER_BURST_SIZE=2
760+
DOCKER_PROOFS_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
761+
762+
docker_batcher_send_sp1_burst:
763+
@echo "Sending SP1 fibonacci task to Batcher..."
764+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
765+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
766+
--proving_system SP1 \
767+
--proof ./scripts/test_files/sp1/sp1_fibonacci.proof \
768+
--vm_program ./scripts/test_files/sp1/sp1_fibonacci.elf \
769+
--repetitions $(DOCKER_BURST_SIZE) \
770+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
771+
--rpc_url $(DOCKER_RPC_URL)
772+
773+
docker_batcher_send_risc0_burst:
774+
@echo "Sending Risc0 fibonacci task to Batcher..."
775+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
776+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
777+
--proving_system Risc0 \
778+
--proof ./scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.proof \
779+
--vm_program ./scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id.bin \
780+
--public_input ./scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci.pub \
781+
--repetitions $(DOCKER_BURST_SIZE) \
782+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
783+
--rpc_url $(DOCKER_RPC_URL)
784+
785+
docker_batcher_send_plonk_bn254_burst:
786+
@echo "Sending Groth16Bn254 1!=0 task to Batcher..."
787+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
788+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
789+
--proving_system GnarkPlonkBn254 \
790+
--proof ./scripts/test_files/gnark_plonk_bn254_script/plonk.proof \
791+
--public_input ./scripts/test_files/gnark_plonk_bn254_script/plonk_pub_input.pub \
792+
--vk ./scripts/test_files/gnark_plonk_bn254_script/plonk.vk \
793+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
794+
--rpc_url $(DOCKER_RPC_URL) \
795+
--repetitions $(DOCKER_BURST_SIZE)
796+
797+
docker_batcher_send_plonk_bls12_381_burst:
798+
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
799+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
800+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
801+
--proving_system GnarkPlonkBls12_381 \
802+
--proof ./scripts/test_files/gnark_plonk_bls12_381_script/plonk.proof \
803+
--public_input ./scripts/test_files/gnark_plonk_bls12_381_script/plonk_pub_input.pub \
804+
--vk ./scripts/test_files/gnark_plonk_bls12_381_script/plonk.vk \
805+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
806+
--repetitions $(DOCKER_BURST_SIZE) \
807+
--rpc_url $(DOCKER_RPC_URL)
808+
809+
docker_batcher_send_groth16_burst:
810+
@echo "Sending Groth16 BLS12-381 1!=0 task to Batcher..."
811+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') aligned submit \
812+
--private_key $(DOCKER_PROOFS_PRIVATE_KEY) \
813+
--proving_system Groth16Bn254 \
814+
--proof ./scripts/test_files/gnark_groth16_bn254_script/groth16.proof \
815+
--public_input ./scripts/test_files/gnark_groth16_bn254_script/plonk_pub_input.pub \
816+
--vk ./scripts/test_files/gnark_groth16_bn254_script/groth16.vk \
817+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS) \
818+
--repetitions $(DOCKER_BURST_SIZE) \
819+
--rpc_url $(DOCKER_RPC_URL)
820+
821+
# Update target as new proofs are supported.
822+
docker_batcher_send_all_proofs_burst:
823+
@$(MAKE) docker_batcher_send_sp1_burst
824+
@$(MAKE) docker_batcher_send_risc0_burst
825+
@$(MAKE) docker_batcher_send_plonk_bn254_burst
826+
@$(MAKE) docker_batcher_send_plonk_bls12_381_burst
827+
@$(MAKE) docker_batcher_send_groth16_burst
828+
829+
docker_batcher_send_infinite_groth16:
830+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') \
831+
sh -c ' \
832+
mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs; \
833+
counter=1; \
834+
timer=3; \
835+
while true; do \
836+
echo "Generating proof $${counter} != 0"; \
837+
gnark_groth16_bn254_infinite_script $${counter}; \
838+
aligned submit \
839+
--rpc_url $(DOCKER_RPC_URL) \
840+
--repetitions $(DOCKER_BURST_SIZE) \
841+
--proving_system Groth16Bn254 \
842+
--proof scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_$${counter}_groth16.proof \
843+
--public_input scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_$${counter}_groth16.pub \
844+
--vk scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_$${counter}_groth16.vk \
845+
--proof_generator_addr $(PROOF_GENERATOR_ADDRESS); \
846+
sleep $${timer}; \
847+
counter=$$((counter + 1)); \
848+
done \
849+
'
850+
851+
docker_verify_proofs_onchain:
852+
@echo "Verifying proofs..."
853+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') \
854+
sh -c ' \
855+
for proof in ./aligned_verification_data/*.cbor; do \
856+
echo "Verifying $${proof}"; \
857+
aligned verify-proof-onchain \
858+
--aligned-verification-data $${proof} \
859+
--rpc_url $(DOCKER_RPC_URL); \
860+
done \
861+
'
862+
863+
DOCKER_PROOFS_WAIT_TIME=30
864+
865+
docker_verify_proof_submission_success:
866+
@echo "Verifying proofs were successfully submitted..."
867+
docker exec $(shell docker ps | grep batcher | awk '{print $$1}') \
868+
sh -c ' \
869+
if [ -z "$$(ls -A ./aligned_verification_data)" ]; then echo "ERROR: There are no proofs on aligned_verification_data/ directory" && exit 1; fi; \
870+
echo "Waiting $(DOCKER_PROOFS_WAIT_TIME) seconds before starting proof verification. \n"; \
871+
sleep $(DOCKER_PROOFS_WAIT_TIME); \
872+
for proof in ./aligned_verification_data/*.cbor; do \
873+
echo "Verifying proof $${proof} \n"; \
874+
verification=$$(aligned verify-proof-onchain \
875+
--aligned-verification-data $${proof} \
876+
--rpc_url $$(echo $(DOCKER_RPC_URL)) 2>&1); \
877+
if echo "$$verification" | grep -q not; then \
878+
echo "ERROR: Proof verification failed for $${proof}"; \
879+
exit 1; \
880+
elif echo "$$verification" | grep -q verified; then \
881+
echo "Proof verification succeeded for $${proof}"; \
882+
fi; \
883+
echo "---------------------------------------------------------------------------------------------------"; \
884+
done; \
885+
if [ $$(ls -1 ./aligned_verification_data/*.cbor | wc -l) -ne 10 ]; then \
886+
echo "ERROR: Some proofs were verified successfully, but some proofs are missing in the aligned_verification_data/ directory"; \
887+
exit 1; \
888+
fi; \
889+
echo "All proofs verified successfully!"; \
890+
'
891+
892+
docker_attach_foundry:
893+
docker exec -ti $(shell docker ps | grep anvil | awk '{print $$1}') /bin/bash
894+
895+
docker_attach_anvil:
896+
docker exec -ti $(shell docker ps | grep anvil | awk '{print $$1}') /bin/bash
897+
898+
docker_attach_aggregator:
899+
docker exec -ti $(shell docker ps | grep aggregator | awk '{print $$1}') /bin/bash
900+
901+
docker_attach_operator:
902+
docker exec -ti $(shell docker ps | grep operator | awk '{print $$1}') /bin/bash
903+
904+
docker_attach_batcher:
905+
docker exec -ti $(shell docker ps | grep batcher | awk '{print $$1}') /bin/bash
906+
907+
docker_logs_anvil:
908+
docker compose -f docker-compose.yaml logs anvil -f
909+
910+
docker_logs_aggregator:
911+
docker compose -f docker-compose.yaml logs aggregator -f
912+
913+
docker_logs_operator:
914+
docker compose -f docker-compose.yaml logs operator -f
915+
916+
docker_logs_batcher:
917+
docker compose -f docker-compose.yaml logs batcher -f
918+
701919
__TELEMETRY__:
702920
# Collector, Jaeger and Elixir API
703921
telemetry_full_start: open_telemetry_start telemetry_start

anvil.Dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
AWS_SECRET_ACCESS_KEY=test
2+
AWS_REGION=us-east-2
3+
AWS_ACCESS_KEY_ID=test
4+
AWS_BUCKET_NAME=aligned.storage
5+
UPLOAD_ENDPOINT=http://localstack:4566
6+
DOWNLOAD_ENDPOINT=http://localstack:4566/aligned.storage
7+
RUST_LOG=info
8+
RUST_BACKTRACE=1

compose.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: "production"
4+
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5+
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6+
eth_rpc_url: "http://anvil:8545"
7+
eth_rpc_url_fallback: "http://anvil:8545"
8+
eth_ws_url: "ws://anvil:8545"
9+
eth_ws_url_fallback: "ws://anvil:8545"
10+
eigen_metrics_ip_port_address: "localhost:9090"
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: "config-files/anvil.aggregator.ecdsa.key.json"
15+
private_key_store_password: ""
16+
17+
## BLS Configurations
18+
bls:
19+
private_key_store_path: "config-files/anvil.aggregator.bls.key.json"
20+
private_key_store_password: ""
21+
22+
## Aggregator Configurations
23+
aggregator:
24+
server_ip_port_address: 0.0.0.0:8090
25+
bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44
26+
avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690
27+
enable_metrics: true
28+
metrics_ip_port_address: 0.0.0.0:9091
29+
telemetry_ip_port_address: localhost:4001
30+
garbage_collector_period: 2m #The period of the GC process. Suggested value for Prod: '168h' (7 days)
31+
garbage_collector_tasks_age: 20 #The age of tasks that will be removed by the GC, in blocks. Suggested value for prod: '216000' (30 days)
32+
garbage_collector_tasks_interval: 10 #The interval of queried blocks to get an old batch. Suggested value for prod: '900' (3 hours)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Common variables for all the services
2+
# 'production' only prints info and above. 'development' also prints debug
3+
environment: "production"
4+
aligned_layer_deployment_config_file_path: "./contracts/script/output/devnet/alignedlayer_deployment_output.json"
5+
eigen_layer_deployment_config_file_path: "./contracts/script/output/devnet/eigenlayer_deployment_output.json"
6+
eth_rpc_url: "http://anvil:8545"
7+
eth_rpc_url_fallback: "http://anvil:8545"
8+
eth_ws_url: "ws://anvil:8545"
9+
eth_ws_url_fallback: "ws://anvil:8545"
10+
eigen_metrics_ip_port_address: "localhost:9090"
11+
12+
## ECDSA Configurations
13+
ecdsa:
14+
private_key_store_path: "config-files/anvil.batcher.ecdsa.key.json"
15+
private_key_store_password: ""
16+
17+
## Batcher configurations
18+
batcher:
19+
block_interval: 3
20+
batch_size_interval: 10
21+
max_proof_size: 67108864 # 64 MiB
22+
max_batch_size: 268435456 # 256 MiB
23+
eth_ws_reconnects: 99999999999999
24+
pre_verification_is_enabled: true
25+
metrics_port: 9093
26+
non_paying:
27+
address: 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 # Anvil address 9
28+
replacement_private_key: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # Anvil address 1

0 commit comments

Comments
 (0)