Skip to content

Add BN254 groth16 verifier#399

Open
jayz22 wants to merge 4 commits intostellar:mainfrom
jayz22:add-bn254-groth16
Open

Add BN254 groth16 verifier#399
jayz22 wants to merge 4 commits intostellar:mainfrom
jayz22:add-bn254-groth16

Conversation

@jayz22
Copy link
Contributor

@jayz22 jayz22 commented Feb 4, 2026

What

Summary:

  • Restructured groth16_verifier into a workspace with bls12-381 and bn254 subpackages.
  • Added BN254 Groth16 verifier implementation, generated artifacts, and tests mirroring BLS12-381.

Copilot AI review requested due to automatic review settings February 4, 2026 00:31
@socket-security
Copy link

socket-security bot commented Feb 4, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedsoroban-sdk@​25.0.28210093100100

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

This pull request restructures the groth16_verifier directory into a Cargo workspace and adds a BN254 Groth16 verifier implementation alongside the existing BLS12-381 implementation.

Changes:

  • Restructured the project into a Cargo workspace with two member packages: bls12-381 and bn254
  • Moved existing BLS12-381 verifier code from the root to the bls12-381 subdirectory
  • Added BN254 Groth16 verifier with contract implementation, tests, and generated artifacts

Reviewed changes

Copilot reviewed 18 out of 37 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
groth16_verifier/Cargo.toml Converted to workspace configuration with shared dependencies, upgraded soroban-sdk to 25.0.2
groth16_verifier/Cargo.lock Updated with new workspace structure and additional dependencies for ark-bn254 0.5.0
groth16_verifier/Makefile Updated to build both packages and optimize WASM outputs to opt/ directory
groth16_verifier/README Updated to describe both implementations (note: lacks .md extension)
groth16_verifier/src/test.rs Deleted - moved to bls12-381/src/test.rs
groth16_verifier/bls12-381/* New subdirectory containing migrated BLS12-381 implementation
groth16_verifier/bn254/* New subdirectory containing BN254 implementation with lib.rs, tests, data artifacts, and auxiliary files
Comments suppressed due to low confidence (1)

groth16_verifier/README:16

  • The main README file lacks a .md extension while the subdirectory READMEs (bls12-381/README.md and bn254/README.md) have .md extensions. For consistency and better platform support (e.g., GitHub rendering), consider renaming this file to README.md.
# Groth16 Verifier Examples

This directory contains two Groth16 verifier contracts:

- BLS12-381 implementation: [bls12-381](bls12-381)
- BN254 implementation: [bn254](bn254)

Each subpackage includes its own contract, tests, and data artifacts. Shared Rust toolchain configuration remains at the workspace root.

## ⚠️ WARNING: Demonstration Use Only

**This project is for demonstration purposes only.**
- It has **not** undergone security auditing
- It is **not** safe for use in production environments

**Use at your own risk.**

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

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
ark-bn254 = { version = "0.5.0" }
ark-serialize = { version = "0.5.0" }
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The BN254 package uses ark-serialize version 0.5.0, while soroban-env-host uses ark-serialize version 0.4.2. This version mismatch could lead to compatibility issues. Consider using ark-serialize version 0.4.2 to match the runtime dependency.

Suggested change
ark-serialize = { version = "0.5.0" }
ark-serialize = { version = "0.4.2" }

Copilot uses AI. Check for mistakes.
ark-bn254 = { version = "0.5.0" }
ark-serialize = { version = "0.5.0" }
ark-ff = { version = "0.5.0" }
ark-ec = { version = "0.5.0" }
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The BN254 package uses ark-ec version 0.5.0, while soroban-env-host uses ark-ec version 0.4.2. This version mismatch could lead to compatibility issues. Consider using ark-ec version 0.4.2 to match the runtime dependency.

Suggested change
ark-ec = { version = "0.5.0" }
ark-ec = { version = "0.4.2" }

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Extra blank lines between the use statement and contracterror definition. The bls12-381 implementation has only one blank line here. Consider removing one blank line for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +20
ark-bn254 = { version = "0.5.0" }
ark-serialize = { version = "0.5.0" }
ark-ff = { version = "0.5.0" }
ark-ec = { version = "0.5.0" }
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The BN254 package uses ark-bn254 version 0.5.0, while soroban-env-host (a dependency of soroban-sdk) uses ark-bn254 version 0.4.0. This version mismatch could lead to subtle compatibility issues or unexpected behavior. Consider using ark-bn254 version 0.4.0 to match the runtime dependency, or verify that version 0.5.0 is intentionally required for test-only functionality.

Suggested change
ark-bn254 = { version = "0.5.0" }
ark-serialize = { version = "0.5.0" }
ark-ff = { version = "0.5.0" }
ark-ec = { version = "0.5.0" }
ark-bn254 = { version = "0.4.0" }
ark-serialize = { version = "0.4.0" }
ark-ff = { version = "0.4.0" }
ark-ec = { version = "0.4.0" }

Copilot uses AI. Check for mistakes.
soroban-sdk = { workspace = true, features = ["testutils"] }
ark-bn254 = { version = "0.5.0" }
ark-serialize = { version = "0.5.0" }
ark-ff = { version = "0.5.0" }
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The BN254 package uses ark-ff version 0.5.0, while soroban-env-host uses ark-ff version 0.4.2. This version mismatch could lead to compatibility issues. Consider using ark-ff version 0.4.2 to match the runtime dependency.

Suggested change
ark-ff = { version = "0.5.0" }
ark-ff = { version = "0.4.2" }

Copilot uses AI. Check for mistakes.
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.

1 participant