test(solana): KKSOLSC1 v2 schema reviews asserted by screen text - #110
Merged
Merged
Conversation
Emulator tests for keepkey-firmware feat/solana-schema-v2 (issue #828),
asserting what the OLED says rather than how many screens there are.
tests/oled_text.py reads text off a DebugLink frame. DebugLinkState.layout
is pixels only, so it renders the expected string with the firmware's own
title and body glyphs (tables generated from lib/board/font.c; `python
oled_text.py font.c` regenerates them), wraps it as draw_string_walk()
does, and requires every line whole and left-aligned on consecutive rows of
one screen. On recorded frames it rejects one-character changes, dropped
characters and prefixes of every checked string.
test_msg_solana_schema_v2.py:
- Certified (public Vault 501 certificate + the real Relay v1 delegate
signature): a static System Transfer companion is reviewed ("Funding
account", then "Send 0.002000000 SOL to <dest>?" under INSTR 2/2); with
SetComputeUnitPrice the review shows "Fee payer <key>" and "Max priority
fee 0.000200000 SOL" on consecutive FEE screens; a duplicate price or limit
is refused with "Invalid priority fee". These skip when the emulator
refuses the certificate because it was built without the alpha ClearSign
root, and fail on any other refusal.
- Runtime (CI signer in slots 2 and 3): a Transfer companion is refused;
on the real SoltoshiDICE join signed by slot 2, slot 2's SDICE definition
shows "1000.000000 SDICE" with the mint beneath it for all three
TOKEN_AMOUNTs, while slot 3's definition renders pixel-identical to none
("1000000000 base units of mint" + mint).
- ClearsignAttestor: a v2 TOKEN_AMOUNT arg costs exactly one extra screen,
"Arg 1 token mint is / account #3", right after the arg, and the returned
signature verifies over sha256(payload).
Each of these firmware mutations fails at least one test: certified reviews
not binding the priority fee, the attestor mint screen removed, the mint
dropped beside a trusted symbol, companion instructions not screened, the
fee computed without the explicit compute-unit limit (same screen count,
different text), and runtime token definitions accepted from any slot.
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emulator tests for keepkey-firmware
feat/solana-schema-v2(BitHighlander/keepkey-firmware#828). They assert what the OLED says, not how many screens there are.tests/oled_text.pyDebugLinkState.layoutis pixels only, so this helper renders the expected string with the firmware's own title and body glyphs. The tables are generated fromlib/board/font.c, andpython oled_text.py path/to/font.cregenerates them. It wraps the text the waydraw_string_walk()does, then requires every line to be whole (nothing lit just before or after it) and left-aligned on consecutive rows of one screen. On recorded frames it rejects one-character changes, dropped characters and prefix/suffix variants of every checked string.tests/test_msg_solana_schema_v2.pyAll tests use
requires_firmware("7.16.0")andrequires_fullFeature().Certified (public Vault 501 certificate and the real Relay v1 delegate signature; no secrets):
KK_CLEARSIGN_ALPHA_ROOT. Any other refusal fails the test. The existingtest_relay_certified_v0_no_lookup_proof_reaches_signer_checkdoes not skip: it fails on a root-less build, so CI still has a hard guard on the root.Runtime (CI signer in slots 2 and 3,
requires_message("LoadClearsignSigner")):kSoltoshiJoinMessageHex), with the schema signed by slot 2. Slot 2's SDICE definition shows "1000.000000 SDICE" with the mint beneath it for Buy-in, Allowance and Max wager. Slot 3's definition renders pixel-identical to no definition: "1000000000 base units of mint" plus the mint.ClearsignAttestor (
requires_message("ClearsignAttestorSign")):Verification
The tests ran against kkemu built from the firmware branch with
KK_FORCE_UDP=1on UDP 23644/23645:Each of these firmware mutations (kkemu rebuilt) fails at least one test:
review_binds_feewithout|| certified).scripts/generate-test-report.pyis unchanged. Its audit checks the tests it catalogues but does not require every test to be catalogued.