1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

tests: use valid paths in various altcoin tests

This commit is contained in:
Jan Pochyla 2018-12-13 15:49:19 +01:00
parent bfb6a196c0
commit 0390c1da0a
5 changed files with 61 additions and 60 deletions

View File

@ -27,22 +27,22 @@ class TestMsgEthereumGetaddress(TrezorTest):
def test_ethereum_getaddress(self):
self.setup_mnemonic_nopin_nopassphrase()
assert (
ethereum.get_address(self.client, []).hex()
== "1d1c328764a41bda0492b66baa30c4a339ff85ef"
ethereum.get_address(self.client, [H_(44), H_(60)]).hex()
== "e025dfbe2c53638e547c6487ded34add7b8aafc1"
)
assert (
ethereum.get_address(self.client, [1]).hex()
== "437207ca3cf43bf2e47dea0756d736c5df4f597a"
ethereum.get_address(self.client, [H_(44), H_(60), 1]).hex()
== "ed46c856d0c79661cf7d40ffe0c0c5077c00e898"
)
assert (
ethereum.get_address(self.client, [0, H_(1)]).hex()
== "e5d96dfa07bcf1a3ae43677840c31394258861bf"
ethereum.get_address(self.client, [H_(44), H_(60), 0, H_(1)]).hex()
== "6682fa7f3ec58581b1e576268b5463b4b5c93839"
)
assert (
ethereum.get_address(self.client, [H_(9), 0]).hex()
== "f68804ac9eca9483ab4241d3e4751590d2c05102"
ethereum.get_address(self.client, [H_(44), H_(60), H_(9), 0]).hex()
== "fb3be0f9717ff5fcf3c58eb49a9ed67f1bd89d4e"
)
assert (
ethereum.get_address(self.client, [0, 9999999]).hex()
== "7a6366ecfcaf0d5dcc1539c171696c6cdd1eb8ed"
ethereum.get_address(self.client, [H_(44), H_(60), 0, 9999999]).hex()
== "6b909b50d88c9a8e02453a87b3662e3e7a5e0cf1"
)

View File

@ -17,6 +17,7 @@
import pytest
from trezorlib import ethereum
from trezorlib.tools import H_
from .common import TrezorTest
@ -24,16 +25,16 @@ from .common import TrezorTest
@pytest.mark.ethereum
class TestMsgEthereumSignmessage(TrezorTest):
PATH = [0]
ADDRESS = "cb3864960e8db1a751212c580af27ee8867d688f"
PATH = [H_(44), H_(60), H_(0), 0]
ADDRESS = "ea53af85525b1779ee99ece1a5560c0b78537c3b"
VECTORS = [
(
"This is an example of a signed message.",
"b7837058907192dbc9427bf57d93a0acca3816c92927a08be573b785f2d72dab65dad9c92fbe03a358acdb455eab2107b869945d11f4e353d9cc6ea957d08a871b",
"9bacd833b51fde010bab53bafd9d832eadd3b175d2af2e629bb2944fcc987dce7ff68bb3571ed25a720c220f2f9538bc8d04f582bee002c9af086590a49805901c",
),
(
"VeryLongMessage!" * 64,
"da2b73b0170479c2bfba3dd4839bf0d67732a44df8c873f3f3a2aca8a57d7bdc0b5d534f54c649e2d44135717001998b176d3cd1212366464db51f5838430fb31c",
"752d283b3aea1eb44fd09203f4d5c430a6544e399b8500b02722b54325f6d8d457fd83460a31045cb0d6e8356240954ba072fdfe5cdb3f16d416e2acf1a180a51c",
),
]

View File

