Skip to content

add Soroban Groth16 verifier generator#396

Open
mysteryon88 wants to merge 8 commits intostellar:mainfrom
mysteryon88-forks:main
Open

add Soroban Groth16 verifier generator#396
mysteryon88 wants to merge 8 commits intostellar:mainfrom
mysteryon88-forks:main

Conversation

@mysteryon88
Copy link

What

Added usage examples for the Soroban Groth16 verifier contract generator implemented in this project, using proofs and verification keys produced by Circom, Gnark, and Arkworks.

Why

These examples demonstrate how the generator can be used with popular ZK frameworks to generate Soroban-compatible verifier contracts and make the intended workflow clearer for users.

Known limitations

  • The implementation is based on the Soroban Groth16 verifier example from the Stellar repository
  • The generator and resulting contracts have not undergone a security audit

Copilot AI review requested due to automatic review settings January 27, 2026 08:25
@socket-security
Copy link

socket-security bot commented Jan 27, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
License policy violation: cargo unicode-ident under Unicode-3.0

License: Unicode-3.0 - the applicable license policy does not allow this license (4) (unicode-ident-1.0.22/Cargo.toml)

License: Unicode-3.0 - the applicable license policy does not allow this license (4) (unicode-ident-1.0.22/Cargo.toml)

License: Unicode-3.0 - the applicable license policy does not allow this license (4) (unicode-ident-1.0.22/LICENSE-UNICODE)

From: ?cargo/tracing@0.1.44cargo/ark-snarkjs@0.1.4cargo/ark-r1cs-std@0.5.0cargo/ark-ec@0.5.0cargo/ark-ff@0.5.0cargo/ark-serialize@0.5.0cargo/ark-crypto-primitives@0.5.0cargo/ark-groth16@0.5.0cargo/unicode-ident@1.0.22

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/unicode-ident@1.0.22. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang github.com/bits-and-blooms/bitset under BSD-3-Clause

Location: Package overview

From: ?golang/github.com/consensys/gnark-crypto@v0.19.0golang/github.com/consensys/gnark@v0.14.0golang/github.com/bits-and-blooms/bitset@v1.24.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/github.com/bits-and-blooms/bitset@v1.24.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
High CVE: gnark-crypto allows unchecked memory allocation during vector deserialization in golang github.com/consensys/gnark-crypto

CVE: GHSA-fj2x-735w-74vq gnark-crypto allows unchecked memory allocation during vector deserialization (HIGH)

Affected versions: = 0.19.0; >= 0.9.1 < 0.18.1; >= 0.19.0 < 0.19.2

Patched version: 0.19.2

From: groth16_verifier/data/gnark_bn254/auxiliary/go.modgolang/github.com/consensys/gnark-crypto@v0.19.0

ℹ Read more on: This package | This alert | What is a CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/github.com/consensys/gnark-crypto@v0.19.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang github.com/consensys/gnark-crypto under Apache-2.0 AND BSD-3-Clause

Location: Package overview

From: groth16_verifier/data/gnark_bn254/auxiliary/go.modgolang/github.com/consensys/gnark-crypto@v0.19.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/github.com/consensys/gnark-crypto@v0.19.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang github.com/google/pprof under Apache-2.0 AND BSD-3-Clause

Location: Package overview

From: ?golang/github.com/consensys/gnark@v0.14.0golang/github.com/google/pprof@v0.0.0-20250820193118-f64d9cf942d6

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/github.com/google/pprof@v0.0.0-20250820193118-f64d9cf942d6. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang golang.org/x/crypto under BSD-3-Clause

Location: Package overview

From: ?golang/github.com/consensys/gnark-crypto@v0.19.0golang/github.com/consensys/gnark@v0.14.0golang/golang.org/x/crypto@v0.41.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/golang.org/x/crypto@v0.41.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang golang.org/x/sync under BSD-3-Clause

Location: Package overview

From: ?golang/github.com/consensys/gnark-crypto@v0.19.0golang/github.com/consensys/gnark@v0.14.0golang/golang.org/x/sync@v0.16.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/golang.org/x/sync@v0.16.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: golang golang.org/x/sys under BSD-3-Clause

Location: Package overview

