Skip to content

Commit 43bf520

Browse files
committed
fix: ETH signtx_data expected_responses order — Send confirm before BLIND SIGNATURE
1 parent 1643411 commit 43bf520

1 file changed

Lines changed: 30 additions & 19 deletions

File tree

tests/test_msg_ethereum_signtx.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,37 @@ def test_ethereum_signtx_data(self):
5454
"691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a",
5555
)
5656

57-
# Second signing — verify signatures are deterministic
5857
self.client.apply_policy("AdvancedMode", 1)
59-
sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
60-
n=[0, 0],
61-
nonce=0,
62-
gas_price=20,
63-
gas_limit=20,
64-
to=binascii.unhexlify("1d1c328764a41bda0492b66baa30c4a339ff85ef"),
65-
value=10,
66-
data=b"abcdefghijklmnop" * 16,
67-
)
68-
self.assertEqual(sig_v, 28)
69-
self.assertEqual(
70-
binascii.hexlify(sig_r),
71-
"6da89ed8627a491bedc9e0382f37707ac4e5102e25e7a1234cb697cedb7cd2c0",
72-
)
73-
self.assertEqual(
74-
binascii.hexlify(sig_s),
75-
"691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a",
76-
)
58+
59+
with self.client:
60+
self.client.set_expected_responses(
61+
[
62+
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput), # Send value confirm
63+
proto.ButtonRequest(code=proto_types.ButtonRequest_Other), # BLIND SIGNATURE warning
64+
proto.ButtonRequest(code=proto_types.ButtonRequest_ConfirmOutput), # Confirm data hex
65+
proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx), # Final sign confirm
66+
eth_proto.EthereumTxRequest(),
67+
]
68+
)
69+
70+
sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
71+
n=[0, 0],
72+
nonce=0,
73+
gas_price=20,
74+
gas_limit=20,
75+
to=binascii.unhexlify("1d1c328764a41bda0492b66baa30c4a339ff85ef"),
76+
value=10,
77+
data=b"abcdefghijklmnop" * 16,
78+
)
79+
self.assertEqual(sig_v, 28)
80+
self.assertEqual(
81+
binascii.hexlify(sig_r),
82+
"6da89ed8627a491bedc9e0382f37707ac4e5102e25e7a1234cb697cedb7cd2c0",
83+
)
84+
self.assertEqual(
85+
binascii.hexlify(sig_s),
86+
"691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a",
87+
)
7788

7889
sig_v, sig_r, sig_s = self.client.ethereum_sign_tx(
7990
n=[0, 0],

0 commit comments

Comments
 (0)