Skip to content

Commit 731d39b

Browse files
Merge 6831ab4 into 43a1084
2 parents 43a1084 + 6831ab4 commit 731d39b

21 files changed

+543
-19
lines changed

aggregation_mode/readme.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# Aligned aggregation mode
3+
4+
## How to run it locally
5+
6+
1. Deploy aligned contracts on anvil:
7+
8+
```shell
9+
make deploy_aligned_contracts
10+
```
11+
12+
2. Start anvil:
13+
14+
```shell
15+
make anvil_start_with_block_time
16+
```
17+
18+
3. Start batcher
19+
20+
```shell
21+
make start_batcher_local
22+
```
23+
24+
4. Send SP1 proofs:
25+
26+
```shell
27+
make batcher_send_sp1_burst
28+
```
29+
30+
5. Start proof aggregator:
31+
32+
```shell
33+
# This will not run a real prover but a mocked one see below to run a real prover
34+
make start_proof_aggregator_local
35+
```
36+
37+
or
38+
39+
```shell
40+
make start_proof_aggregator_local_with_proving
41+
```
42+
43+
Note: Proving can be quite slow without GPUs
44+
45+
### Check the logs
46+
47+
1. Get latest aggregated proof:
48+
49+
```shell
50+
cast call 0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc "currentAggregatedProofNumber()" --rpc-url http://localhost:8545
51+
```
52+
53+
2. Get aggregated proof info:
54+
55+
```shell
56+
cast call 0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc "getAggregatedProof(uint64)(uint8,bytes32,bytes32)" <AGG_PROOF_NUMBER> --rpc-url http://localhost:8545
57+
```

