@@ -234,7 +234,8 @@ impl Network for TestnetV0 {
234234 . ok_or_else ( || anyhow ! ( "Verifying key for credits.aleo/{function_name}' not found" ) )
235235 }
236236
237- /// Returns the `proving key` for the inclusion circuit.
237+ #[ cfg( not( feature = "wasm" ) ) ]
238+ /// Returns the `proving key` for the inclusion_v0 circuit.
238239 fn inclusion_v0_proving_key ( ) -> & ' static Arc < VarunaProvingKey < Self > > {
239240 static INSTANCE : OnceLock < Arc < VarunaProvingKey < Console > > > = OnceLock :: new ( ) ;
240241 INSTANCE . get_or_init ( || {
@@ -246,6 +247,28 @@ impl Network for TestnetV0 {
246247 } )
247248 }
248249
250+ #[ cfg( feature = "wasm" ) ]
251+ /// Returns the `proving key` for the inclusion_v0 circuit.
252+ fn inclusion_v0_proving_key ( inclusion_key_bytes : Option < Vec < u8 > > ) -> & ' static Arc < VarunaProvingKey < Self > > {
253+ static INSTANCE : OnceLock < Arc < VarunaProvingKey < Console > > > = OnceLock :: new ( ) ;
254+ INSTANCE . get_or_init ( || {
255+ inclusion_key_bytes
256+ . map ( |bytes| {
257+ snarkvm_parameters:: testnet:: InclusionV0Prover :: verify_bytes ( & bytes)
258+ . expect ( "Bytes provided did not match expected inclusion checksum." ) ;
259+ Arc :: new (
260+ CircuitProvingKey :: from_bytes_le ( & bytes[ 1 ..] ) . expect ( "Failed to load inclusion proving key." ) ,
261+ )
262+ } )
263+ . unwrap_or_else ( || {
264+ Arc :: new (
265+ CircuitProvingKey :: from_bytes_le ( & snarkvm_parameters:: testnet:: INCLUSION_V0_PROVING_KEY [ 1 ..] )
266+ . expect ( "Failed to load inclusion proving key." ) ,
267+ )
268+ } )
269+ } )
270+ }
271+
249272 /// Returns the `verifying key` for the inclusion circuit.
250273 fn inclusion_v0_verifying_key ( ) -> & ' static Arc < VarunaVerifyingKey < Self > > {
251274 static INSTANCE : OnceLock < Arc < VarunaVerifyingKey < Console > > > = OnceLock :: new ( ) ;
@@ -258,6 +281,7 @@ impl Network for TestnetV0 {
258281 } )
259282 }
260283
284+ #[ cfg( not( feature = "wasm" ) ) ]
261285 /// Returns the `proving key` for the inclusion circuit.
262286 fn inclusion_proving_key ( ) -> & ' static Arc < VarunaProvingKey < Self > > {
263287 static INSTANCE : OnceLock < Arc < VarunaProvingKey < Console > > > = OnceLock :: new ( ) ;
@@ -270,6 +294,28 @@ impl Network for TestnetV0 {
270294 } )
271295 }
272296
297+ #[ cfg( feature = "wasm" ) ]
298+ /// Returns the `proving key` for the inclusion circuit.
299+ fn inclusion_proving_key ( inclusion_key_bytes : Option < Vec < u8 > > ) -> & ' static Arc < VarunaProvingKey < Self > > {
300+ static INSTANCE : OnceLock < Arc < VarunaProvingKey < Console > > > = OnceLock :: new ( ) ;
301+ INSTANCE . get_or_init ( || {
302+ inclusion_key_bytes
303+ . map ( |bytes| {
304+ snarkvm_parameters:: testnet:: InclusionProver :: verify_bytes ( & bytes)
305+ . expect ( "Bytes provided did not match expected inclusion checksum." ) ;
306+ Arc :: new (
307+ CircuitProvingKey :: from_bytes_le ( & bytes[ 1 ..] ) . expect ( "Failed to load inclusion proving key." ) ,
308+ )
309+ } )
310+ . unwrap_or_else ( || {
311+ Arc :: new (
312+ CircuitProvingKey :: from_bytes_le ( & snarkvm_parameters:: testnet:: INCLUSION_PROVING_KEY [ 1 ..] )
313+ . expect ( "Failed to load inclusion proving key." ) ,
314+ )
315+ } )
316+ } )
317+ }
318+
273319 /// Returns the `verifying key` for the inclusion circuit.
274320 fn inclusion_verifying_key ( ) -> & ' static Arc < VarunaVerifyingKey < Self > > {
275321 static INSTANCE : OnceLock < Arc < VarunaVerifyingKey < Console > > > = OnceLock :: new ( ) ;
0 commit comments