feat(wasm-utxo): add BitGoPsbt.combineInputs for raw PSBT merge#299
Merged
Conversation
beecb9c to
730af57
Compare
730af57 to
2e8b0c5
Compare
Adds `combine_inputs` (Rust/WASM) and `combineInputs` (JS/TS) to `BitGoPsbt`. This method merges all input fields from a raw PSBT (provided as bytes) into the current PSBT. Unlike `combineMusig2Nonces`, it handles all script types and works with stripped PSBTs: - Parses the source with bitcoin's base PSBT deserializer for non-ZEC coins; for ZEC uses a new `ZcashBitGoPsbt::deserialize_stripped` that applies the ZEC-aware transaction converter but skips the `ZecConsensusBranchId` proprietary-key requirement. - Dispatches on the `BitGoPsbt` enum variant so ZEC PSBTs are parsed correctly without requiring coin information at call sites. - Copies per input: partial_sigs, tap_key_sig, tap_script_sigs, proprietary. Used by ims-utxo to combine an HSM-signed response PSBT with the full request PSBT before verifying and finalizing the transaction. Tests cover BTC (p2shP2wsh), LTC, ZEC, and ZcashBitGoPsbt metadata in a consolidated `test/fixedScript/combineInputs.ts`. Refs: T1-3607
2e8b0c5 to
06a6111
Compare
davidkaplanbitgo
approved these changes
Jun 18, 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
combine_inputs(Rust/WASM) andcombineInputs(JS/TS) toBitGoPsbtpartial_sigs,tap_key_sig,tap_script_sigs,proprietaryZcashBitGoPsbt::deserialize_stripped— uses the ZEC-aware transaction converter but skips theZecConsensusBranchIdrequirement, so stripped HSM responses are acceptedBitGoPsbtenum variant to avoid threading coin information through the calltest/fixedScript/combineInputs.ts: BTC (p2shP2wsh), LTC, ZEC (combine + finalize + extract, stripped response), ZcashBitGoPsbt metadataMotivation
After HSM co-signing, ims-utxo needs to merge the stripped HSM response PSBT back into the full request PSBT before verifying signatures and finalizing. The existing
combineMusig2Noncesonly handles MuSig2 proprietary data; this method handles all script types. The ZEC-aware parser path is needed becauseZcashBitGoPsbt::deserializerejects PSBTs lacking theZecConsensusBranchIdproprietary key, which stripped HSM responses may omit.Test plan
cargo testinpackages/wasm-utxopassesnpm testinpackages/wasm-utxopasses (17combineInputstests: BTC ×6, LTC ×1, ZEC ×5, ZcashBitGoPsbt metadata ×5)Refs: T1-3607