What changed, and why it matters
This commit only updates test files in the COLDCARD firmware repository. It adjusts test cases to use new internal constants, skips some secure-notes/password checks on non-Q1 hardware, replaces a slow wallet-creation helper with a faster import helper, updates menu navigation labels in a test, and adds a missing assertion for a classic P2PKH address format. There are no changes to firmware source code, no security fixes, and no disclosed vulnerability.
No security action required; this is a routine test-maintenance commit. Reviewers may verify the updated test assertions still cover intended behavior, especially the HSM menu navigation change and the Q1-gated notes/passwords checks.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff touches four test files under testing/. Changes include: (1) unit_addrs.py now imports public_constants (AF_CLASSIC, AF_P2SH, AF_P2WPKH, AF_P2WSH) and replaces string literals like ‘p2pkh’/’p2sh’ with those constants; (2) test_ephemeral.py gates secure-notes and password assertions behind is_q1 and adds the is_q1 fixture; (3) test_hsm.py replaces a slow make_myself_wallet retry loop with import_ms_wallet and updates menu path from ‘Advanced/Tools’ -> ‘Enable HSM’ to ‘Advanced/Tools’ -> ‘Spending Policy’ -> ‘HSM Mode’; (4) test_ownership.py adds an assertion branch for ‘Classic P2PKH’. No runtime firmware code is modified.
Changed components
testing/devtest/unit_addrs.pytesting/test_ephemeral.pytesting/test_hsm.pytesting/test_ownership.pyInspect captured patch +23 / −18
diff --git a/testing/devtest/unit_addrs.py b/testing/devtest/unit_addrs.py
index 299d7c2..f4355be 100644
--- a/testing/devtest/unit_addrs.py
+++ b/testing/devtest/unit_addrs.py
@@ -4,41 +4,42 @@
from h import a2b_hex, b2a_hex
from serializations import CTxOut
from uio import BytesIO
+from public_constants import AF_CLASSIC, AF_P2SH, AF_P2WPKH, AF_P2WSH
cases = [
# TxOut, type, is_segwit, hash160/pubkey,
( 'c4f33d0000000000160014ad46a001d55bd55d157e716bf17c02f8964b5a19',
- 'p2pkh', True,
+ AF_P2WPKH, True,
'ad46a001d55bd55d157e716bf17c02f8964b5a19' ),
( '202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac',
- 'p2pkh', False,
+ AF_CLASSIC, False,
'8280b37df378db99f66f85c95a783a76ac7a6d59' ),
# from legendary txid: 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8
( '301b0f000000000017a914e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a87',
- 'p2sh', False,
+ AF_P2SH, False,
'e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a'),
# from testnet: a4c89e0ffb84d06a1e62f0f9f0f5974db250878caa1f71f9992a1f865b8ff2fa
# via <https://github.com/bitcoinjs/bitcoinjs-lib/issues/856>
( 'b88201000000000017a914f0ca58dc8e539421a3cb4a9c22c059973075287c87',
- 'p2sh', False,
+ AF_P2SH, False,
'f0ca58dc8e539421a3cb4a9c22c059973075287c'),
# XXX missing: P2SH segwit, 1of1 and N of M
( 'd0f13d0000000000160014f2369bac6d24ed11313fa65adda1971d10e17bff',
- 'p2pkh', True,
+ AF_P2WPKH, True,
'f2369bac6d24ed11313fa65adda1971d10e17bff')
]
-for raw_txo, expect_type, expect_sw, expect_hash in cases:
+for i, (raw_txo, expect_type, expect_sw, expect_hash) in enumerate(cases):
expect_hash = a2b_hex(expect_hash)
out = CTxOut()
out.deserialize(BytesIO(a2b_hex(raw_txo)))
- print("Case: %s... " % raw_txo[0:30])
+ print("Case %d: %s... " % (i, raw_txo[0:30]))
addr_type, addr_or_pubkey, is_segwit = out.get_address()
assert is_segwit == expect_sw, 'wrong segwit'
diff --git a/testing/test_ephemeral.py b/testing/test_ephemeral.py
index 49eb6de..be3a6f8 100644
--- a/testing/test_ephemeral.py
+++ b/testing/test_ephemeral.py
@@ -1253,7 +1253,7 @@ def test_xfp_collision(reset_seed_words, settings_set, import_ephemeral_xprv,
@pytest.mark.parametrize("refuse", [False, True])
def test_add_current_active(reset_seed_words, settings_set, import_ephemeral_xprv,
goto_home, pick_menu_item, cap_story, cap_menu,
- press_cancel, verify_ephemeral_secret_ui,
+ press_cancel, verify_ephemeral_secret_ui, is_q1,
seed_vault_enable, refuse, press_select, set_bip39_pw,
need_some_notes, need_some_passwords, import_ms_wallet,
restore_main_seed, settings_get, clear_ms):
@@ -1273,8 +1273,9 @@ def test_add_current_active(reset_seed_words, settings_set, import_ephemeral_xpr
restore_main_seed(seed_vault=True)
# add secure notes and passwords
- need_some_notes()
- need_some_passwords()
+ if is_q1:
+ need_some_notes()
+ need_some_passwords()
# save multisig wallet to master settings
ms_name = "aaa"
@@ -1321,7 +1322,8 @@ def test_add_current_active(reset_seed_words, settings_set, import_ephemeral_xpr
mss = settings_get("multisig")
assert len(mss) == 1
assert mss[0][0] == ms_name
- assert len(settings_get("notes")) == 3
+ if is_q1:
+ assert len(settings_get("notes")) == 3
sv = settings_get("seeds")
assert len(sv) == 2
assert sv[0][0] == xfp2str(sv_pass_xfp) # added passphrase wallet
diff --git a/testing/test_hsm.py b/testing/test_hsm.py
index b5e4d68..fb9af23 100644
--- a/testing/test_hsm.py
+++ b/testing/test_hsm.py
@@ -545,7 +545,7 @@ def test_simple_limit(dev, amount, over, start_hsm, fake_txn, attempt_psbt, twea
tweak_rule(0, dict(max_amount=int(amount+over)))
attempt_psbt(psbt)
-def test_named_wallets(dev, start_hsm, tweak_rule, make_myself_wallet, hsm_status,
+def test_named_wallets(dev, start_hsm, tweak_rule, hsm_status, import_ms_wallet,
attempt_psbt, fake_txn, fake_ms_txn, amount=5E6, incl_xpubs=False):
wname = 'Myself-4'
M = 4
@@ -553,12 +553,11 @@ def test_named_wallets(dev, start_hsm, tweak_rule, make_myself_wallet, hsm_statu
stat = hsm_status()
assert not stat.active
- for retry in range(3):
- keys, _ = make_myself_wallet(4) # slow AF
+ keys = import_ms_wallet(M,M, name=wname, accept=True)
+ time.sleep(.2)
- stat = hsm_status()
- if wname in stat.wallets:
- break
+ stat = hsm_status()
+ assert wname in stat.wallets
# policy: only allow multisig w/ that name
policy = DICT(rules=[dict(wallet=wname)])
@@ -1560,7 +1559,8 @@ def test_hsm_commands_disabled(dev, goto_home, pick_menu_item, hsm_reset, start_
# disable HSM related commands (now enabled because module scope fixture 'enable_hsm_commands')
goto_home()
pick_menu_item("Advanced/Tools")
- pick_menu_item("Enable HSM")
+ pick_menu_item("Spending Policy")
+ pick_menu_item("HSM Mode")
pick_menu_item("Default Off")
goto_home()
try:
diff --git a/testing/test_ownership.py b/testing/test_ownership.py
index 774c8fc..830136c 100644
--- a/testing/test_ownership.py
+++ b/testing/test_ownership.py
@@ -335,6 +335,8 @@ def test_address_explorer_saver(af, wipe_cache, settings_set, goto_address_explo
assert 'Derivation path' in story
if af == "Segwit P2WPKH":
assert " P2WPKH " in story
+ elif af == "Classic P2PKH":
+ assert " P2PKH " in story
else:
assert af in story
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.