Skip to content

feat(wasm-utxo): add BitGoPsbt.combineInputs for raw PSBT merge#299

Merged
OttoAllmendinger merged 1 commit into
masterfrom
otto/T1-3607-combine-signatures
Jun 18, 2026
Merged

feat(wasm-utxo): add BitGoPsbt.combineInputs for raw PSBT merge#299
OttoAllmendinger merged 1 commit into
masterfrom
otto/T1-3607-combine-signatures

Conversation

@OttoAllmendinger

@OttoAllmendinger OttoAllmendinger commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds combine_inputs (Rust/WASM) and combineInputs (JS/TS) to BitGoPsbt
  • Merges all input fields from a raw PSBT (bytes) into the current PSBT: partial_sigs, tap_key_sig, tap_script_sigs, proprietary
  • ZEC support via ZcashBitGoPsbt::deserialize_stripped — uses the ZEC-aware transaction converter but skips the ZecConsensusBranchId requirement, so stripped HSM responses are accepted
  • Dispatches on the BitGoPsbt enum variant to avoid threading coin information through the call
  • Tests consolidated in test/fixedScript/combineInputs.ts: BTC (p2shP2wsh), LTC, ZEC (combine + finalize + extract, stripped response), ZcashBitGoPsbt metadata

Motivation

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 combineMusig2Nonces only handles MuSig2 proprietary data; this method handles all script types. The ZEC-aware parser path is needed because ZcashBitGoPsbt::deserialize rejects PSBTs lacking the ZecConsensusBranchId proprietary key, which stripped HSM responses may omit.

Test plan

  • cargo test in packages/wasm-utxo passes
  • npm test in packages/wasm-utxo passes (17 combineInputs tests: BTC ×6, LTC ×1, ZEC ×5, ZcashBitGoPsbt metadata ×5)
  • CI green

Refs: T1-3607

@linear-code

linear-code Bot commented Jun 18, 2026

Copy link
Copy Markdown

T1-3607

@OttoAllmendinger OttoAllmendinger force-pushed the otto/T1-3607-combine-signatures branch 2 times, most recently from beecb9c to 730af57 Compare June 18, 2026 14:38
@OttoAllmendinger OttoAllmendinger changed the title feat(wasm-utxo): add BitGoPsbt.combineSignatures for raw PSBT merge feat(wasm-utxo): add BitGoPsbt.combineInputs for raw PSBT merge Jun 18, 2026
@OttoAllmendinger OttoAllmendinger force-pushed the otto/T1-3607-combine-signatures branch from 730af57 to 2e8b0c5 Compare June 18, 2026 14:46
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
@OttoAllmendinger OttoAllmendinger force-pushed the otto/T1-3607-combine-signatures branch from 2e8b0c5 to 06a6111 Compare June 18, 2026 14:52
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review June 18, 2026 15:21
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner June 18, 2026 15:21
@OttoAllmendinger OttoAllmendinger merged commit 0e88949 into master Jun 18, 2026
17 checks passed
@OttoAllmendinger OttoAllmendinger deleted the otto/T1-3607-combine-signatures branch June 18, 2026 15:21
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.

2 participants