-
Notifications
You must be signed in to change notification settings - Fork 2
Feat: Allow generation and veryfying groth16 proofs to enable compatiblity between sp1 versions #4
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
base: main
Are you sure you want to change the base?
Conversation
program/src/main.rs
Outdated
| // https://docs.rs/sp1-prover/3.0.0-rc1/src/sp1_prover/types.rs.html#56 | ||
| let vkey_digest_bn254 = babybears_to_bn254(&proof_vkey_hash); | ||
| let vkey_digest_bytes32 = format!("0x{:0>64}", vkey_digest_bn254.as_canonical_biguint().to_str_radix(16)); | ||
| Groth16Verifier::verify(&proof, &recursive_input.public_values, &vkey_digest_bytes32, &sp1_key).expect("groth16 verification failed"); |
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.
SP1 key is read from the input, but the program vkey is either hardcoded one of the v1 ELF, or current one; so this seems safe?
flake.nix
Outdated
|
|
||
| RUSTC_VERSION = overrides.toolchain.channel; | ||
|
|
||
| # https://github.com/rust-lang/rust-bindgen#environment-variables |
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.
I think this and further magic you do to make bindgen work nice can be achieved by just adding pkgs.rustPlatform.bindgenHook to build inputs
flake.nix
Outdated
| buildInputs = with pkgs; [ | ||
| clang | ||
| llvmPackages.bintools | ||
| rustup |
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.
I think you should just use Fenix instead, it has fromRustToolchainFile or similar
Needs more robust testing and cleanup. Program part should be mostly done, wanted to share and get early comments.