-
Notifications
You must be signed in to change notification settings - Fork 2
Adding zkvm-pico support on sha2/sha256 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding zkvm-pico support on sha2/sha256 #3
Conversation
|
@ArtiomTr this PR is good to review. |
sha2/Cargo.toml
Outdated
| force-soft = [] # Force software implementation | ||
| force-soft-compact = [] # Force compact software implementation | ||
| asm-aarch64 = ["asm"] # DEPRECATED: use `asm` instead | ||
| zkvm-pico = [] # For Brevis pico zkvm compilation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a new feature
ArtiomTr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just one more check needed
| } else if #[cfg(all(target_os = "zkvm", target_vendor = "risc0", target_arch = "riscv32", feature = "zkvm-pico"))] { | ||
| // Brevis Pico target string is also `riscv32im-risc0-zkvm-elf`, so we use an additional feature | ||
| // to distinguish pico. | ||
| // ref: https://github.com/brevis-network/pico/blob/main/sdk/cli/src/build/build.rs#L82 | ||
| mod pico; | ||
| use pico::compress; | ||
| } else if #[cfg(all(target_os = "zkvm", target_vendor = "risc0", target_arch = "riscv32", feature = "zkvm-risc0"))] { | ||
| // zkvm-r0vm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this would successfully compile, even if target_vendor = "risc0", but both zkvm-pico and zkvm-risc0 features are disabled? Can you please add:
#[cfg(all(target_os = "zkvm", target_vendor = "risc0", not(any(feature = "zkvm-pico", feature = "zkvm-risc0"))))]
compile_error!("please select at least one feature from [`zkvm-pico`, `zkvm-risc0`]");or something similar, to prevent accidentally keeping precompile off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
0d3a387
into
grandinetech:RustCrypto-hashes/sha2-v0.10.9
Copied from discord: Investigated the issue if I can use target_os, target_arch to distinguish brevis pico from other zkvms. I believe the ans is not.
Because pico themselves use riscv32im-risc0-zkvm-elf as the target string.
As a result,
target_arch == riscv32,target_vendor == risc0,target_os == zkvm, same as risc0 vm 😓. Here is an example of their check in pico sha256 lib.I raised this issue to them this morning, but there will be a lot of changes, across multiple repos, if they decide to address this issue. So I am not hopeful they will address this anytime soon and we probably have to resolve to add our own (feature) flag.
Also run
cargo fmton sha2 crate.