forked from risc0/risc0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set RISC0_FEATURE_bigint2 in risc0-build to signal zkVM features and …
…fix usage of `stability::unstable` with `no_mangle` (risc0#2567) This is a proposal for how we might improve build debugging when someone tries to use bigint2, but it is not available. In this PR, an env var is added to invocations of `cargo` in `risc0-build` that is a positive signal to downstream crates that that a new "hardware" feature is available. In the case of upcoming cryptography patches that only work with `bigint2`, we'd add the following snippet to the `lib.rs` file. The advantage being that we give an error and link to our docs rather than a linker error at the end of the build process. From there, we can provide better guidance on either upgrading the `risc0-zkvm` version or downgrading the cryptography patch version. ```rust #[cfg(all(target_os = "zkvm", target_arch = "riscv32"))] const _: () = { assert!( core::option_env!("RISC0_FEATURE_bigint2").is_some(), r#" RISC Zero zkVM feature bigint2 is not available, and is required by this crate. If you'd like to use bigint2, please upgrade to risc0-zkvm and risc0-build and ensure the required feature flags are enabled. See the RISC Zero dev docs for more information. https://dev.risczero.com/api/zkvm/acceleration "# ); }; ``` This is written with bigint2 in mind. It could also be used when transitioning to the new ABI with zkVM revision 2. When I went to test this I found that my ECDSA program linked and built without setting `unstable` on `risc0-zkvm`, which was unexpected. Digging into the `stability` crate I found that the way the implement their macro [1], it doesn't play nice with `no_mangle` and the symbol will still be included. https://docs.rs/stability/latest/src/stability/unstable.rs.html#85
- Loading branch information
Showing
7 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ all-features = true | |
[features] | ||
docker = [] | ||
guest-list = [] | ||
unstable = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters