What changed, and why it matters
This commit only adjusts test files and removes a couple of unused imports from production code. There is no security fix or vulnerability being patched.
No security action needed. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit titled ‘fix tests’ updates six files. In shared/psbt.py it removes unused imports (hash256, ser_uint256, OP_RETURN). The remaining five files are test-only changes: increasing sleep delays in QR scanning tests, using a simulator root directory path for NFC test files, adjusting expected OP_RETURN display length from 200 to 160 characters, accommodating both old and new bitcoind error messages in a signature test, and removing a parameterized ‘hobbled’ option from a teleport multisig test. No runtime security behavior of the firmware is changed.
Changed components
shared/psbt.py (unused import cleanup only)testing/test_hobble.pytesting/test_ownership.pytesting/test_sign.pytesting/test_sssp.pytesting/test_teleport.pyInspect captured patch +24 / −17
diff --git a/shared/psbt.py b/shared/psbt.py
index 6cf88f1..f17648a 100644
--- a/shared/psbt.py
+++ b/shared/psbt.py
@@ -13,12 +13,12 @@ from uio import BytesIO
from sffile import SizerFile
from multisig import MultisigWallet, disassemble_multisig_mn
from exceptions import FatalPSBTIssue, FraudulentChangeOutput
-from serializations import ser_compact_size, deser_compact_size, hash160, hash256
-from serializations import CTxIn, CTxInWitness, CTxOut, ser_string, ser_uint256, COutPoint
+from serializations import ser_compact_size, deser_compact_size, hash160
+from serializations import CTxIn, CTxInWitness, CTxOut, ser_string, COutPoint
from serializations import ser_sig_der, uint256_from_str, ser_push_data
from serializations import SIGHASH_ALL, SIGHASH_SINGLE, SIGHASH_NONE, SIGHASH_ANYONECANPAY
from serializations import ALL_SIGHASH_FLAGS
-from opcodes import OP_CHECKMULTISIG, OP_RETURN
+from opcodes import OP_CHECKMULTISIG
from glob import settings
from public_constants import (
diff --git a/testing/test_hobble.py b/testing/test_hobble.py
index 31934cc..ae9dece 100644
--- a/testing/test_hobble.py
+++ b/testing/test_hobble.py
@@ -411,7 +411,7 @@ def test_h_qrscan(en_okeys, set_hobble, scan_a_qr, need_keypress, press_cancel,
for ss in keys:
need_keypress(KEY_QR)
scan_a_qr(ss)
- time.sleep(0.5)
+ time.sleep(1)
title, story = cap_story()
if en_okeys:
@@ -428,7 +428,7 @@ def test_h_qrscan(en_okeys, set_hobble, scan_a_qr, need_keypress, press_cancel,
need_keypress(KEY_QR)
tt = f'B$H{dt}0100'+('A'*80)
scan_a_qr(tt)
- time.sleep(0.5)
+ time.sleep(1)
if dt == 'E':
title, story = cap_story()
diff --git a/testing/test_ownership.py b/testing/test_ownership.py
index 29fa5fe..774c8fc 100644
--- a/testing/test_ownership.py
+++ b/testing/test_ownership.py
@@ -582,7 +582,7 @@ def test_20_more_build_after_match(sim_exec, import_ms_wallet, clear_ms, wipe_ca
def test_named_wallet_search_fail(load_shared_mod, goto_home, pick_menu_item, nfc_write,
- cap_story):
+ cap_story, sim_root_dir):
addr = fake_address(AF_P2WSH, True)
addr = f"{addr}?wallet=unknown"
cc_ndef = load_shared_mod('cc_ndef', '../shared/ndef.py')
@@ -595,7 +595,8 @@ def test_named_wallet_search_fail(load_shared_mod, goto_home, pick_menu_item, nf
pick_menu_item('Advanced/Tools')
pick_menu_item('NFC Tools')
pick_menu_item('Verify Address')
- open('debug/nfc-addr.ndef', 'wb').write(ccfile)
+ with open(f'{sim_root_dir}/debug/nfc-addr.ndef', 'wb') as f:
+ f.write(ccfile)
nfc_write(ccfile)
time.sleep(1)
@@ -610,7 +611,7 @@ def test_named_wallet_search_fail(load_shared_mod, goto_home, pick_menu_item, nf
def test_named_wallet_search(wname, valid, method, clear_ms, import_ms_wallet, is_q1,
load_shared_mod, goto_home, pick_menu_item, scan_a_qr,
cap_story, need_keypress, nfc_write, use_testnet,
- wipe_cache, settings_set):
+ wipe_cache, settings_set, sim_root_dir):
from test_multisig import make_ms_address, HARD
@@ -671,7 +672,8 @@ def test_named_wallet_search(wname, valid, method, clear_ms, import_ms_wallet, i
pick_menu_item('Advanced/Tools')
pick_menu_item('NFC Tools')
pick_menu_item('Verify Address')
- open('debug/nfc-addr.ndef', 'wb').write(ccfile)
+ with open(f'{sim_root_dir}/debug/nfc-addr.ndef', 'wb') as f:
+ f.write(ccfile)
nfc_write(ccfile)
# press_select()
diff --git a/testing/test_sign.py b/testing/test_sign.py
index 915fdc1..0e581a2 100644
--- a/testing/test_sign.py
+++ b/testing/test_sign.py
@@ -1855,12 +1855,15 @@ def test_op_return_signing(op_return_data, dev, fake_txn, bitcoind_d_sim_watch,
assert "Multiple OP_RETURN outputs:" not in story # always just one - core restriction
try:
- assert len(op_return_data) <= 200
- expect = op_return_data.decode("ascii")
+ assert len(op_return_data) <= 160
+ try:
+ expect = op_return_data.decode("ascii")
+ except:
+ # not ascii
+ expect = op_return_data.hex()
except:
expect = binascii.hexlify(op_return_data).decode()
- if len(op_return_data) > 200:
- expect = expect[:200] + "\n ⋯\n" + expect[-200:]
+ expect = expect[:160] + "\n ⋯\n" + expect[-160:]
assert expect in story
tx = end_sign(accept=True, finalize=True).hex()
diff --git a/testing/test_sssp.py b/testing/test_sssp.py
index b14d469..4fb0a2f 100644
--- a/testing/test_sssp.py
+++ b/testing/test_sssp.py
@@ -610,7 +610,11 @@ def test_deltamode_signature(active_policy, setup_sssp, bitcoind, settings_set,
# check wrong signature happened
assert signed != signed2
probs = wo.testmempoolaccept([signed2.hex()])[0]
- assert 'Signature must be zero' in probs['reject-reason'], probs
+ try:
+ # old bitcoind
+ assert 'Signature must be zero' in probs['reject-reason'], probs
+ except AssertionError:
+ assert 'mandatory-script-verify-flag-failed' in probs['reject-reason'], probs
assert not probs['allowed']
# check right signature
diff --git a/testing/test_teleport.py b/testing/test_teleport.py
index 2171e39..51070af 100644
--- a/testing/test_teleport.py
+++ b/testing/test_teleport.py
@@ -421,19 +421,17 @@ def test_tx_wrong_pub(rx_start, tx_start, cap_menu, enter_complex, pick_menu_ite
@pytest.mark.parametrize('M', [4])
@pytest.mark.parametrize('segwit', [True])
@pytest.mark.parametrize('incl_xpubs', [ False ])
-@pytest.mark.parametrize('hobbled', [ False, True ])
def test_teleport_ms_sign(M, use_regtest, make_myself_wallet, segwit, num_ins, dev, clear_ms,
fake_ms_txn, try_sign, incl_xpubs, bitcoind, cap_story, need_keypress,
cap_menu, pick_menu_item, grab_payload, rx_complete, press_select,
ndef_parse_txn_psbt, press_nfc, nfc_read, settings_get, settings_set,
txid_from_export_prompt, sim_root_dir,
- set_hobble, hobbled, readback_bbqr, nfc_is_enabled):
+ set_hobble, readback_bbqr, nfc_is_enabled):
# IMPORTANT: won't work if you start simulator with --ms flag. Use no args
all_out_styles = list(unmap_addr_fmt.keys())
num_outs = len(all_out_styles)
- set_hobble(hobbled)
clear_ms()
use_regtest()
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.