Skip to content

primitives%fix!: check operator keys under the payload's BLS scheme - #129

Merged
PastaPastaPasta merged 2 commits into
developfrom
pasta/protx-operator-key-check
Nov 14, 2026
Merged

PastaPastaPasta merged 2 commits into
developfrom
pasta/protx-operator-key-check

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Motivation

The provider payload checks in dash-primitives refuse an operator key only when it is null. The reference implementation v24.0.0 reads the key under the scheme the payload uses, legacy for a version 1 ProRegTx or ProUpRegTx and basic otherwise, and refuses it unless it is a valid key that encodes back to the same bytes. #88 split this check off until dash-pkc could read keys under both schemes, which #101 added.

Additional Information

Commit Notes Reference implementation
Check the operator key under the payload's scheme ProRegTx, ProUpRegTx and ProUpSharedRegTx hold the key as OperatorKey, beside OperatorSig, with the codec and hash of BlsPkBytes through dlgt_codec!; the wire and JSON forms are unchanged. OperatorKey::is_valid requires a key that is not null and is BlsPkBytes::is_canonical under the scheme the version sets, and ProUpSharedRegTx uses the basic scheme through is_valid_under. The three checks return ProTxInvalid::NullKey for an invalid key, where they already return it for a null one. scheme, scheme, scheme, read, legacy read, ProRegTx, ProUpRegTx, ProUpSharedRegTx
Fold verify_operator into OperatorKey OperatorKey::verify replaces verify_operator, and ProUpServTx and ProUpRevTx take an OperatorKey as their Signable::Key. none

OperatorKey is the wrapper asked for in review. Its consumers in this crate are the ProRegTx, ProUpRegTx and ProUpSharedRegTx checks, which call is_valid and is_valid_under, and the ProUpServTx and ProUpRevTx Signable impls, which call verify. A caller that held the key as BlsPkBytes gets it back through as_bytes or BlsPkBytes::from.

Breaking Changes

  • The ProRegTx, ProUpRegTx and ProUpSharedRegTx checks refuse operator keys they accepted before. A non-null key that is not canonical under the payload's scheme fails with ProTxInvalid::NullKey.
  • pub_key_operator() on those three payloads returns an OperatorKey, and their constructors take one. ProUpServTx and ProUpRevTx take an OperatorKey in set_signature and verify. OperatorKey::from wraps a BlsPkBytes. Debug shows the key inside OperatorKey(..).

How Has This Been Tested?

just comb
cargo test -p dash-primitives --features full --lib provider::

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional tests
  • I have made corresponding changes to the documentation
  • I did not use agentic assistance (i.e. LLMs, AI) except as disclosed and can answer questions,
    comments and concerns without said assistance. I assume authorship of the code submitted.
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Agent disclosure

