Skip to content

wallet-toolbox 2.14.3: dust-floor surplus shaping; admin abortAction - #638

Merged
sirdeggen merged 2 commits into
mainfrom
fix/toolbox-change-dust-and-admin-abort
Sep 26, 2026
Merged

sirdeggen merged 2 commits into
mainfrom
fix/toolbox-change-dust-and-admin-abort

Conversation

@sirdeggen

Copy link
Copy Markdown
Contributor

Ports two fixes found on device in bsv-wallet (patched there via patch-package on wallet-toolbox-mobile 2.14.0).

1. generateChangeSdk error: required fee error 23 !== 33

shapeSurplusChangeOutputs split change into changeInitialSatoshis outputs without a dust-floor check. Baskets still on the legacy minimumDesiredUTXOValue of 32 get sub-dust outputs (floor is 40 at 100 sat/kB); removeDustOutputs folds them away, shrinking the tx while r.fee stays sized for the larger one, so validation throws.

Fix: pass dustFloor into the shaping request and use max(dustFloor, changeInitialSatoshis) as the per-output floor for the gate, the initial satoshis and distributeExcessFees. The planFunding/actionBatch path goes through generateChangeSdk, so it's covered by the same helper.

2. Cancel payment: "The action reference was not issued by this permissions manager."

abortAction required a reference in the in-memory pendingActionOriginators map, which is cleared after signing and lost on restart. So signed noSend actions and earlier sessions' actions could never be aborted, even by the admin. The admin originator now skips that check. Other originators still need a reference this manager issued to them, and signAction is unchanged.

Tests

  • generateChangeSdk.test.ts 10b2: the exact repro (one coin, 100165–100260 sats, 32-sat basket, 100 sat/kB) asserts every change output ≥ dust floor and fee = ceil(size/1000·100).
  • WalletPermissionsManager.boundaries.test.ts: the admin aborts an unissued reference; example.com and undefined are refused for both unissued and foreign references, and the underlying wallet is never called.
  • Both failed before the fix. Full pnpm test for wallet-toolbox passes: 283 suites, 3070 tests.

Version bumped to 2.14.3 (root, client, mobile) with a CHANGELOG entry.

🤖 Generated with Claude Code

…action

Surplus change shaping split change into outputs of changeInitialSatoshis
with no dust-floor check. Legacy baskets on minimumDesiredUTXOValue 32
produced sub-dust outputs that removeDustOutputs folded away, leaving the
fee sized for the larger tx: "generateChangeSdk error: required fee error".
Each split output now starts at max(dustFloor, changeInitialSatoshis).

WalletPermissionsManager.abortAction required an in-memory pending
reference, so signed noSend actions and earlier sessions' actions could
not be aborted even by the admin. The admin originator now skips that
check; other originators keep it.

Bump to 2.14.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
{
"name": "@bsv/wallet-toolbox",
"version": "2.14.2",
"version": "2.14.3",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug] Bumping @bsv/wallet-toolbox, @bsv/wallet-toolbox-client, and @bsv/wallet-toolbox-mobile to 2.14.3 (client and mobile manifests are the same one-line bump) leaves the governed release record on 2.14.2. publishedVersion should stay 2.14.2 until npm publication, but releaseType is still none, so it disagrees with the patch delta, and the summary/migration still describe 2.14.2. The same bump also leaves governance/repository-health/baselines.json publicPackageVersions, docs/packages/wallet/wallet-toolbox.md, wallet-toolbox-client.md, and wallet-toolbox-mobile.md frontmatter, and the generated docs/reference/stack-facts.md / package API ledger stale. CI on ab39b12a failed repository health on exactly these checks (releaseType disagreement, baselines version mismatch, package-doc version mismatch, stale stack facts); the later build, test, and mutation failures are skips caused by that gate. The package CHANGELOG entry is not a substitute for governance/package-release-notes.json.

Suggestion: For all three wallet-toolbox entries, keep publishedVersion at 2.14.2, set releaseType to patch, and replace summary and migration with the dust-floor and admin-abort fixes (migration can say none for consumers). Set the three publicPackageVersions and the three docs/packages frontmatter versions to 2.14.3, then run pnpm docs:facts so stack-facts.md and docs/reference/package-api-migrations.md match. Do not mark 2.14.3 as already published.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d2cda19: all three wallet-toolbox release-note entries now have releaseType: patch with the dust-floor and admin-abort summary, and migration says none is needed. publishedVersion stays at 2.14.2. publicPackageVersions and the docs frontmatter are bumped to 2.14.3, and pnpm docs:facts regenerated stack-facts.md and package-api-migrations.md. pnpm health:check passes locally.

Set releaseType patch with the dust-floor and admin-abort summary for all
three wallet-toolbox entries (publishedVersion stays 2.14.2 until npm
publication), bump baselines and package-doc versions, and regenerate
stack facts and the package API ledger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sirdeggen
sirdeggen merged commit b6c6272 into main Sep 26, 2026
46 checks passed
@sirdeggen
sirdeggen deleted the fix/toolbox-change-dust-and-admin-abort branch September 26, 2026 04:12
sirdeggen added a commit to bsv-blockchain/bsv-wallet that referenced this pull request Sep 26, 2026
…pstreamed hunks

2.14.3 ships both fixes from f0224e7 upstream (bsv-blockchain/ts-stack#638):
dust-floored surplus change shaping and admin abortAction. Their hunks are
removed; the patch is rebased onto 2.14.3 with git merge-file (clean) and
renamed to patches/@bsv+wallet-toolbox-mobile+2.14.3.patch. Every earlier
hunk carries over byte-for-byte (identical changed lines in both bundles),
and applying the new patch to the pristine 2.14.3 tarball reproduces the
installed bundles exactly.

Also in 2.14.1-2.14.3: discoverByAttributes re-filters overlay results the
way the overlay searched them. On 2.14.0 an `any` search matched a certificate
field literally named `any`, so network results never reached ContactsScreen
or the Pay recipient search. The exact-spend amount moved from a result
symbol to a shared WeakMap; no app code reads it.

The two regression tests stay and pass against the upstream code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant