Repository navigation
fix(wallet-toolbox): restore inline locking scripts on funding outputs read with noScript - #1139
Draft
GenericCPU wants to merge 4 commits into
Draft
GenericCPU wants to merge 4 commits into
GenericCPU wants to merge 4 commits into
Conversation
…en from a noScript scan Change candidates are read with noScript: true, which clears every locking script. validateOutputScript reloads only a script offloaded into the raw transaction, so an output whose script is stored inline on its row left StorageIdb.allocateChangeInput, and makeFundingResult for action batches, with no locking script. The signer then received a funding input it cannot sign. Add StorageProvider.restoreOutputScript, which falls back to rereading the row, and use it in both funding paths. Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks done
Run allocateChangeInput over every row shape validateOutputScript cannot fill: an inline script, a row restored or synced without txid/scriptOffset/ scriptLength, and an offloaded script whose raw transaction storage no longer holds. Guard that a script offloaded into a stored raw transaction is still rebuilt from it. Co-authored-by: Cursor <cursoragent@cursor.com>
…rageProvider API Move the helper into storage/methods, which the package does not export, so the fix adds no public method a subclass could collide with. Co-authored-by: Cursor <cursoragent@cursor.com>
… funding result Co-authored-by: Cursor <cursoragent@cursor.com>
|
This branch has not been deployed
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.



Program and scope
StorageIdb.allocateChangeInputandavailableManagedChangeread candidates withnoScript: true.validateOutputScriptonly reloads a script offloaded into the raw transaction, so a script stored inline on the output row stayed cleared, and funding reached the signer without a locking script. Adds an internalstorage/methods/restoreOutputScripthelper (raw-transaction slice first, then a reread of the row) and uses it inallocateChangeInputandmakeFundingResult.noScriptscans themselves, and offloaded-script handling are unchanged. No public API change: the helper lives instorage/methods, which the package does not export. The other findings in the issue each have their own pull request or are proposals.517b4b0c989abe1cc95a56f4bdd0595656048000Impact
Affected packages/services and intended patch versions (publication occurs only
through the release workflow after approval):
@bsv/wallet-toolboxpatch.Verification
517b4b0c989abe1cc95a56f4bdd0595656048000):pnpm --filter @bsv/wallet-toolbox exec jest --watchman=false src/storage/__test/allocateChangeInputScript.test.ts: 5 passed, 5 total;actionBatch.test.ts(which runsmakeFundingResult) 61 passed. New test:allocateChangeInputon SQLite and IndexedDB over each row shapevalidateOutputScriptcannot fill (inlinescriptOffset: 0; restored or synced withouttxid/scriptOffset/scriptLength; offloaded with no stored raw transaction), plus a guard that offloaded scripts in a stored raw transaction still rebuild from it. Without the source change it fails all three shape cases on IndexedDB (3 failed, 2 passed).cd packages/wallet/wallet-toolbox && pnpm exec tsc --noEmit -p tsconfig.json: exit 0pnpm exec oxlint <changed files>: exit 0, no warningspnpm exec prettier --check <changed files>: clean on every changed hunk;StorageIdb.tsreports one pre-existing warning (thecertifiersfilter line) thatmainalso has, left untouched to keep this diff to the fixcompatibility, public API, artifacts, dependencies, docs, and operations
scope-based skip is expected and validated by the merge gate
Security and dependencies
audit results were reviewed
(including accepted or false-positive issue states) and zero unreviewed hotspots;
Sonar's aggregate
Quality Gate passedverdict alone is not merge evidenceand removal condition
Release and operations
controlling program (deferred to the release workflow)
Completion evidence
passing checks, resolved alerts, measurements, or an approved exception
guidance are current or concretely not applicable
being handed to another contributor as "complete"
restriction is assumed