Giter Site home page Giter Site logo

risc0 / risc0 Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 315.0 81.71 MB

RISC Zero is a zero-knowledge verifiable general computing platform based on zk-STARKs and the RISC-V microarchitecture.

Home Page: https://risczero.com

License: Apache License 2.0

C++ 67.34% C 0.03% Rust 21.62% Cuda 4.59% Metal 4.85% Assembly 0.09% Python 0.18% Solidity 0.50% Dockerfile 0.02% HTML 0.16% JavaScript 0.07% CSS 0.01% TeX 0.44% Circom 0.09% Shell 0.01%
cryptography risc-v rust stark virtual-machine zero-knowledge

risc0's Introduction

Crates.io MIT licensed Build Status Discord chat Twitter

WARNING: This software is still experimental, we do not recommend it for production use (see Security section).

RISC Zero is a zero-knowledge verifiable general computing platform based on zk-STARKs and the RISC-V microarchitecture.

A zero knowledge proof allows one party (the prover) to convince another party (the verifier) that something is true without revealing all the details. In the case of RISC Zero, the prover can show they correctly executed some code (known to both parties), while only revealing to the verifier the output of the code, not any of its inputs or any state during execution.

The code runs in a special virtual machine, called a zkVM. The RISC Zero zkVM emulates a small RISC-V computer, allowing it to run arbitrary code in any language, so long as a compiler toolchain exists that targets RISC-V. Currently, SDK support exists for Rust, C, and C++.

Protocol overview and terminology

First, the code to be proven must be compiled from its implementation language into a method. A method is represented by a RISC-V ELF file with a special entry point that runs the code of the method. Additionally, one can compute for a given method its image ID which is a special type of cryptographic hash of the ELF file, and is required for verification.

Next, the host program runs and proves the method inside the zkVM. The logical RISC-V machine running inside the zkVM is called the guest and the prover running the zkVM is called the host. The guest and the host can communicate with each other during the execution of the method, but the host cannot modify the execution of the guest in any way, or the proof being generated will be invalid. During execution, the guest code can write to a special append-only log called the journal that represents the official output of the computation.

Presuming the method terminated correctly, a receipt is produced, which provides the proof of correct execution. This receipt consists of 2 parts: the journal written during execution and a blob of opaque cryptographic data called the seal.

The verifier can then verify the receipt and examine the log. If any tampering was done to the journal or the seal, the receipt will fail to verify. Additionally, it is cryptographically infeasible to generate a valid receipt unless the output of the journal is the exactly correct output for some valid execution of the method whose image ID matches the receipt. In summary, the receipt acts as a zero knowledge proof of correct execution.

Because the protocol is zero knowledge, the verifier cannot infer anything about the details of the execution or any data passed between the host and the guest (aside from what is implied by the data written to the journal and the correct execution of the code).

Security

This code is based on the well studied zk-STARK protocol, which has been proven secure under the random oracle model, with the only assumption being the security of the cryptographic hash used. Our implementation uses SHA-256 for that hash and targets 100 bits of security.

That said, this code is still under heavy development and has not been audited. There may be bugs in the zk-STARK implementation, the arithmetic circuit used to instantiate the RISC-V zkVM, or any other element of the code's implementation. Such bugs may impact the security of receipts, leak information, or cause any other manner of problems. Caveat emptor.

Getting Started

To start your own project, you can use our cargo risczero tool to write the initial boilerplate and set up a standard directory structure.

First, install Rust if you don't already have it, then install the cargo risczero tool. We'll use cargo binstall to get cargo-risczero installed. See cargo-binstall for more details.

cargo install cargo-binstall
cargo binstall cargo-risczero

Next we'll need to install the risc0 toolchain with:

cargo risczero install

Then, create a new project (named my_project in this example):

cargo risczero new my_project

More details and options for cargo risczero are given in its README.

For more guidance on how to use RISC Zero, how RISC Zero projects are typically structured, and other resources useful to developers new to RISC Zero, see our Getting Started page.

Building from source

Building from source requires some additional tools and steps. Please refer to CONTRIBUTING.md for the full instructions.

Rust Binaries

crate crates.io
cargo-risczero x
risc0-r0vm x
risc0-tools x

Rust Libraries

crate crates.io docs.rs
bonsai-sdk x
risc0-binfmt x
risc0-build x
risc0-build-kernel x
risc0-circuit-recursion x
risc0-circuit-recursion-sys x
risc0-circuit-rv32im x
risc0-circuit-rv32im-sys x
risc0-core x
risc0-sys x
risc0-zkp x
risc0-zkvm x
risc0-zkvm-platform x

Feature flags

The following feature flags are present in one or more of the crates listed above:

Feature Target(s) Implies Description Crates
client all except rv32im std Enables the client API. risc0-zkvm
cuda prove, std Enables CUDA GPU acceleration for the prover. Requires CUDA toolkit to be installed. risc0-circuit-recursion, risc0-circuit-rv32im, risc0-zkp, risc0-zkvm
disable-dev-mode all except rv32im Disables dev mode so that proving and verifying may not be faked. Used to prevent a misplaced RISC0_DEV_MODE from breaking security in production systems. risc0-zkvm
metal macos prove, std Enables Metal GPU acceleration for the prover. risc0-circuit-recursion, risc0-circuit-rv32im, risc0-zkp, risc0-zkvm
prove all except rv32im std Enables the prover, incompatible within the zkvm guest. risc0-circuit-recursion, risc0-circuit-rv32im, risc0-zkp, risc0-zkvm
std all Support for the Rust stdlib. risc0-circuit-recursion, risc0-circuit-rv32im, risc0-zkp, risc0-zkvm

License

This project is licensed under the Apache2 license. See LICENSE.

risc0's People

Contributors

3lkn avatar austinabell avatar boltonbailey avatar brianretford avatar capossele avatar cardosaum avatar choongng avatar criadoperez avatar dependabot[bot] avatar elakn avatar flaub avatar hashcashier avatar hmrtn avatar imdaisyadams avatar intoverflow avatar it09 avatar jbruestle avatar justinfrevert avatar morgangibbs87 avatar mothran avatar nategraf avatar omahs avatar pdg744 avatar rlukata avatar roee-87 avatar schmerik avatar shkoo avatar spaugh avatar tzerrell avatar weikengchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

risc0's Issues

Build fails on Opensuse

Environment

OS: openSUSE Tumbleweed x86_64
Kernel: 5.17.9-1-default
gcc: 12
g++: 12

Logs

❯ bazelisk build //...

WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
INFO: Reading 'startup' options from /home/lyqingye/workspace/github/risc0/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=183
INFO: Reading rc options for 'build' from /home/lyqingye/workspace/github/risc0/.bazelrc:
  'build' options: -c opt --announce_rc --enable_runfiles --nobuild_python_zip --incompatible_enable_cc_toolchain_resolution --flag_alias=accel=//risc0/zkp/accel:flag --//bazel/rules/clang_format:config=//:.clang-format --@rules_rust//:rustfmt.toml=//bazel/rules/rust:rustfmt.toml
INFO: Analyzed 206 targets (0 packages loaded, 0 targets configured).
INFO: Found 206 targets...
ERROR: /home/lyqingye/workspace/github/risc0/risc0/zkp/verify/BUILD.bazel:5:11: Compiling risc0/zkp/verify/taps.cpp failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 21 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from risc0/zkp/verify/taps.cpp:15:
./risc0/zkp/verify/taps.h:38:18: error: 'size_t' does not name a type
   38 | static constexpr size_t kNumRegisterGroups = 3;
      |                  ^~~~~~
./risc0/zkp/verify/taps.h:21:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
   20 | #include <vector>
  +++ |+#include <cstddef>
   21 | 
