fix: correct P2P signature unpacking after #2296#2320
Conversation
…ning-bounty-2273-v2 [#2273 Items A,B,C] Ed25519 key rotation, registry expiry, and non-root fallback
…rdize UNIT constants
wuxiaobinsh-gif
left a comment
There was a problem hiding this comment.
PR Review: fix: correct P2P signature unpacking after #2296
Verdict: Looks good to merge. ✅
Technical Observations
-
Root cause is clearly identified: The caller in
_verify_signaturestill uses tuple unpacking for 2 values (sig, key_version = ...) but #2296 changed the return to 3-tuple. The fix correctly updates both_verify_signatureandverify_messagefunctions. -
Test coverage added: Three new test files covering the regression:
repro_issue_2288.py— reproduces the original issueaudit_account_utxo_mismatch.py— adds broader audit coverage- The pattern of test files suggests a regression-test-first workflow, which is solid.
-
Risk assessment: Low — the fix is targeted, only changes the unpacking side of the signature call chain. No new logic introduced, just matching the interface to its callers.
-
Minor note: The PR description could mention the specific error (
ValueError: too many values to unpack (expected 2, got 3)) for searchability, but the issue references cover this.
Recommendation
Merge before P2P message processing becomes blocked. The dependency on #2296 makes this a required patch.
FlintLeng
left a comment
There was a problem hiding this comment.
Review — ⚠️ Duplicate of #2321
This PR and #2321 by the same author (MichaelSovereign) contain identical changes:
- Same
unpack_signature2→3 arg fix - Same
audit_account_utxo_mismatch.pytest file - Same
repro_issue_2288.pytest file - Same
RC_ADMIN_KEYtest fixes in 3 test files - Same
pubkey_heximmutability fix intest_beacon_join_routing
The only difference is #2321 also includes p2p_identity.py changes (lazy loading, sign(), pubkey_hex property).
Recommendation: Close this PR as duplicate. Merge #2321 instead (after addressing review concerns there).
Also note: both PRs have the same scope inflation problem — mixing signature fixes, admin key enforcement, and UTXO mismatch tests into one PR.
Wallet: kuanglaodi2-sudo
fengqiankun6-sudo
left a comment
There was a problem hiding this comment.
PR Review — #2320 APPROVED
Reviewer: fengqiankun6-sudo | Bounty: #2782 PR Review
Summary
Fixes two related issues:
- unpack_signature regression: Updates 2-tuple unpacking to 3-tuple (from #2296 change)
- _handle_get_state arity fix: Generates synthetic msg_id for state responses
Code Quality
- Uses _ as placeholder for unused key_version — correct
- Uses json.dumps(payload) in hash for deterministic content — cleaner than #2323 approach
- Consistent fix across both _verify_signature and verify_message
Security
- No new security concerns introduced
Verdict
APPROVED — Fixes the unpack_signature regression cleanly. Merge when ready.
|
Michael Sovereign here. Closing this in favor of PR #2321 which includes these signature unpacking fixes as part of the broader P2P identity hardening package. 🦅 |
PR #2296 updated
p2p_identity.unpack_signatureto return a 3-tuple (includingkey_version), but did not update the callers inrustchain_p2p_gossip.py. This causes aValueError: too many values to unpack (expected 2, got 3)on every message verification attempt.This PR correctly updates the unpacking logic in
_verify_signatureandverify_message.Addresses the regression noted in #2312 and unblocks P2P message processing.