Skip to content

test: GetAddress returns BIP-86 taproot addresses - #28

Open
BitHighlander wants to merge 1 commit into
taproot/basefrom
test/getaddress-taproot
Open

test: GetAddress returns BIP-86 taproot addresses#28
BitHighlander wants to merge 1 commit into
taproot/basefrom
test/getaddress-taproot

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Emulator coverage for SPENDTAPROOT, supporting the taproot work in BitHighlander/keepkey-firmware#328.

Drives the full GetAddress path — fsm_msgGetAddresspath_mismatched's new m/86' branch → compute_address → BIP-86 tweak → bech32m → protobuf. None of that is reachable from the firmware's C unit tests, which stop at the crypto.

Ground truth, not self-confirmation

Expected values are the three official BIP-86 vectors. BIP-86 publishes them against the abandon abandon … about mnemonic, which is exactly what setup_mnemonic_abandon() loads — so these are the spec's constants, not values our implementation produced. A test written against the allallall seed would have had to use addresses we generated, which proves nothing.

Verified

Built kkemu from the taproot firmware branch and ran it: 1 passed.

Mutation checked — flipping one character of the first expected address gives FAILED, so the assertions are not vacuous.

Two things a reviewer should know

This test SKIPS today. It gates on TAPROOT_FIRMWARE_VERSION = "7.16.0" while CMakeLists.txt is 7.15.0. A gate that is never reached is a test that is silently green forever, so the constant has to move in step with the project version. Gating at 7.15.0 instead is wrong — released 7.15.0-rcN firmware without taproot would fail rather than skip, which is the whole point of the gate.

The base branch is unusual on purpose. taproot/base is pinned at d88a073a, the exact commit keepkey-firmware records for this submodule, so the diff here is one file. Basing on develop would not work: develop's generated keepkeylib/types_pb2.py has no SPENDTAPROOT (it pins device-protocol 22ca1d98, while d88a073a pins f2246ceb — the same one the firmware uses), so proto.SPENDTAPROOT would raise AttributeError.

That lineage gap is pre-existing and worth fixing separately: develop is behind on protocol, and the commit the firmware pins lives only on agent/x402-solana-metadata.

Drives the emulator through the full GetAddress path for SPENDTAPROOT --
fsm_msgGetAddress, path_mismatched's m/86' branch, compute_address, the
BIP-86 tweak and bech32m encoding -- none of which the firmware's C unit
tests reach.

Expected values are the three official BIP-86 vectors.  BIP-86 publishes
them against the "abandon abandon ... about" mnemonic, which is exactly
what setup_mnemonic_abandon loads, so these are the spec's constants and
not values our implementation produced.

Verified against a locally built emulator: 1 passed.  Also mutation
checked -- flipping one character of the first expected address makes it
fail, so the assertions are not vacuous.

NOTE: gated at 7.16.0 via TAPROOT_FIRMWARE_VERSION.  develop is currently
7.15.0, so this SKIPS until the project version bumps.  A gate that is
never reached is a test that is silently green forever -- keep the
constant in step with CMakeLists.txt.
BitHighlander added a commit to BitHighlander/keepkey-firmware that referenced this pull request Jul 31, 2026
Bumps deps/python-keepkey by one commit to pick up
tests/test_msg_getaddress_taproot.py (BitHighlander/python-keepkey#28),
which drives the emulator through the full SPENDTAPROOT GetAddress path
and asserts the three official BIP-86 addresses.

Verified against a locally built kkemu: 1 passed, and mutation checked so
the assertions are known not to be vacuous.

The test gates on firmware 7.16.0 and CMakeLists is 7.15.0, so it SKIPS
until the project version bumps.  Deliberate: gating at 7.15.0 would make
released 7.15.0-rcN firmware without taproot fail rather than skip.
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.

1 participant