Skip to content

Commit f840e38

Browse files
committed
test: capture Ethereum policy refusal sequence
1 parent 2bb6a05 commit f840e38

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

scripts/generate-test-report.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def junit_reconciliation(path):
371371
('test_msg_changepin', 'test_set_pin'): 3,
372372
('test_msg_changepin', 'test_change_pin'): 4,
373373
('test_msg_changepin', 'test_remove_pin'): 2,
374-
('test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked'): 1,
374+
('test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked'): 2,
375375
('test_msg_ping', 'test_authenticator_passphrase_cancel_is_terminal'): 1,
376376
('test_msg_solana_signtx', 'test_solana_sign_system_transfer'): 3,
377377
}
@@ -488,6 +488,8 @@ def junit_reconciliation(path):
488488
((0, 0, 72, 64), 'e5addc208c68cf1655e2aa00789159a3039b6a27e18df9891c88fcfe1af71219'),
489489
),
490490
('test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked'): (
491+
((0, 0, 256, 64),
492+
'b2c97fc85385ca518efff76b9d9a6ffa61118a33fba031a2d3836aa92fd765be'),
491493
((0, 0, 80, 16),
492494
'f0d262606b7358aee6b8c9d9dfac9035f89bd8a8b26b2551c11561731b47880d'),
493495
),
@@ -1288,10 +1290,10 @@ def junit_reconciliation(path):
12881290
['Opaque policy warning', 'Complete calldata hash approval']),
12891291
('V9', 'test_msg_ethereum_signtx', 'test_ethereum_blind_sign_blocked',
12901292
'Opaque contract data blocked (AdvancedMode OFF)',
1291-
'On 7.14.2 the same arbitrary calldata produces one non-approving Blocked notice, then '
1292-
'Failure_ActionCancelled. The exact two-message sequence proves there is no signing '
1293-
'approval after the policy notice.',
1294-
['Blocked policy notice']),
1293+
'On 7.14.2 the same transaction first identifies its destination, then produces a '
1294+
'non-approving Blocked notice and Failure_ActionCancelled. The exact three-message '
1295+
'sequence proves there is no signing approval after the policy notice.',
1296+
['Transaction destination', 'Blocked policy notice']),
12951297
]),
12961298

12971299
('SOL', 'Solana', '7.14.0',

tests/test_msg_ethereum_signtx.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,21 @@ def test_ethereum_signtx_data(self):
101101
def test_ethereum_blind_sign_blocked(self):
102102
"""AdvancedMode OFF + contract data = device refuses to sign (7.14.2+).
103103
104-
The device displays one non-approving Blocked notice, then returns the
105-
policy failure. The exact ButtonRequest -> Failure sequence proves the
106-
host cannot advance from that notice into a signing approval.
104+
The device identifies the transaction destination, displays one
105+
non-approving Blocked notice, then returns the policy failure. The
106+
exact two-ButtonRequest -> Failure sequence proves the host cannot
107+
advance from that notice into a signing approval.
107108
"""
108109
self.requires_firmware("7.14.2")
109110
self.requires_fullFeature()
110111
self.setup_mnemonic_nopin_nopassphrase()
111112
self.client.apply_policy("AdvancedMode", 0)
113+
common.reset_screenshot_capture(self.client)
112114

113115
with self.client:
114116
self.client.set_expected_responses([
117+
proto.ButtonRequest(
118+
code=proto_types.ButtonRequest_ConfirmOutput),
115119
proto.ButtonRequest(
116120
code=proto_types.ButtonRequest_Other),
117121
proto.Failure(
@@ -147,6 +151,7 @@ def test_ethereum_blind_sign_allowed(self):
147151
self.requires_fullFeature()
148152
self.setup_mnemonic_nopin_nopassphrase()
149153
self.client.apply_policy("AdvancedMode", 1)
154+
common.reset_screenshot_capture(self.client)
150155

151156
sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
152157
n=[0, 0],

0 commit comments

Comments
 (0)