aggregation_mode/src/backend/fetcher.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use super::{
55
types::{AlignedLayerServiceManager, AlignedLayerServiceManagerContract, RPCProvider},
66
};
77
use crate::{
8-
aggregators::{sp1_aggregator::SP1ProofWithPubValuesAndElf, AlignedProof}, backend::s3::get_aligned_batch_from_s3
8+
aggregators::{sp1_aggregator::SP1ProofWithPubValuesAndElf, AlignedProof},
9+
backend::s3::get_aligned_batch_from_s3,
910
};
1011
use aligned_sdk::core::types::ProvingSystemId;
1112
use alloy::{
@@ -88,7 +89,10 @@ impl ProofsFetcher {
8889
ProvingSystemId::SP1 => {
8990
let elf = p.vm_program_code?;
9091
let proof_with_pub_values = bincode::deserialize(&p.proof).ok()?;
91-
let sp1_proof = SP1ProofWithPubValuesAndElf { proof_with_pub_values, elf };
92+
let sp1_proof = SP1ProofWithPubValuesAndElf {
93+
proof_with_pub_values,
94+
elf,
95+
};
9296

9397
Some(AlignedProof::SP1(sp1_proof))
9498
}

aggregation_mode/src/backend/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use crate::aggregators::{
1111
};
1212

1313
use alloy::{
14-
consensus::{BlobTransactionSidecar},
14+
consensus::BlobTransactionSidecar,
1515
eips::eip4844::BYTES_PER_BLOB,
1616
hex,
1717
network::EthereumWallet,
18-
primitives::{Address},
18+
primitives::Address,
1919
providers::{PendingTransactionError, ProviderBuilder},
2020
rpc::types::TransactionReceipt,
2121
signers::local::LocalSigner,

aggregation_mode/src/backend/s3.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub enum GetBatchProofsError {
66
Deserialization,
77
EmptyBody,
88
StatusFailed,
9-
ReqwestClientFailed
9+
ReqwestClientFailed,
1010
}
1111

1212
// needed to make S3 bucket work
@@ -16,11 +16,13 @@ pub async fn get_aligned_batch_from_s3(
1616
url: String,
1717
) -> Result<Vec<VerificationData>, GetBatchProofsError> {
1818
let client = reqwest::Client::builder()
19-
.user_agent(DEFAULT_USER_AGENT)
20-
.build()
21-
.map_err(|_| GetBatchProofsError::ReqwestClientFailed)?;
19+
.user_agent(DEFAULT_USER_AGENT)
20+
.build()
21+
.map_err(|_| GetBatchProofsError::ReqwestClientFailed)?;
2222

23-
let response = client.get(url).send()
23+
let response = client
24+
.get(url)
25+
.send()
2426
.await
2527
.map_err(|_| GetBatchProofsError::Fetching)?;
2628
if !response.status().is_success() {

contracts/remappings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ eigenlayer-scripts/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/script/
55
forge-std/=lib/forge-std/src/
66
@openzeppelin/contracts/=lib/eigenlayer-middleware/lib/openzeppelin-contracts/contracts/
77
@openzeppelin-upgrades/contracts/=lib/eigenlayer-middleware/lib/openzeppelin-contracts-upgradeable/contracts/
8+
@sp1-contracts/=lib/sp1-contracts/contracts/src/

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ contract AlignedProofAggregationService is
4949
bytes32 blobVersionedHash,
5050
//bytes32 sp1ProgramVKey,
5151
bytes calldata sp1PublicValues
52+
)
5253
//bytes calldata sp1ProofBytes
53-
) public onlyAlignedAggregator {
54+
public
55+
onlyAlignedAggregator
56+
{
5457
// In dev mode, poofs are mocked, so we skip the verification part
5558
if (sp1VerifierAddress == VERIFIER_MOCK_ADDRESS) {
5659
(bytes32 merkleRoot) = abi.decode(sp1PublicValues, (bytes32));
5760
_newAggregatedProof(merkleRoot, blobVersionedHash);
5861
return;
5962
}
60-
6163
}
6264

6365
function markCurrentAggregatedProofAsMissed() public onlyAlignedAggregator {

contracts/src/core/IAlignedProofAggregationService.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ interface IAlignedProofAggregationService {
3232
bytes32 blobVersionedHash,
3333
//bytes32 sp1ProgramVKey,
3434
bytes calldata sp1PublicValues
35+
)
3536
//bytes calldata sp1ProofBytes
36-
) external;
37+
external;
3738

3839
function getAggregatedProof(uint64 proofNumber)
3940
external

explorer/.env.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ DB_HOST=localhost
1414

1515
# Config file
1616
ALIGNED_CONFIG_FILE="../contracts/script/output/devnet/alignedlayer_deployment_output.json"
17+
ALIGNED_PROOF_AGG_CONFIG_FILE="../contracts/script/output/devnet/proof_aggregation_service_deployment_output.json"
18+
## Don't use public nodes as blob data can be retrieved from them
19+
BEACON_CLIENT="<beacon_client_url>"
1720

1821
# Debug
1922
DEBUG_ERRORS=true

explorer/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ DB_HOST=<db_host>
1414

1515
# Config file
1616
ALIGNED_CONFIG_FILE="<aligned_config_file>"
17+
ALIGNED_PROOF_AGG_CONFIG_FILE="<proof_aggregation_config_file>"
18+
## Don't use public nodes as blob data can be retrieved from them
19+
BEACON_CLIENT="<beacon_client_url>"
1720

1821
# Debug
1922
DEBUG_ERRORS=<true|false>

explorer/ecto_setup_db.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export DB_USER=$DB_USER
1010
export DB_PASS=$DB_PASS
1111
export DB_HOST=$DB_HOST
1212
export ALIGNED_CONFIG_FILE=$ALIGNED_CONFIG_FILE
13+
export ALIGNED_PROOF_AGG_CONFIG_FILE=$ALIGNED_PROOF_AGG_CONFIG_FILE
14+
export BEACON_CLIENT=$BEACON_CLIENT
1315

1416
mix deps.get
1517

0 commit comments

Comments
 (0)