Skip to content

Conversation

@OttoAllmendinger
Copy link
Contributor

This PR adds comprehensive PSBT testing capabilities and refines transaction
explanation utilities across the codebase:

PSBT Testing Enhancements

  • Add AcidTest utility for comprehensive PSBT testing across all supported
    input/output types and networks
  • Create AcidTest.suite() function to generate complete test suites
  • Add round-trip PSBT buffer serialization test
  • Split sign/verify tests into separate files for PSBT and legacy transactions

Transaction Explanation Improvements

  • Add tests for explainPsbt utility using the new AcidTest framework
  • Refactor transaction explanation utilities for better readability
  • Remove unnecessary type parameters from explainPsbt
  • Make fee and locktime fields optional in transaction explanations
  • Update getRootWalletKeys to handle RootWalletKeys instances properly

Type System Improvements

  • Add proper typing throughout the codebase
  • Improve test organization with const arrays and type refinements

BTC-2732, BG-59313

OttoAllmendinger and others added 8 commits November 11, 2025 13:18
Add a test to ensure PSBTs can be serialized to buffer and back without
any loss of information.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Creates a utility class for testing that generates PSBTs with all
supported input and output types for a given network. The AcidTest class
can create PSBTs with:
- All wallet script types supported by the network
- p2shP2pk inputs (for replay protection)
- Various output types including those from another wallet
- OP_RETURN outputs

Refactors existing tests to use this utility, making them more
comprehensive and maintainable.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
…ions

Split the combined test file into two separate files - one for PSBT
operations and another for legacy transaction signing and verification.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Adds a utility function to generate a comprehensive test suite for PSBT
functionality across networks, sign stages, and tx formats. Improves test
organization by using const arrays and type refinements, and adds a name
getter to AcidTest for better test reporting.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Add unit test for the explainPsbt utility function using AcidTest framework
from utxo-lib. Tests ensure that transaction explanations correctly include
output amounts, change outputs, and signature counts across different signing
stages.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Extracted helper functions from the main explainPsbt function to improve
readability and maintainability. Updated getRootWalletKeys to properly
handle RootWalletKeys instances and added proper typing throughout the
codebase.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
Simplify the explainPsbt function by removing unnecessary type parameters
since the types can be inferred from the UtxoPsbt.

Issue: BG-59313

Co-authored-by: llm-git <[email protected]>
Adjust TransactionExplanation interface to allow for undefined locktime and
parameterized fee type to support both string and undefined return types.
This change helps with different use cases across the codebase.

Issue: BTC-2732

Co-authored-by: llm-git <[email protected]>
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2732.utxo-lib-testutils-acid-test branch from 3c6d2f1 to 0912ec0 Compare November 11, 2025 12:23
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review November 11, 2025 13:00
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner November 11, 2025 13:00
@OttoAllmendinger OttoAllmendinger merged commit c82d952 into master Nov 11, 2025
13 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.

3 participants