Skip to content

Commit 5019745

Browse files
committed
Merge branch 'refs/heads/staging' into feat/bump-gnark-version-to-0-12
# Conflicts: # docs/2_architecture/0_supported_verifiers.md
2 parents 27676e7 + deecb46 commit 5019745

212 files changed

Lines changed: 29384 additions & 4345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-and-test-rust.yml

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
branches: ["*"]
88
paths:
99
- "batcher/**"
10-
- ".github/workflows/build-rust.yml"
10+
- "aggregation_mode/**"
11+
- ".github/workflows/build-and-test-rust.yml"
1112

1213
jobs:
1314
build:
@@ -19,9 +20,23 @@ jobs:
1920
- name: Set up Rust
2021
uses: actions-rs/toolchain@v1
2122
with:
22-
toolchain: stable
23+
toolchain: 1.86.0
2324
components: rustfmt, clippy
2425
override: true
26+
27+
# Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
28+
- name: Install sp1 toolchain
29+
run: |
30+
curl -L https://sp1.succinct.xyz | bash
31+
source /home/runner/.bashrc
32+
~/.sp1/bin/sp1up
33+
34+
- name: Install risc0 toolchain
35+
run: |
36+
curl -L https://risczero.com/install | bash
37+
source ~/.bashrc
38+
~/.risc0/bin/rzup install
39+
2540
- name: Cache Rust dependencies
2641
uses: actions/cache@v3
2742
with:
@@ -32,27 +47,61 @@ jobs:
3247
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
3348
restore-keys: |
3449
${{ runner.os }}-rust-
35-
- name: Check formatting of Rust projects
50+
51+
- name: Check formatting of Batcher
3652
run: |
3753
cd batcher
3854
cargo fmt --all -- --check
39-
- name: Run Clippy
55+
56+
- name: Run Clippy on Batcher
4057
run: |
4158
cd batcher
4259
cargo clippy --all -- -D warnings
43-
- name: Build Rust projects
60+
61+
- name: Build Batcher
4462
run: |
4563
cd batcher
4664
cargo build --all
4765
66+
- name: Check formatting of AggregationMode
67+
run: |
68+
cd aggregation_mode
69+
cargo fmt --all -- --check
70+
71+
- name: Build AggregationMode # We build before clippy to generate the ELF
72+
run: |
73+
cd aggregation_mode
74+
cargo build --all
75+
76+
- name: Run Clippy on AggregationMode
77+
run: |
78+
cd aggregation_mode
79+
# We need to skip the build as clippy does not support the riscv32im-risc0-zkvm-elf target
80+
RISC0_SKIP_BUILD=1 cargo clippy --all -- -D warnings
81+
4882
test:
4983
runs-on: aligned-runner
5084
needs: build
5185
steps:
5286
- name: Checkout code
5387
uses: actions/checkout@v4
88+
5489
- name: foundry-toolchain
5590
uses: foundry-rs/foundry-toolchain@v1.2.0
91+
92+
# Reference: https://github.com/succinctlabs/sp1/actions/runs/8886659400/workflow#L61-L65
93+
- name: Install sp1 toolchain
94+
run: |
95+
curl -L https://sp1.succinct.xyz | bash
96+
source /home/runner/.bashrc
97+
~/.sp1/bin/sp1up
98+
99+
- name: Install risc0 toolchain
100+
run: |
101+
curl -L https://risczero.com/install | bash
102+
source ~/.bashrc
103+
~/.risc0/bin/rzup install
104+
56105
- name: Cache Rust dependencies
57106
uses: actions/cache@v3
58107
with:
@@ -63,7 +112,13 @@ jobs:
63112
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
64113
restore-keys: |
65114
${{ runner.os }}-rust-
66-
- name: Run tests
115+
116+
- name: Run Batcher tests
67117
run: |
68118
cd batcher
69119
cargo test --all
120+
121+
- name: Run AggregationMode tests
122+
run: |
123+
cd aggregation_mode
124+
cargo test --all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ batcher/aligned/batch_inclusion_responses/*
1212
**/broadcast
1313
volume
1414
config-files/*.last_processed_batch.json
15+
config-files/*.last_aggregated_block.json
1516

1617
nonce_*.bin
1718

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,12 @@
3131
[submodule "claim_contracts/lib/openzeppelin-contracts"]
3232
path = claim_contracts/lib/openzeppelin-contracts
3333
url = https://github.com/OpenZeppelin/openzeppelin-contracts
34+
[submodule "contracts/lib/sp1-contracts"]
35+
path = contracts/lib/sp1-contracts
36+
url = https://github.com/succinctlabs/sp1-contracts
37+
[submodule "contracts/lib/risc0-ethereum"]
38+
path = contracts/lib/risc0-ethereum
39+
url = https://github.com/risc0/risc0-ethereum
40+
[submodule "contracts/eigenlayer_contracts/eigenlayer-contracts"]
41+
path = contracts/eigenlayer_contracts/eigenlayer-contracts
42+
url = https://github.com/Layr-Labs/eigenlayer-contracts.git

Makefile

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ CONFIG_FILE?=config-files/config.yaml
77
export OPERATOR_ADDRESS ?= $(shell yq -r '.operator.address' $(CONFIG_FILE))
88
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml
99

10-
OPERATOR_VERSION=v0.15.1
10+
OPERATOR_VERSION=v0.15.2
11+
EIGEN_SDK_GO_VERSION_DEVNET=v0.2.0-beta.1
1112
EIGEN_SDK_GO_VERSION_TESTNET=v0.2.0-beta.1
12-
EIGEN_SDK_GO_VERSION_MAINNET=v0.1.13
13+
EIGEN_SDK_GO_VERSION_MAINNET=v0.2.0-beta.1
1314

1415
ifeq ($(OS),Linux)
1516
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
@@ -71,10 +72,23 @@ go_deps:
7172
install_foundry:
7273
curl -L https://foundry.paradigm.xyz | bash
7374

75+
install_eigenlayer_cli_devnet: ## Install Eigenlayer CLI v0.11.3 (Devnet compatible)
76+
curl -sSfL https://raw.githubusercontent.com/layr-labs/eigenlayer-cli/master/scripts/install.sh | sh -s -- v0.13.0
77+
78+
anvil_deploy_all_contracts: anvil_deploy_eigen_contracts anvil_deploy_risc0_contracts anvil_deploy_sp1_contracts anvil_deploy_aligned_contracts
79+
7480
anvil_deploy_eigen_contracts:
7581
@echo "Deploying Eigen Contracts..."
7682
. contracts/scripts/anvil/deploy_eigen_contracts.sh
7783

84+
anvil_deploy_risc0_contracts:
85+
@echo "Deploying RISC0 Contracts..."
86+
. contracts/scripts/anvil/deploy_risc0_contracts.sh
87+
88+
anvil_deploy_sp1_contracts:
89+
@echo "Deploying SP1 Contracts..."
90+
. contracts/scripts/anvil/deploy_sp1_contracts.sh
91+
7892
anvil_deploy_aligned_contracts:
7993
@echo "Deploying Aligned Contracts..."
8094
. contracts/scripts/anvil/deploy_aligned_contracts.sh
@@ -146,6 +160,68 @@ anvil_start_with_more_prefunded_accounts:
146160
@echo "Starting Anvil..."
147161
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 7 -a 2000
148162

163+
__AGGREGATION_MODE__: ## ____
164+
165+
is_aggregator_set:
166+
@if [ -z "$(AGGREGATOR)" ]; then \
167+
echo "Error: AGGREGATOR is not set. Please provide arg AGGREGATOR='sp1' or 'risc0'."; \
168+
exit 1; \
169+
fi
170+
171+
reset_last_aggregated_block:
172+
@echo "Resetting last aggregated block..."
173+
@echo '{"last_aggregated_block":0}' > config-files/proof-aggregator.last_aggregated_block.json
174+
175+
start_proof_aggregator_dev: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with mock proofs (DEV mode)
176+
AGGREGATOR=$(AGGREGATOR) RISC0_DEV_MODE=1 cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --bin proof_aggregator -- config-files/config-proof-aggregator-mock.yaml
177+
178+
start_proof_aggregator: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving activated
179+
AGGREGATOR=$(AGGREGATOR) cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove --bin proof_aggregator -- config-files/config-proof-aggregator.yaml
180+
181+
start_proof_aggregator_dev_ethereum_package: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with mock proofs (DEV mode) in ethereum package
182+
AGGREGATOR=$(AGGREGATOR) RISC0_DEV_MODE=1 cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --bin proof_aggregator -- config-files/config-proof-aggregator-mock-ethereum-package.yaml
183+
184+
start_proof_aggregator_ethereum_package: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving activated in ethereum package
185+
AGGREGATOR=$(AGGREGATOR) cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove --bin proof_aggregator -- config-files/config-proof-aggregator-ethereum-package.yaml
186+
187+
start_proof_aggregator_gpu: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving + GPU acceleration (CUDA)
188+
AGGREGATOR=$(AGGREGATOR) SP1_PROVER=cuda cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove,gpu --bin proof_aggregator -- config-files/config-proof-aggregator.yaml
189+
190+
start_proof_aggregator_gpu_ethereum_package: is_aggregator_set reset_last_aggregated_block ## Starts proof aggregator with proving activated in ethereum package
191+
AGGREGATOR=$(AGGREGATOR) SP1_PROVER=cuda cargo run --manifest-path ./aggregation_mode/Cargo.toml --release --features prove,gpu --bin proof_aggregator -- config-files/config-proof-aggregator-ethereum-package.yaml
192+
193+
verify_aggregated_proof_sp1_holesky_stage:
194+
@echo "Verifying SP1 in aggregated proofs on holesky..."
195+
@cd batcher/aligned/ && \
196+
cargo run verify-agg-proof \
197+
--network holesky-stage \
198+
--from-block $(FROM_BLOCK) \
199+
--proving_system SP1 \
200+
--public_input ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.pub \
201+
--program-id-file ../../scripts/test_files/sp1/sp1_fibonacci_4_1_3.vk \
202+
--beacon_url $(BEACON_URL) \
203+
--rpc_url https://ethereum-holesky-rpc.publicnode.com
204+
205+
verify_aggregated_proof_risc0_holesky_stage:
206+
@echo "Verifying RISC0 in aggregated proofs on holesky..."
207+
@cd batcher/aligned/ && \
208+
cargo run verify-agg-proof \
209+
--network holesky-stage \
210+
--from-block $(FROM_BLOCK) \
211+
--proving_system Risc0 \
212+
--program-id-file ../../scripts/test_files/risc_zero/fibonacci_proof_generator/fibonacci_id_2_0.bin \
213+
--public_input ../../scripts/test_files/risc_zero/fibonacci_proof_generator/risc_zero_fibonacci_2_0.pub \
214+
--beacon_url $(BEACON_URL) \
215+
--rpc_url https://ethereum-holesky-rpc.publicnode.com
216+
217+
install_aggregation_mode: ## Install the aggregation mode with proving enabled
218+
cargo install --path aggregation_mode --features prove,gpu --bin proof_aggregator
219+
220+
agg_mode_write_program_ids: ## Write proof aggregator zkvm programs ids
221+
@cd aggregation_mode && \
222+
cargo run --release --bin write_program_image_id_vk_hash
223+
224+
149225
_AGGREGATOR_:
150226

151227
build_aggregator:
@@ -179,7 +255,9 @@ operator_set_eigen_sdk_go_version_testnet:
179255
@echo "Setting Eigen SDK version to: $(EIGEN_SDK_GO_VERSION_TESTNET)"
180256
go get github.com/Layr-Labs/eigensdk-go@$(EIGEN_SDK_GO_VERSION_TESTNET)
181257

182-
operator_set_eigen_sdk_go_version_devnet: operator_set_eigen_sdk_go_version_mainnet
258+
operator_set_eigen_sdk_go_version_devnet:
259+
@echo "Setting Eigen SDK version to: $(EIGEN_SDK_GO_VERSION_DEVNET)"
260+
go get github.com/Layr-Labs/eigensdk-go@$(EIGEN_SDK_GO_VERSION_DEVNET)
183261

184262
operator_set_eigen_sdk_go_version_mainnet:
185263
@echo "Setting Eigen SDK version to: $(EIGEN_SDK_GO_VERSION_MAINNET)"
@@ -280,7 +358,7 @@ operator_remove_from_whitelist:
280358

281359
operator_deposit_into_mock_strategy:
282360
@echo "Depositing into mock strategy"
283-
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.MOCK' contracts/script/output/devnet/eigenlayer_deployment_output.json))
361+
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.WETH' contracts/script/output/devnet/eigenlayer_deployment_output.json))
284362
@go run operator/cmd/main.go deposit-into-strategy \
285363
--config $(CONFIG_FILE) \
286364
--strategy-address $(STRATEGY_ADDRESS) \
@@ -510,6 +588,11 @@ batcher_send_burst_groth16: batcher/target/release/aligned
510588
@mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs
511589
@./batcher/aligned/send_burst_tasks.sh $(BURST_SIZE) $(START_COUNTER)
512590

591+
batcher_send_proof_with_random_address:
592+
@cd batcher/aligned/ && ./send_proof_with_random_address.sh
593+
594+
batcher_send_burst_with_random_address:
595+
@cd batcher/aligned/ && ./send_burst_with_random_address.sh
513596

514597
__TASK_SENDER__:
515598
BURST_TIME_SECS ?= 3
@@ -584,7 +667,6 @@ aligned_get_user_balance_holesky:
584667
--network holesky \
585668
--user_addr $(USER_ADDR)
586669

587-
588670
__GENERATE_PROOFS__:
589671
# TODO add a default proving system
590672

@@ -684,12 +766,20 @@ upgrade_batcher_payment_service: ## Upgrade BatcherPayments contract. Parameters
684766
@echo "Upgrading BatcherPayments Contract on $(NETWORK) network..."
685767
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/upgrade_batcher_payment_service.sh
686768

769+
deploy_proof_aggregator:
770+
@echo "Deploying ProofAggregator contract on $(NETWORK) network..."
771+
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/deploy_proof_aggregator.sh
772+
773+
upgrade_proof_aggregator:
774+
@echo "Upgrading ProofAggregator Contract on $(NETWORK) network..."
775+
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/upgrade_proof_aggregator.sh
776+
687777
build_aligned_contracts:
688-
@cd contracts/src/core && forge build
778+
@cd contracts/src/core && forge build --via-ir
689779

690780
show_aligned_error_codes:
691781
@echo "\nAlignedLayerServiceManager errors:"
692-
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
782+
@cd contracts && forge inspect src/core/IAlignedLayerServiceManager.sol:IAlignedLayerServiceManager errors
693783
@echo "\nBatcherPaymentService errors:"
694784
@cd contracts && forge inspect src/core/BatcherPaymentService.sol:BatcherPaymentService errors
695785

@@ -1239,6 +1329,7 @@ ethereum_package_inspect: ## Prints detailed information about the net
12391329

12401330
ethereum_package_rm: ## Stops and removes the ethereum_package environment and used resources
12411331
kurtosis enclave rm aligned -f
1332+
kurtosis engine stop
12421333

12431334
batcher_start_ethereum_package: user_fund_payment_service
12441335
@echo "Starting Batcher..."
@@ -1249,11 +1340,11 @@ aggregator_start_ethereum_package:
12491340
$(MAKE) aggregator_start AGG_CONFIG_FILE=config-files/config-aggregator-ethereum-package.yaml
12501341

12511342
operator_start_ethereum_package:
1252-
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
1343+
$(MAKE) operator_start ENVIRONMENT=devnet OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
12531344

12541345
operator_register_start_ethereum_package:
1255-
$(MAKE) operator_full_registration OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml \
1256-
$(MAKE) operator_start OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
1346+
$(MAKE) operator_full_registration OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
1347+
$(MAKE) operator_start ENVIRONMENT=devnet OPERATOR_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8 CONFIG_FILE=config-files/config-operator-1-ethereum-package.yaml
12571348

12581349

12591350
install_spamoor: ## Instal spamoor to spam transactions

0 commit comments

Comments
 (0)