Repository navigation
fix!: reject WIF keys without 0x01 flag, reject sighash types >0xff, maintain symmetry in {sign,recover} compact signatures, drop unused divergent segments - #1144
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (22)
💤 Files with no reviewable changes (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe changes update key parsing and public APIs, BIP32 seed validation and derivation, message and transaction signing, and wallet key construction. They also remove selected ordering implementations, key and witness methods, and an RPC error variant. ChangesCryptography and wallet updates
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant FFIClient
participant transaction_sign_input
participant DashCore
participant Builder
FFIClient->>transaction_sign_input: transaction, input, sighash_type
transaction_sign_input->>DashCore: calculate sighash and serialize signature
transaction_sign_input->>Builder: push serialized signature and public key
Builder-->>transaction_sign_input: scriptSig bytes
transaction_sign_input-->>FFIClient: signing result
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No identified issue blocks merging after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)Full details: Docstring CoverageExplanation Docstring coverage is 70.91% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 16 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #1144 +/- ##
==========================================
+ Coverage 78.20% 78.44% +0.24%
==========================================
Files 298 298
Lines 78716 78651 -65
==========================================
+ Hits 61556 61698 +142
+ Misses 17160 16953 -207
|
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review No review for |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Bots are done — your move: post |
|
/self-reviewed |
|
Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface · |
Additional Information
Depends on refactor!: drop
dashcore_hashes::hexin favour ofhex-conservative, banhex{,_lit,-literal}withcargo deny#1110PrivateKey::from_wifacccepts any 34-byte payload as a compressed key, but reference refuses if the last byte isn't0x01(source). Attempts to import such keys now fail withkey::Error::InvalidWifCompressionFlag.During code cleanup in preparation for ECDSA integration with
dash-pkc, some definitions were removed as they deviate with the reference implementation and sit unused.PublicKeysorts uncompressed keys first, whileCPubKey::operator<compares serializations, placing0x02and0x03ahead of0x04(source).PublicKey::to_sort_keyandSortKeywere removed to follow.ExtendedPubKey's derived ordering starts atnetworkanddepth, whileCExtPubKey::operator<orders by key, then chain code (source).PubKeyOrAddressinherited its ordering fromPublicKey.PublicKey::read_fromexpects a bare key, but reference prefixes aCPubKeywith itsCompactSizelength (source).signer::CompactSignatureduplicatedMessageSignature, as both write the header likeCKey::SignCompact(source).signerverification behaviour,MessageSignature::from_slicenow only accepts the headersSignCompactemits (27 to 34), where it previously accepted anything from 27. Note that this is stricter than the reference implementation, asCPubKey::RecoverCompactmasks the header and accepts any value (source).Private child derivation panicked on an IL of zero, which BIP32 treats as valid (source) and the reference implementation accepts as a zero tweak (source). IL is now parsed as a
Scalar, asSecretKeyrejects zero.ExtendedPrivKey::new_masterandRootExtendedPrivKey::new_masternow share one derivation, mirroringCExtKey::SetSeed(source), where only the latter validated the seed length. Both now returnbip32::Error::InvalidSeedLengthoutside the 128-512 range permitted by BIP32 (source).transaction_sign_inputhashed with all 32 bits of its sighash type (source) but appended only the low byte, which verifiers hash with instead (source), so types above0xffnever verified, matching reference behaviour (source).PR Hygiene ·
cb23ea2CHANGELOG.md,crypto/src/key.rs,dash/src/blockdata/script/builder.rsand 13 more) — QuantumExplorer or ZocoLini or xdustinfacekey-wallet(key-wallet/src/account/mod.rs,key-wallet/src/bip32.rs,key-wallet/src/wallet/helper.rsand 3 more) — QuantumExplorer or ZocoLini or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit
Bug Fixes
0xff; supported one-byte types are handled consistently.Breaking Changes