diff options
| author | Kamen Mladenov <kamen@syndamia.com> | 2025-03-21 13:04:30 +0200 |
|---|---|---|
| committer | Kamen Mladenov <kamen@syndamia.com> | 2025-04-04 11:03:00 +0300 |
| commit | e7018851c4b5c44c7e6b7e907ffc186b1da5c9f4 (patch) | |
| tree | af4aad265dc10a5a6973c9b8f7e76c30686bafa6 /zkvms/nexus/host | |
| parent | 023070de2dde4df9b809cf04ff09ab1a3af3e01c (diff) | |
| download | zkVMs-benchmarks-e7018851c4b5c44c7e6b7e907ffc186b1da5c9f4.tar zkVMs-benchmarks-e7018851c4b5c44c7e6b7e907ffc186b1da5c9f4.tar.gz zkVMs-benchmarks-e7018851c4b5c44c7e6b7e907ffc186b1da5c9f4.zip | |
feat(zkvms/nexus): Update SDK usage
Update according to their new methods.
Diffstat (limited to 'zkvms/nexus/host')
| -rw-r--r-- | zkvms/nexus/host/Cargo.toml | 2 | ||||
| -rw-r--r-- | zkvms/nexus/host/src/main.rs | 46 |
2 files changed, 22 insertions, 26 deletions
diff --git a/zkvms/nexus/host/Cargo.toml b/zkvms/nexus/host/Cargo.toml index 29b3533..bfa9818 100644 --- a/zkvms/nexus/host/Cargo.toml +++ b/zkvms/nexus/host/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -nexus-sdk = { path = "/nix/store/crj1vza7idyckr20y72ai3cv2fkc0ia8-Nexus-zkVM-unstable-2025-03-11/sdk" } +nexus-sdk = { path = "/nix/store/63pzywhap3cxlqf74wjdwxxc66w7f29w-Nexus-zkVM-unstable-2025-03-11/sdk" } zkvms_host_io = { path = "../../../zkvms_host_io" } diff --git a/zkvms/nexus/host/src/main.rs b/zkvms/nexus/host/src/main.rs index 1a3f05a..0ef044d 100644 --- a/zkvms/nexus/host/src/main.rs +++ b/zkvms/nexus/host/src/main.rs @@ -1,10 +1,9 @@ use nexus_sdk::{ - compile::CompileOpts, - nova::seq::{Generate, Nova, PP}, - Local, Prover, Verifiable, + stwo::seq::Stwo, + Local, Prover, Verifiable, Viewable, }; use zkvms_host_io::{ - benchmarkable, read_args, Input, Output, + benchmarkable, read_args, Input, Return, RunType::{Execute, Prove, Verify}, }; @@ -16,53 +15,50 @@ fn main() { let elf_path = std::env::var("ELF_PATH").expect("ELF PATH is missing"); - println!("Setting up Nova public parameters..."); - let pp: PP = PP::generate().expect("failed to generate parameters"); - match run_info.run_type { Execute => unreachable!(), Prove => benchmarkable! { - // Nova<T> doesn't derive Clone + // Stwo<T> doesn't derive Clone println!("Loading guest..."); - let prover: Nova<Local> = Nova::new_from_file(&elf_path).expect("failed to load guest program"); + let prover: Stwo<Local> = Stwo::new_from_file(&elf_path).expect("failed to load guest program"); println!("Proving execution of vm..."); - let proof = prover - .prove_with_input::<Input>(&pp, &run_info.input) + let (view, _) = prover + .prove_with_input(&run_info.private_input, &run_info.public_input) .expect("failed to prove program"); println!( " output is {:?}!", - proof - .output::<Output>() + view + .public_output::<Return>() .expect("failed to deserialize output") ); - println!(">>>>> Logging\n{}<<<<<", proof.logs().join("")); + println!(">>>>> Logging\n{}<<<<<", view.logs().expect("failed to retrieve debug logs").join("")); }, Verify => { - // Nova<T> doesn't derive Clone + // Stwo<T> doesn't derive Clone println!("Loading guest..."); - let prover: Nova<Local> = - Nova::new_from_file(&elf_path).expect("failed to load guest program"); + let prover: Stwo<Local> = Stwo::new_from_file(&elf_path).expect("failed to load guest program"); println!("Proving execution of vm..."); - let proof = prover - .prove_with_input::<Input>(&pp, &run_info.input) + let (view, proof) = prover + .prove_with_input(&run_info.private_input, &run_info.public_input) .expect("failed to prove program"); println!( " output is {:?}!", - proof - .output::<Output>() - .expect("failed to deserialize output") - ); + view + .public_output::<Return>() + .expect("failed to deserialize output") + ); - println!(">>>>> Logging\n{}<<<<<", proof.logs().join("")); + println!(">>>>> Logging\n{}<<<<<", view.logs().expect("failed to retrieve debug logs").join("")); benchmarkable! { print!("Verifying execution..."); - proof.verify(&pp).expect("failed to verify proof"); + proof.verify(&view).expect("failed to verify proof"); + println!(" Succeeded!"); } } } |
