Skip to content

Commit 34c4d2b

Browse files
Merge 72e0568 into a2dcb5f
2 parents a2dcb5f + 72e0568 commit 34c4d2b

20 files changed

+628
-539
lines changed

aggregation_mode/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ make proof_aggregator_write_program_ids
7474

7575
We are using docker to produce deterministic builds so that the program ids are the same for all systems.
7676

77-
### Updating the program id in `AlignedProofAggregationService` contract
77+
### Updating the verifier program commitment in `AlignedProofAggregationService` contract
7878

79-
If the program ids have changed, you will also need to update them in the `AlignedProofAggregationService` contract.
79+
If the verifier program commitments have changed, you will also need to add the updated one to the `AlignedProofAggregationService` contract. You can do this by calling the `allowVerifyingProgram` method with the new commitment and the proving system ID as parameters (you can check the last parameter in the ProvingSystemId definition at `contracts/src/core/IAlignedProofAggregationService.sol`).
8080

81-
- Risc0: call `setRisc0AggregatorProgramImageId` method with the value of `risc0_root_aggregator_image_id` from `aggregation_mode/program_ids.json`.
82-
- SP1: call: `setSP1AggregatorProgramVKHash` method with the value of `sp1_root_aggregator_vk_hash` from `aggregation_mode/program_ids.json`.
81+
You can fetch the verifier program commitment values from the following:
82+
83+
- Risc0: Use the value of `risc0_chunk_aggregator_image_id` from `aggregation_mode/program_ids.json`.
84+
- SP1: Use the value of `sp1_chunk_aggregator_vk_hash` from `aggregation_mode/program_ids.json`.

aggregation_mode/abi/AlignedProofAggregationService.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aggregation_mode/src/backend/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub struct Config {
2323
pub ecdsa: ECDSAConfig,
2424
pub proofs_per_chunk: u16,
2525
pub total_proofs_limit: u16,
26+
pub sp1_chunk_aggregator_vk_hash: String,
27+
pub risc0_chunk_aggregator_image_id: String,
2628
}
2729

