|
1 | | -use proof_aggregator::backend::{Config, ProofAggregator}; |
| 1 | +use std::fs; |
| 2 | + |
| 3 | +use proof_aggregator::{ |
| 4 | + backend::{Config, ProofAggregator}, |
| 5 | + zk::{ |
| 6 | + backends::sp1::{vk_from_elf, SP1Proof}, |
| 7 | + Proof, |
| 8 | + }, |
| 9 | +}; |
| 10 | +use sp1_sdk::SP1ProofWithPublicValues; |
2 | 11 | use tracing_subscriber::FmtSubscriber; |
3 | 12 |
|
4 | 13 | #[tokio::main] |
5 | 14 | async fn main() { |
6 | 15 | let subscriber = FmtSubscriber::builder().finish(); |
7 | 16 | tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed"); |
8 | 17 |
|
| 18 | + let proofs_to_push = 2; |
| 19 | + |
9 | 20 | // TODO read proof aggregator yaml config file |
10 | 21 | let config = Config { |
11 | 22 | private_key: "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6".into(), |
12 | 23 | rpc_url: "http://localhost:8545".into(), |
| 24 | + max_proofs_in_queue: proofs_to_push, |
| 25 | + submit_proofs_every_secs: 2, |
13 | 26 | }; |
14 | 27 | let mut proof_aggregator = ProofAggregator::new(config); |
15 | 28 |
|
16 | | - // TODO read proofs from fs |
17 | | - // proof_aggregator.add_proof(proof) |
| 29 | + for _ in 0..proofs_to_push { |
| 30 | + let sp1_proof = |
| 31 | + SP1ProofWithPublicValues::load("../scripts/test_files/sp1/sp1_fibonacci_4_1_3.proof") |
| 32 | + .expect("loading proof failed"); |
| 33 | + let proof_elf = |
| 34 | + fs::read("../scripts/test_files/sp1/sp1_fibonacci_4_1_3.elf").expect("elf bytes"); |
| 35 | + let proof = Proof::SP1(SP1Proof { |
| 36 | + proof: sp1_proof, |
| 37 | + vk: vk_from_elf(&proof_elf), |
| 38 | + }); |
| 39 | + |
| 40 | + proof_aggregator |
| 41 | + .add_proof(proof, &proof_elf) |
| 42 | + .expect("Proof to be valid"); |
| 43 | + } |
18 | 44 |
|
19 | 45 | proof_aggregator.start().await; |
20 | 46 | } |
0 commit comments