tests: pass through additional_info if provided for psbt/pset signing
What changed, and why it matters
This commit only changes test code. It makes the test helper pass an optional 'additional_info' field through to the sign_psbt() function when it is present in test cases. There is no change to the actual signing code or wallet behavior, so it does not create or fix a security vulnerability.
No security action needed. Treat as a normal test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff refactors test_jade.py to extract hex-to-binary conversion of additional_info wallet summaries into a helper function, _h2b_additional_info(), and then calls that helper for both txn and psbt/pset test-case paths. It also updates test_sign_psbt() to pass additional_info to jadeapi.sign_psbt() when it exists. This is purely a test-infrastructure change; no production code is modified.
Changed components
test_jade.pyInspect captured patch +14 / −6
diff --git a/test_jade.py b/test_jade.py
index 6ef98ff..3e29eb8 100644
--- a/test_jade.py
+++ b/test_jade.py
@@ -46,6 +46,13 @@ def h2b(hexdata):
return bytes.fromhex(hexdata)
+def _h2b_additional_info(additional_info):
+ for summary_item in additional_info['wallet_input_summary']:
+ summary_item['asset_id'] = h2b(summary_item['asset_id'])
+ for summary_item in additional_info['wallet_output_summary']:
+ summary_item['asset_id'] = h2b(summary_item['asset_id'])
+
+
def _h2b_test_case(testcase):
# Convert fields from hex to binary
if 'txn' in testcase['input']:
@@ -65,11 +72,7 @@ def _h2b_test_case(testcase):
commitment[k] = v if k == 'value' else h2b(v)
if 'additional_info' in testcase['input']:
- additional_info = testcase['input']['additional_info']
- for summary_item in additional_info['wallet_input_summary']:
- summary_item['asset_id'] = h2b(summary_item['asset_id'])
- for summary_item in additional_info['wallet_output_summary']:
- summary_item['asset_id'] = h2b(summary_item['asset_id'])
+ _h2b_additional_info(testcase['input']['additional_info'])
for k in ['expected_output', 'expected_legacy_output']:
if k in testcase:
@@ -78,6 +81,9 @@ def _h2b_test_case(testcase):
elif 'psbt' in testcase['input']:
testcase['input']['psbt'] = base64.b64decode(testcase['input']['psbt'])
+ if 'additional_info' in testcase['input']:
+ _h2b_additional_info(testcase['input']['additional_info'])
+
if 'expected_output' in testcase:
expected_output = testcase['expected_output']
expected_output['psbt'] = base64.b64decode(expected_output['psbt'])
@@ -3042,7 +3048,9 @@ def test_sign_psbt(jadeapi, cases, has_psram):
continue
try:
- rslt = jadeapi.sign_psbt(txn_data['input']['network'], psbt_bin)
+ network = txn_data['input']['network']
+ additional_info = txn_data['input'].get('additional_info')
+ rslt = jadeapi.sign_psbt(network, psbt_bin, additional_info)
except JadeError as err:
if expect_pset_failure:
continue # Trying to parse a PSET on an unsupported device
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.