Skip to content

Commit 32baa21

Browse files
committed
fix: update template files
1 parent b129342 commit 32baa21

File tree

13 files changed

+18
-54
lines changed

13 files changed

+18
-54
lines changed

adapters/native/src/env.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::cell::RefCell;
22

3-
use zkaleido::{ProofReceipt, ZkVmEnv};
3+
use zkaleido::ZkVmEnv;
44

55
/// Encapsulates the mutable state of the NativeMachine.
66
#[derive(Debug, Clone)]
@@ -79,8 +79,6 @@ impl ZkVmEnv for NativeMachine {
7979
self.commit_buf(&bytes);
8080
}
8181

82-
fn verify_groth16_receipt(&self, _receipt: &ProofReceipt, _verification_key: &[u8; 32]) {}
83-
8482
fn verify_native_proof(&self, _vk_digest: &[u32; 8], _public_values: &[u8]) {}
8583

8684
fn read_verified_serde<T: serde::de::DeserializeOwned>(&self, _vk_digest: &[u32; 8]) -> T {

adapters/risc0/guest/src/env.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use risc0_zkvm::{guest::env, serde::from_slice};
22
use serde::{de::DeserializeOwned, Serialize};
3-
use zkaleido::{ProofReceipt, ZkVmEnv};
4-
5-
#[cfg(not(feature = "mock"))]
6-
use crate::verify_groth16;
3+
use zkaleido::ZkVmEnv;
74

85
/// An environment adapter for the RISC0 system implementing [`ZkVmEnv`].
96
///
@@ -40,14 +37,6 @@ impl ZkVmEnv for Risc0ZkVmEnv {
4037
env::verify(vk, public_values).expect("verification failed")
4138
}
4239

43-
#[cfg(not(feature = "mock"))]
44-
fn verify_groth16_receipt(&self, receipt: &ProofReceipt, verification_key: &[u8; 32]) {
45-
verify_groth16(receipt, verification_key).expect("groth16 verification failed");
46-
}
47-
48-
#[cfg(feature = "mock")]
49-
fn verify_groth16_receipt(&self, _receipt: &ProofReceipt, _verification_key: &[u8; 32]) {}
50-
5140
fn read_verified_serde<T: DeserializeOwned>(&self, vk_digest: &[u32; 8]) -> T {
5241
let buf = self.read_verified_buf(vk_digest);
5342
from_slice(&buf).expect("risc0 zkvm deserialization failed")

adapters/sp1/guest/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ rustdoc.all = "warn"
1616
zkaleido.workspace = true
1717

1818
bincode.workspace = true
19-
cfg-if = { workspace = true, optional = true }
20-
serde = { workspace = true, optional = true }
19+
cfg-if.workspace = true
2120
sha2 = { workspace = true, optional = true }
2221
sp1-zkvm = "4.1.0"
22+
serde.workspace = true
2323

2424
[features]
2525
zkvm-verify = ["sp1-zkvm/verify", "sha2"]

adapters/sp1/guest/src/env.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ use sha2::{Digest, Sha256};
55
use sp1_zkvm::io;
66
#[cfg(feature = "zkvm-verify")]
77
use sp1_zkvm::lib::verify::verify_sp1_proof;
8-
use zkaleido::{ProofReceipt, ZkVmEnv};
9-
10-
#[cfg(not(feature = "mock"))]
11-
use crate::verify_groth16;
8+
use zkaleido::ZkVmEnv;
129

1310
/// An environment adapter for the SP1 proof system implementing [`ZkVmEnv`].
1411
///
@@ -51,14 +48,6 @@ impl ZkVmEnv for Sp1ZkVmEnv {
5148
}
5249
}
5350

54-
#[cfg(feature = "mock")]
55-
fn verify_groth16_receipt(&self, _receipt: &ProofReceipt, _verification_key: &[u8; 32]) {}
56-
57-
#[cfg(not(feature = "mock"))]
58-
fn verify_groth16_receipt(&self, receipt: &ProofReceipt, verification_key: &[u8; 32]) {
59-
verify_groth16(receipt, verification_key).expect("groth16 verification failed");
60-
}
61-
6251
fn read_verified_serde<T: DeserializeOwned>(&self, vk_digest: &[u32; 8]) -> T {
6352
let buf = self.read_verified_buf(vk_digest);
6453
deserialize(&buf).expect("bincode deserialization failed")

artifacts/risc0/templates/Cargo.toml.tera

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "{{ edition }}"
77

88
[dependencies]
99
{{ program_dir }} = { path = "../../../examples/{{ program_dir }}" }
10-
zkaleido-risc0-adapter = { path = "../../../adapters/risc0" }
10+
zkaleido-risc0-guest-env = { path = "../../../adapters/risc0/guest" }
1111

1212
[patch.crates-io]
1313
sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" }

artifacts/risc0/templates/src/main.rs.tera

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use {{program}}::process_{{program}};
2-
use zkaleido_risc0_adapter::Risc0ZkVmEnv;
2+
use zkaleido_risc0_guest_env::Risc0ZkVmEnv;
33

44
pub fn main() {
55
process_{{program}}(&Risc0ZkVmEnv)

artifacts/sp1/templates/Cargo.toml.tera

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ edition = "{{ edition }}"
77

88
[dependencies]
99
{{ program_dir }} = { path = "../../../examples/{{ program_dir }}" }
10-
zkaleido-sp1-adapter = { path = "../../../adapters/sp1/guest", features = ["zkvm"] }
10+
zkaleido-sp1-guest-env = { path = "../../../adapters/sp1/guest" }
1111
sp1-zkvm = "4.1.0"
1212

1313
[features]
14-
mock = ["zkaleido-sp1-adapter/mock"]
14+
mock = ["zkaleido-sp1-guest-env/mock"]
1515

1616
[patch.crates-io]
1717
sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8" }

artifacts/sp1/templates/src/main.rs.tera

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
sp1_zkvm::entrypoint!(main);
77

88
use {{program}}::process_{{program}};
9-
use zkaleido_sp1_adapter::Sp1ZkVmEnv;
9+
use zkaleido_sp1_guest_env::Sp1ZkVmEnv;
1010

1111
pub fn main() {
1212
process_{{program}}(&Sp1ZkVmEnv)

runner/src/programs/fibonacci.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ fn fib_prover_perf_report(host: &impl ZkVmHostPerf) -> PerformanceReport {
88

99
#[cfg(feature = "sp1")]
1010
pub fn sp1_fib_report() -> PerformanceReport {
11-
use zkaleido_sp1_adapter::SP1Host;
1211
use zkaleido_sp1_artifacts::FIBONACCI_ELF;
12+
use zkaleido_sp1_host::SP1Host;
1313
let host = SP1Host::init(FIBONACCI_ELF);
1414
fib_prover_perf_report(&host)
1515
}
1616

1717
#[cfg(feature = "risc0")]
1818
pub fn risc0_fib_report() -> PerformanceReport {
19-
use zkaleido_risc0_adapter::Risc0Host;
2019
use zkaleido_risc0_artifacts::GUEST_RISC0_FIBONACCI_ELF;
20+
use zkaleido_risc0_host::Risc0Host;
2121
let host = Risc0Host::init(GUEST_RISC0_FIBONACCI_ELF);
2222
fib_prover_perf_report(&host)
2323
}

runner/src/programs/fibonacci_composition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ fn fib_composition_prover_perf_report(
2222

2323
#[cfg(feature = "sp1")]
2424
pub fn sp1_fib_composition_report() -> PerformanceReport {
25-
use zkaleido_sp1_adapter::SP1Host;
2625
use zkaleido_sp1_artifacts::{FIBONACCI_COMPOSITION_ELF, FIBONACCI_ELF};
26+
use zkaleido_sp1_host::SP1Host;
2727
let fib_host = SP1Host::init(FIBONACCI_ELF);
2828
let fib_composition_host = SP1Host::init(FIBONACCI_COMPOSITION_ELF);
2929
fib_composition_prover_perf_report(&fib_host, &fib_composition_host)
3030
}
3131

3232
#[cfg(feature = "risc0")]
3333
pub fn risc0_fib_composition_report() -> PerformanceReport {
34-
use zkaleido_risc0_adapter::Risc0Host;
3534
use zkaleido_risc0_artifacts::{
3635
GUEST_RISC0_FIBONACCI_COMPOSITION_ELF, GUEST_RISC0_FIBONACCI_ELF,
3736
};
37+
use zkaleido_risc0_host::Risc0Host;
3838
let fib_host = Risc0Host::init(GUEST_RISC0_FIBONACCI_ELF);
3939
let fib_composition_host = Risc0Host::init(GUEST_RISC0_FIBONACCI_COMPOSITION_ELF);
4040
fib_composition_prover_perf_report(&fib_host, &fib_composition_host)

0 commit comments

Comments
 (0)