Refactoring and enhancements for SNARK-friendly STM

Open
#3,066 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@leepl37 is already working on this.

Since Mar 10, 2026.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Quiet
Tech stack
rust

Research direction

Start with mithril-stm/src/protocol/participant/signer.rs at the referenced RNG handling lines, then review the STM library structure and its CPU/circuit compatibility tests. The issue spans several iterations, including registration-entry refactors, error handling, verification-key and signature options, and lottery-target computation; done means the selected checklist items are implemented and covered by the relevant tests.

Written by the indexing model from the issue text.

Description

cryptography :closed_lock_with_key: refactoring :hammer_and_wrench: stale :calendar: to-groom :thinking:

Why

The STM library has accumulated structural debt as SNARK support was introduced alongside the existing concatenation proof system.

What

Perform targeted refactorings and enhancements across the STM library to improve separation of concerns, test efficiency, API readiness for SNARK signing, and overall code hygiene.

How

Current iteration

Following iteration

  • Enhance error handling with Midnight zk library (need new version of Midnight zk released)
  • Refactor RegistrationEntry into struct with fields
  • Refactoring ClosedRegistrationEntry (To avoid having double options for vk and stake/lottery target value, use a ClosedRegistrationEntryForConcatenation and a Option<ClosedRegistrationEntryForSnark>)
  • Refactor tests for CPU/circuit compatibility (Create a dedicated module for CPU/non-recursive circuit compatibility tests)

Later

  • Get rid of Options for SNARK verification keys and signatures
  • Optimize computation of Lottery Target Value with Binomial Series?

(1-phi_f)^w = 1 - w * phi_f + w(w-1) * (phi_f^2) / 2! - w(w-1)(w-2) * (phi_f^3) / 3! + ...

Dominant language
Rust
Stars
155
Forks
52
Avg merge
2d 17h
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntersectMBO/mithril

All issues in IntersectMBO/mithril

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.