./risc0/zkp/verify/taps.h:72:3: error: 'size_t' does not name a type
   72 |   size_t offset() const { return data_->offset; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:72:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:73:3: error: 'size_t' does not name a type
   73 |   size_t back() const { return data_->back; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:73:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:74:3: error: 'size_t' does not name a type
   74 |   size_t comboID() const { return data_->combo; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:74:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:102:3: error: 'size_t' does not name a type
  102 |   size_t offset() const { return data_->offset; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:102:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:103:3: error: 'size_t' does not name a type
  103 |   size_t comboID() const { return data_->combo; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:103:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:110:3: error: 'size_t' does not name a type
  110 |   size_t operator[](size_t i) { return data_[i].back; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:110:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:149:43: error: 'size_t' has not been declared
  149 |   ComboRef(const detail::ComboData* data, size_t id) : data_(data), id_(id) {}
      |                                           ^~~~~~
./risc0/zkp/verify/taps.h:150:3: error: 'size_t' does not name a type
  150 |   size_t id() const { return id_; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:150:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:151:3: error: 'size_t' does not name a type
  151 |   size_t size() const { return data_->offsets[id_ + 1] - data_->offsets[id_]; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:151:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:157:3: error: 'size_t' does not name a type
  157 |   size_t id_;
      |   ^~~~~~
./risc0/zkp/verify/taps.h:157:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h: In constructor 'risc0::ComboRef::ComboRef(const risc0::detail::ComboData*, int)':
./risc0/zkp/verify/taps.h:149:69: error: class 'risc0::ComboRef' does not have any field named 'id_'
  149 |   ComboRef(const detail::ComboData* data, size_t id) : data_(data), id_(id) {}
      |                                                                     ^~~
./risc0/zkp/verify/taps.h: In member function 'const uint16_t* risc0::ComboRef::begin() const':
./risc0/zkp/verify/taps.h:152:71: error: 'id_' was not declared in this scope
  152 |   const uint16_t* begin() const { return data_->taps + data_->offsets[id_]; }
      |                                                                       ^~~
./risc0/zkp/verify/taps.h: In member function 'const uint16_t* risc0::ComboRef::end() const':
./risc0/zkp/verify/taps.h:153:69: error: 'id_' was not declared in this scope
  153 |   const uint16_t* end() const { return data_->taps + data_->offsets[id_ + 1]; }
      |                                                                     ^~~
./risc0/zkp/verify/taps.h: At global scope:
./risc0/zkp/verify/taps.h:162:48: error: 'size_t' has not been declared
  162 |   ComboIterator(const detail::ComboData* data, size_t id) : data_(data), id_(id) {}
      |                                                ^~~~~~
./risc0/zkp/verify/taps.h:171:3: error: 'size_t' does not name a type
  171 |   size_t id_;
      |   ^~~~~~
./risc0/zkp/verify/taps.h:171:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h: In constructor 'risc0::ComboIterator::ComboIterator(const risc0::detail::ComboData*, int)':
./risc0/zkp/verify/taps.h:162:74: error: class 'risc0::ComboIterator' does not have any field named 'id_'
  162 |   ComboIterator(const detail::ComboData* data, size_t id) : data_(data), id_(id) {}
      |                                                                          ^~~
./risc0/zkp/verify/taps.h: In member function 'risc0::ComboRef risc0::ComboIterator::operator*() const':
./risc0/zkp/verify/taps.h:163:55: error: 'id_' was not declared in this scope
  163 |   ComboRef operator*() const { return ComboRef(data_, id_); }
      |                                                       ^~~
./risc0/zkp/verify/taps.h: In member function 'risc0::ComboIterator& risc0::ComboIterator::operator++()':
./risc0/zkp/verify/taps.h:165:5: error: 'id_' was not declared in this scope
  165 |     id_++;
      |     ^~~
./risc0/zkp/verify/taps.h: At global scope:
./risc0/zkp/verify/taps.h:178:3: error: 'size_t' does not name a type
  178 |   size_t groupBegin[kNumRegisterGroups + 1];
      |   ^~~~~~
./risc0/zkp/verify/taps.h:178:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:202:3: error: 'size_t' does not name a type
  202 |   size_t tapsSize() { return data_->groupBegin[kNumRegisterGroups]; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:202:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:226:3: error: 'size_t' does not name a type
  226 |   size_t groupSize(RegisterGroup group) {
      |   ^~~~~~
./risc0/zkp/verify/taps.h:226:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:232:3: error: 'size_t' does not name a type
  232 |   size_t combosSize() const { return data_->combos.count; }
      |   ^~~~~~
./risc0/zkp/verify/taps.h:232:3: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
./risc0/zkp/verify/taps.h:239:21: error: 'size_t' has not been declared
  239 |   ComboRef getCombo(size_t id) { return ComboRef(&data_->combos, id); }
      |                     ^~~~~~
./risc0/zkp/verify/taps.h: In member function 'risc0::IteratorRange<risc0::TapIterator> risc0::TapSetRef::taps()':
./risc0/zkp/verify/taps.h:206:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  206 |                                       data_->taps + data_->groupBegin[kNumRegisterGroups]);
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h:206:71: error: 'kNumRegisterGroups' was not declared in this scope; did you mean 'RegisterGroup'?
  206 |                                       data_->taps + data_->groupBegin[kNumRegisterGroups]);
      |                                                                       ^~~~~~~~~~~~~~~~~~
      |                                                                       RegisterGroup
./risc0/zkp/verify/taps.h: In member function 'risc0::IteratorRange<risc0::RegIterator> risc0::TapSetRef::regs()':
./risc0/zkp/verify/taps.h:211:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  211 |                                       data_->taps + data_->groupBegin[kNumRegisterGroups]);
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h:211:71: error: 'kNumRegisterGroups' was not declared in this scope; did you mean 'RegisterGroup'?
  211 |                                       data_->taps + data_->groupBegin[kNumRegisterGroups]);
      |                                                                       ^~~~~~~~~~~~~~~~~~
      |                                                                       RegisterGroup
./risc0/zkp/verify/taps.h: In member function 'risc0::IteratorRange<risc0::TapIterator> risc0::TapSetRef::groupTaps(risc0::RegisterGroup)':
./risc0/zkp/verify/taps.h:215:5: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'?
  215 |     size_t groupID = static_cast<size_t>(group);
      |     ^~~~~~
      |     std::size_t
In file included from /usr/include/c++/12/cstdint:38,
                 from ./risc0/zkp/verify/taps.h:17:
/usr/include/c++/12/x86_64-suse-linux/bits/c++config.h:2535:33: note: 'std::size_t' declared here
 2535 |   typedef __SIZE_TYPE__         size_t;
      |                                 ^~~~~~
./risc0/zkp/verify/taps.h:216:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  216 |     return IteratorRange<TapIterator>(data_->taps + data_->groupBegin[groupID],
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h:216:71: error: 'groupID' was not declared in this scope; did you mean 'group'?
  216 |     return IteratorRange<TapIterator>(data_->taps + data_->groupBegin[groupID],
      |                                                                       ^~~~~~~
      |                                                                       group
./risc0/zkp/verify/taps.h:217:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  217 |                                       data_->taps + data_->groupBegin[groupID + 1]);
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h: In member function 'risc0::IteratorRange<risc0::RegIterator> risc0::TapSetRef::groupRegs(risc0::RegisterGroup)':
./risc0/zkp/verify/taps.h:221:5: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'?
  221 |     size_t groupID = static_cast<size_t>(group);
      |     ^~~~~~
      |     std::size_t
/usr/include/c++/12/x86_64-suse-linux/bits/c++config.h:2535:33: note: 'std::size_t' declared here
 2535 |   typedef __SIZE_TYPE__         size_t;
      |                                 ^~~~~~
./risc0/zkp/verify/taps.h:222:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  222 |     return IteratorRange<RegIterator>(data_->taps + data_->groupBegin[groupID],
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h:222:71: error: 'groupID' was not declared in this scope; did you mean 'group'?
  222 |     return IteratorRange<RegIterator>(data_->taps + data_->groupBegin[groupID],
      |                                                                       ^~~~~~~
      |                                                                       group
./risc0/zkp/verify/taps.h:223:60: error: 'const struct risc0::detail::TapSetData' has no member named 'groupBegin'
  223 |                                       data_->taps + data_->groupBegin[groupID + 1]);
      |                                                            ^~~~~~~~~~
./risc0/zkp/verify/taps.h: At global scope:
./risc0/zkp/verify/taps.h:242:22: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'?
  242 | using Reg = std::set<size_t>;
      |                      ^~~~~~
      |                      std::size_t
/usr/include/c++/12/x86_64-suse-linux/bits/c++config.h:2535:33: note: 'std::size_t' declared here
 2535 |   typedef __SIZE_TYPE__         size_t;
      |                                 ^~~~~~
./risc0/zkp/verify/taps.h:242:28: error: template argument 1 is invalid
  242 | using Reg = std::set<size_t>;
      |                            ^
./risc0/zkp/verify/taps.h:242:28: error: template argument 2 is invalid
./risc0/zkp/verify/taps.h:242:28: error: template argument 3 is invalid
./risc0/zkp/verify/taps.h:243:24: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'?
  243 | using Group = std::map<size_t, Reg>;
      |                        ^~~~~~
      |                        std::size_t
/usr/include/c++/12/x86_64-suse-linux/bits/c++config.h:2535:33: note: 'std::size_t' declared here
 2535 |   typedef __SIZE_TYPE__         size_t;
      |                                 ^~~~~~
./risc0/zkp/verify/taps.h:243:32: error: 'Reg' was not declared in this scope
  243 | using Group = std::map<size_t, Reg>;
      |                                ^~~
./risc0/zkp/verify/taps.h:243:35: error: template argument 1 is invalid
  243 | using Group = std::map<size_t, Reg>;
      |                                   ^
./risc0/zkp/verify/taps.h:243:35: error: template argument 2 is invalid
./risc0/zkp/verify/taps.h:243:35: error: template argument 3 is invalid
./risc0/zkp/verify/taps.h:243:35: error: template argument 4 is invalid
./risc0/zkp/verify/taps.h:244:37: error: 'Group' was not declared in this scope
  244 | using All = std::map<RegisterGroup, Group>;
      |                                     ^~~~~
./risc0/zkp/verify/taps.h:244:42: error: template argument 2 is invalid
  244 | using All = std::map<RegisterGroup, Group>;
      |                                          ^
./risc0/zkp/verify/taps.h:244:42: error: template argument 4 is invalid
./risc0/zkp/verify/taps.h:254:16: error: 'All' does not name a type
  254 |   TapSet(const All& all);
      |                ^~~
risc0/zkp/verify/taps.cpp:25:22: error: 'All' does not name a type
   25 | TapSet::TapSet(const All& all) {
      |                      ^~~
risc0/zkp/verify/taps.cpp: In constructor 'risc0::TapSet::TapSet(const int&)':
risc0/zkp/verify/taps.cpp:26:15: error: 'Reg' was not declared in this scope
   26 |   std::vector<Reg> combos;
      |               ^~~
risc0/zkp/verify/taps.cpp:26:18: error: template argument 1 is invalid
   26 |   std::vector<Reg> combos;
      |                  ^
risc0/zkp/verify/taps.cpp:26:18: error: template argument 2 is invalid
risc0/zkp/verify/taps.cpp:27:23: error: template argument 3 is invalid
   27 |   std::map<Reg, size_t> combosToID;
      |                       ^
risc0/zkp/verify/taps.cpp:27:23: error: template argument 4 is invalid
risc0/zkp/verify/taps.cpp:30:10: error: request for member 'push_back' in 'combos', which is of non-class type 'int'
   30 |   combos.push_back(self);
      |          ^~~~~~~~~
risc0/zkp/verify/taps.cpp:31:14: error: request for member 'insert' in 'combosToID', which is of non-class type 'int'
   31 |   combosToID.insert(std::make_pair(self, 0));
      |              ^~~~~~
risc0/zkp/verify/taps.cpp:33:38: error: 'kNumRegisterGroups' was not declared in this scope; did you mean 'RegisterGroup'?
   33 |   for (size_t groupID = 0; groupID < kNumRegisterGroups; groupID++) {
      |                                      ^~~~~~~~~~~~~~~~~~
      |                                      RegisterGroup
In file included from risc0/zkp/verify/taps.cpp:17:
risc0/zkp/verify/taps.cpp:36:17: error: request for member 'count' in 'all', which is of non-class type 'const int'
   36 |     REQUIRE(all.count(group));
      |                 ^~~~~
./risc0/core/util.h:25:11: note: in definition of macro 'REQUIRE'
   25 |     if (!(x)) {                                                                                    \
      |           ^
risc0/zkp/verify/taps.cpp:38:11: error: 'struct risc0::detail::TapSetData' has no member named 'groupBegin'
   38 |     data_.groupBegin[groupID] = taps_.size();
      |           ^~~~~~~~~~
risc0/zkp/verify/taps.cpp:40:11: error: 'Group' does not name a type
   40 |     const Group& regs = all.at(group);
      |           ^~~~~
risc0/zkp/verify/taps.cpp:42:23: error: 'regs' was not declared in this scope
   42 |     size_t regCount = regs.rbegin()->first + 1;
      |                       ^~~~
risc0/zkp/verify/taps.cpp:47:10: error: expected ';' before 'combo'
   47 |       Reg combo = regs.at(reg);
      |          ^~~~~~
      |          ;
risc0/zkp/verify/taps.cpp:48:15: error: 'combo' was not declared in this scope; did you mean 'combos'?
   48 |       REQUIRE(combo.size() > 0);
      |               ^~~~~
./risc0/core/util.h:25:11: note: in definition of macro 'REQUIRE'
   25 |     if (!(x)) {                                                                                    \
      |           ^
risc0/zkp/verify/taps.cpp:50:23: error: request for member 'count' in 'combosToID', which is of non-class type 'int'
   50 |       if (!combosToID.count(combo)) {
      |                       ^~~~~
risc0/zkp/verify/taps.cpp:50:29: error: 'combo' was not declared in this scope; did you mean 'combos'?
   50 |       if (!combosToID.count(combo)) {
      |                             ^~~~~
      |                             combos
risc0/zkp/verify/taps.cpp:51:36: error: request for member 'size' in 'combos', which is of non-class type 'int'
   51 |         combosToID[combo] = combos.size();
      |                                    ^~~~
risc0/zkp/verify/taps.cpp:52:16: error: request for member 'push_back' in 'combos', which is of non-class type 'int'
   52 |         combos.push_back(combo);
      |                ^~~~~~~~~
risc0/zkp/verify/taps.cpp:55:35: error: 'combo' was not declared in this scope; did you mean 'combos'?
   55 |       size_t comboID = combosToID[combo];
      |                                   ^~~~~
      |                                   combos
risc0/zkp/verify/taps.cpp:72:9: error: 'struct risc0::detail::TapSetData' has no member named 'groupBegin'
   72 |   data_.groupBegin[kNumRegisterGroups] = taps_.size();
      |         ^~~~~~~~~~
risc0/zkp/verify/taps.cpp:72:20: error: 'kNumRegisterGroups' was not declared in this scope; did you mean 'RegisterGroup'?
   72 |   data_.groupBegin[kNumRegisterGroups] = taps_.size();
      |                    ^~~~~~~~~~~~~~~~~~
      |                    RegisterGroup
risc0/zkp/verify/taps.cpp:75:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   75 |   for (auto combo : combos) {
      |                     ^~~~~~
      |                     std::begin
In file included from /usr/include/c++/12/map:63,
                 from ./risc0/zkp/verify/taps.h:18:
/usr/include/c++/12/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
risc0/zkp/verify/taps.cpp:75:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
   75 |   for (auto combo : combos) {
      |                     ^~~~~~
      |                     std::end
/usr/include/c++/12/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
risc0/zkp/verify/taps.cpp:85:31: error: request for member 'size' in 'combos', which is of non-class type 'int'
   85 |   data_.combos.count = combos.size();
      |                               ^~~~
INFO: Elapsed time: 0.606s, Critical Path: 0.43s
INFO: 40 processes: 35 internal, 5 linux-sandbox.
FAILED: Build did NOT complete successfully

Did not build successfully under mac Intel

Here is my failed info :

ERROR: /Users/karlyu/risc0/risc0/zkvm/sdk/cpp/guest/BUILD.bazel:10:17: Compiling risc0/zkvm/sdk/cpp/guest/cppstd.cpp failed: (Aborted): riscv32-unknown-elf-gcc failed: error executing command external/risc0_toolchain_riscv32im-osx-x86_64/bin/riscv32-unknown-elf-gcc '-DRISCV=1' '-mabi=ilp32' '-march=rv32im' -ffreestanding -fno-strict-aliasing -fno-exceptions -fno-non-call-exceptions -Wall ... (remaining 34 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
dyld: Symbol not found: __ZTTNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE
  Referenced from: /private/var/tmp/_bazel_karlyu/06f658563a59c318505fb96938db5614/sandbox/darwin-sandbox/164/execroot/risc0/external/risc0_toolchain_riscv32im-osx-x86_64/bin/riscv32-unknown-elf-gcc (which was built for Mac OS X 12.0)
  Expected in: /usr/lib/libc++.1.dylib
 in /private/var/tmp/_bazel_karlyu/06f658563a59c318505fb96938db5614/sandbox/darwin-sandbox/164/execroot/risc0/external/risc0_toolchain_riscv32im-osx-x86_64/bin/riscv32-unknown-elf-gcc



FAILED: Build did NOT complete successfully
//examples/cpp/battleship:test                                        NO STATUS
//examples/cpp/deck:test                                              NO STATUS
//examples/rust/battleship:test                                       NO STATUS
//examples/rust/battleship/core:test                                  NO STATUS
//examples/rust/digital_signature:test                                NO STATUS
//examples/rust/votingmachine:test                                    NO STATUS
//risc0/core/test:test                                                NO STATUS
//risc0/zkp/accel/test:test                                           NO STATUS
//risc0/zkp/core/test:test                                            NO STATUS
//risc0/zkp/prove/test:test                                           NO STATUS
//risc0/zkvm/circuit/test:add_test                                    NO STATUS
//risc0/zkvm/circuit/test:addi_test                                   NO STATUS
//risc0/zkvm/circuit/test:and_test                                    NO STATUS
//risc0/zkvm/circuit/test:andi_test                                   NO STATUS
//risc0/zkvm/circuit/test:auipc_test                                  NO STATUS
//risc0/zkvm/circuit/test:beq_test                                    NO STATUS
//risc0/zkvm/circuit/test:bge_test                                    NO STATUS
//risc0/zkvm/circuit/test:bgeu_test                                   NO STATUS
//risc0/zkvm/circuit/test:blt_test                                    NO STATUS
//risc0/zkvm/circuit/test:bltu_test                                   NO STATUS
//risc0/zkvm/circuit/test:bne_test                                    NO STATUS
//risc0/zkvm/circuit/test:div_test                                    NO STATUS
//risc0/zkvm/circuit/test:divu_test                                   NO STATUS
//risc0/zkvm/circuit/test:jal_test                                    NO STATUS
//risc0/zkvm/circuit/test:jalr_test                                   NO STATUS
//risc0/zkvm/circuit/test:lb_test                                     NO STATUS
//risc0/zkvm/circuit/test:lbu_test                                    NO STATUS
//risc0/zkvm/circuit/test:lh_test                                     NO STATUS
//risc0/zkvm/circuit/test:lhu_test                                    NO STATUS
//risc0/zkvm/circuit/test:lui_test                                    NO STATUS
//risc0/zkvm/circuit/test:lw_test                                     NO STATUS
//risc0/zkvm/circuit/test:mul_test                                    NO STATUS
//risc0/zkvm/circuit/test:mulh_test                                   NO STATUS
//risc0/zkvm/circuit/test:mulhsu_test                                 NO STATUS
//risc0/zkvm/circuit/test:mulhu_test                                  NO STATUS
//risc0/zkvm/circuit/test:or_test                                     NO STATUS
//risc0/zkvm/circuit/test:ori_test                                    NO STATUS
//risc0/zkvm/circuit/test:rem_test                                    NO STATUS
//risc0/zkvm/circuit/test:remu_test                                   NO STATUS
//risc0/zkvm/circuit/test:sb_test                                     NO STATUS
//risc0/zkvm/circuit/test:sh_test                                     NO STATUS
//risc0/zkvm/circuit/test:simple_test                                 NO STATUS
//risc0/zkvm/circuit/test:sll_test                                    NO STATUS
//risc0/zkvm/circuit/test:slli_test                                   NO STATUS
//risc0/zkvm/circuit/test:slt_test                                    NO STATUS
//risc0/zkvm/circuit/test:slti_test                                   NO STATUS
//risc0/zkvm/circuit/test:sltiu_test                                  NO STATUS
//risc0/zkvm/circuit/test:sltu_test                                   NO STATUS
//risc0/zkvm/circuit/test:sra_test                                    NO STATUS
//risc0/zkvm/circuit/test:srai_test                                   NO STATUS
//risc0/zkvm/circuit/test:srl_test                                    NO STATUS
//risc0/zkvm/circuit/test:srli_test                                   NO STATUS
//risc0/zkvm/circuit/test:sub_test                                    NO STATUS
//risc0/zkvm/circuit/test:sw_test                                     NO STATUS
//risc0/zkvm/circuit/test:xor_test                                    NO STATUS
//risc0/zkvm/circuit/test:xori_test                                   NO STATUS
//risc0/zkvm/prove/test:test                                          NO STATUS
//risc0/zkvm/sdk/cpp/guest/test:test                                  NO STATUS
//risc0/zkvm/sdk/rust/core:test_guest                                 NO STATUS
//risc0/zkvm/sdk/rust/core:test_host                                  NO STATUS
//risc0/zkvm/sdk/rust/serde:test_guest                                NO STATUS
//risc0/zkvm/sdk/rust/serde:test_host                                 NO STATUS

FAILED: Build did NOT complete successfully

Improve error message for MethodId verification failures

A clear error message should be presented when MethodId verification fails. Especially in the case where the generated MethodId is smaller than the number of cycles (we run off the end of the table). A helpful error message directing the user to use the code_limit parameter of embed_methods_with_options function would be good.

Circuit file names and line numbers leak into verifier release builds and takes up a lot of rodata space

Example from a WASM release build:

cirgen/circuit/rv32im/top.cpp:18cirgen/components/bytes.cpp:21cirgen/components/bytes.cpp:34cirgen/components/bytes.cpp:37cirgen/components/bytes.cpp:82cirgen/components/bytes.cpp:83cirgen/circuit/rv32im/body.cpp:14cirgen/circuit/rv32im/body.cpp:17cirgen/circuit/rv32im/body.cpp:18cirgen/circuit/rv32im/body.cpp:43cirgen/circuit/rv32im/body.cpp:29cirgen/circuit/rv32im/body.cpp:30cirgen/circuit/rv32im/body.cpp:31./cirgen/components/onehot.h:35cirgen/circuit/rv32im/decode.cpp:11cirgen/circuit/rv32im/decode.cpp:12cirgen/circuit/rv32im/decode.cpp:13cirgen/circuit/rv32im/decode.cpp:15cirgen/circuit/rv32im/decode.cpp:23cirgen/circuit/rv32im/compute.cpp:17cirgen/circuit/rv32im/compute.cpp:45cirgen/circuit/rv32im/decode.cpp:71cirgen/circuit/rv32im/compute.cpp:134cirgen/components/u32.cpp:59./cirgen/circuit/rv32im/rv32im.inl:37./cirgen/circuit/rv32im/rv32im.inl:44cirgen/circuit/rv32im/decode.cpp:89./cirgen/circuit/rv32im/rv32im.inl:50./cirgen/circuit/rv32im/rv32im.inl:56./cirgen/circuit/rv32im/rv32im.inl:57./cirgen/circuit/rv32im/rv32im.inl:58./cirgen/circuit/rv32im/rv32im.inl:59cirgen/circuit/rv32im/memio.cpp:80./cirgen/circuit/rv32im/rv32im.inl:82cirgen/components/u32.cpp:183cirgen/components/u32.cpp:228cirgen/components/u32.cpp:232cirgen/circuit/rv32im/ecall.cpp:128cirgen/circuit/rv32im/ecall.cpp:133cirgen/circuit/rv32im/ecall.cpp:40cirgen/circuit/rv32im/ecall.cpp:42cirgen/circuit/rv32im/ecall.cpp:94cirgen/circuit/rv32im/sha.cpp:195cirgen/circuit/rv32im/sha.cpp:196cirgen/circuit/rv32im/sha.cpp:104cirgen/circuit/rv32im/sha.cpp:111cirgen/circuit/rv32im/sha.cpp:286cirgen/circuit/rv32im/sha.cpp:290cirgen/circuit/rv32im/sha.cpp:319cirgen/circuit/rv32im/sha.cpp:364cirgen/circuit/rv32im/ffpu.cpp:37cirgen/circuit/rv32im/ffpu.cpp:70cirgen/components/ram.cpp:21cirgen/c omponents/ram.cpp:22cirgen/circuit/rv32im/ffpu.cpp:41cirgen/circuit/rv32im/ffpu.cpp:45cirgen/circuit/rv32im/rv32im.cpp:18Top/Code/OneHot/Reg1(./cirgen/components/mux.h:37)Top/Code/OneHot/Reg1(cirgen/circuit/rv32im/top.cpp:18)Top/Code/Mux/1/Reg(./cirgen/compiler/edsl/com ponent.h:85)cirgen/components/bytes.cpp:22cirgen/components/bytes.cpp:102cirgen/components/bytes.cpp:103Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement20/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement20/Reg1(./cirgen/compiler /edsl/component.h:85)cirgen/components/bytes.cpp:44cirgen/components/bytes.cpp:45cirgen/components/bytes.cpp:46cirgen/components/bytes.cpp:47cirgen/components/bytes.cpp:48Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement1/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/B ytesSetup/PlonkBody/BytesPlonkElement1/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement2/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement2/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/Bytes Setup/PlonkBody/BytesPlonkElement3/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement3/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement4/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup /PlonkBody/BytesPlonkElement4/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement5/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement5/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/Plo nkBody/BytesPlonkElement6/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement6/Reg1(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBody/BytesPlonkElement7/Reg(./cirgen/compiler/edsl/edsl.h:110)Top/Mux/1/BytesSetup/PlonkBod y/BytesPlonkElement7/Reg1(./cirgen/compiler/edsl/edsl.h:110)cirgen/components/bytes.cpp:112cirgen/components/bytes.cpp:113cirgen/components/bytes.cpp:110cirgen/components/bytes.cpp:116./cirgen/components/mux.h:37Top/Code/OneHot/Reg2(./cirgen/components/mux.h:37)Top/Code /Mux/2/Reg1(./cirgen/compiler/edsl/component.h:85)cirgen/components/bytes.cpp:87Top/Code/Mux/2/Reg2(./cirgen/compiler/edsl/component.h:85)Top/Code/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/components/u32.cpp:28cirgen/components/ram.cpp:104cirgen/components/ram.cp p:105cirgen/components/ram.cpp:106Top/Code/Mux/2/Reg3(./cirgen/compiler/edsl/component.h:85)Top/Code/Mux/2/Reg4(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/top.cpp:35Top/Code/Mux/2/Reg5(./cirgen/compiler/edsl/component.h:85)Top/Code/Mux/2/Reg6(./cirgen/c ompiler/edsl/component.h:85)Top/Code/OneHot/Reg3(./cirgen/components/mux.h:37)./cirgen/components/bits.h:57cirgen/circuit/rv32im/body.cpp:22cirgen/circuit/rv32im/body.cpp:23Top/Code/OneHot/Reg4(./cirgen/components/mux.h:37)Top/Mux/4/BytesBody/PlonkBody/BytesPlonkElement /Reg(cirgen/components/bytes.cpp:78)Top/Mux/4/BytesBody/PlonkBody/BytesPlonkElement/Reg1(cirgen/components/bytes.cpp:78)cirgen/circuit/rv32im/body.cpp:28cirgen/circuit/rv32im/body.cpp:27Top/Mux/4/BytesBody/PlonkBody/BytesPlonkElement1/Reg(cirgen/components/bytes.cpp:78) Top/Mux/4/PCReg/Twit/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/PCReg/Twit1/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/OneHot/Reg(./cirgen/components/mux.h:37)cirgen/circuit/rv32im/compute.cpp:112Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkE lement/U32Reg/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement/U32Reg/Reg1(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement/U32Reg/Reg2(./cirgen/compiler/edsl/com ponent.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement/U32Reg/Reg3(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit2/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:53Top/Mux/4/Mux/0/ComputeCyc le/Decoder/Twit1/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:57Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit1/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4 /Mux/0/ComputeCycle/Decoder/Twit/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:30Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit5/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit4/Reg(./cirgen/compiler/edsl/compone nt.h:85)cirgen/circuit/rv32im/decode.cpp:31Top/Mux/4/Mux/0/ComputeCycle/Decoder/Twit2/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit3/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Twit4/Reg(./cirgen/co mpiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Twit3/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit6/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:32Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bi t7/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:49Top/Mux/4/Mux/0/ComputeCycle/Decoder/Twit5/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Twit7/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/Comp uteCycle/Decoder/Twit6/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Decoder/Bit8/Reg(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:33Top/Mux/4/Mux/0/ComputeCycle/Decoder/Reg(./cirgen/compiler/edsl/edsl.h:110)cirgen/circ uit/rv32im/decode.cpp:37Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement1/U32Reg/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement1/U32Reg/Reg1(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/Com puteCycle/RamBody/PlonkBody/RamPlonkElement1/U32Reg/Reg2(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement1/U32Reg/Reg3(./cirgen/compiler/edsl/component.h:85)cirgen/circuit/rv32im/decode.cpp:41cirgen/circuit/rv32im/comp ute.cpp:135Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement2/U32Reg/Reg(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement2/U32Reg/Reg1(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/Ram Body/PlonkBody/RamPlonkElement2/U32Reg/Reg2(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/RamBody/PlonkBody/RamPlonkElement2/U32Reg/Reg3(./cirgen/compiler/edsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/ComputeControl/U32Reg/Reg(./cirgen/compiler/e dsl/component.h:85)Top/Mux/4/Mux/0/ComputeCycle/ComputeControl/U32Reg/Reg1(./cirgen/compiler/edsl/component.h:85)

Where is code of rule checks to validate RISC computation?

Hi, I am reading the documentation of RISC Zero where said the below description.

In the full RISC-V implementation, the rules make up what it means to execute RISC-V instructions properly (i.e. checking that the program counter increments after every instruction). We check thousands of rules in order to validate the execution trace.

I want to know what those rules are, and I tried to find them in implementation but did not find them. Does anyone know where is the implementation of those rules?

Make ELF binaries build deterministically

Currently when Cargo builds the guest methods, the resulting ELF files are not built deterministically (don't know why) resulting in incompatible method IDs. Technically only the 'loadable' part of the ELF needs to be deterministic.

Discuss its performance characteristics

  • Whether the performance of risc0 is linearly proportional to a regular risc processor
    • If so, what the proportion is, or what we can expect it to reach after sufficient optimization.
    • If not, what characteristics of the risc programs will determine their runtime in risc0? I couldn't guess.

Without knowing these things, it's difficult to estimate the impact or usefulness of risc0.

Compilation failes due to `downloader` package update.

Compilation of the risc0-rust-starter fails. The problem is the latest downloader 0.2.7. cargo update -p downloader --precise 0.2.6 is a rescue here, but it's better to drop the dependency on this package, and get something more mature. Another option is updating the toolchain date.

Logs:

[2023/01/04 17:49:09] ziel ~/workspace/risc0 
o_0 > git clone https://github.com/risc0/risc0-rust-starter
Cloning into 'risc0-rust-starter'...
remote: Enumerating objects: 296, done.
remote: Counting objects: 100% (154/154), done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 296 (delta 101), reused 80 (delta 60), pack-reused 142
Receiving objects: 100% (296/296), 74.76 KiB | 1.70 MiB/s, done.
Resolving deltas: 100% (121/121), done.
[2023/01/04 17:49:54] ziel ~/workspace/risc0 
o_0 > cd risc0-rust-starter/
[2023/01/04 17:50:01] ziel ~/workspace/risc0/risc0-rust-starter main
o_0 > cargo run
    Updating git repository `https://github.com/risc0/risc0.git`
    Updating crates.io index
   Compiling libc v0.2.139
   ...
   Compiling downloader v0.2.7
error[E0658]: `let...else` statements are unstable
  --> /home/ziel/.cargo/registry/src/github.com-1ecc6299db9ec823/downloader-0.2.7/src/download.rs:28:5
   |
28 |     let Ok(url) = reqwest::Url::parse(url) else { return std::path::PathBuf::new() };
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
   = help: add `#![feature(let_else)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0658`.
error: could not compile `downloader` due to previous error
warning: build failed, waiting for other jobs to finish...

Inlining failed in call to 'always_inline' when building the project

I try to build and run all tests by executing bazelisk test //... but then I get a compilation error:

ERROR: /home/kamos/.cache/bazel/_bazel_kamos/76ead71fc5575ebd7e484e2e8c787a36/external/.workspace.oneTBB/BUILD.bazel:25:11: Compiling src/tbb/task_dispatcher.cpp [for host] failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 31 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/x86gprintrin.h:81,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/immintrin.h:27,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_machine.h:42,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_utils.h:26,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:20,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/waitpkgintrin.h: In function 'void tbb::detail::r1::prolonged_pause()':
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/waitpkgintrin.h:53:1: error: inlining failed in call to 'always_inline' 'unsigned char _tpause(unsigned int, long long unsigned int)': target specific option mismatch
   53 | _tpause (unsigned int __A, unsigned long long __B)
      | ^~~~~~~
In file included from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:24,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
external/.workspace.oneTBB/src/tbb/scheduler_common.h:230:16: note: called from here
  230 |         _tpause(0, time_stamp + 700);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/x86gprintrin.h:81,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/immintrin.h:27,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_machine.h:42,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_utils.h:26,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:20,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/waitpkgintrin.h:53:1: error: inlining failed in call to 'always_inline' 'unsigned char _tpause(unsigned int, long long unsigned int)': target specific option mismatch
   53 | _tpause (unsigned int __A, unsigned long long __B)
      | ^~~~~~~
In file included from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:24,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
external/.workspace.oneTBB/src/tbb/scheduler_common.h:230:16: note: called from here
  230 |         _tpause(0, time_stamp + 700);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/x86gprintrin.h:81,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/immintrin.h:27,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_machine.h:42,
                 from external/.workspace.oneTBB/include/oneapi/tbb/detail/_utils.h:26,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:20,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/waitpkgintrin.h:53:1: error: inlining failed in call to 'always_inline' 'unsigned char _tpause(unsigned int, long long unsigned int)': target specific option mismatch
   53 | _tpause (unsigned int __A, unsigned long long __B)
      | ^~~~~~~
In file included from external/.workspace.oneTBB/src/tbb/task_dispatcher.h:24,
                 from external/.workspace.oneTBB/src/tbb/task_dispatcher.cpp:17:
external/.workspace.oneTBB/src/tbb/scheduler_common.h:230:16: note: called from here
  230 |         _tpause(0, time_stamp + 700);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
INFO: Elapsed time: 45.283s, Critical Path: 28.89s
INFO: 99 processes: 29 internal, 70 linux-sandbox.
FAILED: Build did NOT complete successfully

Is this somewhat known and already solved?

The system is archlinux, kernel 5.17.1, gcc version 11.2.0.

Support configurable MethodID code size limit

Currently, the make-id tool generates a table of hashes that have kCodeDigestCount entries. In #165, this count goes up by 4 which causes make-id to take 16x longer to run.

This feature would allow users to specify the maximum code size limit instead of always using kCodeDigestCount.

Support Traditional Rust Build?

I was just trying to build risc0 and unfortunately ran into issues because I'm behind an HTTP proxy that requires authentication and has a custom HTTPS certificate, and Java, which is apparently what bazel is using to download files, really doesn't like proxies.

I've never gotten Java to successfully go through my proxy. 😕

Anyway, that's not really your fault or anything you can do about it, but I was also wondering whether or not you would be open to supporting alternative build systems, such as would allow you to add the Rust crate to a normal Rust project and have it built without requiring Bazel to be installed.

Usually this is done in the Rust build.rs script, which will compile the C++ automatically and setup the linker so that the Rust user doesn't really have to think about the C++, other than making sure they have a C++ compiler installed.

I could probably setup a separate git Repo that would add this one as a submodule and contain the build scripts if it wasn't something you wanted to worry about integrating into this repo, but I wanted to see how you felt about it.


Somewhat related I was also wondering if you had any warnings for me if I attempted to do a pure Rust port. :)

Rust is my favorite language and the most-used in projects I'm investing in, and I noticed that this project wasn't massive on lines of code. Only 6.3k lines of C++ code, which is awesome that you've been able to keep the codebase so small!

Also, I'm thinking from the perspective of needing to compile to WASM, and I'm not sure how well compiling a hybrid C++/Rust project will work when I need to target WASM. I'm not sure if that requires building the C++ to WASM and then the Rust to WASM and linking the two WASM modules? ( I think that's experimentally supported by something, but I can't remember where I saw that. )


Anyway, I'm just getting into a closer investigation of the project and I'm not sure if I'll actually have time to mess around much longer or if I'll get to using it for anything, but I really appreciate your time!

Solidity/Toy Verifier

Are they any plans to implement a solidity verifier?

I think this would significantly boost adoption of risc0 as a plug and play layer 2.

If there is not currently a solidity verifier in the roadmap, our team would be happy to work on/contribute a Solidity implementation if there was more documentation of the zkSTARK protocol used or a toy reference implementation to work off of.

See also #222

Support for C in guests?

I tried adding some C code to my guest, but when I do cargo build I get:

methods-guest:   running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=rv32im" "-mabi=ilp32" "-mcmodel=medany" "-Wall" "-Wextra" "-o" "/Users/matthias/zk/risc0-rust-starter/target/debug/build/methods-dd8a3f9b912de31d/out/riscv-guest/riscv32im-risc0-zkvm-elf/release/build/methods-guest-6bec23e2e3313bc4/out/src/bin/fib.o" "-c" "src/bin/fib.cpp"   
methods-guest:   cargo:warning=clang: error: the clang compiler does not support '-march=rv32im'   

Do we have any guide for how to add C or C++ to guests?

Modify battleship NEAR contract to add methodID's.

Due to an API change to the verifier, the battleship NEAR contract does not correctly pass method ids to the verifier, which prevents it from compiling. We should also consider adding build tests for the battleship contract.

Build fails on macOS(arm64)

I am experiencing an issue with building on a Mac Mini M1. bazelisk test //... results in the error detailed below.

Steps to Reproduce

I'm not sure how to reproduce this error. The build was successful on a Macbook Air with similar specs listed below.

Environment

  • macOS Monterey 12.3.1 (21E258)
  • Xcode Version 13.3.1 (13E500a)
  • Apple clang version 13.1.6 (clang-1316.0.21.2.3)
  • Target: arm64-apple-darwin21.4.0

Logs

INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=175
INFO: Reading rc options for 'test' from /path/to/risc0/.bazelrc:
  Inherited 'build' options: -c opt --announce_rc --enable_runfiles --nobuild_python_zip --incompatible_enable_cc_toolchain_resolution --flag_alias=accel=//risc0/zkp/accel:flag --//bazel/rules/clang_format:config=//:.clang-format --@rules_rust//:rustfmt.toml=//bazel/rules/rust:rustfmt.toml
INFO: Repository crates_host instantiated at:
  /path/to/risc0/WORKSPACE:109:18: in <toplevel>
Repository rule crates_repository defined at:
  /private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/crate_universe/private/crates_repository.bzl:102:36: in <toplevel>
ERROR: An error occurred during the fetch of repository 'crates_host':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/crate_universe/private/crates_repository.bzl", line 24, column 34, in _crates_repository_impl
		host_triple = get_host_triple(repository_ctx)
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/cargo/private/cargo_utils.bzl", line 95, column 38, in get_host_triple
		cpu = _query_cpu_architecture(repository_ctx, supported_architectures["macos"])
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/cargo/private/cargo_utils.bzl", line 33, column 13, in _query_cpu_architecture
		fail(_CPU_ARCH_ERROR_MSG.format(
Error in fail: Command failed with exit code '1': ["uname", "-m"]
----------stdout:

----------stderr:
src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory

ERROR: /path/to/risc0/WORKSPACE:109:18: fetching crates_repository rule //external:crates_host: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/crate_universe/private/crates_repository.bzl", line 24, column 34, in _crates_repository_impl
		host_triple = get_host_triple(repository_ctx)
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/cargo/private/cargo_utils.bzl", line 95, column 38, in get_host_triple
		cpu = _query_cpu_architecture(repository_ctx, supported_architectures["macos"])
	File "/private/var/tmp/_bazel_ck/23e37feca6eb160088e3173bb952b18e/external/rules_rust/cargo/private/cargo_utils.bzl", line 33, column 13, in _query_cpu_architecture
		fail(_CPU_ARCH_ERROR_MSG.format(
Error in fail: Command failed with exit code '1': ["uname", "-m"]
----------stdout:

----------stderr:
src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory

INFO: Reading rc options for 'test' from /path/to/risc0/.bazelrc:
  Inherited 'build' options: -c opt --announce_rc --enable_runfiles --nobuild_python_zip --incompatible_enable_cc_toolchain_resolution --flag_alias=accel=//risc0/zkp/accel:flag --//bazel/rules/clang_format:config=//:.clang-format --@rules_rust//:rustfmt.toml=//bazel/rules/rust:rustfmt.toml
ERROR: //bazel/rules/clang_format:config :: Error loading option //bazel/rules/clang_format:config: no such package '@crates_host//': Command failed with exit code '1': ["uname", "-m"]
----------stdout:

----------stderr:
src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory

Proof verification within a guest

Is there currently any plans to allow for porting proof verification to run in a guest?
This would be incredibly useful as it would allow for proof aggregation.

rust-std: Add support for `thread_local_key`

From discord:

Currently, any crate which depends on once_cell (including std::collections::HashMap) will compile but experience a runtime panic because the method thread_local_key is unimplemented.

Exception { what: "panicked at 'should not be used on this target', /risc0-rust-starter/target/debug/build/methods-e1d0c7ab6d906214/out/rust-std_5394976e3be5c2fbe950f41f75eb392cd888657933629544e0a55a75bb0e59d9/library/std/src/sys/unsupported/thread_local_key.rs:25:5" }'

Since the zkvm is single-threaded, it seems like this should be relatively straightforward.

At runtime, ZKVM should inform the guest of its MethodId

Summary

ZKVM uses MethodId to identify guest images. Mechanically, MethodId is the Merkle-root of a data structure that contains the guest's ELF image. It is therefore impossible for the guest to know this value at compile time.

However, there are cases where the guest benefits from knowing its own MethodId. For example, suppose the guest wants to filter a list of receipts to identify other journals written by itself. This particular use case keeps coming up for me.

Proposed fix

At runtime, ZKVM can load the ELF, then it can write the ELF's MethodId to some read-only memory region. If the ZKVM circuit is updated to enforce the accuracy of this data, then the guest will be able to rely on it at runtime.

macOS13 build failed

Build with bazelisk test //... failed using macOS13.

ERROR: /Users/kaichen/Documents/projects/risc0/risc0/zkvm/prove/BUILD.bazel:5:11: Compiling risc0/zkvm/prove/step.cpp failed: (Aborted): wrapped_clang_pp failed: error executing command external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG ... (remaining 40 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:6:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    DO_LOG("C%u: Init", val0.asUInt32());
    ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:25:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    DO_LOG("C%u: MemWrite: M[0x%x] = 0x%04x%04x", val0.asUInt32(), val10.asUInt32(), val11.asUInt32(), val12.asUInt32());
    ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:45:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    DO_LOG("C%u: Reset: %u", val0.asUInt32(), val22.asUInt32());
    ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:212:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    DO_LOG("C%u: Fini", val0.asUInt32());
    ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:1955:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: ADD r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1591.asUInt32(), val230.asUInt32(), val1592.asUInt32(), val1593.asUInt32(), val231.asUInt32(), val1594.asUInt32(), val1595.asUInt32(), val1596.asUInt32(), val1597.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:1998:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: SUB r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1622.asUInt32(), val230.asUInt32(), val1623.asUInt32(), val1624.asUInt32(), val231.asUInt32(), val1625.asUInt32(), val1626.asUInt32(), val1627.asUInt32(), val1628.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2041:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: XOR r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1653.asUInt32(), val230.asUInt32(), val1654.asUInt32(), val1655.asUInt32(), val231.asUInt32(), val1656.asUInt32(), val1657.asUInt32(), val1658.asUInt32(), val1659.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2084:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: OR r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1684.asUInt32(), val230.asUInt32(), val1685.asUInt32(), val1686.asUInt32(), val231.asUInt32(), val1687.asUInt32(), val1688.asUInt32(), val1689.asUInt32(), val1690.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2127:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: AND r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1715.asUInt32(), val230.asUInt32(), val1716.asUInt32(), val1717.asUInt32(), val231.asUInt32(), val1718.asUInt32(), val1719.asUInt32(), val1720.asUInt32(), val1721.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2170:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: SLT r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1746.asUInt32(), val230.asUInt32(), val1747.asUInt32(), val1748.asUInt32(), val231.asUInt32(), val1749.asUInt32(), val1750.asUInt32(), val1751.asUInt32(), val1752.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2213:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: SLTU r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1777.asUInt32(), val230.asUInt32(), val1778.asUInt32(), val1779.asUInt32(), val231.asUInt32(), val1780.asUInt32(), val1781.asUInt32(), val1782.asUInt32(), val1783.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2254:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: ADDI r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1806.asUInt32(), val230.asUInt32(), val1807.asUInt32(), val1808.asUInt32(), val231.asUInt32(), val1809.asUInt32(), val1810.asUInt32(), val1811.asUInt32(), val1812.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2294:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: XORI r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1835.asUInt32(), val230.asUInt32(), val1836.asUInt32(), val1837.asUInt32(), val231.asUInt32(), val1838.asUInt32(), val1839.asUInt32(), val1840.asUInt32(), val1841.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2334:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: ORI r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1864.asUInt32(), val230.asUInt32(), val1865.asUInt32(), val1866.asUInt32(), val231.asUInt32(), val1867.asUInt32(), val1868.asUInt32(), val1869.asUInt32(), val1870.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2374:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: ANDI r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1893.asUInt32(), val230.asUInt32(), val1894.asUInt32(), val1895.asUInt32(), val231.asUInt32(), val1896.asUInt32(), val1897.asUInt32(), val1898.asUInt32(), val1899.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2414:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: SLTI r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1922.asUInt32(), val230.asUInt32(), val1923.asUInt32(), val1924.asUInt32(), val231.asUInt32(), val1925.asUInt32(), val1926.asUInt32(), val1927.asUInt32(), val1928.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2454:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: SLTIU r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1951.asUInt32(), val230.asUInt32(), val1952.asUInt32(), val1953.asUInt32(), val231.asUInt32(), val1954.asUInt32(), val1955.asUInt32(), val1956.asUInt32(), val1957.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2494:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: LB r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val1980.asUInt32(), val230.asUInt32(), val1981.asUInt32(), val1982.asUInt32(), val231.asUInt32(), val1983.asUInt32(), val1984.asUInt32(), val1985.asUInt32(), val1986.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from risc0/zkvm/prove/step.cpp:40:
bazel-out/darwin-opt/bin/risc0/zkvm/circuit/step.cpp.inc:2534:9: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
        DO_LOG("C%u: pc: %08x Decode: LH r%u=0x%04x%04x, r%u=0x%04x%04x, imm=0x%04x%04x", val156.asUInt32(), val2009.asUInt32(), val230.asUInt32(), val2010.asUInt32(), val2011.asUInt32(), val231.asUInt32(), val2012.asUInt32(), val2013.asUInt32(), val2014.asUInt32(), val2015.asUInt32());
        ^
risc0/zkvm/prove/step.cpp:24:5: note: expanded from macro 'DO_LOG'
    sprintf(buf, __VA_ARGS__);                                                                     \
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Error in child process '/usr/bin/xcrun'. 1

Unwanted bindgen artifacts in WASM file.

Problem

My goal is running risc0 verifier inside the WASM VM.

Here is my example:

risc0-zkvm included in dependencies:

[dependencies]
risc0-zkvm = { version = "1.0.0-rc.2", features = [ "verify-only" ] }

verifier.rs is my source code. It's enough to use risc0_zkvm, no need to interact with any code like Recipt:

#![no_main]

use risc0_zkvm;

extern "C" {
    pub fn load_data() -> u8;
}

#[no_mangle]
unsafe fn verify() {
    let _ = load_data();
}

See full code here: https://github.com/zie1ony/risc0-wasm-unwanted-bindgen

Compile it to wasm:

$ cargo build --release --target wasm32-unknown-unknown

Now I can inspect it using wasm2wat from WABT package.

$ wasm2wat target/wasm32-unknown-unknown/release/verify.wasm
(module
  (type (;0;) (func (param i32 i32)))
 ...
  (type (;21;) (func (param i32 i32 f64 i32 i32)))
  (import "env" "load_data" (func $load_data (type 11)))
  (import "__wbindgen_placeholder__" "__wbindgen_describe" (func $_ZN12wasm_bindgen19__wbindgen_describe17h402830b0880612dcE (type 12)))
  (import "__wbindgen_placeholder__" "__wbindgen_throw" (func $_ZN12wasm_bindgen16__wbindgen_throw17hc7b411560c64c5a5E (type 0)))
  (import "__wbindgen_externref_xform__" "__wbindgen_externref_table_grow" (func $_ZN12wasm_bindgen9externref31__wbindgen_externref_table_grow17h5d8fced3e7917d66E (type 13)))
  (import "__wbindgen_externref_xform__" "__wbindgen_externref_table_set_null" (func $_ZN12wasm_bindgen9externref35__wbindgen_externref_table_set_null17h644009d4f22d60bcE (type 12)))
  (func $verify (type 14)
    call $load_data

Those __wbindgen_placeholder__ imports, are not expected, and the wasm file has much more of bindgen artifacts.

$` wasm2wat target/wasm32-unknown-unknown/release/verify.wasm | grep bindgen | wc -l
9544

Of course WASM hosts outside the browser or Node will not be able to satisfy those imports and will fail.

Reason

The reason is getrandom crate in the dependencies of risc0-zkvm. It comes from rand's dependencies. getrandom devs supports wasm32-unknown-unknown target only when the js feature is on, but this expects the wasm file to be used in JS environment, which is really naive. And to support JS they use... wasm-bindgen. You can read more in the source code: https://github.com/rust-random/getrandom/blob/master/src/lib.rs#L60

Solutions

I see three solutions:

  1. Drop the random from dependencies for verify-only feature.
  2. Remove bindgen artifacts somehow from the wasm file. There are WASM tools like wasm-bindgen or WABT, but I haven't found any way of doing so.
  3. Improve getrandom and make PR to their repo.

My preferable solution is the first one, as it reduces dependecies and improves the rist0 repo. I might be wrong, but the random values are not needed for verification, right?

`risc0-zkp-accel` 0.4.0 build failed on docs.rs

I was monitoring the docs.rs recent build failures and noticed that risc0-zkp-accel 0.4.0 is failing because it attempts to access the network in its build script: https://docs.rs/crate/risc0-zkp-accel/0.4.0

It should be sufficient to omit the network accesses when the crate is being built by docs.rs. You can check for the DOCS_RS environment variable and skip the network access, or just fail gracefully without panicking.

(In fact, it seems like a lot of your crates are failing to build, such as risc0-zkvm-host-sys, risc0-zkvm-prove, and risc0-zkvm-host.)

Possibility of using SNARKs instead of STARKs

Hi guys,

Really great project. So I was going through the code and according to my understanding it should be possible to swap the current zkp module from using STARKs to SNARKs. Is there any assumptions on zkvm side which would stop me in doing that?

there are some issues with no-std support

I noticed that risc0 handles std and no-std issues, for version 0.10 I managed to compile it to no-std after manually modifying some dependencies.

But for version 0.11.1, the problem is more complicated, I don't know how to compile it successfully.

I think no-std should at least support the deserialization of receipt, methodID, and the verification execution of receipt, so that it can be executed in some embedded environments that do not support std.

error[E0463]: can't find crate for `std`
  |
  = note: the `riscv64imac-unknown-none-elf` target may not support the standard library
  = note: `std` is required by `once_cell` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

   Compiling paste v1.0.8
   Compiling downcast-rs v1.2.0
   Compiling getrandom v0.2.7
   Compiling matrixmultiply v0.3.2
   Compiling codespan-reporting v0.11.1
   Compiling generic-array v0.14.6
   Compiling ckb-standalone-types v0.1.2
   Compiling memchr v2.5.0
error[E0463]: can't find crate for `std`
  |
  = note: the `riscv64imac-unknown-none-elf` target may not support the standard library
  = note: `std` is required by `downcast_rs` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/downcast-rs-1.2.0/src/lib.rs:167:1
    |
167 | pub extern crate std as __std;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
    |
    = note: the `riscv64imac-unknown-none-elf` target may not support the standard library
    = help: consider building the standard library from source with `cargo build -Zbuild-std`

   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.10
error[E0463]: can't find crate for `std`
  |
  = note: the `riscv64imac-unknown-none-elf` target may not support the standard library
  = note: `std` is required by `matrixmultiply` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error[E0463]: can't find crate for `std`
 --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.7/src/error_impls.rs:9:1
  |
9 | extern crate std;
  | ^^^^^^^^^^^^^^^^^ can't find crate
  |
  = note: the `riscv64imac-unknown-none-elf` target may not support the standard library
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

   Compiling num-traits v0.2.15
error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.7/src/lib.rs:240:9
    |
240 | /         compile_error!("target is not supported, for more information see: \
241 | |                         https://docs.rs/getrandom/#unsupported-targets");
    | |________________________________________________________________________^

(Rust) guests cannot deserialize enum constructors with more than 1 argument

Synopsis

In a recent project, I defined an enum similar to:

#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum MyEnum {
    MyUnaryConstructor(Vec<u8>),
    MyBinaryConstructor(Vec<u8>, SomeStruct),
}

I observed that the guest was unable to deserialize the 2nd constructor (MyBinaryConstructor). I changed the definition to something like

#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct MyBoxedPair {
    pub first: Vec<u8>,
    pub second: SomeStruct,
}

#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum MyEnum {
    MyUnaryConstructor(Vec<u8>),
    MyBinaryConstructor(MyBoxedPair),
}

With this change, the guest is able to deserialize the 2nd constructor.

cargo bench fails to compile on Ubuntu 22.04

Attempting to run either cargo bench --bench fib or simply cargo bench from HEAD (currently 8b90fbe), I get a failure to build, with stderr output ending like this:

  cargo:warning=cxx/step_exec.cpp: In function ‘risc0::Fp risc0::circuit::rv32im::step_exec(void*, void (*)(void*, const char*, const char*, const risc0::Fp*, size_t, risc0::Fp*, size_t), size_t, size_t, risc0::Fp**)’:
  cargo:warning=cxx/step_exec.cpp:32:4: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
  cargo:warning=   32 | Fp step_exec(void* ctx, HostBridge host, size_t steps, size_t cycle, Fp** args) {
  cargo:warning=      |    ^~~~~~~~~
  exit status: 0
  exit status: 0
  cargo:warning=c++: fatal error: Killed signal terminated program cc1plus
  cargo:warning=compilation terminated.
  exit status: 1

  --- stderr


  error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-std=c++17" "-o" "/home/mars/risc0/target/release/build/risc0-circuit-rv32im-2df37cb2210a07d8/out/cxx/poly_fp.o" "-c" "cxx/poly_fp.cpp" with args "c++" did not execute successfully (status code exit status: 1).

Complete output:

benchfail.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.