Skip to content

SNARK-friendly STM: New Key Registration#2880

Merged
curiecrypt merged 8 commits into
mainfrom
curiecrypt/msnark/key-registration
Jan 23, 2026
Merged

SNARK-friendly STM: New Key Registration#2880
curiecrypt merged 8 commits into
mainfrom
curiecrypt/msnark/key-registration

Conversation

@curiecrypt

@curiecrypt curiecrypt commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Content

This PR includes new key registration functionality.
New key registration supports registering different types of keys specific to proof system.
Changing the key registration results in some important modifications in the other (sub-)modules in STM library.

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

This branch provides the STM library to be fully convenient for integrating SNARK proofs.

Issue(s)

Closes #2791

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

Test Results

    5 files  ± 0    172 suites  ±0   31m 59s ⏱️ + 1m 3s
2 426 tests + 5  2 426 ✅ + 5  0 💤 ±0  0 ❌ ±0 
7 553 runs  +20  7 553 ✅ +20  0 💤 ±0  0 ❌ ±0 

Results for commit 609870e. ± Comparison against base commit 3fdf7b5.

This pull request removes 3 and adds 8 tests. Note that renamed tests count towards both.
mithril-stm ‑ protocol::aggregate_signature::clerk::tests::test_dedup
mithril-stm ‑ protocol::key_registration::tests::golden::golden_conversions
mithril-stm ‑ protocol::key_registration::tests::test_keyreg
mithril-stm ‑ proof_system::concatenation::aggregate_key::tests::golden::golden_conversions
mithril-stm ‑ proof_system::concatenation::aggregate_key::tests::golden_json::golden_conversions
mithril-stm ‑ proof_system::concatenation::clerk::tests::test_dedup
mithril-stm ‑ protocol::aggregate_signature::aggregate_key::tests::golden_json::golden_conversions
mithril-stm ‑ protocol::key_registration::register::tests::golden::golden_conversions
mithril-stm ‑ protocol::key_registration::register::tests::test_keyreg
mithril-stm ‑ protocol::key_registration::registration_entry::tests::test_ord_different_stakes
mithril-stm ‑ protocol::key_registration::registration_entry::tests::test_ord_same_stake_different_keys

♻️ This comment has been updated with latest results.

@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from d731e0c to 8c98a17 Compare January 9, 2026 19:21
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs Fixed
Comment thread mithril-stm/src/protocol/key_registration/register.rs Fixed
Comment thread mithril-stm/src/signature_scheme/bls_multi_signature/mod.rs Fixed
Comment thread mithril-stm/src/signature_scheme/bls_multi_signature/mod.rs Fixed
Comment thread mithril-stm/src/signature_scheme/bls_multi_signature/mod.rs Fixed
@curiecrypt

curiecrypt commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator Author

@jpraynaud tests related to hex encodings for AggregateVerificationKey fail:

  • restorations_from_json_hex_and_bytes_hex_give_same_certificate
  • genesis_certificate::restorations_from_bytes_hex_succeeds
    Couldn't resolve why.
    Json serializations for AggregateVerificationKey work. (Golden string matches with the one produced by main implementation) See Golden test for avk #2904

Copilot AI left a comment

Copy link
Copy Markdown

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 a significant refactoring of the key registration system in mithril-stm to support SNARK-friendly STM. The changes introduce a new RegistrationEntry type that encapsulates verification keys and stakes, reorganizes the proof system architecture by separating concatenation-specific logic, and updates the API throughout the codebase.

Changes:

  • Introduces new RegistrationEntry type and refactors KeyRegistration/ClosedKeyRegistration to use ordered sets
  • Restructures proof system by extracting concatenation-specific components (ConcatenationClerk, ConcatenationProofSigner, ConcatenationProofKey)
  • Converts AggregateVerificationKey from struct to enum to support multiple proof systems
  • Updates all dependent code (tests, examples, benchmarks, mithril-common, mithril-signer, demos) to use new APIs

Reviewed changes

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