2830
impl Config {

aggregation_mode/src/backend/mod.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ pub struct ProofAggregator {
4444
proof_aggregation_service: AlignedProofAggregationServiceContract,
4545
fetcher: ProofsFetcher,
4646
config: Config,
47+
sp1_chunk_aggregator_vk_hash_bytes: [u8; 32],
48+
risc0_chunk_aggregator_image_id_bytes: [u8; 32],
4749
}
4850

4951
impl ProofAggregator {
@@ -66,11 +68,25 @@ impl ProofAggregator {
6668
ZKVMEngine::from_env().expect("AGGREGATOR env variable to be set to one of sp1|risc0");
6769
let fetcher = ProofsFetcher::new(&config);
6870

71+
let sp1_chunk_aggregator_vk_hash_bytes: [u8; 32] =
72+
hex::decode(&config.sp1_chunk_aggregator_vk_hash)
73+
.expect("Failed to decode SP1 chunk aggregator VK hash")
74+
.try_into()
75+
.expect("SP1 chunk aggregator VK hash must be 32 bytes");
76+
77+
let risc0_chunk_aggregator_image_id_bytes: [u8; 32] =
78+
hex::decode(&config.risc0_chunk_aggregator_image_id)
79+
.expect("Failed to decode Risc0 chunk aggregator image id")
80+
.try_into()
81+
.expect("Risc0 chunk aggregator image id must be 32 bytes");
82+
6983
Self {
7084
engine,
7185
proof_aggregation_service,
7286
fetcher,
7387
config,
88+
sp1_chunk_aggregator_vk_hash_bytes,
89+
risc0_chunk_aggregator_image_id_bytes,
7490
}
7591
}
7692

@@ -157,10 +173,11 @@ impl ProofAggregator {
157173
let tx_req = match aggregated_proof {
158174
AlignedProof::SP1(proof) => self
159175
.proof_aggregation_service
160-
.verifySP1(
176+
.verifyAggregationSP1(
161177
blob_versioned_hash.into(),
162178
proof.proof_with_pub_values.public_values.to_vec().into(),
163179
proof.proof_with_pub_values.bytes().into(),
180+
self.sp1_chunk_aggregator_vk_hash_bytes.into(),
164181
)
165182
.sidecar(blob)
166183
.into_transaction_request(),
@@ -169,10 +186,11 @@ impl ProofAggregator {
169186
AggregatedProofSubmissionError::Risc0EncodingSeal(e.to_string())
170187
})?;
171188
self.proof_aggregation_service
172-
.verifyRisc0(
189+
.verifyAggregationRisc0(
173190
blob_versioned_hash.into(),
174191
encoded_seal.into(),
175192
proof.receipt.journal.bytes.into(),
193+
self.risc0_chunk_aggregator_image_id_bytes.into(),
176194
)
177195
.sidecar(blob)
178196
.into_transaction_request()

config-files/config-proof-aggregator-ethereum-package.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ proofs_per_chunk: 512 # Amount of proofs to process per chunk
1313
# We can aggregate as much proofs as 126.976 / 32 = 3968 per blob
1414
total_proofs_limit: 3968
1515

16+
# These program ids are the ones from the chunk aggregator programs
17+
# Can be found in the Proof Aggregation Service deployment config
18+
# (remember to trim the 0x prefix)
19+
sp1_chunk_aggregator_vk_hash: "00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509"
20+
risc0_chunk_aggregator_image_id: "d8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
21+
1622
ecdsa:
1723
private_key_store_path: "config-files/anvil.proof-aggregator.ecdsa.key.json"
1824
private_key_store_password: ""

config-files/config-proof-aggregator-mock-ethereum-package.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ proofs_per_chunk: 512 # Amount of proofs to process per chunk
1313
# We can aggregate as much proofs as 126.976 / 32 = 3968 per blob
1414
total_proofs_limit: 3968
1515

16+
# These program ids are the ones from the chunk aggregator programs
17+
# Can be found in the Proof Aggregation Service deployment config
18+
# (remember to trim the 0x prefix)
19+
sp1_chunk_aggregator_vk_hash: "00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509"
20+
risc0_chunk_aggregator_image_id: "d8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
1621

1722
ecdsa:
1823
private_key_store_path: "config-files/anvil.proof-aggregator.ecdsa.key.json"

config-files/config-proof-aggregator-mock.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ proofs_per_chunk: 512 # Amount of proofs to process per chunk
1313
# We can aggregate as much proofs as 126.976 / 32 = 3968 per blob
1414
total_proofs_limit: 3968
1515

16+
# These program ids are the ones from the chunk aggregator programs
17+
# Can be found in the Proof Aggregation Service deployment config
18+
# (remember to trim the 0x prefix)
19+
sp1_chunk_aggregator_vk_hash: "00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509"
20+
risc0_chunk_aggregator_image_id: "d8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
1621

1722
ecdsa:
1823
private_key_store_path: "config-files/anvil.proof-aggregator.ecdsa.key.json"

config-files/config-proof-aggregator.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ proofs_per_chunk: 512 # Amount of proofs to process per chunk
1313
# We can aggregate as much proofs as 126.976 / 32 = 3968 per blob
1414
total_proofs_limit: 3968
1515

16+
# These program ids are the ones from the chunk aggregator programs
17+
# Can be found in the Proof Aggregation Service deployment config
18+
# (remember to trim the 0x prefix)
19+
sp1_chunk_aggregator_vk_hash: "00ba19eed0aaeb0151f07b8d3ee7c659bcd29f3021e48fb42766882f55b84509"
20+
risc0_chunk_aggregator_image_id: "d8cfdd5410c70395c0a1af1842a0148428cc46e353355faccfba694dd4862dbf"
1621

1722
ecdsa:
1823
private_key_store_path: "config-files/anvil.proof-aggregator.ecdsa.key.json"

contracts/script/deploy/AlignedProofAggregationServiceDeployer.s.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pragma solidity ^0.8.12;
22

33
import {AlignedProofAggregationService} from "../../src/core/AlignedProofAggregationService.sol";
4+
import {IAlignedProofAggregationService} from "../../src/core/IAlignedProofAggregationService.sol";
45
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
56

67
import "forge-std/Script.sol";

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)