Add g16.verify Groth16 verifier builtin - #138
Merged
Merged
Conversation
elldeeone
marked this pull request as draft
June 29, 2026 05:30
Collaborator
Author
Merged
Collaborator
Author
elldeeone
marked this pull request as ready for review
August 3, 2026 12:10
someone235
requested changes
Aug 3, 2026
|
|
||
| ```javascript | ||
| entry verify(byte[] verifyingKey, byte[] proof, byte[32] publicInput0, byte[32] publicInput1) { | ||
| require(g16.verify(verifyingKey, proof, publicInput0, publicInput1)); |
Contributor
There was a problem hiding this comment.
Remove the require, g16.verify has to be void
Collaborator
Author
There was a problem hiding this comment.
Fixed g16.verify is now void and drops the success value. Rebased on current master and all checks pass.
someone235
requested changes
Aug 7, 2026
| let parameters = builtin_parameters(name) | ||
| .ok_or_else(|| CompilerError::Unsupported(format!("builtin function '{name}' has no parameter types")))?; | ||
| check_builtin_args(name, args, parameters, ctx)?; | ||
| if name == "g16.verify" { |
Contributor
There was a problem hiding this comment.
Can you add a comment of something like
"g16.verify requires special treatment since it has variable amount of arguments"
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
g16.verify(...)as the low-level SilverScript intrinsic for verifying Groth16 proofs through the Rusty Kaspa ZK precompile.The builtin signature is:
This PR now builds on merged #137 and reuses its qualified builtin, parser, compiler, and tree-sitter patterns.
This PR includes:
g16.verifybyte[]verifying key/proof arguments and variadicbyte[32]public inputsOpZkPrecompilewithZkTag::Groth16using the Rusty Kaspa stack conventionScope
This is the raw Groth16 intrinsic discussed in #137. It intentionally leaves the merged
r0.*verifier behavior unchanged.The possibility of implementing
r0.g16.verify(...)as a SilverScript standard function on top of this intrinsic can be evaluated separately, including the cross-path R0 fixture test suggested in the #137 discussion.Tests