Rust examples for RISC Zero
(This repository has been deprecated. These examples now live in the examples directory of the main RISC Zero repository.)
These RISC Zero examples have been moved to the main risc0/risc0 repository
License: Apache License 2.0
(This repository has been deprecated. These examples now live in the examples directory of the main RISC Zero repository.)
Running:
cargo run --release --bin prove -- -i waldo.webp -x 1150 -y 291 -w 58 -h 70 -m waldo_mask.png
results in:
Running `target/release/prove -i waldo.webp -x 1150 -y 291 -w 58 -h 70 -m waldo_mask.png`
Read image at waldo.webp with size: 2800 x 1760
Read image mask at waldo_mask.png
Created Merkle tree from image with root Node(631d3ed302c665a793fe4da7fedc0354016bd5946d2e1637fc813c409e39b6a8)
Running the prover to cut out Waldo at (1150, 291) with dimensions (58, 70)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: eqz failed at: cirgen/components/ram.cpp:94', /Users/flaub/.cargo/git/checkouts/risc0-7d6ab9951628e5b1/d6fc82a/risc0/zkp/src/prove/executor.rs:191:22
Examples should be based off of HEAD of https://github.com/risc0/risc0 (in part to match https://github.com/risc0/risc0-rust-starter for easier documentation and use; but see also risc0/risc0-rust-starter#24 for general discussion of why to do depend on HEAD)
This repository has been migrated into https://github.com/risc0/risc0/tree/main/examples. Ensure all associated content (e.g. issues) is appropriately migrated, put up a redirection notice, and archive this repository.
Based on the test results from this PR #45 (CI run: https://github.com/risc0/risc0-rust-examples/actions/runs/4028293123/jobs/6925018354), the risc0_zkvm::guest::sha::digest
appears to be broken. I confirmed this and was able to work around it by using a different method, but this one should be fixed (or removed)
In #19, there is an error parsing the chess board state String. If the length of this string is not a multiple of 4, it gives an error about "Double wrote write-once memory". I padded the board with whitespace in #19 as a workaround. But I also made a branch https://github.com/risc0/risc0-rust-examples/tree/tzerrell/chess-failure without the workaround, which exhibits the error.
Given the "multiple of 4" condition, I suspect an alignment issue.
In step 2 of the Hello Multiply tutorial, there's a section that says,
"While we're at it, let's change the rest of the references in factors/src/main.rs. Don't worry about why these lines are included yet; for now, we're just being diligent not to leave dead references behind. Here are what the other two lines with METHOD_NAME_ELF and METHOD_NAME_ID should look like after updating:
let mut prover = Prover::new(MULTIPLY_ELF, MULTIPLY_ID)
.expect("Prover should be constructed from valid method source code and corresponding image ID");
...
receipt.verify(MULTIPLY_ID)
.expect("Code you have proven should successfully verify; did you specify the correct image ID?");
"
I believe there is another line you have to change/delete:
let method_code = std::fs::read(METHOD_NAME_PATH)
.expect("Method code should be present at the specified path; did you use the correct *_PATH constant?");
Most older examples include a section in their methods/guest/Cargo.toml
file that reads
[profile.release]
lto = true
opt-level = "z"
The more recent examples omit this section. Let's determine whether this section is beneficial, and either include or remove it from all examples.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.