1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 23:38:09 +00:00

python: add more unit tests for ethereum message sign/verify

This commit is contained in:
Pavol Rusnak 2019-05-16 18:10:47 +02:00
parent fc3a93dc47
commit 2d3ef6ae3b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 52 additions and 3 deletions

1
.gitmodules vendored
View File

@ -4,6 +4,7 @@
[submodule "vendor/QR-Code-generator"]
path = vendor/QR-Code-generator
url = https://github.com/nayuki/QR-Code-generator.git
ignore = untracked
[submodule "vendor/secp256k1-zkp"]
path = vendor/secp256k1-zkp
url = https://github.com/ElementsProject/secp256k1-zkp.git

View File

@ -36,6 +36,30 @@ class TestMsgEthereumSignmessage(TrezorTest):
"VeryLongMessage!" * 64,
"752d283b3aea1eb44fd09203f4d5c430a6544e399b8500b02722b54325f6d8d457fd83460a31045cb0d6e8356240954ba072fdfe5cdb3f16d416e2acf1a180a51c",
),
(
"MsgLenIs9",
"6570bd48d38a68ade78273fca18943ed36ec48cb2eb5b6792bc56f20588b1c75020f04b86740321e562eb2ec2022eec4ad673dc120c6895983856e5437cb95c91c",
),
(
"MsgLenIs10",
"5f26de400e53a333479ce9518ef0724b81615b3e3842c3205754f48a9ff1a3fc0e383ccb7dabdfd8e284abe69c0065f15f033f37210f5efeccfc9a6b0813a2af1b",
),
(
"MsgLenIs11!",
"7d8c1deec29c01c1982f46a91e1d9d99e399374b8aac875703ca947583ec6d944e7579d3934ac10e910a2959daa9e89fa5f4c0fc62bacdc8ec788d09b22e2ad61c",
),
(
"This message has length 99" + 73 * "!",
"ac255920b53788eb81f5debd3792554ee4666d38059c8c39f74abd4032483fce2365af2236b8edf83801ad6e57f1e126e55a7757f2a2ebc991efe495b48d16d01c",
),
(
"This message has length 100" + 73 * "!",
"47a70be8e7161a2c597de2237ba3846218e86561e9b5115b7fe9604ab63c05f85456204ba309e11e3b242a8c09a166ce611fb34bf1c54598162bbcce749549ea1b",
),
(
"This message has length 101" + 74 * "!",
"0f413d3eff519c52ba01333b8bd132d20c2e62e3a77483e6a803dc3b711e3c2e11548f21687764a7290347079c00fc9dd976e060600d774bf1ae2f99bd8803bf1c",
),
]
def test_sign(self):

View File

@ -24,15 +24,39 @@ from .common import TrezorTest
@pytest.mark.ethereum
class TestMsgEthereumVerifymessage(TrezorTest):
ADDRESS = "0xCb3864960e8DB1A751212c580AF27Ee8867d688F"
ADDRESS = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b"
VECTORS = [
(
"This is an example of a signed message.",
"b7837058907192dbc9427bf57d93a0acca3816c92927a08be573b785f2d72dab65dad9c92fbe03a358acdb455eab2107b869945d11f4e353d9cc6ea957d08a871b",
"9bacd833b51fde010bab53bafd9d832eadd3b175d2af2e629bb2944fcc987dce7ff68bb3571ed25a720c220f2f9538bc8d04f582bee002c9af086590a49805901c",
),
(
"VeryLongMessage!" * 64,
"da2b73b0170479c2bfba3dd4839bf0d67732a44df8c873f3f3a2aca8a57d7bdc0b5d534f54c649e2d44135717001998b176d3cd1212366464db51f5838430fb31c",
"752d283b3aea1eb44fd09203f4d5c430a6544e399b8500b02722b54325f6d8d457fd83460a31045cb0d6e8356240954ba072fdfe5cdb3f16d416e2acf1a180a51c",
),
(
"MsgLenIs9",
"6570bd48d38a68ade78273fca18943ed36ec48cb2eb5b6792bc56f20588b1c75020f04b86740321e562eb2ec2022eec4ad673dc120c6895983856e5437cb95c91c",
),
(
"MsgLenIs10",
"5f26de400e53a333479ce9518ef0724b81615b3e3842c3205754f48a9ff1a3fc0e383ccb7dabdfd8e284abe69c0065f15f033f37210f5efeccfc9a6b0813a2af1b",
),
(
"MsgLenIs11!",
"7d8c1deec29c01c1982f46a91e1d9d99e399374b8aac875703ca947583ec6d944e7579d3934ac10e910a2959daa9e89fa5f4c0fc62bacdc8ec788d09b22e2ad61c",
),
(
"This message has length 99" + 73 * "!",
"ac255920b53788eb81f5debd3792554ee4666d38059c8c39f74abd4032483fce2365af2236b8edf83801ad6e57f1e126e55a7757f2a2ebc991efe495b48d16d01c",
),
(
"This message has length 100" + 73 * "!",
"47a70be8e7161a2c597de2237ba3846218e86561e9b5115b7fe9604ab63c05f85456204ba309e11e3b242a8c09a166ce611fb34bf1c54598162bbcce749549ea1b",
),
(
"This message has length 101" + 74 * "!",
"0f413d3eff519c52ba01333b8bd132d20c2e62e3a77483e6a803dc3b711e3c2e11548f21687764a7290347079c00fc9dd976e060600d774bf1ae2f99bd8803bf1c",
),
]