Skip to content

refactor(stm): harden legacy decoders and key registration#3429

Open
damrobi wants to merge 4 commits into
mainfrom
damrobi/msnark/refactor-stm-codec-and-keyreg
Open

refactor(stm): harden legacy decoders and key registration#3429
damrobi wants to merge 4 commits into
mainfrom
damrobi/msnark/refactor-stm-codec-and-keyreg

Conversation

@damrobi

@damrobi damrobi commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Content

This PR includes some updates of legacy decoders and of the key registration. The updates harden the robustness of the decoders and of the key registration.

Changes

  • KeyRegistration now keeps two HashMap to keep track of the registered keys

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

Issue(s)

@damrobi damrobi self-assigned this Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Test Results

     5 files  ± 0     209 suites  ±0   34m 1s ⏱️ - 2h 41m 5s
 3 315 tests  - 71   3 315 ✅  - 71  0 💤 ±0  0 ❌ ±0 
11 050 runs   - 71  11 050 ✅  - 71  0 💤 ±0  0 ❌ ±0 

Results for commit 7b4d7f8. ± Comparison against base commit 936eadd.

This pull request removes 73 and adds 2 tests. Note that renamed tests count towards both.
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_out_of_bounds
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::index_too_large_for_circuit_range
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::indices_not_increasing
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_merkle_path_mismatch
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_swap_keep_merkle_path
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::leaf_wrong_verification_key
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_corrupt_sibling
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_flip_position
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_length_long
mithril-stm ‑ circuits::halo2::tests::golden::cases::negative::slow::merkle_path_length_short
…
mithril-stm ‑ protocol::key_registration::register::tests::register_by_entry_rejects_same_snark_key_with_different_concatenation_key
mithril-stm ‑ protocol::key_registration::register::tests::register_by_entry_rejects_same_verification_key_with_different_stake

♻️ This comment has been updated with latest results.

@damrobi
damrobi force-pushed the damrobi/msnark/refactor-stm-codec-and-keyreg branch from 25ced7c to 005d085 Compare July 21, 2026 16:41
@damrobi
damrobi temporarily deployed to testing-preview July 21, 2026 17:07 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview July 21, 2026 17:07 — with GitHub Actions Inactive
@damrobi
damrobi force-pushed the damrobi/msnark/refactor-stm-codec-and-keyreg branch 2 times, most recently from 426aa37 to 79c7c92 Compare July 22, 2026 08:42
@damrobi
damrobi marked this pull request as ready for review July 22, 2026 08:43
@damrobi
damrobi removed the request for review from curiecrypt July 22, 2026 08:44
@damrobi
damrobi force-pushed the damrobi/msnark/refactor-stm-codec-and-keyreg branch from 79c7c92 to f65e932 Compare July 22, 2026 08:53
@damrobi
damrobi temporarily deployed to testing-preview July 22, 2026 09:16 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview July 22, 2026 09:16 — with GitHub Actions Inactive
@jpraynaud
jpraynaud requested a review from Copilot July 22, 2026 09:39

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 hardens mithril-stm’s legacy byte decoders against malformed inputs and strengthens key registration by enforcing uniqueness on verification keys (rather than on full registration entries that include stake).

Changes:

  • Hardened legacy from_bytes_legacy deserializers to use checked arithmetic and safe slice access.
  • Updated KeyRegistration to track registered verification keys via dedicated maps and reject duplicates even if stake differs.
  • Bumped mithril-stm to 0.11.3 and propagated the version update through workspace dependencies and changelog.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mithril-stm/src/protocol/key_registration/register.rs Enforces key-level uniqueness during registration (and adds tests for duplicate-key scenarios).
mithril-stm/src/proof_system/concatenation/aggregate_key.rs Hardens legacy aggregate key decoding by avoiding unchecked slice indexing.
mithril-stm/src/membership_commitment/merkle_tree/path.rs Hardens legacy Merkle path/batch path decoding with checked offsets and safe slicing.
mithril-stm/CHANGELOG.md Adds 0.11.3 entry describing the decoder and key registration hardening.
mithril-stm/Cargo.toml Bumps crate version to 0.11.3.
mithril-common/Cargo.toml Updates dependency on mithril-stm to 0.11.3.
Cargo.lock Updates lockfile for mithril-stm version bump.

Comment thread mithril-stm/src/protocol/key_registration/register.rs Outdated
@damrobi
damrobi force-pushed the damrobi/msnark/refactor-stm-codec-and-keyreg branch from f65e932 to 7b4d7f8 Compare July 22, 2026 13:48
@damrobi
damrobi temporarily deployed to testing-preview July 22, 2026 14:37 — with GitHub Actions Inactive
@damrobi
damrobi temporarily deployed to testing-2-preview July 22, 2026 14:37 — with GitHub Actions Inactive
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