add execute method

This commit is contained in:
Kevaundray Wedderburn
2025-05-15 14:37:24 +01:00
parent 53a0bf7b4b
commit fa92d12b31
3 changed files with 24 additions and 18 deletions

22
Cargo.lock generated
View File

@@ -2244,7 +2244,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
dependencies = [
"libc",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -6019,7 +6019,7 @@ dependencies = [
[[package]]
name = "pico-derive"
version = "0.1.0"
source = "git+https://github.com/brevis-network/pico#1aa4bfdef1d0a7aa5eef484b4875728c4a42dc07"
source = "git+https://github.com/brevis-network/pico?tag=v1.1.3#d67fb4389d7d14d55f8ae6d156f436649b9dab2d"
dependencies = [
"proc-macro2",
"quote",
@@ -6028,8 +6028,8 @@ dependencies = [
[[package]]
name = "pico-patch-libs"
version = "1.1.2"
source = "git+https://github.com/brevis-network/pico#1aa4bfdef1d0a7aa5eef484b4875728c4a42dc07"
version = "1.1.3"
source = "git+https://github.com/brevis-network/pico?tag=v1.1.3#d67fb4389d7d14d55f8ae6d156f436649b9dab2d"
dependencies = [
"bincode",
"serde",
@@ -6037,8 +6037,8 @@ dependencies = [
[[package]]
name = "pico-sdk"
version = "1.1.2"
source = "git+https://github.com/brevis-network/pico#1aa4bfdef1d0a7aa5eef484b4875728c4a42dc07"
version = "1.1.3"
source = "git+https://github.com/brevis-network/pico?tag=v1.1.3#d67fb4389d7d14d55f8ae6d156f436649b9dab2d"
dependencies = [
"anyhow",
"bincode",
@@ -6063,8 +6063,8 @@ dependencies = [
[[package]]
name = "pico-vm"
version = "1.1.2"
source = "git+https://github.com/brevis-network/pico#1aa4bfdef1d0a7aa5eef484b4875728c4a42dc07"
version = "1.1.3"
source = "git+https://github.com/brevis-network/pico?tag=v1.1.3#d67fb4389d7d14d55f8ae6d156f436649b9dab2d"
dependencies = [
"anyhow",
"arrayref",
@@ -6479,7 +6479,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -6978,7 +6978,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -8162,7 +8162,7 @@ dependencies = [
"getrandom 0.3.3",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]

View File

@@ -8,7 +8,7 @@ license.workspace = true
[dependencies]
zkvm-interface = { workspace = true }
thiserror = "2"
pico-sdk = { git = "https://github.com/brevis-network/pico" }
pico-sdk = { git = "https://github.com/brevis-network/pico", tag = "v1.1.3" }
bincode = "1.3.3"
[lints]

View File

@@ -1,6 +1,6 @@
use pico_sdk::client::DefaultProverClient;
use std::process::Command;
use zkvm_interface::{Compiler, ProgramProvingReport, zkVM};
use zkvm_interface::{Compiler, ProgramExecutionReport, ProgramProvingReport, zkVM};
mod error;
use error::PicoError;
@@ -62,9 +62,17 @@ impl zkVM<PICO_TARGET> for ErePico {
fn execute(
&self,
_inputs: &zkvm_interface::Input,
inputs: &zkvm_interface::Input,
) -> Result<zkvm_interface::ProgramExecutionReport, Self::Error> {
todo!("pico currently does not have an execute method exposed via the SDK")
let client = DefaultProverClient::new(&self.program);
let mut stdin = client.new_stdin_builder();
for input in inputs.chunked_iter() {
stdin.write_slice(input);
}
let num_cycles = client.emulate(stdin);
Ok(ProgramExecutionReport::new(num_cycles))
}
fn prove(
@@ -99,11 +107,9 @@ impl zkVM<PICO_TARGET> for ErePico {
Ok((proof_serialized, ProgramProvingReport::new(elapsed)))
}
fn verify(&self, _proof: &[u8]) -> Result<(), Self::Error> {
fn verify(&self, proof: &[u8]) -> Result<(), Self::Error> {
let client = DefaultProverClient::new(&self.program);
let _vk = client.riscv_vk();
todo!("Verification method missing from sdk")
}
}