From: ?golang/github.com/consensys/gnark-crypto@v0.19.0golang/github.com/consensys/gnark@v0.14.0golang/golang.org/x/sys@v0.35.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/golang.org/x/sys@v0.35.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds example inputs and generated Soroban verifier contract crates demonstrating how to use the Soroban Groth16 verifier generator with Circom- and Gnark-produced artifacts.

Changes:

  • Added Circom and Gnark example proof/VK JSON fixtures under groth16_verifier_gen/data/.
  • Added two generated Soroban verifier contract crates (verifier, gnark_verifier) with basic tests.
  • Added groth16_verifier_gen workspace scaffolding/docs (README, workspace Cargo files, gitignore), plus an unrelated account/Cargo.lock update.

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
groth16_verifier_gen/data/gnark/verification_key.json Adds Gnark verification key fixture for generator usage/testing.
groth16_verifier_gen/data/gnark/proof.json Adds Gnark proof fixture for generator usage/testing.
groth16_verifier_gen/data/circom/verification_key.json Adds Circom verification key fixture for generator usage/testing.
groth16_verifier_gen/data/circom/public.json Adds Circom public inputs fixture for generator usage/testing.
groth16_verifier_gen/data/circom/proof.json Adds Circom proof fixture for generator usage/testing.
groth16_verifier_gen/contracts/verifier/src/test.rs Adds tests for the generated verifier contract (Circom fixtures).
groth16_verifier_gen/contracts/verifier/src/lib.rs Adds generated verifier contract implementation with embedded VK bytes.
groth16_verifier_gen/contracts/verifier/Cargo.toml Adds contract crate manifest for the generated verifier.
groth16_verifier_gen/contracts/gnark_verifier/src/test.rs Adds tests that load Gnark proof JSON and call the contract verifier.
groth16_verifier_gen/contracts/gnark_verifier/src/lib.rs Adds generated verifier contract implementation for Gnark VK bytes.
groth16_verifier_gen/contracts/gnark_verifier/Cargo.toml Adds contract crate manifest for the generated Gnark verifier.
groth16_verifier_gen/README.md Documents how to run the verifier generator on the included fixtures.
groth16_verifier_gen/Cargo.toml Adds workspace definition for the generated example contracts.
groth16_verifier_gen/Cargo.lock Adds lockfile for the new workspace.
groth16_verifier_gen/.gitignore Adds ignore rules for build artifacts and local Soroban config.
account/Cargo.lock Updates lockfile dependencies (appears unrelated to this PR’s stated scope).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mysteryon88 and others added 3 commits January 27, 2026 11:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jayz22
Copy link
Contributor

jayz22 commented Jan 28, 2026

I don't think this should be its own example..
IIUC It's essentially the same code as https://github.com/stellar/soroban-examples/tree/main/groth16_verifier, with different hardcoded vk parameters generated from other systems.

The groth16 example was generated with circom/snarkjs with parameters included, if you feel strongly it should also have Gnark support, perhaps open a PR in the same example with another set of data?

The project you mentioned in the description is a code generator, which clearly isn't this example here.

@mysteryon88
Copy link
Author

@jayz22

Thanks for the feedback, that’s fair.

I think part of the reason I made it a separate example is that I felt a bit uncomfortable modifying or reusing an existing example, so I created a new one instead. I understand your point though, and I’ll update the PR soon to extend the existing Groth16 example rather than adding a new one.

It was also important for me to share a small utility I wrote for generating the contract / VK bindings, to avoid manual translation. Similar generators exist in other ecosystems, but I haven’t seen one for Stellar/Soroban yet.

I’ll rework the PR accordingly.

@jayz22
Copy link
Contributor

jayz22 commented Jan 28, 2026

@jayz22

Thanks for the feedback, that’s fair.

I think part of the reason I made it a separate example is that I felt a bit uncomfortable modifying or reusing an existing example, so I created a new one instead. I understand your point though, and I’ll update the PR soon to extend the existing Groth16 example rather than adding a new one.

It was also important for me to share a small utility I wrote for generating the contract / VK bindings, to avoid manual translation. Similar generators exist in other ecosystems, but I haven’t seen one for Stellar/Soroban yet.

I’ll rework the PR accordingly.

@mysteryon88 no worries! didn't mean to dismiss the work, this is a nice contribution improving its usability.
Please give it a try, happy to help you if needed!

@mysteryon88
Copy link
Author

@jayz22

Hi, I’ve updated the repository - I’d be glad to get your feedback!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 56 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants