Skip to content

Commit d05819e

Browse files
committed
tests: update commitment error messages to match all text variants
We return a number of different errors for invalid commitments, use the common part of the error string to avoid having to update all tests for the changes resulting from merging sign_tx impls.
1 parent 34f2994 commit d05819e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

test_jade.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,26 +2092,26 @@ def _commitsValueBlindProof(val):
20922092
# Some bad commitment data is detected immediately... esp if it is
20932093
# missing or not syntactically valid, unparseable etc.
20942094
bad_commitments = [ # Field missing - note commitments are optional so not an error to omit
2095-
(_commitsMinus('asset_id'), 'extract trusted commitments'),
2096-
(_commitsMinus('value'), 'extract trusted commitments'),
2097-
(_commitsMinus('abf'), 'extract trusted commitments'),
2098-
(_commitsMinus('vbf'), 'extract trusted commitments'),
2095+
(_commitsMinus('asset_id'), 'trusted commitments'),
2096+
(_commitsMinus('value'), 'trusted commitments'),
2097+
(_commitsMinus('abf'), 'trusted commitments'),
2098+
(_commitsMinus('vbf'), 'trusted commitments'),
20992099
(_commitsMinus('blinding_key'), 'Missing commitments data'),
21002100
# Field bad type/length etc.
2101-
(_commitsUpdate('asset_id', 'notbin'), 'extract trusted commitments'),
2102-
(_commitsUpdate('asset_id', h2b('123abc')), 'extract trusted commitments'),
2103-
(_commitsUpdate('asset_id', b''), 'extract trusted commitments'),
2104-
(_commitsUpdate('value', 'notint'), 'extract trusted commitments'),
2105-
(_commitsUpdate('abf', 'notbin'), 'extract trusted commitments'),
2106-
(_commitsUpdate('abf', h2b('123abc')), 'extract trusted commitments'),
2107-
(_commitsUpdate('abf', b''), 'extract trusted commitments'),
2108-
(_commitsUpdate('vbf', 'notbin'), 'extract trusted commitments'),
2109-
(_commitsUpdate('vbf', h2b('123abc')), 'extract trusted commitments'),
2110-
(_commitsUpdate('vbf', b''), 'extract trusted commitments'),
2111-
(_commitsUpdate('asset_generator', 'notbin'), 'extract trusted commit'),
2112-
(_commitsUpdate('asset_generator', '123abc'), 'extract trusted commit'),
2113-
(_commitsUpdate('value_commitment', 'notbin'), 'extract trusted commit'),
2114-
(_commitsUpdate('value_commitment', '123abc'), 'extract trusted commit'),
2101+
(_commitsUpdate('asset_id', 'notbin'), 'trusted commitments'),
2102+
(_commitsUpdate('asset_id', h2b('123abc')), 'trusted commitments'),
2103+
(_commitsUpdate('asset_id', b''), 'trusted commitments'),
2104+
(_commitsUpdate('value', 'notint'), 'trusted commitments'),
2105+
(_commitsUpdate('abf', 'notbin'), 'trusted commitments'),
2106+
(_commitsUpdate('abf', h2b('123abc')), 'trusted commitments'),
2107+
(_commitsUpdate('abf', b''), 'trusted commitments'),
2108+
(_commitsUpdate('vbf', 'notbin'), 'trusted commitments'),
2109+
(_commitsUpdate('vbf', h2b('123abc')), 'trusted commitments'),
2110+
(_commitsUpdate('vbf', b''), 'trusted commitments'),
2111+
(_commitsUpdate('asset_generator', 'notbin'), 'trusted commitments'),
2112+
(_commitsUpdate('asset_generator', '123abc'), 'trusted commitments'),
2113+
(_commitsUpdate('value_commitment', 'notbin'), 'trusted commitments'),
2114+
(_commitsUpdate('value_commitment', '123abc'), 'trusted commitments'),
21152115
(_commitsUpdate('blinding_key', 'notbin'), 'Missing commitments data'),
21162116
(_commitsUpdate('blinding_key', '123abc'), 'Missing commitments data'),
21172117
# Field bad value
@@ -2121,15 +2121,15 @@ def _commitsValueBlindProof(val):
21212121
(_commitsUpdate('asset_generator', BADVAL33), 'blinded asset generator'),
21222122
(_commitsUpdate('value_commitment', BADVAL33), 'blinded value commitment'),
21232123
# Asset blind proof in place of abf
2124-
(_commitsAssetBlindProof(''), 'extract trusted commitments'),
2125-
(_commitsAssetBlindProof('notbin'), 'extract trusted commitments'),
2126-
(_commitsAssetBlindProof('123abc'), 'extract trusted commitments'),
2127-
(_commitsAssetBlindProof(b''), 'extract trusted commitments'),
2124+
(_commitsAssetBlindProof(''), 'trusted commitments'),
2125+
(_commitsAssetBlindProof('notbin'), 'trusted commitments'),
2126+
(_commitsAssetBlindProof('123abc'), 'trusted commitments'),
2127+
(_commitsAssetBlindProof(b''), 'trusted commitments'),
21282128
# Value blind proof in place of vbf
2129-
(_commitsValueBlindProof(''), 'extract trusted commitments'),
2130-
(_commitsValueBlindProof('notbin'), 'extract trusted commitments'),
2131-
(_commitsValueBlindProof('123abc'), 'extract trusted commitments'),
2132-
(_commitsValueBlindProof(b''), 'extract trusted commitments')]
2129+
(_commitsValueBlindProof(''), 'trusted commitments'),
2130+
(_commitsValueBlindProof('notbin'), 'trusted commitments'),
2131+
(_commitsValueBlindProof('123abc'), 'trusted commitments'),
2132+
(_commitsValueBlindProof(b''), 'trusted commitments')]
21332133
if has_psram:
21342134
# Invalid/incorrect explicit proofs
21352135
bad_commitments.append((_commitsAssetBlindProof(BAD_ASSET_PROOF),

0 commit comments

Comments
 (0)