Skip to content

Conversation

@OttoAllmendinger
Copy link
Contributor

This PR replaces utxo-lib with wasm-utxo in the abstract-utxo package
tests and includes significant refactoring to improve test organization
and reduce boilerplate.

Changes

  • Replaced utxo-lib with wasm-utxo library in Bitcoin test implementation
  • Implemented utility functions to create PSBTs with the new library
  • Consolidated test fixtures for better organization
  • Moved address validation tests to their own file
  • Reorganized BTC backup key fixtures and audit tests
  • Consolidated spoofing protection tests
  • Extracted getWalletAddress helper for generating addresses from
    RootWalletKeys
  • Added nockWalletKeys helper to reduce mocking boilerplate
  • Exported utilities for better accessibility
  • Replaced hardcoded addresses with dynamically generated ones
  • Simplified test setup with utility functions

BTC-2650

@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2650.port-impl-btc-to-wasm-utxo branch from df559db to 9845e73 Compare February 11, 2026 12:20
OttoAllmendinger and others added 3 commits February 11, 2026 13:52
Port Bitcoin test implementation to use wasm-utxo library instead of
utxo-lib. This includes implementing utility functions to create PSBTs
and maintaining the same test behavior with the new implementation.

Issue: BTC-2650

Co-authored-by: llm-git <llm-git@ttll.de>
Consolidate test fixtures and refactor unit tests for better organization.
Move address validation tests to their own file, reorganize BTC backup key
fixtures and audit tests, and consolidate spoofing protection tests.

Issue: BTC-2650

Co-authored-by: llm-git <llm-git@ttll.de>
- util/address.ts: Extract getWalletAddress helper from psbt.ts for
  generating addresses from RootWalletKeys, enabling dynamic address
  generation in tests instead of hardcoded values

- util/nockBitGo.ts: Add nockWalletKeys helper to encapsulate the
  repeated pattern of mocking wallet key fetch endpoints, reducing
  10+ lines of boilerplate per test to a single function call

- util/index.ts: Export nockBitGo and address utilities so they're
  accessible from the central util import

- postProcessPrebuild.ts: Use getUtxoCoin('tbtc') instead of manual
  TestBitGo setup, and generate output address dynamically instead
  of hardcoding

- testSpoofTransaction.ts: Replace hardcoded addresses with dynamically
  generated ones using wallet keys vs attacker keys, making the test
  intent clearer. Use nockBitGo() and nockWalletKeys() to eliminate
  URL extraction and key mocking boilerplate

Co-authored-by: Cursor <cursoragent@cursor.com>

TICKET: BTC-2650
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2650.port-impl-btc-to-wasm-utxo branch from 9845e73 to 2b6aa37 Compare February 11, 2026 12:52
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review February 11, 2026 13:11
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner February 11, 2026 13:11
@OttoAllmendinger OttoAllmendinger merged commit 3d31e1f into master Feb 11, 2026
20 checks passed
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