Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1041 +/- ##
==========================================
+ Coverage 76.02% 77.14% +1.11%
==========================================
Files 255 320 +65
Lines 58413 81657 +23244
==========================================
+ Hits 44410 62995 +18585
- Misses 14003 18662 +4659
|
Contributor
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
A security report pointed out that `PartiallySignedTransaction::sign()` signs each input with whatever sighash type the input declares, with no BIP174 whitelist: a hostile coordinator can set SIGHASH_NONE|ANYONECANPAY (0x82) on an input and the victim's signature is then valid for any other transaction spending that same input. The claim is accurate. `sighash_ecdsa()` only checked that the value was one of the six standard types, and 0x82 is standard. The behaviour is not ours, though: the whole module is a verbatim copy of rust-bitcoin's psbt (same `sign()`, same `sighash_ecdsa()`, same doc comments as bitcoin 0.32.5), which leaves the check to the BIP174 Signer role. Rather than add the whitelist, the module goes away, because nothing used it: - No other module in this workspace referenced `key_wallet::psbt`. `TransactionBuilder` does its own signing and hardcodes `EcdsaSighashType::All`. - `key-wallet-ffi` and `dash-spv-ffi` expose no PSBT symbol, so the mobile wallets could never reach it. - dashpay/platform, the one repository that depends on key-wallet by git, has zero occurrences of `psbt` in any .rs/.toml/.ts/.js file. - The two examples that did use it, `ecdsa-psbt` and `taproot-psbt`, declared `required-features = ["bitcoinconsensus"]` — a feature that does not exist in dash/Cargo.toml — so they have never once compiled. Most of it was meaningless here anyway: `output_type()` resolved inputs to `Wpkh`, `Wsh`, `ShWpkh` and `Tr`, computing segwit and taproot sighashes for a chain that has neither. Only `Bare` and `Sh` were reachable. Removed with it: the BIP174 vector test and its fixtures, the two examples plus the dash -> key-wallet dev-dependency cycle they created, the `dash_deserialize_psbt` fuzz target and key-wallet as a dash-fuzz dependency, key-wallet's now-unused optional `base64` dependency, and `ScriptBuf::p2wpkh_script_code()` with `Script::v0_p2wpkh()`, whose only callers in the workspace were the PSBT signer and each other. `walletcreatefundedpsbt` and friends in rpc-client are Dash Core RPC methods, not this code, and stay. Verified: cargo build --workspace --all-targets, cargo clippy --workspace --all-targets --all-features with no warnings, cargo fmt --check, cargo test -p key-wallet --all-features (646 passed), cargo test -p dashcore --all-features (628 + 37 + 12 + 1 passed), cargo doc with no broken intra-doc links. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ZocoLini
force-pushed
the
chore/drop-unused-psbt-module
branch
from
September 22, 2026 16:05
c8240d7 to
1fba9b1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A security report pointed out that
PartiallySignedTransaction::sign()signs each input with whatever sighash type the input declares, with no BIP174 whitelist: a hostile coordinator can set SIGHASH_NONE|ANYONECANPAY (0x82) on an input and the victim's signature is then valid for any other transaction spending that same input.The claim is accurate.
sighash_ecdsa()only checked that the value was one of the six standard types, and 0x82 is standard. The behaviour is not ours, though: the whole module is a verbatim copy of rust-bitcoin's psbt (samesign(), samesighash_ecdsa(), same doc comments as bitcoin 0.32.5), which leaves the check to the BIP174 Signer role.Rather than add the whitelist, the module goes away, because nothing used it:
key_wallet::psbt.TransactionBuilderdoes its own signing and hardcodesEcdsaSighashType::All.key-wallet-ffianddash-spv-ffiexpose no PSBT symbol, so the mobile wallets could never reach it.psbtin any .rs/.toml/.ts/.js file.ecdsa-psbtandtaproot-psbt, declaredrequired-features = ["bitcoinconsensus"]— a feature that does not exist in dash/Cargo.toml — so they have never once compiled.Most of it was meaningless here anyway:
output_type()resolved inputs toWpkh,Wsh,ShWpkhandTr, computing segwit and taproot sighashes for a chain that has neither. OnlyBareandShwere reachable.Removed with it: the BIP174 vector test and its fixtures, the two examples plus the dash -> key-wallet dev-dependency cycle they created, the
dash_deserialize_psbtfuzz target and key-wallet as a dash-fuzz dependency, key-wallet's now-unused optionalbase64dependency, andScriptBuf::p2wpkh_script_code()withScript::v0_p2wpkh(), whose only callers in the workspace were the PSBT signer and each other.walletcreatefundedpsbtand friends in rpc-client are Dash Core RPC methods, not this code, and stay.Verified: cargo build --workspace --all-targets, cargo clippy --workspace --all-targets --all-features with no warnings, cargo fmt --check, cargo test -p key-wallet --all-features (646 passed), cargo test -p dashcore --all-features (628 + 37 + 12 + 1 passed), cargo doc with no broken intra-doc links.