@ -31,9 +31,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
3,
0,
41,
"a90d0bc4f8d63be69453dd62f2bb5fff53c610000abf956672564d8a654d401a",
"544a2e57bc8b4da18660a1e6036967ea581cc635f5137e3ba97a750867c27cf2",
42,
"cde31d8ab07d423d5e52aeb148180528ea54974cdb4c5578499c0137ec24d892",
"41fc58955b3b3e3f3b2aced65e11e8a3cb6339027f943bec3d504d6398b69dd2",
100000000000000000,
21000,
None,
@ -41,9 +41,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
3,
1,
42,
"699428a6950e23c6843f1bf3754f847e64e047e829978df80d55187d19a401ce",
"087343d0a3a2f10842218ffccb146b59a8431b6245ab389fde22dc833f171e6e",
41,
"57951fed170f3765dea164d65acd31373799db32ec572e213b1d9a1209956b98",
"0971f8830c0e2e89919309f217ed2eadb0c63d647e016d220729ce79d27c24a0",
100000000000000000,
21000,
None,
@ -52,8 +52,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
3,
2,
42,
"ba85b622a8bb82606ba96c132e81fa8058172192d15bc41d7e57c031bca17df4",
"6473b75997634b6f692f8d672193591d299d5bf1c2d6e51f1a14ed0530b91c7d",
"73744f66231690edd9eed2ab3c2b56ec4f6c4b9aabc633ae7f3f4ea94223d52c",
"7f500afbe2b2b4e4e57f22511e3a42b3596b85cad7fe1eca700cdae1905d3555",
100000000000000000,
21004,
b"\0",
@ -62,8 +62,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
3,
3,
42,
"d021c98f92859c8db5e4de2f0e410a8deb0c977eb1a631e323ebf7484bd0d79a",
"2c0e9defc9b1e895dc9520ff25ba3c635b14ad70aa86a5ad6c0a3acb82b569b6",
"1a4fc1ec5f98bf874d5336aaf1fa9069ce68dc36c3f77e93465c9ac2c8b4b741",
"13007c9b1df6a0d2f2ffa9d0ebcdec189122a5e781eb64967eb0d6a6def95b7a",
100000000000000000,
299732,
b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
@ -72,8 +72,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
3,
4,
42,
"dd52f026972a83c56b7dea356836fcfc70a68e3b879cdc8ef2bb5fea23e0a7aa",
"079285fe579c9a2da25c811b1c5c0a74cd19b6301ee42cf20ef7b3b1353f7242",
"8da0358d780df542f767d977f99ad034b6d9fa808fe50997141be2a1b93542c0",
"2dafe1ead8aae1051e6662c5d553b34067bda9c8fa7314ae8693ec61ddfc96d4",
0,
21004,
b"\0",
@ -81,9 +81,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
1,
1,
37,
"bae6198fdc87ccad6256e543617a34d052bfd17ae3be0bec7fbf8ea34bf9c930",
"7d12f625f3e54700b6ed14ab669f45a8a2b5552c39f0781b0ab3796f19e6b4d1",
38,
"b72707f0f5a38339c9dd0359720312c739a8ac6554659c7af48456f06ba33374",
"75a431c046046942f9c1f3305cd08f34302164811c675ac0a0ac0b73cb30a90e",
0,
21004,
b"\0",
@ -91,9 +91,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
255,
1,
546,
"7597a40719509ae3850d2eba808b7b2f7d272fda316e1321e5ebcc911e9f1b0d",
"269dd69248273820f65b43d8824bb7aff1aa4e35ee663a5433a5df8f0c47dc31",
545,
"529172fb644a6d29b7218fb783f3d666021fc29cc4bf9bffbcfb3b84ab8d6181",
"30980c6102a12872ef9cd888f2bf90c81bbbdc8878ff7d1d1382f8983b0d0c49",
0,
21004,
b"\0",
@ -101,9 +101,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
256,
1,
547,
"64e9821db2001ff5dff13c9d8c7fb0701ff860f5f95155d378fb9fcc06088f28",
"4d03f339afed717e2155f044a6b0a895b5ac98343f1745e7525870c2046c36bc",
548,
"db53c05c679bdfdf3ded787ce9607d3f109ae46c87b1dcc9ab34053e5ed0eace",
"39645dd48118d369b588dbf279f1a8c01051fabf65bf8eaa633c6433ff120cce",
0,
21004,
b"\0",
@ -111,9 +111,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
65535,
1,
131106,
"6f2275808dc328184d7aa019d0a68f8dd8234969576a477670934145bb358969",
"2be1ff9045bccff9ba3d6d5c7789a52c52c9679526dd3ec349caa318c3d055ff",
131105,
"b520fa77767cdf07b6014d4a8fb35eebe5ed7c0edab97132b0dc74e3e1f13ed9",
"78735b2db4cf95fb651c5c1f5529e60542019e456c6cb7a9f4bd9bbb83418d99",
0,
21004,
b"\0",
@ -122,8 +122,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
65536,
1,
131107,
"e16e35afe534a46e3e4cf09f355cbf02edc01937c2b444238162c2aca79037b8",
"1083b84e21b1cbad95c7ea9792818c18fa716aa25951c5341b48732d611a396a",
"4b6122ba875b57ce084bd5f08e9ae1944e998726a4056c9b7746432d8f46ba99",
"6812c2668ac9c9927b69ef7cf9baec54436f7319ccc14f0f664e1e94e6109e06",
0,
21004,
b"\0",
@ -131,9 +131,9 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
(
16777215,
1,
33554466,
"f9753ee68cf2af20638cc753945d157039504f82d6d6fe0ec98806b64366c551",
"056b57a69d88a4b71fba993c580d8bbf04f2c857f97a8b7d4b2892b5dafa9114",
33554465,
"68a8c6f2336a8e3296f17a307d84a1e6d3ab1383fdcc62611c2e8426f2e2777e",
"2d4ce900077ab40aac26064945998dbac5a014baadae2d3cb629cdeb9452db61",
0,
21004,
b"\0",
@ -142,8 +142,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
16777216,
1,
33554468,
"23a5399650c6efa46a25a0a966a29119830d9c587b6b93da43cb0be6d3c69059",
"5a6eddffc62317a6a3801608071655a9c43423aef9705b2f5df4212942265c37",
"b6c42c584ef69621a2e5f3e1ab9dad890dbff3c92a599230dd0e394cd29d1c68",
"497eec05ea52773d0f05e7fdf4f7993b3a06ef958804b39af699ef09ed0f5d7e",
0,
21004,
b"\0",
@ -152,8 +152,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
2147483629,
1,
4294967294,
"6a996586f1ea19afe9cb0ca44dec6bb8643cdf53b5cf148323c94a32a04b087d",
"0d086b208df6826657edf98010972b2649b323466a7ea4b67e7285fb9e829481",
"1a31f886c0bba527e622a731270dc29e62a607ff63558fca38745e5b9a672686",
"0f3fce8a70598bbb54387cde7e8f957a27e4a816cbc9408717b27d8666222bd9",
0,
21004,
b"\0",
@ -162,8 +162,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
2147483630,
1,
4294967296,
"fd0377ff429a51ae284c4b09b7d7c26c78944c86bb311b5988d70be4fc59eeba",
"2ad183858ac6b1efa820b9ee2c2dbf6659a73cc5b714d32c380b263d024f2ee9",
"ba6cb6e2ebbac3726db9a3e4a939454009108f6515330e567aeada14ecebe074",
"2bbfba1154cae32e3e6c6bbf3ce41cba6cc8c6b764245ba6026605506838e690",
0,
21004,
None,
@ -172,8 +172,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
2147483631,
1,
4294967298,
"a4e89720285b179f679ecec1c79e4948b18ee4cf08f76b11d701cbead5e81a70",
"094b32d3e53833c8085dadfe169782db4d32856d7b556f832f64dfdcfa1dd3b8",
"3c743528e9ce315db02e487de93f2b2cfc93421e43f1d519f77a2f05bd2ce190",
"16c1fec1495fe5da89d1a026f1a575ff354e18ff0fb9d04a6cfb0413267ab2bc",
100000000000000000,
21000,
None,
@ -182,8 +182,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
3125659152,
1,
6251318340,
"a39e51d16cb10c81a9c1d9b071b714c4ecf112702407f1cc7aae35c85eced3d3",
"0b0654665e4677c77510fc2a43026ee66c13261d3d893895bc49e6f4eaa5c8bd",
"82cde0c9e1a94c1305791b09e1bcd021a49b036a16d9733acbc1a08bb30f3410",
"472c8897519ba410b86f80993236d992e18e94d1f59c3d8760d2d7c90914dfc6",
1,
21005,
None,
@ -192,8 +192,8 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
4294967295,
1,
8589934625,
"3367230b5f506426f075f3137f4fd6a5fc4198326dd4936bbc38bf0c5ff43a5e",
"6e48c3c95b3a534f7853a3b5dd72cdeffe9b7e93503eb7a793c9d5fdc14c4e99",
"67788e892fb372bba16823e16d3186f67494d7b1128555248f3661ad87e9d7ef",
"2faf9f06dfdf23ceca2796cf0d55c88187f199e98a94dfb15722824b244d81a1",
100000000000000000,
21000,
None,
@ -205,7 +205,7 @@ class TestMsgEthereumSigntxChainId(TrezorTest):
for ci, n, sv, sr, ss, v, gl, d in VECTORS:
sig_v, sig_r, sig_s = ethereum.sign_tx(
self.client,
n=[H_(44), H_(1), H_(0), 0, 0],
n=[H_(44), H_(60), H_(0), 0, 0],
nonce=n,
gas_price=20000000000,
gas_limit=gl,

View File

@ -66,7 +66,7 @@ class TestMsgLiskSignTx(TrezorTest):
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
proto.LiskSignedTx(
signature=bytes.fromhex(
"87b9789ed10fb93311b77d23e34484ee653b43206a7e416da70f8dd6b15231a8dfe05c66bcbca62ba841fdde8affdb04b3ee18300caa8560cd15f6a4942a870a"
"cdce9eba2ea8fa75f90fbc725f0d9de6152c7189a3044ab2fe307d9ff54754856e09125d7a15376eaf4bb5451b63881821948222ccd9ffb5da4d9b1aa8bd4904"
)
),
]
@ -74,7 +74,7 @@ class TestMsgLiskSignTx(TrezorTest):
lisk.sign_tx(
self.client,
parse_path("m/44'/9999'/0'"),
parse_path("m/44'/134'/123456'/123456'/123456'/123456'/123456'"),
{
"amount": "10000000",
"recipientId": "9971262264659915921L",

View File

@ -64,5 +64,5 @@ class TestMsgStellarGetAddress(TrezorTest):
assert exc.value.args[0] == proto.FailureType.ProcessError
assert exc.value.args[1].endswith("Failed to derive private key")
else:
assert exc.value.args[0] == proto.FailureType.FirmwareError
assert exc.value.args[1].endswith("Firmware error")
assert exc.value.args[0] == proto.FailureType.DataError
assert exc.value.args[1].endswith("Forbidden key path")