Skip to content

feat(stm): Signer and Signature for SNARK Proof System - #3009

Merged
curiecrypt merged 12 commits into
mainfrom
curiecrypt/msnark/phase2-single-signature-for-snark
Mar 5, 2026
Merged

curiecrypt merged 12 commits into
mainfrom
curiecrypt/msnark/phase2-single-signature-for-snark

Conversation

@curiecrypt

@curiecrypt curiecrypt commented Feb 16, 2026 •

Copy link
Copy Markdown
Collaborator

Content

This PR includes:

  • Implement the SNARK proof signer (SnarkProofSigner<D>) that generates unique Schnorr signatures and checks the lottery
  • Add SingleSignatureForSnark to SingleSignature, gated behind future_snark feature, with full serialization (bytes + JSON) support
  • Integrate SNARK signing into the Signer flow: create_single_signature now produces both concatenation and SNARK signatures when future_snark is enabled
  • Extend Initializer to generate and carry Schnorr key pairs (SchnorrSigningKey, VerificationKeyForSnark)
  • Update AggregateVerificationKey to include a SNARK aggregate key built from the SNARK Merkle tree commitment
  • Update SingleSignature::verify to validate the SNARK signature against the SNARK AVK when present
  • Add deterministic golden tests for SingleSignature and SingleSignatureWithRegisteredParty covering future_snark

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

Comments

From<(RegistrationEntry, Stake)> for ClosedRegistrationEntry is updated to set modulus - 1 to the target value instead of 1.

Issue(s)

Closes #2943

@github-actions

github-actions Bot commented Feb 16, 2026 •

Copy link
Copy Markdown

Test Results

    5 files  ± 0    190 suites  ±0   59m 1s ⏱️ + 1m 11s
2 649 tests +14  2 649 ✅ +14  0 💤 ±0  0 ❌ ±0 
9 501 runs  +14  9 501 ✅ +14  0 💤 ±0  0 ❌ ±0 

Results for commit 6d3b93c. ± Comparison against base commit 9897af9.

♻️ This comment has been updated with latest results.

@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch 2 times, most recently from 1c17dc2 to f7ebfd3 Compare February 17, 2026 19:22
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch from b15c64b to 3b20205 Compare February 18, 2026 00:56
@curiecrypt
curiecrypt marked this pull request as ready for review February 18, 2026 01:10
Copilot AI review requested due to automatic review settings February 18, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR implements SNARK proof system primitives for single signatures in the Mithril STM library, specifically adding a new SnarkProofSigner that generates Schnorr signatures with lottery checking, and integrating it into the existing Signer flow alongside the concatenation proof system.

Changes:

  • Added SnarkProofSigner<D> that generates unique Schnorr signatures over [merkle_root, message] and validates lottery eligibility (with placeholder lottery logic)
  • Extended SingleSignature to include optional SingleSignatureForSnark when the future_snark feature is enabled, with full serialization support (bytes and JSON)
  • Updated Signer, Initializer, and AggregateVerificationKey to support SNARK signing alongside concatenation, all gated behind the future_snark feature flag
  • Added deterministic golden tests for SingleSignature and SingleSignatureWithRegisteredParty covering both proof systems

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
mithril-stm/src/proof_system/halo2_snark/signer.rs New SnarkProofSigner implementation with signature creation and lottery checking (placeholder logic)
mithril-stm/src/proof_system/halo2_snark/single_signature.rs SingleSignatureForSnark with verification logic against SNARK AVK
mithril-stm/src/proof_system/halo2_snark/aggregate_key.rs AggregateVerificationKeyForSnark implementation using Merkle tree commitment
mithril-stm/src/protocol/participant/signer.rs Extended Signer to optionally hold and use SnarkProofSigner when creating signatures
mithril-stm/src/protocol/participant/initializer.rs Updated to generate Schnorr key pairs and create both concatenation and SNARK signers
mithril-stm/src/protocol/single_signature/signature.rs Added optional snark_signature field with verification, serialization, and golden tests
mithril-stm/src/protocol/aggregate_signature/aggregate_key.rs Added optional SNARK AVK field with getter method
mithril-stm/src/membership_commitment/merkle_tree/commitment.rs Added build_snark_message to convert message and root to BaseFieldElement array
mithril-stm/tests/test_extensions/protocol_phase.rs Updated verification calls to pass None for SNARK registration entry
mithril-stm/README.md Updated example to include new None parameter in verify call
mithril-signer/src/services/single_signer.rs Updated test to pass None for SNARK registration entry
mithril-common/src/protocol/multi_signer.rs Updated verification to pass None for SNARK registration entry
mithril-common/src/entities/certificate.rs Updated AVK construction to pass None for SNARK AVK
Comments suppressed due to low confidence (2)

