@@ -37,13 +37,15 @@ pub trait ClientSdkProver<T: BorshSerialize + Send> {
37
37
fn prove (
38
38
& self ,
39
39
commitment_metadata : Vec < u8 > ,
40
- calldata : T ,
40
+ calldatas : T ,
41
41
) -> Pin < Box < dyn std:: future:: Future < Output = Result < ProofData > > + Send + ' _ > > ;
42
42
}
43
43
44
44
#[ cfg( feature = "risc0" ) ]
45
45
pub mod risc0 {
46
46
47
+ use borsh:: BorshSerialize ;
48
+
47
49
use super :: * ;
48
50
49
51
pub struct Risc0Prover < ' a > {
@@ -53,10 +55,10 @@ pub mod risc0 {
53
55
pub fn new ( binary : & ' a [ u8 ] ) -> Self {
54
56
Self { binary }
55
57
}
56
- pub async fn prove (
58
+ pub async fn prove < T : BorshSerialize > (
57
59
& self ,
58
60
commitment_metadata : Vec < u8 > ,
59
- calldatas : Vec < Calldata > ,
61
+ calldatas : T ,
60
62
) -> Result < ProofData > {
61
63
let explicit = std:: env:: var ( "RISC0_PROVER" ) . unwrap_or_default ( ) ;
62
64
let receipt = match explicit. to_lowercase ( ) . as_str ( ) {
@@ -84,11 +86,11 @@ pub mod risc0 {
84
86
}
85
87
}
86
88
87
- impl ClientSdkProver < Vec < Calldata > > for Risc0Prover < ' _ > {
89
+ impl < T : BorshSerialize + Send + ' static > ClientSdkProver < T > for Risc0Prover < ' _ > {
88
90
fn prove (
89
91
& self ,
90
92
commitment_metadata : Vec < u8 > ,
91
- calldatas : Vec < Calldata > ,
93
+ calldatas : T ,
92
94
) -> Pin < Box < dyn std:: future:: Future < Output = Result < ProofData > > + Send + ' _ > > {
93
95
Box :: pin ( self . prove ( commitment_metadata, calldatas) )
94
96
}
@@ -118,10 +120,10 @@ pub mod sp1 {
118
120
Ok ( sdk:: ProgramId ( serde_json:: to_vec ( & self . vk ) ?) )
119
121
}
120
122
121
- pub async fn prove (
123
+ pub async fn prove < T : BorshSerialize > (
122
124
& self ,
123
125
commitment_metadata : Vec < u8 > ,
124
- calldatas : Vec < Calldata > ,
126
+ calldatas : T ,
125
127
) -> Result < ProofData > {
126
128
// Setup the inputs.
127
129
let mut stdin = SP1Stdin :: new ( ) ;
@@ -141,13 +143,13 @@ pub mod sp1 {
141
143
}
142
144
}
143
145
144
- impl ClientSdkProver < Vec < Calldata > > for SP1Prover {
146
+ impl < T : BorshSerialize + Send + ' static > ClientSdkProver < T > for SP1Prover {
145
147
fn prove (
146
148
& self ,
147
149
commitment_metadata : Vec < u8 > ,
148
- calldata : Vec < Calldata > ,
150
+ calldatas : T ,
149
151
) -> 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 ) )
151
153
}
152
154
}
153
155
}
0 commit comments