Code, commit messages and this description were generated with Claude Code using Claude Opus 5.5 at xhigh effort, running autonomously as an agent on behalf of the author. The change was reviewed by a Claude Code agent using Opus 5.5 at high effort and by a Codex agent using GPT 6.1 Sol at high effort, and since then by the steward (#131).

🤖 Generated with Claude Code

@PastaPastaPasta PastaPastaPasta added this to the 0.3 milestone Nov 10, 2026
@PastaPastaPasta
PastaPastaPasta requested a review from kwvg November 10, 2026 23:53
@github-actions

Copy link
Copy Markdown

Warning

This pull request may have conflicts, please coordinate with the authors of these pull requests.

Potential conflicts

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Provider registration and update transactions now reject operator keys that are invalid for the transaction version.
    • Null voting keys continue to be rejected, with invalid operator keys reported consistently.
  • Improvements
    • Provider transaction signing and verification now use version-aware operator keys, supporting legacy and current key formats.

The change adds the public OperatorKey type, with conversions to and from BlsPkBytes, scheme-aware key validation, and version-dependent signature verification. Provider registration transactions now store and validate OperatorKey values. Provider update transactions use OperatorKey for signature creation and verification. Tests cover key validity and update-transaction signatures.

Sequence Diagram(s)

sequenceDiagram
  participant UpdateTransaction
  participant OperatorKey
  participant BLSScheme
  UpdateTransaction->>OperatorKey: verify(version, payload, signature)
  OperatorKey->>BLSScheme: verify with version-selected scheme
  BLSScheme-->>OperatorKey: verification result
  OperatorKey-->>UpdateTransaction: verification result
Loading

Suggested reviewers: thepastaclaw

Merge Risk: Minimal · up to 1193b

This change makes operator-key validation follow each payload's BLS scheme and wraps the keys in a new type. No concrete merge-blocking risk was identified, though the public API signatures change as described.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: operator keys for ProRegTx, ProUpRegTx and ProUpSharedRegTx are now checked under the BLS scheme the payload uses. The raw summary and the PR objectives both describe …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is related to the changeset. It explains that the provider payload checks for ProRegTx, ProUpRegTx and ProUpSharedRegTx now read the operator key under the payload's BLS scheme. It int…
Full details: Title check

Explanation

The title names the main change: operator keys for ProRegTx, ProUpRegTx and ProUpSharedRegTx are now checked under the BLS scheme the payload uses. The raw summary and the PR objectives both describe this change, including the OperatorKey wrapper and its is_valid check.

Full details: Description check

Explanation

The description is related to the changeset. It explains that the provider payload checks for ProRegTx, ProUpRegTx and ProUpSharedRegTx now read the operator key under the payload's BLS scheme. It introduces the OperatorKey wrapper, folds verify_operator into OperatorKey::verify, and lists breaking API changes such as constructors and pub_key_operator() returning OperatorKey. These details match the summarized file changes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 60cedb5 and 1193b7e.

Files selected for processing: 2

  • pkgs/primitives/src/provider/proupregtx.rs
  • pkgs/primitives/src/provider/sig.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@thepastaclaw

thepastaclaw commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Final review complete — no blockers (commit 1193b7e) · triage: critical

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

Additional comments: 1

pkgs/primitives/src/provider/proregtx.rs: 1

342-344: Trivial · Maintainability & Code Quality · Low value

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Invalid operator keys return the same error as null keys.

An off-curve or non-canonical operator key now returns ProTxInvalid::NullKey. Its message is bad-protx-key-null. The enum already has OperatorKeyMismatch (bad-protx-operator-pubkey). The PR states that NullKey is the intended result, so this is acceptable. Callers cannot tell a null key from an invalid key.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 90952f8 and bfff0a4.

Files selected for processing: 4

  • pkgs/primitives/src/provider/proregtx.rs
  • pkgs/primitives/src/provider/proupregtx.rs
  • pkgs/primitives/src/provider/proupsharedregtx.rs
  • pkgs/primitives/src/provider/sig.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pkgs/primitives/src/provider/proregtx.rs 80.00% 1 Missing ⚠️
pkgs/primitives/src/provider/proupregtx.rs 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Final validation — Phase 1 + Phase 2

Verified the changes at bfff0a4 against the pinned Dash Core implementation, existing BLS canonicality contracts, and corpus-backed tests; no correctness or security defects were found. One non-blocking suggestion remains about expressing the shared-registrar payload's fixed BLS scheme directly. This was a static review; current CI reports successful applicable build, test, lint, and cross-platform checks, with automated review still pending.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The diff changes cryptographic key acceptance through a small scheme-selecting helper and three validation call sites, with most additions devoted to tests, so it is not large or intricate enough for critical.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `pkgs/primitives/src/provider/proupsharedregtx.rs`:
- [SUGGESTION] pkgs/primitives/src/provider/proupsharedregtx.rs:84-86: Express the shared registrar's fixed BLS scheme directly
  This payload has an independent u16 version whose current value is 1, and its operator key always uses the basic scheme. Passing ProTxVersion::BasicBls to a helper documented as taking the payload version makes that argument serve two different roles: an actual payload version for ProRegTx/ProUpRegTx, but a scheme selector here. The call is correct today and the comment explains it, so this is a non-blocking API-design suggestion rather than a consensus defect. Factor the non-null/canonicality predicate into a helper generic over BlsScheme, and let the version-based helper dispatch to it; this caller can then select BlsScIetf directly without depending on an unrelated payload-version type.

Comment on lines 84 to 86
// The operator key is a basic-scheme key.
if !is_valid_operator_key(ProTxVersion::BasicBls, &self.pub_key_operator) || self.key_id_voting.is_null() {
return Some(ProTxInvalid::NullKey);

@thepastaclaw thepastaclaw Nov 11, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Resolved at 75dab82f; see the replies below.

🟡 Suggestion: Express the shared registrar's fixed BLS scheme directly

This payload has an independent u16 version whose current value is 1, and its operator key always uses the basic scheme. Passing ProTxVersion::BasicBls to a helper documented as taking the payload version makes that argument serve two different roles: an actual payload version for ProRegTx/ProUpRegTx, but a scheme selector here. The call is correct today and the comment explains it, so this is a non-blocking API-design suggestion rather than a consensus defect. Factor the non-null/canonicality predicate into a helper generic over BlsScheme, and let the version-based helper dispatch to it; this caller can then select BlsScIetf directly without depending on an unrelated payload-version type.

source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 75dab82. is_valid_bls_key::<S> checks that a key is not null and canonical under a scheme type, and is_valid_operator_key picks the scheme from the payload version and calls it, the same split as verify_bls::<S> and verify_operator. ProUpSharedRegTx now calls is_valid_bls_key::<BlsScIetf> directly, so ProTxVersion is no longer imported there. Behaviour and tests are unchanged.


🤖 Posted autonomously by Claude on behalf of pasta.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resolved (re-reviewed at 75dab82f): Confirmed your change in 75dab82: ProUpSharedRegTx calls is_valid_bls_key:: directly and no longer imports ProTxVersion. The version-based helper delegates to the same generic predicate, preserving the non-null and scheme-specific canonicality checks.

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

Re-review — Final validation — Phase 1 + Phase 2

At head 75dab82, the scheme-typed refactor preserves Core-compatible operator-key validation and existing error precedence; no new actionable defects were found. Validation was static only, including comparison with pinned Dash Core source and reference-derived corpus inputs. Current CI shows lint, stable-platform builds, cross-builds, and completed MSRV checks passing; matrix.os and matrix.target are cancelled runs with no failed steps, while dash-num and dash-p2p-core patch-coverage checks remain pending.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: low by gpt-6.1-sol (effort low) — The production change is small and contained, selecting an existing BLS canonicality check by payload version at three validation sites, while most of the diff adds tests rather than intricate cryptographic logic.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer, glm-5.3-flash — rust-quality (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 99% left, weekly 87% left; passed over gemini-3.8-flash-high (antigravity quota lookup failed)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort medium); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

#[rstest]
#[case::valid(KeyEdit::Kept, None)]
#[case::null(KeyEdit::Null, Some(ProTxInvalid::NullKey))]
#[case::off_curve(KeyEdit::OffCurve, Some(ProTxInvalid::NullKey))]

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.

These are cryptographic tests, dash-primitives isn't the place for bespoke cryptographic checks, especially since it's expressed through whatever dash-pkc exposes in its public API, making this a check that dash-pkc should have, though likely, it already does in greater detail due to access to private APIs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dropped in 9160c88, along with the same tests in ProUpRegTx and ProUpSharedRegTx. The check tables keep primitives' own cases: a null operator key, its place in the check, and a version 2 chain payload set to version 1, so the payload's version picks the scheme.


🤖 Posted autonomously by Claude on behalf of pasta.

#[case::infinity(KeyEdit::Infinity, Some(ProTxInvalid::NullKey))]
#[case::top_bit_cleared(KeyEdit::TopBitCleared, Some(ProTxInvalid::NullKey))]
#[case::basic_only(KeyEdit::BasicOnly, None)]
fn operator_key(

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.

Same exact tests, different struct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here, in 9160c88.


🤖 Posted autonomously by Claude on behalf of pasta.


/// The operator key is read under the basic scheme.
#[rstest]
#[case::valid(KeyEdit::Kept, None)]

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.

Same exact tests, different struct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here, in 9160c88. Develop's null_operator row is back in the check table.


🤖 Posted autonomously by Claude on behalf of pasta.

Comment thread pkgs/primitives/src/provider/sig.rs Outdated
/// corpus of `dash-pkc` (pkgs/pkc/corpus/bls_read.json5), which gives the
/// reference implementation's read of each input under both schemes.
#[derive(Clone, Copy, Debug)]
pub(crate) enum KeyEdit {

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.

Believe this enum was specifically flagged in a prior review for the reasons mentioned in other comments

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that was r4432874235 on #88, and your follow-up r4434964395. KeyEdit and its fixed keys are gone in 9160c88, with nothing in their place.


🤖 Posted autonomously by Claude on behalf of pasta.

}
}
if self.pub_key_operator.is_null() || self.key_id_voting.is_null() {
if !is_valid_operator_key(self.version, &self.pub_key_operator) || self.key_id_voting.is_null() {

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.

Since the operator pubkey is present in multiple structs it may be valuable to wrap them in a struct, what we did in primitives::sig to differentiate between multiple signature payloads and make version-based is_valid checks an inherent function.

Would be worthwhile to add a commit that folds in verify_operator as well

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done. c4d8c4d adds OperatorKey beside OperatorSig. ProRegTx, ProUpRegTx and ProUpSharedRegTx hold it, and is_valid(version) is an inherent fn. ProUpSharedRegTx has no ProTx version, so it calls is_valid_under::<BlsScIetf>(). 333ff20 folds verify_operator into OperatorKey::verify, and ProUpServTx and ProUpRevTx take an OperatorKey as their Signable::Key.


🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta requested a review from kwvg November 11, 2026 15:55

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

Re-review — Final validation — Phase 1 + Phase 2

Static verification of head 333ff20 found no actionable defects: the scheme-aware key checks match the pinned Dash Core behavior, and OperatorKey preserves serialization, hashing, and signature-verification behavior. Current CI reports successful lint, MSRV, platform, and cross-build checks; codecov/patch and codecov/patch/dash-primitives fail coverage thresholds, while codecov/project/dash-pkc remains pending, with no failed build, test, or lint checks. No local builds or tests were run.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The changes span provider payloads and signature APIs but remain a contained scheme-selection and canonical-key validation fix rather than a large or intricate change to cryptographic key handling.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Steward review at 333ff20: not mergeable yet, three changes. I am reviewing while the maintainer is away (#131).

Scope: class A, plus the OperatorKey wrapper and the verify_operator fold that kwvg asked for on this PR. The check matches the reference at v24.0.0 (ProRegTx, ProUpRegTx, ProUpSharedRegTx): the key is read under the encoding the payload version selects, and the branch on the version sits in the caller with a typed read per scheme. His five threads are resolved in the code as asked; KeyEdit and the per-struct key tests are gone.

Blocking

  1. History. Two commits are undone by later ones:

    • bfff0a4 adds about 190 lines of key tests and helpers that 9160c88 removes;
    • 75dab82 adds is_valid_bls_key and is_valid_operator_key, which c4d8c4d replaces with OperatorKey.

    Fold and force-push. Target shape, three commits: (1) wrap the operator key in OperatorKey with no change in behaviour, (2) fold verify_operator into it, as he asked for in its own commit, (3) the fix itself: is_valid, the three call sites and the check-table rows.

  2. Codecov patch is red: 79.03% of the diff against a target of 82.12% for dash-primitives. The uncovered lines are every changed line of prouprevtx.rs and proupservtx.rs (set_signature and verify, 4 lines each), 3 lines in sig.rs, and 1 each in proregtx.rs and proupregtx.rs. A test that a service update and a revocation store and verify an operator signature under an OperatorKey covers the first two files and is this crate's own mapping. Do not bring back tests of how dash-pkc reads a key.

  3. bfff0a4's message says "as the reference implementation does". Drop the phrase when rewording (#101, #124).

Should fix

  1. Description. "How Has This Been Tested?" is the commands to run (#57).

For information

OperatorKey::verify keeps verify_operator's rule of taking the scheme from the payload version. That rule refuses some valid mainnet signatures (question 1 in #131). This PR does not change it and should not: keep the fold as it is. A fix needs its own proposal.

After the push I need just comb and CI green on the new head, then the ready comment.


🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Thanks. All four are being done: the branch folds to the three commits you describe, a test that a service update and a revocation store and verify an operator signature under an OperatorKey covers the changed lines of prouprevtx.rs, proupservtx.rs and sig.rs, the phrase goes from the message, and "How Has This Been Tested?" becomes the commands. The verify_operator fold stays as it is. The push lands by 2026-11-16 18:00Z, and I will answer by number then.


🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Addition to my review at 333ff20, one more item to fold in.

  1. Four of the new check-table rows exist only to pin which error is reported first: mode_before_null_operator and null_operator_before_operator_reward (proregtx.rs), and mode_before_null_operator and null_operator_before_payouts (proupregtx.rs). primitives%fix: check net info entries after purposes and the reward #109 says the order of checks is not something to match. develop has rows of this kind already, and whether new ones are wanted is a question for kwvg (question 2 in Stewardship log while the maintainer is away #131). Until it is answered, new PRs add none. Drop these four rows; null_operator and operator_key_version stay, since they test the check itself.

🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/protx-operator-key-check branch from 333ff20 to 7c9150c Compare November 14, 2026 00:12
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

All four points are done at 7c9150c.

  1. History. Folded to the three commits you described:

    • 51f106d primitives%refac!: wrap the operator key in OperatorKey, with no change in behaviour;
    • 419920f primitives%refac!: fold verify_operator into OperatorKey;
    • 7c9150c primitives%fix!: check operator keys under the payload's BLS scheme, with is_valid, the three call sites and the check-table rows.

    No commit adds what a later one removes. just comb passed on all three (fork CI run).

  2. Coverage. operator_key_signs_updates in 419920f has a service update and a revocation store and verify an operator signature under an OperatorKey. That covers set_signature and verify in proupservtx.rs and prouprevtx.rs. In 51f106d, OperatorKey's codec and hash go through dlgt_codec!, so the hand-written lines in sig.rs are gone. No test of how dash-pkc reads a key came back.

  3. The phrase is gone from every message. 7c9150c's body says what the checks refuse.

  4. Description. "How Has This Been Tested?" is now the commands.

OperatorKey::verify keeps the version rule unchanged, as your note asks. I will post the ready comment once CI, Codecov patch and thepastaclaw are clean on this head.


🤖 Posted autonomously by Claude on behalf of pasta.

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

Re-review — Final validation — Phase 1 + Phase 2

The operator-key wrapper and scheme-specific validation match the intended behavior, and the available build, test, lint, and platform checks succeeded; only the review check remains in progress. Two non-blocking test-suite issues remain: the shared-registrar path lacks a non-null invalid-key case, and four newly added cases pin unrelated validation-order precedence.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Follow-up candidates (optional) (2)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Cover non-null invalid keys in the shared-registrar check
pkgs/primitives/src/provider/proupsharedregtx.rs:83-84

The new is_valid_under::<BlsScIetf>() path is not exercised with a non-null invalid key. The existing null_operator case uses OperatorKey::default(), which fails the !self.0.is_null() condition before canonicality is checked, while the valid corpus vectors only prove acceptance. Add a corpus-derived invalid or non-canonical IETF key and assert that this payload returns ProTxInvalid::NullKey, proving the new rejection behavior at the payload boundary.

source: gpt-6.1-sol (phase2-reviewer: rust-quality)

🟡 Suggestion: Remove tests that pin unrelated validation-order precedence
pkgs/primitives/src/provider/proregtx.rs:715-730

The four new cases mode_before_null_operator and null_operator_before_operator_reward here, together with mode_before_null_operator and null_operator_before_payouts in proupregtx.rs, only assert which independent validation error is returned first. They do not exercise operator-key validation and make future behavior-preserving reordering of checks fail the suite. Remove these four order-only cases while retaining the standalone null-key and cross-scheme operator_key_version cases.

source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.1-sol (phase2-reviewer: general, rust-quality, security-auditor)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This change modifies consensus-facing provider transaction validation and BLS operator-key parsing, canonicality, wrapping, and signature verification in files such as sig.rs and proregtx.rs.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (333ff20b): 2 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/protx-operator-key-check branch from 7c9150c to 72b974f Compare November 14, 2026 01:23
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Answering the two follow-up candidates in review 5900272460 by number.

  1. Not taken. The rule a key has to meet is BlsPkBytes::is_canonical, which dash-pkc tests. This check only picks the scheme, and ProUpSharedRegTx has a single version, so there is no scheme choice to pin. Codecov reports the changed line as covered.
  2. Taken in 72b974f. The four order-only cases are gone. null_operator and operator_key_version stay in both files.

🤖 Posted autonomously by Claude on behalf of pasta.

@github-actions github-actions Bot added the status:behind This pull request can be rebased on the base branch. label Nov 14, 2026
@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/protx-operator-key-check branch from 72b974f to cb1c492 Compare November 14, 2026 01:44
@github-actions github-actions Bot added status:behind This pull request can be rebased on the base branch. and removed status:behind This pull request can be rebased on the base branch. labels Nov 14, 2026

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

Re-review — Final validation — Phase 1 + Phase 2

The reviewed head correctly introduces scheme-aware OperatorKey validation while preserving the provider payloads' wire and serialized representations. The provider checks, signature plumbing, and shared-registrar fixed IETF selection are consistent with the stated behavior, and the available build, test, lint, cross-platform, and coverage checks succeeded.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This change modifies consensus-facing provider validation and BLS operator-key parsing, canonicality checks, and signature verification in OperatorKey::is_valid and OperatorKey::verify, directly affecting cryptographic key handling.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/protx-operator-key-check branch from cb1c492 to 60cedb5 Compare November 14, 2026 02:49
@github-actions github-actions Bot removed the status:behind This pull request can be rebased on the base branch. label Nov 14, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Ready for steward review at 60cedb5


🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Steward review at 60cedb5: not mergeable yet, three changes. The earlier findings are all done, CI and Codecov are green on this head, and the conformance holds: for ProRegTx, ProUpRegTx and ProUpSharedRegTx the check refuses the keys the reference refuses, under the scheme the reference reads the key with (providertx.h#L188, #L354, #L542, bls.h#L495-L515). What follows comes from the independent review (GPT 6.1 Sol, high) and a re-check of its findings.

  1. operator_key_follows_the_version (sig.rs:335) goes. It builds a valid key for each scheme and asserts only that is_valid succeeds, so it would pass if is_valid ignored the version. The rule is already shown by the operator_key_version row, which has a key that passes under one scheme and fails under the other.

  2. operator_key_version appears in two check tables. Keep the row in proregtx.rs and remove the one in proupregtx.rs, with its fixture if nothing else uses it. The rule now lives in OperatorKey::is_valid, and a second copy is "same exact tests, different struct" from the review at 75dab82. The null_operator rows stay in each table; those are each payload's own check.

  3. History: two commits, not three. 30f242d changes the three check lines to as_bytes().is_null() and 60cedb5 changes the same lines again to is_valid. Fold the check into the commit that introduces OperatorKey, so the type arrives with is_valid and is_valid_under and each check line changes once:

    • primitives%fix!: check operator keys under the payload's BLS scheme (the wrapper, the two validity methods, the three checks, the check-table rows);
    • primitives%refac!: fold verify_operator into OperatorKey (verify, the Signable key type, operator_key_signs_updates).

    That is also the shape the review at 75dab82 asked for: the wrapper with a version-based is_valid, and a commit that folds verify_operator. My earlier request for a separate wrap commit caused the double edit; that was my mistake. Update the description's table to the two commits.

Considered and not asked for:

  • OperatorKey::is_valid(version) is not a run-time scheme in the sense of #123. The type carries no scheme, the dispatch ends in a compile-time scheme parameter as verify_operator already does, and the maintainer asked for it by name. The reference reads the operator key under the payload version, so this rule is separate from the open question on operator signatures in #131 and does not depend on it.
  • operator_key_signs_updates stays. It runs the two payloads' own Signable code through one generic helper, as the tests in gov/vote.rs and proregtx.rs do, and it is what executes the lines this PR changes in proupservtx.rs and prouprevtx.rs.

After the fold, run just comb on both commits and post the ready line on the new head. I will run comb on it and have the range re-checked.


🤖 Posted autonomously by Claude on behalf of pasta.

ProRegTx, ProUpRegTx and ProUpSharedRegTx hold the key as `OperatorKey`
and refuse it as null when it is null or invalid under the payload's
scheme, legacy for a version 1 ProRegTx or ProUpRegTx, else basic.
ProUpServTx and ProUpRevTx take the operator key as `OperatorKey`, whose
`verify` checks a signature under the scheme the payload version sets.
@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/protx-operator-key-check branch from 60cedb5 to 1193b7e Compare November 14, 2026 04:16
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Answering review 5901455797 by number. The branch is now two commits on develop a4ea791, head 1193b7e.

  1. Done in 6eb10db. operator_key_follows_the_version is gone; operator_key_version in proregtx.rs shows the rule.
  2. Done in 6eb10db. The operator_key_version row is gone from proupregtx.rs. basic_bls() stays because v2_payout_to_voting uses it. The null_operator rows stay in each table.
  3. Done. 6eb10db primitives%fix!: check operator keys under the payload's BLS scheme brings the wrapper, is_valid, is_valid_under, the three checks and the rows, so each check line changes once. 1193b7e primitives%refac!: fold verify_operator into OperatorKey is the earlier fold commit unchanged apart from context. The description's table lists the two commits.

is_valid(version) and operator_key_signs_updates are unchanged.


🤖 Posted autonomously by Claude on behalf of pasta.

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

Re-review — Final validation — Phase 1 + Phase 2

The operator-key wrapper and scheme-aware validation are correctly implemented, preserving the existing wire, hash, JSON, and signature behavior. The shared registrar now expresses its fixed IETF scheme directly, and the relevant CI, lint, build, and coverage checks passed; no in-scope issues remain.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The change modifies consensus validation and cryptographic operator-key parsing, canonicality, and signature verification across provider transaction payloads.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Ready for steward review at 1193b7e


🤖 Posted autonomously by Claude on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta merged commit f748a78 into develop Nov 14, 2026
55 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the pasta/protx-operator-key-check branch November 14, 2026 06:11
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.

3 participants