mithril-stm/src/proof_system/halo2_snark/aggregate_key.rs:16

  • The #[allow(dead_code)] attribute is not permitted in production code. This code is used when creating the aggregate verification key from ClosedKeyRegistration, so this directive should be removed.
// TODO: remove this allow dead_code directive when function is called or future_snark is activated
#[allow(dead_code)]
impl<D: MembershipDigest> AggregateVerificationKeyForSnark<D> {

mithril-stm/src/protocol/aggregate_signature/aggregate_key.rs:54

  • The PartialEq implementation only compares the concatenation_aggregate_verification_key field and does not compare the snark_aggregate_verification_key field when the future_snark feature is enabled. This means two AggregateVerificationKey instances with different SNARK AVKs would be considered equal, which is incorrect.

The implementation should compare both fields when future_snark is enabled to ensure correct equality semantics.

impl<D: MembershipDigest> PartialEq for AggregateVerificationKey<D> {
    fn eq(&self, other: &Self) -> bool {
        self.to_concatenation_aggregate_verification_key()
            == other.to_concatenation_aggregate_verification_key()
    }
}

@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch from dd26acf to 3ea16ac Compare February 18, 2026 21:08

@hjeljeli32 hjeljeli32 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The structure looks good and the design is clean. I left a few comments around alignment between STM and circuit:

  • Merkle root encoding in build_snark_message
  • DST usage and lottery verification
  • Lottery index bound semantics (< m vs <= m)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 29 out of 29 changed files in this pull request and generated 9 comments.

@damrobi damrobi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks good to me overall, I left a few comments on some compatibility problems we might have with the circuit currently.

@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch from 78cf185 to e232869 Compare March 4, 2026 16:13
@curiecrypt
curiecrypt temporarily deployed to testing-preview March 4, 2026 16:28 — with GitHub Actions Inactive
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch from e232869 to e642516 Compare March 4, 2026 19:38
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/phase2-single-signature-for-snark branch from e642516 to f07fec2 Compare March 4, 2026 19:49
@curiecrypt
curiecrypt requested a review from Copilot March 4, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 36 out of 36 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

mithril-stm/src/signature_scheme/unique_schnorr_signature/jubjub/poseidon_digest.rs:20

  • DOMAIN_SEPARATION_TAG_LOTTERY is annotated with #[allow(dead_code)] and a TODO. Since it is only used under future_snark, consider gating the constant with #[cfg(feature = "future_snark")] (or otherwise ensuring it is referenced) so the allow + TODO can be removed and dead-code warnings still stay clean.

@hjeljeli32 hjeljeli32 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I just left 2 minor comments about error handling.

@jpraynaud jpraynaud left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 🚀

@damrobi damrobi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👍

@curiecrypt
curiecrypt merged commit bd0ed43 into main Mar 5, 2026
58 checks passed
@curiecrypt
curiecrypt deleted the curiecrypt/msnark/phase2-single-signature-for-snark branch March 5, 2026 14:16

This branch was previously deployed

1 inactive deployment
testing-preview — 6d3b93c1 Deployed Mar 4, 2026 by curiecrypt via deploy-testing (testing-preview) #11380
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.

SNARK pre-aggregation primitives in STM library - Phase 2

6 participants