Files
seedsigner/tests
kdmukai bb2471a60e Verify that change outputs actually pay this seed
An output counted as change when its policy matched the inputs' and its
rebuilt scriptPubKey matched what the output committed to. Neither step
established that the key involved was ours. The policy comparison
included cosigners resolved from the coordinator's own global xpubs, so
one misannotated fingerprint made an output stop matching and skip
verification altogether, and multisig never checked our key against the
committed script at all.

Outputs now compare on script shape alone, and every candidate proves
ownership: single sig by rebuilding from the claimed derivation path,
multisig by finding this seed's key in the committed script. Where the
psbt's account of an output contradicts what the output commits to, the
parse refuses rather than quietly reclassifying. A claim set too
malformed to answer that question, one populating both derivation path
maps or claiming more keys than its script uses, is refused as well.

change_data now carries the verified derivation path in place of the
coordinator's claimed fingerprints and paths, so the views no longer
re-derive trust from strings the parse has already settled.

Taproot mismatches stay exempt. A script tree tweaks the internal key,
so honest taproot change fails the rebuild too, and embit leaves
PSBT_OUT_TAP_TREE unparsed, which is what would tell the two apart.
2026-09-04 21:03:48 -05:00
..
2025-10-23 14:23:27 -05:00
2024-11-06 14:00:36 -06:00
2024-11-05 12:19:35 -06:00
2025-12-17 21:11:14 +01:00
2025-12-26 07:13:00 -06:00
2024-03-02 07:46:35 -06:00
2024-07-14 13:21:23 -05:00
2025-01-02 18:38:03 -06:00

Running Tests

The tests are designed to be run on non-Raspi hardware.

Setup

On your testing machine you'll have to install:

# general dependencies
pip3 install -r requirements.txt

# test suite dependencies
pip3 install -r tests/requirements.txt

Then make the seedsigner python module visible/importable to the tests by installing it:

pip3 install -e .

Running all tests, calculating overall test coverage

tldr: just run the convenience script from the project root:

./tests/run_full_coverage.sh

Running tests manually

Run the whole test suite:

pytest

Run a specific test file:

pytest tests/test_this_file.py

Run a specific test:

pytest tests/test_this_file.py::test_this_specific_test

Force pytest to show logging output:

pytest tests/test_this_file.py::test_this_specific_test -o log_cli=1

# or (same result)

pytest tests/test_this_file.py::test_this_specific_test --log-cli-level=DEBUG

Annoying complications:

  • If you want to see print() statements that are in a test file, add -s
  • Better idea: use a proper logger in the test file and use one of the above options to display logs

Screenshot generator

The screenshot generator is meant to mostly be a utility and not really part of the test suite. However, it is actually implemented to be run by pytest.

see: Screenshot generator README

Generate coverage manually

Run tests and generate test coverage

coverage run -m pytest

The screenshots can generate their own separate coverage report:

coverage run -m pytest tests/screenshot_generator/generator.py --locale es

Show the resulting test coverage details:

coverage report

Generate the interactive html report:

coverage html