Skip to content

Commit b42fe37

Browse files
committed
Merge remote-tracking branch 'origin/feat/integrate-agg-mode-with-db' into feat/recover-address
2 parents 24e0a8f + d087c55 commit b42fe37

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

aggregation_mode/batcher/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl Db {
9999
pub async fn insert_task(
100100
&self,
101101
address: &str,
102-
proving_system_id: i64,
102+
proving_system_id: i32,
103103
proof: &[u8],
104104
program_commitment: &[u8],
105105
merkle_path: Option<&[u8]>,

aggregation_mode/batcher/src/server/http.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ impl BatcherServer {
5252
HttpServer::new(move || {
5353
App::new()
5454
.app_data(Data::new(state.clone()))
55-
// Note: this is temporary and should be lowered when we accept proofs via multipart form data instead of json
56-
.app_data(web::JsonConfig::default().limit(50 * 1024 * 1024)) // 50mb
5755
.route("/nonce/{address}", web::get().to(Self::get_nonce))
5856
.route("/receipts", web::get().to(Self::get_receipts))
5957
.route("/proof/sp1", web::post().to(Self::post_proof_sp1))
@@ -203,7 +201,7 @@ impl BatcherServer {
203201
.db
204202
.insert_task(
205203
&recovered_address,
206-
AggregationModeProvingSystem::SP1.as_u16() as i64,
204+
AggregationModeProvingSystem::SP1.as_u16() as i32,
207205
&proof_content,
208206
&vk_content,
209207
None,

aggregation_mode/db/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum TaskStatus {
1616
pub struct Task {
1717
pub task_id: Uuid,
1818
pub address: String,
19-
pub proving_system_id: i64,
19+
pub proving_system_id: i32,
2020
pub proof: Vec<u8>,
2121
pub program_commitment: Vec<u8>,
2222
pub merkle_path: Option<Vec<u8>>,

aggregation_mode/proof_aggregator/src/aggregators/sp1_aggregator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ pub(crate) fn run_user_proofs_aggregator(
127127
.verify(&proof, &vk)
128128
.map_err(SP1AggregationError::Verification)?;
129129

130-
let proof_and_elf = SP1ProofWithPubValuesAndVk {
130+
let proof_and_vk = SP1ProofWithPubValuesAndVk {
131131
proof_with_pub_values: proof,
132132
vk,
133133
};
134134

135-
Ok(proof_and_elf)
135+
Ok(proof_and_vk)
136136
}
137137

138138
pub(crate) fn run_chunk_aggregator(
@@ -199,12 +199,12 @@ pub(crate) fn run_chunk_aggregator(
199199
.verify(&proof, &vk)
200200
.map_err(SP1AggregationError::Verification)?;
201201

202-
let proof_and_elf = SP1ProofWithPubValuesAndVk {
202+
let proof_and_vk = SP1ProofWithPubValuesAndVk {
203203
proof_with_pub_values: proof,
204204
vk,
205205
};
206206

207-
Ok(proof_and_elf)
207+
Ok(proof_and_vk)
208208
}
209209

210210
pub fn vk_from_elf(elf: &[u8]) -> SP1VerifyingKey {

aggregation_mode/proof_aggregator/src/backend/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Db {
4949
.map_err(|e| DbError::Query(e.to_string()))
5050
}
5151

52-
pub async fn insert_tasks_merkle_path_and_mark_them_as_submitted(
52+
pub async fn insert_tasks_merkle_path_and_mark_them_as_verified(
5353
&self,
5454
updates: Vec<(Uuid, Vec<u8>)>,
5555
) -> Result<(), DbError> {

aggregation_mode/proof_aggregator/src/backend/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use config::Config;
2323
use fetcher::{ProofsFetcher, ProofsFetcherError};
2424
use merkle_tree::compute_proofs_merkle_root;
2525
use risc0_ethereum_contracts::encode_seal;
26+
use sqlx::types::Uuid;
2627
use std::thread::sleep;
2728
use std::{str::FromStr, time::Duration};
2829
use tracing::{error, info, warn};
@@ -213,9 +214,9 @@ impl ProofAggregator {
213214
);
214215

215216
info!("Storing merkle paths for each task...",);
216-
let mut merkle_paths_for_tasks = vec![];
217-
for task_id in tasks_id {
218-
let Some(proof) = merkle_tree.get_proof_by_pos(0) else {
217+
let mut merkle_paths_for_tasks: Vec<(Uuid, Vec<u8>)> = vec![];
218+
for (idx, task_id) in tasks_id.into_iter().enumerate() {
219+
let Some(proof) = merkle_tree.get_proof_by_pos(idx) else {
219220
warn!("Proof not found for task id {task_id}");
220221
continue;
221222
};
@@ -228,7 +229,7 @@ impl ProofAggregator {
228229
merkle_paths_for_tasks.push((task_id, proof_bytes))
229230
}
230231
self.db
231-
.insert_tasks_merkle_path_and_mark_them_as_submitted(merkle_paths_for_tasks)
232+
.insert_tasks_merkle_path_and_mark_them_as_verified(merkle_paths_for_tasks)
232233
.await
233234
.map_err(AggregatedProofSubmissionError::StoringMerklePaths)?;
234235
info!("Merkle path inserted sucessfully",);

0 commit comments

Comments
 (0)