fix: accept tsp recipients on Signet and Testnet4 - #70
Conversation
01408a9 to
ea4cd0c
Compare
nymius
left a comment
There was a problem hiding this comment.
Thanks for reviewing this project. The issue is legit.
bb6d7c1 to
754c920
Compare
754c920 to
e33251f
Compare
|
Heads up on the red The cause looks like arg placement: Update: fixed by #74, which makes |
e33251f to
e8e1b08
Compare
The incremental mutants lane has been failing at the unmutated baseline, so no mutants are ever tested. Args after `--` are handed to the test phase only, so the baseline build ran with default features. `bdk_sp` gates serde behind an optional feature while its tests derive Deserialize, which leaves the test targets uncompilable without it and fails the build before mutation starts. Pass the feature through `--cargo-arg` instead, which applies to every cargo invocation including the build. It also has to come out of the trailing args: `--cargo-arg` already adds it to the test command, and cargo rejects `--all-features` given twice. Verified against the diff from bitcoindevkit#70, which previously died at the baseline: 7 mutants found, 6 caught, 1 unviable, none missed.
14e6cbe ci(mutants): build the baseline with --all-features (kkdao) Pull request description: The `Incremental mutants test` lane is currently dead: it fails at the unmutated baseline on every PR, so no mutants are ever tested. The last run on master, 783c63c, is red for the same reason. Args after `--` are handed to the test phase only, so the baseline build runs with default features. `bdk_sp` gates `serde` behind an optional feature while its test scaffolding derives `Deserialize`, so the test targets do not compile without it and the build fails before mutation starts. Reproduces on a clean master worktree with `cargo check -p bdk_sp --tests`. Passing the feature through `--cargo-arg` fixes it, since that applies to every cargo invocation including the build. It also has to come out of the trailing args: `--cargo-arg` already adds it to the test command, and cargo rejects `--all-features` twice. Verified locally against the diff from #70, which previously died at the baseline: ``` 7 mutants tested in 83s: 6 caught, 1 unviable ``` Unrelated, noted while here and left alone: this workflow has `on: push: branches: [main]` while the default branch is `master`, so that trigger never fires. The job is gated on `github.event_name == 'pull_request' anyway, so it changes nothing today. ACKs for top commit: nymius: ACK 14e6cbe Tree-SHA512: f72ac39a6fc09b426c5f2eab96388cec0c32345d8ca8162a652ccb5f8e19888cde61e02dfedcb9fb5c93d94da9cb6d1737c541ac58617aee0f5fa4021b212f81
BIP 352 assigns one human readable prefix to every test network, so codes written for Testnet, Testnet4 and Signet are indistinguishable once encoded and parsing reports `Network::Testnet` for all three. Callers that check a parsed code against a wallet with `code.network == wallet.network()` consequently reject valid recipients on Signet and Testnet4. What the encoding carries is the prefix, not the exact chain, so expose a predicate that compares prefixes and leave the encoding itself untouched. `Display` now shares that mapping through `hrp_for_network` instead of repeating the match, so the two cannot drift apart. The groups follow this crate's encoder rather than `bitcoin::NetworkKind`: regtest has its own `sprt` prefix here, while `NetworkKind` groups it with the other test networks.
`new-tx --to-sp` compared the parsed code's network to the wallet's with `!=`. Because every test network encodes to the same `tsp` prefix and parsing reports `Network::Testnet` for all of them, a Signet or Testnet4 wallet rejected codes that were written for it, including its own. Compare prefixes through `is_valid_for_network` instead, which is the distinction the encoding carries. The bail also gains a message; it was empty, so the rejection surfaced as an error with no text.
e8e1b08 to
bca79c5
Compare
Description
Fixes #68
Every test network encodes to the same
tspprefix, so parsing always returnsNetwork::Testnet.sp-cli2 new-tx --to-spcompared that to the wallet's network with!=, so Signet and Testnet4 wallets rejected valid codes, including their own.Adds
SilentPaymentCode::is_valid_for_network, which compares prefixes instead, and uses it insp-cli2. The emptybail!("")next to it gets a message.Notes to the reviewers
Encoding is unchanged — this only changes how compatibility is judged.
prefix_assignment_is_unchangedpins that.The prefix match already in
Display::fmtis lifted intohrp_for_networkand shared, so the two can't drift.Groups follow this crate's encoder, not
bitcoin::NetworkKind, which groups regtest with the other test networks while this crate gives regtest its ownsprt.Tests are in
silentpaymentsrather than next to the CLI becausecli/v2isn't indefault-membersandjust check/just testexclude it, so a test there would never run. I built and lintedcli/v2directly to check this change.Changelog notice
Added:
SilentPaymentCode::is_valid_for_networkandencoding::hrp_for_network.Fixed:
sp-cli2 new-tx --to-sprejected validtsprecipients on Signet and Testnet4.Checklists
All Submissions:
just p(fmt, clippy and test) before committingNew Features:
Bugfixes: