Repository navigation
pkc%feat(bls): recover a secret key from threshold shares - #117
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Warning This pull request may have conflicts, please coordinate with the authors of these pull requests. Potential conflicts |
|
✅ Final review complete — no blockers (commit 0750b7b) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Static verification at head 4482463 found no blocking defects: scalar recovery matches the pinned Dash Core interpolation algorithm and reuses existing identifier validation and secret-handling patterns. Three non-blocking improvements remain in API documentation, direct error-path coverage, and an inaccurate guard comment. Current CI shows all three stable-platform checks and one MSRV build/test passing; lint, corpus verification, cross-builds, and additional checks remain pending.
🟡 2 suggestion(s) | 💬 1 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: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 6: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The new recover_sk_shares and interpolate_fr functions in pkgs/pkc/src/bls/scheme_ops.rs implement intricate cryptographic secret-key reconstruction, including scalar conversions, Lagrange interpolation, validation, and sensitive-memory cleanup. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `pkgs/pkc/src/bls/scheme_ops.rs`:
- [SUGGESTION] pkgs/pkc/src/bls/scheme_ops.rs:631-633: Directly test the secret-recovery count-mismatch guard
The new recovery tests all call `BlsSecretKey::recover_shares`, which derives equal-length ID and key slices from the same input, so they cannot exercise this `CountMismatch` branch. The separately callable `BlsScheme::recover_sk_shares` needs the guard: without it, `interpolate_fr` would silently truncate its coefficient/scalar `zip` and could return an incorrect key. Add direct scheme-level tests for both mismatch directions and both schemes, keeping at least two secret shares so `InsufficientShares` does not mask the mismatch. The existing `assert_mismatched_id_count_rejected` signature-recovery test provides the pattern.
- [NITPICK] pkgs/pkc/src/bls/scheme_ops.rs:629-630: Describe truncation rather than indexing in the mismatch comment
`interpolate_fr` iterates with `coeffs.iter_mut().zip(scalars)` rather than indexing the scalar slice. Unlike the sibling G1/G2 helpers, unequal lengths would silently truncate the interpolation, not cause an out-of-bounds access. The guard is correct; update its comment to describe the failure it actually prevents.
In `pkgs/pkc/src/bls/share_ops.rs`:
- [SUGGESTION] pkgs/pkc/src/bls/share_ops.rs:229-236: Document that successful recovery does not authenticate the master key
This operation receives neither the original threshold nor an expected master public key. Consequently, two or more structurally valid shares below the split's threshold can interpolate to a nonzero scalar and return `Ok` with a key other than the master. The current error documentation explains the minimum of two but does not make this distinction explicit. Document that callers must supply enough matching shares and that `Ok` alone does not establish correct reconstruction; comparing `recovered.public_key()` with a trusted expected public key can validate the result. This is a documentation improvement, not a request to change the Core-compatible interpolation behavior.
`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Independently reviewed the complete diff at 0750b7b and found no actionable issues; secret-key recovery matches the pinned Dash Core interpolation algorithm and preserves existing input-validation and zeroization conventions. All three prior findings are fixed. This was a static review only: current CI still shows lint, stable-platform builds, and MSRV-related jobs pending, with no failed code checks reported.
🔴 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); 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:
criticalbygpt-6.1-sol(effort low) — The new recover_sk_shares and interpolate_fr functions in pkgs/pkc/src/bls/scheme_ops.rs implement intricate cryptographic secret-key reconstruction, including scalar conversion, Lagrange interpolation, validation, and sensitive-memory zeroization. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-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 final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-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.
Takes dashpay#118 dashpay#116 dashpay#117 dashpay#120 dashpay#124 dashpay#125. The fork keeps its V2 split, its basic-keyed IES calls beside the new `_as` forms, S5's V23_1 params and FU-1's governance signature bound.
Motivation
Unblocking the mock quorum builder in platform#5323.
Breaking Changes
See changelog.
How Has This Been Tested?
Checklist
Agent disclosure
Code generated with Claude Code using Opus 5.5, medium effort. Reviewed with Claude Code using Opus 5.5, medium effort.