@@ -54,38 +54,27 @@ def test_ethereum_signtx_data(self):
5454 "691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a" ,
5555 )
5656
57- self .client .apply_policy ("AdvancedMode" , 1 )
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- )
57+ # Second sign — same params, verify deterministic signature
58+ sig_v , sig_r , sig_s = self .client .ethereum_sign_tx (
59+ n = [0 , 0 ],
60+ nonce = 0 ,
61+ gas_price = 20 ,
62+ gas_limit = 20 ,
63+ to = binascii .unhexlify ("1d1c328764a41bda0492b66baa30c4a339ff85ef" ),
64+ value = 10 ,
65+ data = b"abcdefghijklmnop" * 16 ,
66+ )
67+ self .assertEqual (sig_v , 28 )
68+ self .assertEqual (
69+ binascii .hexlify (sig_r ),
70+ "6da89ed8627a491bedc9e0382f37707ac4e5102e25e7a1234cb697cedb7cd2c0" ,
71+ )
72+ self .assertEqual (
73+ binascii .hexlify (sig_s ),
74+ "691f73b145647623e2d115b208a7c3455a6a8a83e3b4db5b9c6d9bc75825038a" ,
75+ )
8876
77+ # Third sign — different params, different signature
8978 sig_v , sig_r , sig_s = self .client .ethereum_sign_tx (
9079 n = [0 , 0 ],
9180 nonce = 123456 ,
0 commit comments