Skip to content

Commit

Permalink
fix: into implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
atanmarko committed Aug 15, 2024
1 parent 2f08cbc commit 14b566c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions zero_bin/leader/src/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::{Read, Write};
use anyhow::Result;
use paladin::runtime::Runtime;
use proof_gen::proof_types::GeneratedBlockProof;
use prover::{into_block_prover_input_future, BlockProverInput, BlockProverInputFuture};
use prover::{BlockProverInput, BlockProverInputFuture};
use tracing::info;

/// The main function for the stdio mode.
Expand All @@ -18,7 +18,7 @@ pub(crate) async fn stdio_main(
let des = &mut serde_json::Deserializer::from_str(&buffer);
let block_prover_inputs = serde_path_to_error::deserialize::<_, Vec<BlockProverInput>>(des)?
.into_iter()
.map(into_block_prover_input_future)
.map(Into::into)
.collect::<Vec<BlockProverInputFuture>>();

let proved_blocks = prover::prove(
Expand Down
10 changes: 6 additions & 4 deletions zero_bin/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ pub type BlockProverInputFuture = std::pin::Pin<
Box<dyn Future<Output = std::result::Result<BlockProverInput, anyhow::Error>> + Send>,
>;

pub fn into_block_prover_input_future(value: BlockProverInput) -> BlockProverInputFuture {
async fn into(value: BlockProverInput) -> Result<BlockProverInput, anyhow::Error> {
Ok(value)
impl From<BlockProverInput> for BlockProverInputFuture {
fn from(item: BlockProverInput) -> Self {
async fn into(value: BlockProverInput) -> Result<BlockProverInput, anyhow::Error> {
Ok(value)
}
Box::pin(into(item))
}
Box::pin(into(value))
}

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down

0 comments on commit 14b566c

Please sign in to comment.