refactor(abstract-utxo): delete fetchInputs and remove redundant fee guard#8916
Merged
Conversation
f3ecc52 to
3454b9d
Compare
b088a74 to
7e020d6
Compare
7e020d6 to
52032dc
Compare
…guard
Two related cleanups enabled by dead-code removal in the parent PR:
1. **Delete fetchInputs.ts** — getTxInputs and getPsbtTxInputs are no
longer called anywhere after the parent PR's dead-code removal.
2. **Remove fee guard from verifyTransaction** — the
`inputAmount - outputAmount < 0` check in
fixedScript/verifyTransaction.ts is unreachable dead code. The PSBT
path calls psbt.parseTransactionWithWalletKeys (wasm), whose Rust
implementation uses checked_sub to compute miner_fee and returns
ParseTransactionError::FeeCalculation ("Fee calculation error: outputs
exceed inputs") if total output value exceeds total input value. This
fires before the TypeScript guard would ever run. A new unit test in
test/unit/transaction/fixedScript/explainPsbt.ts verifies this: it
tampers a PSBT's witnessUtxo.value to make outputs > inputs and
asserts that explainPsbtWasmBigInt throws with that message.
Refs: T1-3279
52032dc to
296661e
Compare
davidkaplanbitgo
approved these changes
Jun 10, 2026
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.
Summary
Stacks on
otto/abstract-utxo-foundation.Two related cleanups enabled by the dead-code removal in the parent PR:
Delete
fetchInputs.ts—getTxInputsandgetPsbtTxInputsare no longer called anywhere after the dead code removal in the parent PR. The file and its barrel export are deleted.Remove fee guard from
verifyTransaction— theinputAmount - outputAmount < 0check infixedScript/verifyTransaction.tsis unreachable dead code. The PSBT path callspsbt.parseTransactionWithWalletKeys(wasm), whose Rust implementation useschecked_subto computeminer_feeand returnsParseTransactionError::FeeCalculation("Fee calculation error: outputs exceed inputs") if total output value exceeds total input value — this fires before the TypeScript guard would ever execute.PR group context
Stack:
master → abstract-utxo-foundation → this PR → abstract-utxo-replacements → keychains-drop-utxolib → abstract-utxo-terminalTest plan
test/unit/transaction/fixedScript/explainPsbt.ts: tampers a PSBT'switnessUtxo.valueto make outputs exceed inputs and assertsexplainPsbtWasmBigIntthrows/Fee calculation error: outputs exceed inputs/— proving the wasm layer enforces the invariant before the deleted TypeScript guard would have runyarn tsc --noEmitclean inmodules/abstract-utxoyarn lintclean inmodules/abstract-utxo🤖 Generated with Claude Code