Skip to content

Commit

Permalink
itegrate ckp runner with main
Browse files Browse the repository at this point in the history
  • Loading branch information
MdTeach committed Dec 27, 2024
1 parent ebef593 commit 6b28551
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion bin/prover-client/src/checkpoint_runner/submit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::Arc;

use jsonrpsee::{
core::{client::ClientT, params::ArrayParams},
http_client::HttpClient,
Expand All @@ -13,7 +15,7 @@ pub async fn submit_checkpoint_proof(
checkpoint_index: u64,
sequencer_client: &HttpClient,
proof_key: ProofKey,
proof_db: &ProofDb,
proof_db: Arc<ProofDb>,
) -> anyhow::Result<()> {
let proof = proof_db.get_proof(proof_key).unwrap().unwrap();
let proof_bytes = HexBytes::from(proof.proof().as_bytes());
Expand Down
1 change: 1 addition & 0 deletions bin/prover-client/src/operators/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ impl CheckpointOperator {
.ok_or(ProvingTaskError::WitnessNotFound)
}

/// Returns a reference to the internal CL (Consensus Layer) `HttpClient`.
pub fn cl_client(&self) -> &HttpClient {
&self.cl_client
}
Expand Down
18 changes: 9 additions & 9 deletions bin/prover-client/src/prover_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use tokio::{spawn, sync::Mutex, time::sleep};
use tracing::{error, info};

use crate::{
errors::ProvingTaskError, operators::ProofOperator, status::ProvingTaskStatus,
task_tracker::TaskTracker,
checkpoint_runner::submit::submit_checkpoint_proof, errors::ProvingTaskError,
operators::ProofOperator, status::ProvingTaskStatus, task_tracker::TaskTracker,
};

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -67,10 +67,14 @@ impl ProverManager {

// Spawn a new task
spawn(async move {
match make_proof(operator.clone(), task_tracker, task, db).await {
match make_proof(operator.clone(), task_tracker, task, db.clone()).await {
Ok(_) => {
if let ProofContext::Checkpoint(ckp_id) = task.context() {
submit_checkpoint(*ckp_id, operator.clone()).await;
// If checkpoint proving; submit proof to sequencer
if let ProofContext::Checkpoint(checkpoint_index) = task.context() {
let cl_client = operator.checkpoint_operator().cl_client();
let _ =
submit_checkpoint_proof(*checkpoint_index, cl_client, task, db)
.await;
}
}
Err(err) => {
Expand All @@ -86,10 +90,6 @@ impl ProverManager {
}
}

async fn submit_checkpoint(ckp_id: u64, operator: Arc<ProofOperator>) {
println!("submmiting the checkpint {:?}", ckp_id);
}

pub async fn make_proof(
operator: Arc<ProofOperator>,
task_tracker: Arc<Mutex<TaskTracker>>,
Expand Down

0 comments on commit 6b28551

Please sign in to comment.