Show a summary per file
File Description
mithril-stm/src/protocol/key_registration/registration_entry.rs New file defining RegistrationEntry with validation and serialization
mithril-stm/src/protocol/key_registration/register.rs Refactored registration using BTreeSet for ordered entries
mithril-stm/src/protocol/participant/signer.rs Simplified signer to delegate to proof system-specific signers
mithril-stm/src/protocol/participant/initializer.rs Updated to create signers with new registration system
mithril-stm/src/proof_system/concatenation/signer.rs New concatenation proof signer extracted from main Signer
mithril-stm/src/proof_system/concatenation/clerk.rs New concatenation clerk extracted from main Clerk
mithril-stm/src/proof_system/concatenation/proof_key.rs New concatenation proof key type
mithril-stm/src/protocol/aggregate_signature/aggregate_key.rs Converted to enum to support multiple proof systems
mithril-stm/src/protocol/aggregate_signature/clerk.rs Refactored to delegate to proof-system specific clerks
mithril-stm/src/protocol/error.rs Added new error variants for registration
mithril-stm/src/lib.rs Updated type aliases and exports
mithril-stm/tests/* Updated tests to use new registration API
mithril-stm/examples/* Updated examples with new API
mithril-stm/benches/* Updated benchmarks with new API
mithril-common/src/crypto_helper/* Updated wrappers and type aliases
mithril-signer/src/services/single_signer.rs Updated to use new Clerk API
demo/protocol-demo/src/* Updated demo code with new APIs

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

Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
Comment thread mithril-stm/src/protocol/aggregate_signature/clerk.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/mod.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
Comment thread mithril-stm/src/membership_commitment/merkle_tree/leaf.rs
Comment thread mithril-stm/src/protocol/single_signature/signature.rs Outdated
Comment thread mithril-stm/src/protocol/single_signature/signature.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/proof.rs Outdated
Comment thread mithril-stm/README.md Outdated
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from cfb65dc to 425e4f4 Compare January 13, 2026 15:23
Comment thread mithril-common/src/crypto_helper/types/alias.rs Outdated
Comment thread mithril-stm/README.md Outdated
Comment thread mithril-stm/examples/key_registration.rs Outdated
Comment thread mithril-stm/src/lib.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from 37813c2 to 2fc6bb9 Compare January 14, 2026 14:39
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
Comment thread mithril-stm/src/proof_system/concatenation/proof_key.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/aggregate_key.rs
Comment thread mithril-stm/src/proof_system/concatenation/signer.rs
Comment thread mithril-stm/src/proof_system/concatenation/aggregate_key.rs
Comment thread mithril-stm/src/protocol/aggregate_signature/aggregate_key.rs
Comment thread mithril-stm/src/protocol/aggregate_signature/clerk.rs Outdated
Comment thread mithril-stm/src/protocol/participant/initializer.rs Outdated
Comment thread mithril-stm/src/protocol/participant/signer.rs
Comment thread mithril-stm/src/protocol/single_signature/signature.rs Outdated
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from 2fc6bb9 to 4d85b69 Compare January 14, 2026 15:38
Comment thread mithril-common/src/crypto_helper/types/alias.rs Outdated
Comment thread mithril-stm/src/lib.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/register.rs
Comment thread mithril-stm/src/protocol/key_registration/register.rs
Comment thread mithril-stm/src/protocol/key_registration/registration_entry.rs
Comment thread mithril-stm/src/protocol/participant/initializer.rs
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from 4d85b69 to 99f5896 Compare January 14, 2026 16:03
@curiecrypt
curiecrypt requested a review from jpraynaud January 14, 2026 17:09
Comment thread mithril-stm/src/protocol/aggregate_signature/clerk.rs
Comment thread mithril-stm/src/protocol/key_registration/registration_entry.rs
Comment thread mithril-stm/src/protocol/key_registration/registration_entry.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/registration_entry.rs Outdated
Comment thread mithril-stm/src/protocol/participant/initializer.rs Outdated
Comment thread mithril-stm/src/protocol/participant/initializer.rs Outdated
Comment thread mithril-stm/src/protocol/single_signature/signature.rs
Comment thread mithril-stm/src/protocol/aggregate_signature/clerk.rs Outdated
Comment thread mithril-stm/src/protocol/single_signature/signature.rs
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
Comment thread mithril-stm/src/proof_system/concatenation/aggregate_key.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs Outdated

@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 a couple of 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.

Left a few comments on small changes/questions but overall it looks good to me.

Comment thread mithril-stm/src/proof_system/concatenation/proof.rs
Comment thread mithril-stm/src/proof_system/concatenation/proof.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/single_signature.rs
Comment thread mithril-stm/src/protocol/aggregate_signature/signature.rs
Comment thread mithril-stm/src/protocol/participant/initializer.rs Outdated
Comment thread mithril-stm/src/protocol/participant/initializer.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

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


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

Comment thread mithril-stm/src/protocol/key_registration/register.rs
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
Comment thread mithril-stm/src/proof_system/concatenation/aggregate_key.rs

@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, my comments were correctly resolved!

@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.

Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
Comment thread mithril-stm/src/proof_system/concatenation/aggregate_key.rs
Comment thread mithril-stm/src/proof_system/concatenation/clerk.rs
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from 1bd88b8 to e3bab96 Compare January 22, 2026 17:43
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from e3bab96 to 037d8b7 Compare January 23, 2026 09:50
@curiecrypt
curiecrypt force-pushed the curiecrypt/msnark/key-registration branch from 037d8b7 to b097651 Compare January 23, 2026 10:00

@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 🚀

@curiecrypt
curiecrypt merged commit a4113ea into main Jan 23, 2026
98 of 99 checks passed
@curiecrypt
curiecrypt deleted the curiecrypt/msnark/key-registration branch January 23, 2026 11:33
@leepl37 leepl37 mentioned this pull request Feb 3, 2026
1 task
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.

Refactoring STM library for SNARK-friendliness

6 participants