Skip to content

Commit 00e782b

Browse files
authored
Revert "🐛 Fix ClientProver calldatas type (#1165)" (#1169)
This reverts commit 7cb028a.
1 parent bdabf11 commit 00e782b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

crates/client-sdk/src/helpers.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ pub trait ClientSdkProver<T: BorshSerialize + Send> {
3737
fn prove(
3838
&self,
3939
commitment_metadata: Vec<u8>,
40-
calldata: T,
40+
calldatas: T,
4141
) -> Pin<Box<dyn std::future::Future<Output = Result<ProofData>> + Send + '_>>;
4242
}
4343

4444
#[cfg(feature = "risc0")]
4545
pub mod risc0 {
4646

47+
use borsh::BorshSerialize;
48+
4749
use super::*;
4850

4951
pub struct Risc0Prover<'a> {
@@ -53,10 +55,10 @@ pub mod risc0 {
5355
pub fn new(binary: &'a [u8]) -> Self {
5456
Self { binary }
5557
}
56-
pub async fn prove(
58+
pub async fn prove<T: BorshSerialize>(
5759
&self,
5860
commitment_metadata: Vec<u8>,
59-
calldatas: Vec<Calldata>,
61+
calldatas: T,
6062
) -> Result<ProofData> {
6163
let explicit = std::env::var("RISC0_PROVER").unwrap_or_default();
6264
let receipt = match explicit.to_lowercase().as_str() {
@@ -84,11 +86,11 @@ pub mod risc0 {
8486
}
8587
}
8688

87-
impl ClientSdkProver<Vec<Calldata>> for Risc0Prover<'_> {
89+
impl<T: BorshSerialize + Send + 'static> ClientSdkProver<T> for Risc0Prover<'_> {
8890
fn prove(
8991
&self,
9092
commitment_metadata: Vec<u8>,
91-
calldatas: Vec<Calldata>,
93+
calldatas: T,
9294
) -> Pin<Box<dyn std::future::Future<Output = Result<ProofData>> + Send + '_>> {
9395
Box::pin(self.prove(commitment_metadata, calldatas))
9496
}
@@ -118,10 +120,10 @@ pub mod sp1 {
118120
Ok(sdk::ProgramId(serde_json::to_vec(&self.vk)?))
119121
}
120122

121-
pub async fn prove(
123+
pub async fn prove<T: BorshSerialize>(
122124
&self,
123125
commitment_metadata: Vec<u8>,
124-
calldatas: Vec<Calldata>,
126+
calldatas: T,
125127
) -> Result<ProofData> {
126128
// Setup the inputs.
127129
let mut stdin = SP1Stdin::new();
@@ -141,13 +143,13 @@ pub mod sp1 {
141143
}
142144
}
143145

144-
impl ClientSdkProver<Vec<Calldata>> for SP1Prover {
146+
impl<T: BorshSerialize + Send + 'static> ClientSdkProver<T> for SP1Prover {
145147
fn prove(
146148
&self,
147149
commitment_metadata: Vec<u8>,
148-
calldata: Vec<Calldata>,
150+
calldatas: T,
149151
) -> Pin<Box<dyn std::future::Future<Output = Result<ProofData>> + Send + '_>> {
150-
Box::pin(self.prove(commitment_metadata, calldata))
152+
Box::pin(self.prove(commitment_metadata, calldatas))
151153
}
152154
}
153155
}

0 commit comments

Comments
 (0)