What changed, and why it matters
This commit only touches test helper code in the COLDCARD firmware repository. It fixes small test issues: allowing PSBT parsing from string input, validating a setting name in a hobble-mode test, and correctly setting sequence numbers and fallback locktimes in fake transaction generators used by multisig and general transaction tests. There is no change to the actual firmware or wallet security logic.
No security action needed; treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies four files under testing/: psbt.py, test_hobble.py, test_multisig.py, and txn.py. In psbt.py, parse() now accepts ASCII strings by encoding them before base64/hex detection. In test_hobble.py, an assertion is added to reject invalid hobble policy keys and a test call is corrected from ‘okey’ to ‘okeys’. In test_multisig.py and txn.py, fake transaction/PSBT builders now set fallback_locktime for PSBT v2 when a lock_time is supplied, and sequence numbers are assigned before computing the previous txid and are stored into psbt.inputs[i].sequence. These are test-infrastructure correctness improvements, not runtime security fixes.
Changed components
testing/psbt.pytesting/test_hobble.pytesting/test_multisig.pytesting/txn.pyInspect captured patch +17 / −10
diff --git a/testing/psbt.py b/testing/psbt.py
index dbcf509..1df1649 100644
--- a/testing/psbt.py
+++ b/testing/psbt.py
@@ -373,6 +373,9 @@ class BasicPSBT:
return (self.version == 2) or (not self.txn)
def parse(self, raw):
+ if isinstance(raw, str):
+ raw = raw.encode('ascii')
+
# auto-detect and decode Base64 and Hex.
if raw[0:10].lower() == b'70736274ff':
raw = a2b_hex(raw.strip())
@@ -580,4 +583,3 @@ def test_my_psbt():
assert chk == p
# EOF
-
diff --git a/testing/test_hobble.py b/testing/test_hobble.py
index cdcfd93..e3e8acf 100644
--- a/testing/test_hobble.py
+++ b/testing/test_hobble.py
@@ -28,6 +28,7 @@ from charcodes import KEY_QR
def set_hobble(sim_exec, settings_set, settings_remove, goto_home):
def doit(mode, enabled={}): # okeys, words, notes
assert mode in { True, False, 2 }
+ assert not (set(enabled) - {'okeys', 'words', 'notes'}), enabled
if mode:
v = dict(en=True, pol={})
@@ -247,7 +248,7 @@ def test_h_seedvault(sv_empty, set_hobble, pick_menu_item, cap_menu, settings_se
# clear keys from sv, should not be offered in menu, even if okeys set.
settings_remove('seedvault')
- set_hobble(True, {'okey'})
+ set_hobble(True, {'okeys'})
m = cap_menu()
assert 'Seed Vault' not in m
diff --git a/testing/test_multisig.py b/testing/test_multisig.py
index 244f3d6..98a183e 100644
--- a/testing/test_multisig.py
+++ b/testing/test_multisig.py
@@ -1297,6 +1297,8 @@ def fake_ms_txn(pytestconfig):
psbt.txn_version = 2
psbt.input_count = num_ins
psbt.output_count = num_outs
+ if lock_time:
+ psbt.fallback_locktime = lock_time
txn = CTransaction()
txn.nVersion = 2
@@ -1362,19 +1364,19 @@ def fake_ms_txn(pytestconfig):
else:
psbt.inputs[i].witness_utxo = supply.vout[-1].serialize()
- supply.calc_sha256()
- if psbt_v2:
- psbt.inputs[i].previous_txid = supply.hash
- psbt.inputs[i].prevout_idx = 0
- # TODO sequence
- # TODO height timelock
- # TODO time timelock
-
if lock_time and not i:
seq = 0xfffffffd
else:
seq = 0xffffffff
+ supply.calc_sha256()
+ if psbt_v2:
+ psbt.inputs[i].previous_txid = supply.hash
+ psbt.inputs[i].prevout_idx = 0
+ psbt.inputs[i].sequence = seq
+ # psbt.inputs[i].req_time_locktime = None
+ # psbt.inputs[i].req_height_locktime = None
+
spendable = CTxIn(COutPoint(supply.sha256, 0), nSequence=seq)
txn.vin.append(spendable)
diff --git a/testing/txn.py b/testing/txn.py
index 1d8988d..f800c86 100644
--- a/testing/txn.py
+++ b/testing/txn.py
@@ -40,6 +40,8 @@ def fake_txn(dev, pytestconfig):
psbt.txn_version = 2
psbt.input_count = num_ins
psbt.output_count = num_outs
+ if lock_time:
+ psbt.fallback_locktime = lock_time
txn = CTransaction()
txn.nLockTime = lock_time
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.