diff --git a/risc0-cw-verifier/.cargo/config b/risc0-cw-verifier/.cargo/config new file mode 100644 index 0000000..a9bc11f --- /dev/null +++ b/risc0-cw-verifier/.cargo/config @@ -0,0 +1,2 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" diff --git a/risc0-cw-verifier/Cargo.toml b/risc0-cw-verifier/Cargo.toml new file mode 100644 index 0000000..507a4a0 --- /dev/null +++ b/risc0-cw-verifier/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "risc0-cw-verifier" +version = "0.1.0" +edition = "2021" + +[dependencies] +risc0-zkp = { version = "0.21.0", default-features = false } +risc0-zkvm = { version = "0.21.0", default-features = false } + diff --git a/risc0-cw-verifier/README.md b/risc0-cw-verifier/README.md new file mode 100644 index 0000000..5da5f61 --- /dev/null +++ b/risc0-cw-verifier/README.md @@ -0,0 +1,6 @@ +# risc0 verifier for WASM + +```shell +$ # check that code compiles on WASM target +$ cargo wasm +``` diff --git a/risc0-cw-verifier/src/main.rs b/risc0-cw-verifier/src/main.rs new file mode 100644 index 0000000..ac48182 --- /dev/null +++ b/risc0-cw-verifier/src/main.rs @@ -0,0 +1,32 @@ +use risc0_zkp::core::digest::Digest; +use risc0_zkvm::{ExitCode, InnerReceipt, Journal, Receipt, ReceiptClaim, SystemState}; + +fn main() { + // create dummy receipt + // TODO: replace this with code for deserializing a real receipt + let receipt = Receipt { + inner: InnerReceipt::Fake { + claim: ReceiptClaim { + pre: SystemState { + pc: 0, + merkle_root: Digest::ZERO, + } + .into(), + post: SystemState { + pc: 0, + merkle_root: Digest::ZERO, + } + .into(), + exit_code: ExitCode::Halted(0), + input: Digest::ZERO.into(), + output: None.into(), + }, + }, + journal: Journal { bytes: vec![] }, + }; + + // Verify receipt, panic if it's wrong + receipt + .verify(Digest::ZERO) + .expect("dummy receipt fails to verify"); +}