mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 00:08:10 +00:00
chore(tests): vectorizing and creating JSON fixtures for ethereum device tests
This commit is contained in:
parent
cec1f39a90
commit
6f1005b155
67
common/tests/fixtures/ethereum/getaddress.json
vendored
Normal file
67
common/tests/fixtures/ethereum/getaddress.json
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"setup": {
|
||||||
|
"mnemonic": "all all all all all all all all all all all all",
|
||||||
|
"passphrase": ""
|
||||||
|
},
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/60'/0'"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0xdA0b608bdb1a4A154325C854607c68950b4F1a34"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/60'/100'"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x93Fb0Ff84F5BB6E7b6a9835C7AA6dE7a76794266"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/60'/0'/0/100"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x1e6E3708a059aEa1241a81c7aAe84b6CDbC54d59"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ETC",
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/61'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0xF410e37E9C8BCf8CF319c84Ae9dCEbe057804a04"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "GoChain",
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/6060'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0xA26a450ef46a5f11a510eBA2119A3236fa0Aca92"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wanchain",
|
||||||
|
"parameters": {
|
||||||
|
"path": "m/44'/5718350'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0xe432a7533D689ceed00B7EE91d9368b8A1693bD2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
162
common/tests/fixtures/ethereum/sign_tx.json
vendored
Normal file
162
common/tests/fixtures/ethereum/sign_tx.json
vendored
Normal file
File diff suppressed because one or more lines are too long
160
common/tests/fixtures/ethereum/sign_tx_eip155.json
vendored
Normal file
160
common/tests/fixtures/ethereum/sign_tx_eip155.json
vendored
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
{
|
||||||
|
"setup": {
|
||||||
|
"mnemonic": "all all all all all all all all all all all all",
|
||||||
|
"passphrase": ""
|
||||||
|
},
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"name": "Ethereum",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 1,
|
||||||
|
"path": "44'/60'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 38,
|
||||||
|
"sig_r": "6a6349bddb5749bb8b96ce2566a035ef87a09dbf89b5c7e3dfdf9ed725912f24",
|
||||||
|
"sig_s": "4ae58ccd3bacee07cdc4a3e8540544fd009c4311af7048122da60f2054c07ee4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ropsten",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 3,
|
||||||
|
"path": "44'/1'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 42,
|
||||||
|
"sig_r": "9d49a5c234a134bc56d00a7cf0c208c97d746f002c1fd3609b643eb8ef99d07d",
|
||||||
|
"sig_s": "3f064e133624cb59f8103fd5de76c089d8754e3da233a59d2ab2ca47fc306837"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Rinkeby",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 4,
|
||||||
|
"path": "44'/1'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 43,
|
||||||
|
"sig_r": "79a9fd0391f027ed518f3d796a598bf33eef0fb30ef22568a140d674d6b0b76c",
|
||||||
|
"sig_s": "408cd459abafcdb7f2e415b269c85a308aad4c53e63c01d3431d3db6ab6292dd"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ETC",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 61,
|
||||||
|
"path": "44'/61'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 158,
|
||||||
|
"sig_r": "6f03621da2fe75877494697b0852c379ea3b2c4ec4f99ab9ce0c8753ebbaf3aa",
|
||||||
|
"sig_s": "2b8c8def7534e7bc692ee2975a674a0e31c0dbd9137e53d27dee6b15e121c210"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Auxilium",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 28945486,
|
||||||
|
"path": "44'/344'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 57891008,
|
||||||
|
"sig_r": "3298b58680045cfb373b9945f17c468a5c5725c9115c7c18915e8c585c67193f",
|
||||||
|
"sig_s": "6bf1c719350150a520d59542815afd8263d7fe7087608051abe7df11dd7fcbec"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pirl",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 3125659152,
|
||||||
|
"path": "44'/164'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 6251318340,
|
||||||
|
"sig_r": "a876d3cf19f4f6b51fb980aac49e8bd378b88f11adbebc1be33d7b86eb84a054",
|
||||||
|
"sig_s": "3bee0e5a07661e78c9c4af49c8a42f4735f80cbb82931607ac35fc78f8d5b113"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Unknown_chain_id_eth_path",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 609112567,
|
||||||
|
"path": "44'/60'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 1218225170,
|
||||||
|
"sig_r": "0b0f20dc9202db0653a827b9dc924653bc83d67eec9e43d678e0fb6bb3eb6d9e",
|
||||||
|
"sig_s": "5fdbae16da0ffc4d888e915ff210393e5c7655a3c48eaffbbe97d6db428fc277"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Unknown_chain_id_testnet_path",
|
||||||
|
"parameters": {
|
||||||
|
"chain_id": 609112567,
|
||||||
|
"path": "44'/1'/0'/0/0",
|
||||||
|
"nonce": 0,
|
||||||
|
"gas_price": 20000000000,
|
||||||
|
"gas_limit": 21000,
|
||||||
|
"value": 10000000000,
|
||||||
|
"to_address": "0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
||||||
|
"tx_type": null,
|
||||||
|
"data": ""
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"sig_v": 1218225169,
|
||||||
|
"sig_r": "f699de96e886995e460e760839d4f2c7b9f1c98f2d3c108d0add4e8663a679d8",
|
||||||
|
"sig_s": "1447ba45be9fca42bcbf250389403245c8c1b0476e60b96dea320b0a596b5528"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
125
common/tests/fixtures/ethereum/sign_tx_eip1559.json
vendored
Normal file
125
common/tests/fixtures/ethereum/sign_tx_eip1559.json
vendored
Normal file
File diff suppressed because one or more lines are too long
88
common/tests/fixtures/ethereum/signmessage.json
vendored
Normal file
88
common/tests/fixtures/ethereum/signmessage.json
vendored
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"setup": {
|
||||||
|
"mnemonic": "all all all all all all all all all all all all",
|
||||||
|
"passphrase": ""
|
||||||
|
},
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This is an example of a signed message.",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "af4eac50f21acc6daeb0ab036f616f5d19fccade46e47100642b3dfc798c9b740d5873887bdc2f02502c90777a082d10dca113bd1ec29d08108396401421c8cc1b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "e9b3648fe10146a7c5c73ae1e42468273b945554b13769be19c3658e5b55c62d7036b56c1e094dc364060b798b120a528f31d91e815d0612c367bf7471519c761c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs9",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "495b5b021517cd01cb05f02dfb6a1f79a8d9e4f82e8fb01d44ebf7d1218333f1528b67043ffc25c5b64b1e5a182f5d7d5707fcb639092af708969f90038155a91c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs10",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "0c8eb57decbb95d2a783e69d444b3747c49ebcceb14f24287732ba77c39aa5cd2c66f7ec545b8108ef7ce078edac4588c70ab6249fc626114a95606783828f041b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs11!",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "5f1ab8940c2137baf69a2b94f55f0f7e53a022b9e363b564744616271eb89b66145055fc9923c6ead63dd784854c742f4f5651c8257d70cbce5a96ce2986dd311c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 99!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "f2c3d9c81fe35a6bc68f0ace01bd7209baf11e455e7335903e7ad2879ce5d7bc2199bf8bafc1efe1ff2cfdf2963cd5767911a641c9445cca6f37dc6da72fd1611b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 100!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "a6d05d98180246cbd7084f191465d02c4242bc7f856632a2b5b43acd496c46c03a36cc60bfeca6ca98fd210748a3aa68aa7ebba71b39adcad7f88325fc34131a1b"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 101!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"path": "44'/60'/0'/0/0"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"address": "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8",
|
||||||
|
"sig": "fa9d60644436f27eb88956a50893e9a47f67c42fb1b57a44bde4c6e127ab777e0c23b234b6ec9327ffd0620daaa514243ebb5a3652a1bac2d720e0f5555b2e071c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
72
common/tests/fixtures/ethereum/verifymessage.json
vendored
Normal file
72
common/tests/fixtures/ethereum/verifymessage.json
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"setup": {
|
||||||
|
"mnemonic": "all all all all all all all all all all all all",
|
||||||
|
"passphrase": ""
|
||||||
|
},
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This is an example of a signed message.",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "9bacd833b51fde010bab53bafd9d832eadd3b175d2af2e629bb2944fcc987dce7ff68bb3571ed25a720c220f2f9538bc8d04f582bee002c9af086590a49805901c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!VeryLongMessage!",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "752d283b3aea1eb44fd09203f4d5c430a6544e399b8500b02722b54325f6d8d457fd83460a31045cb0d6e8356240954ba072fdfe5cdb3f16d416e2acf1a180a51c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs9",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "6570bd48d38a68ade78273fca18943ed36ec48cb2eb5b6792bc56f20588b1c75020f04b86740321e562eb2ec2022eec4ad673dc120c6895983856e5437cb95c91c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs10",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "5f26de400e53a333479ce9518ef0724b81615b3e3842c3205754f48a9ff1a3fc0e383ccb7dabdfd8e284abe69c0065f15f033f37210f5efeccfc9a6b0813a2af1b"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "MsgLenIs11!",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "7d8c1deec29c01c1982f46a91e1d9d99e399374b8aac875703ca947583ec6d944e7579d3934ac10e910a2959daa9e89fa5f4c0fc62bacdc8ec788d09b22e2ad61c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 99!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "ac255920b53788eb81f5debd3792554ee4666d38059c8c39f74abd4032483fce2365af2236b8edf83801ad6e57f1e126e55a7757f2a2ebc991efe495b48d16d01c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 100!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "47a70be8e7161a2c597de2237ba3846218e86561e9b5115b7fe9604ab63c05f85456204ba309e11e3b242a8c09a166ce611fb34bf1c54598162bbcce749549ea1b"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"msg": "This message has length 101!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
|
||||||
|
"address": "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b",
|
||||||
|
"sig": "0f413d3eff519c52ba01333b8bd132d20c2e62e3a77483e6a803dc3b711e3c2e11548f21687764a7290347079c00fc9dd976e060600d774bf1ae2f99bd8803bf1c"
|
||||||
|
},
|
||||||
|
"result": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
0
tests/device_tests/ethereum/__init__.py
Normal file
0
tests/device_tests/ethereum/__init__.py
Normal file
32
tests/device_tests/ethereum/test_getaddress.py
Normal file
32
tests/device_tests/ethereum/test_getaddress.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# This file is part of the Trezor project.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
||||||
|
#
|
||||||
|
# This library is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License version 3
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the License along with this library.
|
||||||
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from trezorlib import ethereum
|
||||||
|
from trezorlib.tools import parse_path
|
||||||
|
|
||||||
|
from ...common import parametrize_using_common_fixtures
|
||||||
|
|
||||||
|
pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum]
|
||||||
|
|
||||||
|
|
||||||
|
@parametrize_using_common_fixtures(
|
||||||
|
"ethereum/getaddress.json",
|
||||||
|
)
|
||||||
|
def test_getaddress(client, parameters, result):
|
||||||
|
address_n = parse_path(parameters["path"])
|
||||||
|
assert ethereum.get_address(client, address_n) == result["address"]
|
@ -19,7 +19,7 @@ import pytest
|
|||||||
from trezorlib import ethereum
|
from trezorlib import ethereum
|
||||||
from trezorlib.tools import H_
|
from trezorlib.tools import H_
|
||||||
|
|
||||||
from ..common import MNEMONIC12
|
from ...common import MNEMONIC12
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
@pytest.mark.altcoin
|
92
tests/device_tests/ethereum/test_sign_verify_message.py
Normal file
92
tests/device_tests/ethereum/test_sign_verify_message.py
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# This file is part of the Trezor project.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
||||||
|
#
|
||||||
|
# This library is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License version 3
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the License along with this library.
|
||||||
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from trezorlib import ethereum
|
||||||
|
from trezorlib.tools import parse_path
|
||||||
|
|
||||||
|
from ...common import parametrize_using_common_fixtures
|
||||||
|
|
||||||
|
pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum]
|
||||||
|
|
||||||
|
|
||||||
|
@parametrize_using_common_fixtures(
|
||||||
|
"ethereum/signmessage.json",
|
||||||
|
)
|
||||||
|
def test_signmessage(client, parameters, result):
|
||||||
|
res = ethereum.sign_message(
|
||||||
|
client, parse_path(parameters["path"]), parameters["msg"]
|
||||||
|
)
|
||||||
|
assert res.address == result["address"]
|
||||||
|
assert res.signature.hex() == result["sig"]
|
||||||
|
|
||||||
|
|
||||||
|
@parametrize_using_common_fixtures(
|
||||||
|
"ethereum/verifymessage.json",
|
||||||
|
)
|
||||||
|
def test_verify(client, parameters, result):
|
||||||
|
res = ethereum.verify_message(
|
||||||
|
client,
|
||||||
|
parameters["address"],
|
||||||
|
bytes.fromhex(parameters["sig"]),
|
||||||
|
parameters["msg"],
|
||||||
|
)
|
||||||
|
assert res is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_verify_invalid(client):
|
||||||
|
# First vector from the verifymessage JSON fixture
|
||||||
|
msg = "This is an example of a signed message."
|
||||||
|
address = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b"
|
||||||
|
sig = bytes.fromhex(
|
||||||
|
"9bacd833b51fde010bab53bafd9d832eadd3b175d2af2e629bb2944fcc987dce7ff68bb3571ed25a720c220f2f9538bc8d04f582bee002c9af086590a49805901c"
|
||||||
|
)
|
||||||
|
|
||||||
|
res = ethereum.verify_message(
|
||||||
|
client,
|
||||||
|
address,
|
||||||
|
sig,
|
||||||
|
msg,
|
||||||
|
)
|
||||||
|
assert res is True
|
||||||
|
|
||||||
|
# Changing the signature, expecting failure
|
||||||
|
res = ethereum.verify_message(
|
||||||
|
client,
|
||||||
|
address,
|
||||||
|
sig[:-1] + b"\x00",
|
||||||
|
msg,
|
||||||
|
)
|
||||||
|
assert res is False
|
||||||
|
|
||||||
|
# Changing the message, expecting failure
|
||||||
|
res = ethereum.verify_message(
|
||||||
|
client,
|
||||||
|
address,
|
||||||
|
sig,
|
||||||
|
msg + "abc",
|
||||||
|
)
|
||||||
|
assert res is False
|
||||||
|
|
||||||
|
# Changing the address, expecting failure
|
||||||
|
res = ethereum.verify_message(
|
||||||
|
client,
|
||||||
|
address[:-1] + "a",
|
||||||
|
sig,
|
||||||
|
msg,
|
||||||
|
)
|
||||||
|
assert res is False
|
275
tests/device_tests/ethereum/test_signtx.py
Normal file
275
tests/device_tests/ethereum/test_signtx.py
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
# This file is part of the Trezor project.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
||||||
|
#
|
||||||
|
# This library is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License version 3
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the License along with this library.
|
||||||
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from trezorlib import ethereum, messages
|
||||||
|
from trezorlib.debuglink import message_filters
|
||||||
|
from trezorlib.exceptions import TrezorFailure
|
||||||
|
from trezorlib.tools import parse_path
|
||||||
|
|
||||||
|
from ...common import parametrize_using_common_fixtures
|
||||||
|
|
||||||
|
TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef"
|
||||||
|
|
||||||
|
pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum]
|
||||||
|
|
||||||
|
|
||||||
|
@parametrize_using_common_fixtures(
|
||||||
|
"ethereum/sign_tx.json",
|
||||||
|
"ethereum/sign_tx_eip155.json",
|
||||||
|
)
|
||||||
|
def test_signtx(client, parameters, result):
|
||||||
|
with client:
|
||||||
|
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
||||||
|
client,
|
||||||
|
n=parse_path(parameters["path"]),
|
||||||
|
nonce=parameters["nonce"],
|
||||||
|
gas_price=parameters["gas_price"],
|
||||||
|
gas_limit=parameters["gas_limit"],
|
||||||
|
to=parameters["to_address"],
|
||||||
|
chain_id=parameters["chain_id"],
|
||||||
|
value=parameters["value"],
|
||||||
|
tx_type=parameters["tx_type"],
|
||||||
|
data=bytes.fromhex(parameters["data"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
expected_v = 2 * parameters["chain_id"] + 35
|
||||||
|
assert sig_v in (expected_v, expected_v + 1)
|
||||||
|
assert sig_r.hex() == result["sig_r"]
|
||||||
|
assert sig_s.hex() == result["sig_s"]
|
||||||
|
assert sig_v == result["sig_v"]
|
||||||
|
|
||||||
|
|
||||||
|
@parametrize_using_common_fixtures(
|
||||||
|
"ethereum/sign_tx_eip1559.json",
|
||||||
|
)
|
||||||
|
@pytest.mark.skip_t1
|
||||||
|
def test_signtx_eip1559(client, parameters, result):
|
||||||
|
with client:
|
||||||
|
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
||||||
|
client,
|
||||||
|
n=parse_path(parameters["path"]),
|
||||||
|
nonce=parameters["nonce"],
|
||||||
|
gas_limit=parameters["gas_limit"],
|
||||||
|
max_gas_fee=parameters["max_gas_fee"],
|
||||||
|
max_priority_fee=parameters["max_priority_fee"],
|
||||||
|
to=parameters["to_address"],
|
||||||
|
chain_id=parameters["chain_id"],
|
||||||
|
value=parameters["value"],
|
||||||
|
data=bytes.fromhex(parameters["data"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert sig_r.hex() == result["sig_r_hex"]
|
||||||
|
assert sig_s.hex() == result["sig_s_hex"]
|
||||||
|
assert sig_v == result["sig_v"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_sanity_checks(client):
|
||||||
|
"""Is not vectorized because these are internal-only tests that do not
|
||||||
|
need to be exposed to the public.
|
||||||
|
"""
|
||||||
|
# contract creation without data should fail.
|
||||||
|
with pytest.raises(Exception):
|
||||||
|
ethereum.sign_tx(
|
||||||
|
client,
|
||||||
|
n=parse_path("44'/60'/0'/0/0"),
|
||||||
|
nonce=123456,
|
||||||
|
gas_price=20000,
|
||||||
|
gas_limit=20000,
|
||||||
|
to="",
|
||||||
|
value=12345678901234567890,
|
||||||
|
)
|
||||||
|
|
||||||
|
# gas overflow
|
||||||
|
with pytest.raises(TrezorFailure):
|
||||||
|
ethereum.sign_tx(
|
||||||
|
client,
|
||||||
|
n=parse_path("44'/60'/0'/0/0"),
|
||||||
|
nonce=123456,
|
||||||
|
gas_price=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
||||||
|
gas_limit=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
||||||
|
to=TO_ADDR,
|
||||||
|
value=12345678901234567890,
|
||||||
|
)
|
||||||
|
|
||||||
|
# no gas price
|
||||||
|
with pytest.raises(TrezorFailure):
|
||||||
|
client.call(
|
||||||
|
messages.EthereumSignTx(
|
||||||
|
address_n=parse_path("44'/60'/0'/0/0"),
|
||||||
|
nonce=b"AAA",
|
||||||
|
gas_limit=ethereum.int_to_big_endian(10000),
|
||||||
|
to=TO_ADDR,
|
||||||
|
value=ethereum.int_to_big_endian(12345678901234567890),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# no gas limit
|
||||||
|
with pytest.raises(TrezorFailure):
|
||||||
|
client.call(
|
||||||
|
messages.EthereumSignTx(
|
||||||
|
address_n=parse_path("44'/60'/0'/0/0"),
|
||||||
|
nonce=b"AAA",
|
||||||
|
gas_price=ethereum.int_to_big_endian(10000),
|
||||||
|
to=TO_ADDR,
|
||||||
|
value=ethereum.int_to_big_endian(12345678901234567890),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_data_streaming(client):
|
||||||
|
"""Only verifying the expected responses, the signatures are
|
||||||
|
checked in vectorized function above.
|
||||||
|
"""
|
||||||
|
with client:
|
||||||
|
client.set_expected_responses(
|
||||||
|
[
|
||||||
|
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
||||||
|
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
||||||
|
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
||||||
|
message_filters.EthereumTxRequest(
|
||||||
|
data_length=1024,
|
||||||
|
signature_r=None,
|
||||||
|
signature_s=None,
|
||||||
|
signature_v=None,
|
||||||
|
),
|
||||||
|
message_filters.EthereumTxRequest(
|
||||||
|
data_length=1024,
|
||||||
|
signature_r=None,
|
||||||
|
signature_s=None,
|
||||||
|
signature_v=None,
|
||||||
|
),
|
||||||
|
message_filters.EthereumTxRequest(
|
||||||
|
data_length=1024,
|
||||||
|
signature_r=None,
|
||||||
|
signature_s=None,
|
||||||
|
signature_v=None,
|
||||||
|
),
|
||||||
|
message_filters.EthereumTxRequest(
|
||||||
|
data_length=3,
|
||||||
|
signature_r=None,
|
||||||
|
signature_s=None,
|
||||||
|
signature_v=None,
|
||||||
|
),
|
||||||
|
message_filters.EthereumTxRequest(data_length=None),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
ethereum.sign_tx(
|
||||||
|
client,
|
||||||
|
n=parse_path("44'/60'/0'/0/0"),
|
||||||
|
nonce=0,
|
||||||
|
gas_price=20000,
|
||||||
|
gas_limit=20000,
|
||||||
|
to=TO_ADDR,
|
||||||
|
value=0,
|
||||||
|
data=b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip_t1
|
||||||
|
def test_signtx_eip1559_access_list(client):
|
||||||
|
with client:
|
||||||
|
|
||||||
|
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
||||||
|
client,
|
||||||
|
n=parse_path("44'/60'/0'/0/100"),
|
||||||
|
nonce=0,
|
||||||
|
gas_limit=20,
|
||||||
|
to="0x1d1c328764a41bda0492b66baa30c4a339ff85ef",
|
||||||
|
chain_id=1,
|
||||||
|
value=10,
|
||||||
|
max_gas_fee=20,
|
||||||
|
max_priority_fee=1,
|
||||||
|
access_list=[
|
||||||
|
messages.EthereumAccessList(
|
||||||
|
address="0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
|
||||||
|
storage_keys=[
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000003"
|
||||||
|
),
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000007"
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert sig_v == 1
|
||||||
|
assert (
|
||||||
|
sig_r.hex()
|
||||||
|
== "9f8763f3ff8d4d409f6b96bc3f1d84dd504e2c667b162778508478645401f121"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
sig_s.hex()
|
||||||
|
== "51e30b68b9091cf8138c07380c4378c2711779b68b2e5264d141479f13a12f57"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip_t1
|
||||||
|
def test_signtx_eip1559_access_list_larger(client):
|
||||||
|
with client:
|
||||||
|
|
||||||
|
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
||||||
|
client,
|
||||||
|
n=parse_path("44'/60'/0'/0/100"),
|
||||||
|
nonce=0,
|
||||||
|
gas_limit=20,
|
||||||
|
to="0x1d1c328764a41bda0492b66baa30c4a339ff85ef",
|
||||||
|
chain_id=1,
|
||||||
|
value=10,
|
||||||
|
max_gas_fee=20,
|
||||||
|
max_priority_fee=1,
|
||||||
|
access_list=[
|
||||||
|
messages.EthereumAccessList(
|
||||||
|
address="0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
|
||||||
|
storage_keys=[
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000003"
|
||||||
|
),
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000007"
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
messages.EthereumAccessList(
|
||||||
|
address="0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
||||||
|
storage_keys=[
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000006"
|
||||||
|
),
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000007"
|
||||||
|
),
|
||||||
|
bytes.fromhex(
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000009"
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert sig_v == 1
|
||||||
|
assert (
|
||||||
|
sig_r.hex()
|
||||||
|
== "718a3a30827c979975c846d2f60495310c4959ee3adce2d89e0211785725465c"
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
sig_s.hex()
|
||||||
|
== "7d0ea2a28ef5702ca763c1f340427c0020292ffcbb4553dd1c8ea8e2b9126dbc"
|
||||||
|
)
|
@ -1,41 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum
|
|
||||||
from trezorlib.tools import parse_path
|
|
||||||
|
|
||||||
VECTORS = ( # path, address
|
|
||||||
("m/44'/60'/0'", "0xdA0b608bdb1a4A154325C854607c68950b4F1a34"),
|
|
||||||
("m/44'/60'/100'", "0x93Fb0Ff84F5BB6E7b6a9835C7AA6dE7a76794266"),
|
|
||||||
("m/44'/60'/0'/0/0", "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"),
|
|
||||||
("m/44'/60'/0'/0/100", "0x1e6E3708a059aEa1241a81c7aAe84b6CDbC54d59"),
|
|
||||||
# ETC
|
|
||||||
("m/44'/61'/0'/0/0", "0xF410e37E9C8BCf8CF319c84Ae9dCEbe057804a04"),
|
|
||||||
# GoChain
|
|
||||||
("m/44'/6060'/0'/0/0", "0xA26a450ef46a5f11a510eBA2119A3236fa0Aca92"),
|
|
||||||
# Wanchain
|
|
||||||
("m/44'/5718350'/0'/0/0", "0xe432a7533D689ceed00B7EE91d9368b8A1693bD2"),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
@pytest.mark.parametrize("path, address", VECTORS)
|
|
||||||
def test_ethereum_getaddress(client, path, address):
|
|
||||||
address_n = parse_path(path)
|
|
||||||
assert ethereum.get_address(client, address_n) == address
|
|
@ -1,66 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum
|
|
||||||
from trezorlib.tools import parse_path
|
|
||||||
|
|
||||||
PATH = parse_path("m/44h/60h/0h/0/0")
|
|
||||||
ADDRESS = "0x73d0385F4d8E00C5e6504C6030F47BF6212736A8"
|
|
||||||
VECTORS = ( # message, signature
|
|
||||||
(
|
|
||||||
"This is an example of a signed message.",
|
|
||||||
"af4eac50f21acc6daeb0ab036f616f5d19fccade46e47100642b3dfc798c9b740d5873887bdc2f02502c90777a082d10dca113bd1ec29d08108396401421c8cc1b",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"VeryLongMessage!" * 64,
|
|
||||||
"e9b3648fe10146a7c5c73ae1e42468273b945554b13769be19c3658e5b55c62d7036b56c1e094dc364060b798b120a528f31d91e815d0612c367bf7471519c761c",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MsgLenIs9",
|
|
||||||
"495b5b021517cd01cb05f02dfb6a1f79a8d9e4f82e8fb01d44ebf7d1218333f1528b67043ffc25c5b64b1e5a182f5d7d5707fcb639092af708969f90038155a91c",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MsgLenIs10",
|
|
||||||
"0c8eb57decbb95d2a783e69d444b3747c49ebcceb14f24287732ba77c39aa5cd2c66f7ec545b8108ef7ce078edac4588c70ab6249fc626114a95606783828f041b",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"MsgLenIs11!",
|
|
||||||
"5f1ab8940c2137baf69a2b94f55f0f7e53a022b9e363b564744616271eb89b66145055fc9923c6ead63dd784854c742f4f5651c8257d70cbce5a96ce2986dd311c",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"This message has length 99" + 73 * "!",
|
|
||||||
"f2c3d9c81fe35a6bc68f0ace01bd7209baf11e455e7335903e7ad2879ce5d7bc2199bf8bafc1efe1ff2cfdf2963cd5767911a641c9445cca6f37dc6da72fd1611b",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"This message has length 100" + 73 * "!",
|
|
||||||
"a6d05d98180246cbd7084f191465d02c4242bc7f856632a2b5b43acd496c46c03a36cc60bfeca6ca98fd210748a3aa68aa7ebba71b39adcad7f88325fc34131a1b",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"This message has length 101" + 74 * "!",
|
|
||||||
"fa9d60644436f27eb88956a50893e9a47f67c42fb1b57a44bde4c6e127ab777e0c23b234b6ec9327ffd0620daaa514243ebb5a3652a1bac2d720e0f5555b2e071c",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
@pytest.mark.parametrize("message, signature", VECTORS)
|
|
||||||
def test_sign(client, message, signature):
|
|
||||||
res = ethereum.sign_message(client, PATH, message)
|
|
||||||
assert res.address == ADDRESS
|
|
||||||
assert res.signature.hex() == signature
|
|
@ -1,446 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum, messages
|
|
||||||
from trezorlib.exceptions import TrezorFailure
|
|
||||||
from trezorlib.tools import parse_path
|
|
||||||
|
|
||||||
from ..common import MNEMONIC12
|
|
||||||
|
|
||||||
TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef"
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
class TestMsgEthereumSigntx:
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_known_erc20_token(self, client):
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(data_length=None),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
data = bytearray()
|
|
||||||
# method id signalizing `transfer(address _to, uint256 _value)` function
|
|
||||||
data.extend(bytes.fromhex("a9059cbb"))
|
|
||||||
# 1st function argument (to - the receiver)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000574bbb36871ba6b78e27f4b4dcfb76ea0091880b"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 2nd function argument (value - amount to be transferred)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000000000000000000000000000000000000bebc200"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 200 000 000 in dec, decimals of ADT = 9, trezor1 displays 0.2 ADT, Trezor T 200 000 000 Wei ADT
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20,
|
|
||||||
gas_limit=20,
|
|
||||||
# ADT token address
|
|
||||||
to="0xd0d6d6c5fe4a677d343cc433536bb717bae167dd",
|
|
||||||
chain_id=1,
|
|
||||||
# value needs to be 0, token value is set in the contract (data)
|
|
||||||
value=0,
|
|
||||||
data=data,
|
|
||||||
)
|
|
||||||
|
|
||||||
# taken from T1 might not be 100% correct but still better than nothing
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "ec1df922115d256745410fbc2070296756583c8786e4d402a88d4e29ec513fa9"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "7001bfe3ba357e4a9f9e0d3a3f8a8962257615a4cf215db93e48b98999fc51b7"
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_wanchain(self, client):
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(data_length=None),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/5718350'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20,
|
|
||||||
gas_limit=20,
|
|
||||||
# ADT token address
|
|
||||||
to="0xd0d6d6c5fe4a677d343cc433536bb717bae167dd",
|
|
||||||
chain_id=1,
|
|
||||||
tx_type=1,
|
|
||||||
# value needs to be 0, token value is set in the contract (data)
|
|
||||||
value=100,
|
|
||||||
)
|
|
||||||
|
|
||||||
# ad-hoc generated signature. might not be valid.
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "d6e197029031ec90b53ed14e8233aa78b592400513ac0386d2d55cdedc3d796f"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "326e0d600dd1b7ee606eb531b998a6a3b3293d4995fb8cfe0677962e8a43cff6"
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_unknown_erc20_token(self, client):
|
|
||||||
with client:
|
|
||||||
expected_responses = [
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
]
|
|
||||||
# TT asks for contract address confirmation
|
|
||||||
if client.features.model == "T":
|
|
||||||
expected_responses.append(
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx)
|
|
||||||
)
|
|
||||||
|
|
||||||
expected_responses.append(messages.EthereumTxRequest(data_length=None))
|
|
||||||
client.set_expected_responses(expected_responses)
|
|
||||||
|
|
||||||
data = bytearray()
|
|
||||||
# method id signalizing `transfer(address _to, uint256 _value)` function
|
|
||||||
data.extend(bytes.fromhex("a9059cbb"))
|
|
||||||
# 1st function argument (to - the receiver)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000574bbb36871ba6b78e27f4b4dcfb76ea0091880b"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 2nd function argument (value - amount to be transferred)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000123"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# since this token is unknown trezor should display "unknown token value"
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/1"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20,
|
|
||||||
gas_limit=20,
|
|
||||||
# unknown token address (Grzegorz Brzęczyszczykiewicz Token)
|
|
||||||
to="0xfc6b5d6af8a13258f7cbd0d39e11b35e01a32f93",
|
|
||||||
chain_id=1,
|
|
||||||
# value needs to be 0, token value is set in the contract (data)
|
|
||||||
value=0,
|
|
||||||
data=data,
|
|
||||||
)
|
|
||||||
|
|
||||||
# taken from T1 might not be 100% correct but still better than nothing
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "2559bbf1bcb80992b6eaa96f0074b19606d8ea7bf4219e1c9ac64a12855c0cce"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "633a74429eb6d3aeec4ed797542236a85daab3cab15e37736b87a45697541d7a"
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_nodata(self, client):
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(data_length=None), # v,r,s checked later
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=10,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 27
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "2f548f63ddb4cf19b6b9f922da58ff71833b967d590f3b4dcc2a70810338a982"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "428d35f0dca963b5196b63e7aa5e0405d8bff77d6aee1202183f1f68dacb4483"
|
|
||||||
)
|
|
||||||
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(data_length=None),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=123456,
|
|
||||||
gas_price=20000,
|
|
||||||
gas_limit=20000,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=12345678901234567890,
|
|
||||||
)
|
|
||||||
assert sig_v == 27
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "3bf0470cd7f5ad8d82613199f73deadc55c3c9f32f91b1a21b5ef644144ebd58"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "48b3ef1b2502febdf35e9ff4df0ba1fda62f042fad639eb4852a297fc9872ebd"
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_data(self, client):
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(data_length=None),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=10,
|
|
||||||
data=b"abcdefghijklmnop" * 16,
|
|
||||||
)
|
|
||||||
assert sig_v == 27
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "e90f9e3dbfb34861d40d67570cb369049e675c6eebfdda6b08413a2283421b85"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "763912b8801f76cbea7792d98123a245514beeab2f3afebb4bab637888e8393a"
|
|
||||||
)
|
|
||||||
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(
|
|
||||||
data_length=1024,
|
|
||||||
signature_r=None,
|
|
||||||
signature_s=None,
|
|
||||||
signature_v=None,
|
|
||||||
),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=3),
|
|
||||||
messages.EthereumTxRequest(),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=123456,
|
|
||||||
gas_price=20000,
|
|
||||||
gas_limit=20000,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=12345678901234567890,
|
|
||||||
data=b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
|
|
||||||
)
|
|
||||||
assert sig_v == 27
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "dd96d82d791118a55601dfcede237760d2e9734b76c373ede5362a447c42ac48"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "60a77558f28d483d476f9507cd8a6a4bb47b86611aaff95fd5499b9ee9ebe7ee"
|
|
||||||
)
|
|
||||||
|
|
||||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
||||||
def test_ethereum_signtx_message(self, client):
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(
|
|
||||||
data_length=1024,
|
|
||||||
signature_r=None,
|
|
||||||
signature_s=None,
|
|
||||||
signature_v=None,
|
|
||||||
),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=3),
|
|
||||||
messages.EthereumTxRequest(),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20000,
|
|
||||||
gas_limit=20000,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=0,
|
|
||||||
data=b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
|
|
||||||
)
|
|
||||||
assert sig_v == 27
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "81af16020d3c6ad820cab2e2b0834fa37f4a9b0c2443f151a4e2f12fe1081b09"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "7b34b5d8a43771d493cd9fa0c7b27a9563e2a31799fb9f0c2809539a848b9f47"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ethereum_signtx_newcontract(self, client):
|
|
||||||
# contract creation without data should fail.
|
|
||||||
with pytest.raises(Exception):
|
|
||||||
ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=123456,
|
|
||||||
gas_price=20000,
|
|
||||||
gas_limit=20000,
|
|
||||||
to="",
|
|
||||||
value=12345678901234567890,
|
|
||||||
)
|
|
||||||
|
|
||||||
with client:
|
|
||||||
client.set_expected_responses(
|
|
||||||
[
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.ButtonRequest(code=messages.ButtonRequestType.SignTx),
|
|
||||||
messages.EthereumTxRequest(
|
|
||||||
data_length=1024,
|
|
||||||
signature_r=None,
|
|
||||||
signature_s=None,
|
|
||||||
signature_v=None,
|
|
||||||
),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=1024),
|
|
||||||
messages.EthereumTxRequest(data_length=3),
|
|
||||||
messages.EthereumTxRequest(),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20000,
|
|
||||||
gas_limit=20000,
|
|
||||||
to="",
|
|
||||||
value=12345678901234567890,
|
|
||||||
data=b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
|
|
||||||
)
|
|
||||||
assert sig_v == 28
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "c86bda9de238b1c602648996561e7270a3be208da96bbf23474cb8e4014b9f93"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "18742403f75a05e7fa9868c30b36f1e55628de02d01c03084c1ff6775a13137c"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ethereum_sanity_checks(self, client):
|
|
||||||
# gas overflow
|
|
||||||
with pytest.raises(TrezorFailure):
|
|
||||||
ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=123456,
|
|
||||||
gas_price=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
|
||||||
gas_limit=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=12345678901234567890,
|
|
||||||
)
|
|
||||||
|
|
||||||
# no gas price
|
|
||||||
with pytest.raises(TrezorFailure):
|
|
||||||
client.call(
|
|
||||||
messages.EthereumSignTx(
|
|
||||||
address_n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=b"AAA",
|
|
||||||
gas_limit=ethereum.int_to_big_endian(10000),
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=ethereum.int_to_big_endian(12345678901234567890),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# no gas limit
|
|
||||||
with pytest.raises(TrezorFailure):
|
|
||||||
client.call(
|
|
||||||
messages.EthereumSignTx(
|
|
||||||
address_n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=b"AAA",
|
|
||||||
gas_price=ethereum.int_to_big_endian(10000),
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=ethereum.int_to_big_endian(12345678901234567890),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# no nonce
|
|
||||||
# TODO this was supposed to expect a failure if nonce is not provided.
|
|
||||||
# Trezor does not raise such failure however.
|
|
||||||
# with pytest.raises(TrezorFailure):
|
|
||||||
# client.call(
|
|
||||||
# messages.EthereumSignTx(
|
|
||||||
# address_n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
# gas_price=ethereum.int_to_big_endian(10000),
|
|
||||||
# gas_limit=ethereum.int_to_big_endian(10000),
|
|
||||||
# to=TO_ADDR,
|
|
||||||
# value=ethereum.int_to_big_endian(12345678901234567890),
|
|
||||||
# )
|
|
||||||
# )
|
|
@ -1,148 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum
|
|
||||||
from trezorlib.tools import parse_path
|
|
||||||
|
|
||||||
VECTORS_CHAIN_IDS = ( # chain_id, slip44, sig_v, sig_r, sig_s
|
|
||||||
# Ethereum
|
|
||||||
(
|
|
||||||
1,
|
|
||||||
60,
|
|
||||||
(
|
|
||||||
38,
|
|
||||||
"6a6349bddb5749bb8b96ce2566a035ef87a09dbf89b5c7e3dfdf9ed725912f24",
|
|
||||||
"4ae58ccd3bacee07cdc4a3e8540544fd009c4311af7048122da60f2054c07ee4",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Ropsten
|
|
||||||
(
|
|
||||||
3,
|
|
||||||
1,
|
|
||||||
(
|
|
||||||
42,
|
|
||||||
"9d49a5c234a134bc56d00a7cf0c208c97d746f002c1fd3609b643eb8ef99d07d",
|
|
||||||
"3f064e133624cb59f8103fd5de76c089d8754e3da233a59d2ab2ca47fc306837",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Rinkeby
|
|
||||||
(
|
|
||||||
4,
|
|
||||||
1,
|
|
||||||
(
|
|
||||||
43,
|
|
||||||
"79a9fd0391f027ed518f3d796a598bf33eef0fb30ef22568a140d674d6b0b76c",
|
|
||||||
"408cd459abafcdb7f2e415b269c85a308aad4c53e63c01d3431d3db6ab6292dd",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# ETC
|
|
||||||
(
|
|
||||||
61,
|
|
||||||
61,
|
|
||||||
(
|
|
||||||
158,
|
|
||||||
"6f03621da2fe75877494697b0852c379ea3b2c4ec4f99ab9ce0c8753ebbaf3aa",
|
|
||||||
"2b8c8def7534e7bc692ee2975a674a0e31c0dbd9137e53d27dee6b15e121c210",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Auxilium
|
|
||||||
(
|
|
||||||
28945486,
|
|
||||||
344,
|
|
||||||
(
|
|
||||||
57891008,
|
|
||||||
"3298b58680045cfb373b9945f17c468a5c5725c9115c7c18915e8c585c67193f",
|
|
||||||
"6bf1c719350150a520d59542815afd8263d7fe7087608051abe7df11dd7fcbec",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Pirl
|
|
||||||
(
|
|
||||||
3125659152,
|
|
||||||
164,
|
|
||||||
(
|
|
||||||
6251318340,
|
|
||||||
"a876d3cf19f4f6b51fb980aac49e8bd378b88f11adbebc1be33d7b86eb84a054",
|
|
||||||
"3bee0e5a07661e78c9c4af49c8a42f4735f80cbb82931607ac35fc78f8d5b113",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Unknown chain id with Ethereum path
|
|
||||||
(
|
|
||||||
609112567,
|
|
||||||
60,
|
|
||||||
(
|
|
||||||
1218225170,
|
|
||||||
"0b0f20dc9202db0653a827b9dc924653bc83d67eec9e43d678e0fb6bb3eb6d9e",
|
|
||||||
"5fdbae16da0ffc4d888e915ff210393e5c7655a3c48eaffbbe97d6db428fc277",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
# Unknown chain id with testnet path
|
|
||||||
(
|
|
||||||
609112567,
|
|
||||||
1,
|
|
||||||
(
|
|
||||||
1218225169,
|
|
||||||
"f699de96e886995e460e760839d4f2c7b9f1c98f2d3c108d0add4e8663a679d8",
|
|
||||||
"1447ba45be9fca42bcbf250389403245c8c1b0476e60b96dea320b0a596b5528",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
@pytest.mark.parametrize("chain_id, slip44, sig", VECTORS_CHAIN_IDS)
|
|
||||||
def test_chain_ids(client, chain_id, slip44, sig):
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path(f"m/44h/{slip44}h/0h/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20000000000,
|
|
||||||
gas_limit=21000,
|
|
||||||
to="0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
|
||||||
value=10000000000,
|
|
||||||
chain_id=chain_id,
|
|
||||||
)
|
|
||||||
expected_v = 2 * chain_id + 35
|
|
||||||
assert sig_v in (expected_v, expected_v + 1)
|
|
||||||
assert (sig_v, sig_r.hex(), sig_s.hex()) == sig
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
def test_with_data(client):
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx(
|
|
||||||
client,
|
|
||||||
n=parse_path("m/44h/60h/0h/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_price=20000000000,
|
|
||||||
gas_limit=21000,
|
|
||||||
to="0x8eA7a3fccC211ED48b763b4164884DDbcF3b0A98",
|
|
||||||
value=10000000000,
|
|
||||||
chain_id=1,
|
|
||||||
data=b"ABCDEFGHIJKLM",
|
|
||||||
)
|
|
||||||
assert sig_v == 37
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "c57556e308f49c84adc614042bf443381676fd2797f9512a85dc529f7acb7fa8"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "60a82338641fd4a924a6ec31da4aadc0a43ac77d3a021307ec07bb6982ccbe8d"
|
|
||||||
)
|
|
@ -1,308 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum, messages
|
|
||||||
from trezorlib.tools import parse_path
|
|
||||||
|
|
||||||
TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef"
|
|
||||||
|
|
||||||
|
|
||||||
pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum, pytest.mark.skip_t1]
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_nodata(client):
|
|
||||||
with client:
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=0,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
chain_id=1,
|
|
||||||
value=10,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 1
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "2ceeaabc994fbce2fbd66551f9d48fc711c8db2a12e93779eeddede11e41f636"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "2db4a9ecc73da91206f84397ae9287a399076fdc01ed7f3c6554b1c57c39bf8c"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_data(client):
|
|
||||||
with client:
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
gas_limit=20,
|
|
||||||
chain_id=1,
|
|
||||||
to=TO_ADDR,
|
|
||||||
value=10,
|
|
||||||
data=b"abcdefghijklmnop" * 16,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
)
|
|
||||||
assert sig_v == 0
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "8e4361e40e76a7cab17e0a982724bbeaf5079cd02d50c20d431ba7dde2404ea4"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "411930f091bb508e593e22a9ee45bd4d9eeb504ac398123aec889d5951bdebc3"
|
|
||||||
)
|
|
||||||
|
|
||||||
with client:
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=123456,
|
|
||||||
gas_limit=20000,
|
|
||||||
to=TO_ADDR,
|
|
||||||
chain_id=1,
|
|
||||||
value=12345678901234567890,
|
|
||||||
data=b"ABCDEFGHIJKLMNOP" * 256 + b"!!!",
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
)
|
|
||||||
assert sig_v == 0
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "2e4f4c0e7c4e51270b891480060712e9d3bcab01e8ad0fadf2dfddd71504ca94"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "2599beb32757a144dedc82b79153c21269c9939a9245342bcf35764115b62bc1"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_access_list(client):
|
|
||||||
with client:
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=0,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
chain_id=1,
|
|
||||||
value=10,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
access_list=[
|
|
||||||
messages.EthereumAccessList(
|
|
||||||
address="0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
|
|
||||||
storage_keys=[
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000003"
|
|
||||||
),
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000007"
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 1
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "9f8763f3ff8d4d409f6b96bc3f1d84dd504e2c667b162778508478645401f121"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "51e30b68b9091cf8138c07380c4378c2711779b68b2e5264d141479f13a12f57"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_access_list_larger(client):
|
|
||||||
with client:
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=0,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
chain_id=1,
|
|
||||||
value=10,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
access_list=[
|
|
||||||
messages.EthereumAccessList(
|
|
||||||
address="0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
|
|
||||||
storage_keys=[
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000003"
|
|
||||||
),
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000007"
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
messages.EthereumAccessList(
|
|
||||||
address="0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
|
|
||||||
storage_keys=[
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000006"
|
|
||||||
),
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000007"
|
|
||||||
),
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000009"
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 1
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "718a3a30827c979975c846d2f60495310c4959ee3adce2d89e0211785725465c"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "7d0ea2a28ef5702ca763c1f340427c0020292ffcbb4553dd1c8ea8e2b9126dbc"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_known_erc20_token(client):
|
|
||||||
with client:
|
|
||||||
|
|
||||||
data = bytearray()
|
|
||||||
# method id signalizing `transfer(address _to, uint256 _value)` function
|
|
||||||
data.extend(bytes.fromhex("a9059cbb"))
|
|
||||||
# 1st function argument (to - the receiver)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000574bbb36871ba6b78e27f4b4dcfb76ea0091880b"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 2nd function argument (value - amount to be transferred)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000000000000000000000000000000000000bebc200"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/0"),
|
|
||||||
nonce=0,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
gas_limit=20,
|
|
||||||
# ADT token address
|
|
||||||
to="0xd0d6d6c5fe4a677d343cc433536bb717bae167dd",
|
|
||||||
chain_id=1,
|
|
||||||
# value needs to be 0, token value is set in the contract (data)
|
|
||||||
value=0,
|
|
||||||
data=data,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 1
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "94d67bacb7966f881339d91103f5d738d9c491fff4c01a6513c554ab15e86cc0"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "405bd19a7bf4ae62d41fcb7844e36c786b106b456185c3d0877a7ce7eab6c751"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_unknown_erc20_token(client):
|
|
||||||
with client:
|
|
||||||
data = bytearray()
|
|
||||||
# method id signalizing `transfer(address _to, uint256 _value)` function
|
|
||||||
data.extend(bytes.fromhex("a9059cbb"))
|
|
||||||
# 1st function argument (to - the receiver)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"000000000000000000000000574bbb36871ba6b78e27f4b4dcfb76ea0091880b"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 2nd function argument (value - amount to be transferred)
|
|
||||||
data.extend(
|
|
||||||
bytes.fromhex(
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000123"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# since this token is unknown trezor should display "unknown token value"
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/1"),
|
|
||||||
nonce=0,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
gas_limit=20,
|
|
||||||
# unknown token address (Grzegorz Brzęczyszczykiewicz Token)
|
|
||||||
to="0xfc6b5d6af8a13258f7cbd0d39e11b35e01a32f93",
|
|
||||||
chain_id=1,
|
|
||||||
# value needs to be 0, token value is set in the contract (data)
|
|
||||||
value=0,
|
|
||||||
data=data,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 1
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "e631b56bcc596844cb8686b2046e36cf33634aa396e7e1ea94a97aac02c18bda"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "399bff8752539176c4b2f1d5d2a8f6029f79841d28802149ab339a033ffe4c1f"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_ethereum_signtx_large_chainid(client):
|
|
||||||
with client:
|
|
||||||
|
|
||||||
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
|
|
||||||
client,
|
|
||||||
n=parse_path("44'/60'/0'/0/100"),
|
|
||||||
nonce=0,
|
|
||||||
gas_limit=20,
|
|
||||||
to=TO_ADDR,
|
|
||||||
chain_id=3125659152, # Pirl chain id, doesn't support EIP1559 at this time, but chosen for large chain id
|
|
||||||
value=10,
|
|
||||||
max_gas_fee=20,
|
|
||||||
max_priority_fee=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert sig_v == 0
|
|
||||||
assert (
|
|
||||||
sig_r.hex()
|
|
||||||
== "07f8c967227c5a190cb90525c3387691a426fe61f8e0503274280724060ea95c"
|
|
||||||
)
|
|
||||||
assert (
|
|
||||||
sig_s.hex()
|
|
||||||
== "0bf83eaf74e24aa9146b23e06f9edec6e25acb81d3830e8d146b9e7b6923ad1e"
|
|
||||||
)
|
|
@ -1,72 +0,0 @@
|
|||||||
# This file is part of the Trezor project.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
|
||||||
#
|
|
||||||
# This library is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Lesser General Public License version 3
|
|
||||||
# as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the License along with this library.
|
|
||||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from trezorlib import ethereum
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.altcoin
|
|
||||||
@pytest.mark.ethereum
|
|
||||||
class TestMsgEthereumVerifymessage:
|
|
||||||
|
|
||||||
ADDRESS = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b"
|
|
||||||
VECTORS = [
|
|
||||||
(
|
|
||||||
"This is an example of a signed message.",
|
|
||||||
"9bacd833b51fde010bab53bafd9d832eadd3b175d2af2e629bb2944fcc987dce7ff68bb3571ed25a720c220f2f9538bc8d04f582bee002c9af086590a49805901c",
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"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_verify(self, client):
|
|
||||||
for msg, sig in self.VECTORS:
|
|
||||||
res = ethereum.verify_message(client, self.ADDRESS, bytes.fromhex(sig), msg)
|
|
||||||
assert res is True
|
|
||||||
|
|
||||||
def test_verify_invalid(self, client):
|
|
||||||
signature = bytes.fromhex(self.VECTORS[0][1])
|
|
||||||
res = ethereum.verify_message(
|
|
||||||
client, self.ADDRESS, signature, "another message"
|
|
||||||
)
|
|
||||||
assert res is False
|
|
@ -116,6 +116,57 @@
|
|||||||
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_ordinary_transaction_signing_mode]": "9dd34acde52006947bb448a058fc782c808940174427cd8f3d4befcc7a1e8f02",
|
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[with_ordinary_transaction_signing_mode]": "9dd34acde52006947bb448a058fc782c808940174427cd8f3d4befcc7a1e8f02",
|
||||||
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[withdrawal_amount_is_too_large]": "32a633e5651179897c76fd47ad7c89a938c8f8087d4c13cefb1b45449de36509",
|
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[withdrawal_amount_is_too_large]": "32a633e5651179897c76fd47ad7c89a938c8f8087d4c13cefb1b45449de36509",
|
||||||
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[withdrawal_has_non_staking_path]": "32a633e5651179897c76fd47ad7c89a938c8f8087d4c13cefb1b45449de36509",
|
"cardano-test_sign_tx.py::test_cardano_sign_tx_failed[withdrawal_has_non_staking_path]": "32a633e5651179897c76fd47ad7c89a938c8f8087d4c13cefb1b45449de36509",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[ETC]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[GoChain]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[Wanchain]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[parameters0-result0]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[parameters1-result1]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[parameters2-result2]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getaddress.py::test_getaddress[parameters3-result3]": "612dad8ab8762162a186ec9279d7de0bdfc589c52b4e4f4eba0545a00f21c3f0",
|
||||||
|
"ethereum-test_getpublickey.py-test_ethereum_getpublickey": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters0-result0]": "e37127e3ccb1f8b3ef66665e420f4a7fb0743ff809edc379f701e5b444c6e577",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters1-result1]": "ed2286744d5c57b52d0dd6baef271493440732da21d0d006b69d7a9604f802c7",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters2-result2]": "8cbeef8add50e9b6e1b82b9fc6d21be59d677478d257207957882d882b6044b7",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters3-result3]": "09cec2eb4cc3d39735603c38696dc6ca30e165cb9a05cd6b29791a9d4f619060",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters4-result4]": "bbc7feb0274eb3ab7b976b04105f21e1c48d3b85223df7e84fdd5cc2edb99154",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters5-result5]": "57e621bcd84fb1b000b61d596a9ac64f8fda49c87b739c608791c058a2831292",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters6-result6]": "486f0ca32e4c14b5d6d2b85a3038a66a015176da13735ba4e4baa0b47d1964e2",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_signmessage[parameters7-result7]": "307ed84c7b67a74be32e28edb143219daa085a5b316122e60ad120f8c4a8ee4d",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters0-result0]": "95241229201fd860604af3e061eb1173ebd9078e3db8679ecd72db86c7c08f63",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters1-result1]": "d7110b9f3fa4772b5a98ef526758874b8735f9b63e4bee19796daa1c6dbef130",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters2-result2]": "f40ae4dc0aec311555368a773a4618afa307a8a0e9102615c90d77736c41ab0e",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters3-result3]": "1024c4a89c4d50831f64cfec0bef33f0f4591d3b2d7ea4bf7e934b3e510ff933",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters4-result4]": "c0c3bb8a95206228d8b593a89b5be7a4ecd3cc17f9140854ed5e2a2ba667dfb5",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters5-result5]": "0834fca86aab83d58c879e48dee28f5cce42cdc12c950b16bc61ab1213a85e21",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters6-result6]": "6d85c427574dfe99398f619d3a67301261edbb9624a9ca8b393181b8e0ad2b98",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify[parameters7-result7]": "833a713722b6392f0224f67caefe49c03adfb7713782e933259a0d73c2cb7ebe",
|
||||||
|
"ethereum-test_sign_verify_message.py::test_verify_invalid": "95241229201fd860604af3e061eb1173ebd9078e3db8679ecd72db86c7c08f63",
|
||||||
|
"ethereum-test_signtx.py::test_data_streaming": "924e507044eeab99d745d0676f3aa435d208daf7107a2a024c2ffe87cd15e428",
|
||||||
|
"ethereum-test_signtx.py::test_sanity_checks": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Auxilium]": "723083f8dccf4676f7a134a070977576341f2f7a5850e463e487c8705ebe25f1",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[ETC]": "41ed0476f3043025d40eaf13ed76c1ebcd4bee9b7a6d23764a00451f1edc5b40",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Ethereum]": "ad88572a4100efd3909c39c76e452630f25d5600bcde22a18c02c327528507f3",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Pirl]": "1f7046f216ec275ba8a36b9e6c59b2cdd3fee9ca48a96b066cdd4c23f3e27218",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Rinkeby]": "616151df0f0af77bfb861e536d84fa251df16584855bc5d1c3006b2ce5272ef7",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Ropsten]": "7e5061120253d3a608d9815f0da93a83b929cbef4680f960cb4701e564a9297a",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Unknown_chain_id_eth_path]": "0787a56c2398e08ab154bf7c163ad433f3528af71261965b6c1bd0d9568b8854",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[Unknown_chain_id_testnet_path]": "0787a56c2398e08ab154bf7c163ad433f3528af71261965b6c1bd0d9568b8854",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[data_1]": "e8d91683db17ba6ed23d42977c8eaf84b9cfbd1a44c7ead330269a6ba9887ba0",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[data_2_bigdata]": "3a0ebf0136be51351a40e30eececbf51bbdf5c5945dd1cf28f2167433b02ce30",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[known_erc20_token]": "a1f6d2826c508d50cd74a3f6f2c1f2e794d9a53e30d8d0c93c9a7b234aec46bc",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[newcontract]": "2fcd021aa91612d4650b65d5c927cbe8dcbc69e055bd92257b2eca757041150b",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[nodata_1]": "2af225746ebf128b517f956b453e56c42914590f7ba7b0e18273cadcd72682bb",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[nodata_2_bigvalue]": "b3b71b386e1ec8fbe30a6dd88a9de83837887b0aa19b7b02837f9665d252e8ab",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[unknown_erc20_token]": "3802d151a40ef5a5189a0f6459f16eef916e88ba24420646f21d3f54460adc8c",
|
||||||
|
"ethereum-test_signtx.py::test_signtx[wanchain]": "4a721ef7161d9840590f84d63716e40c8d2cdea6ea996bc712058dfc56159f03",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[data_1]": "66909262d749ce0f87d9a4662a1da7bb2bb95c07be3a0b803972e6c32f86a3a9",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[data_2_bigdata]": "9b4b6e7418cd9dbdd32b8b508ad979c04ab301d06021c01285adf20d00c36bcc",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[known_erc20]": "915bab2525b468710b3d981c9debc1b5830d1938366fe7469b459f602a39f3ba",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[large_chainid]": "0ade77023c4dfded6c8b904584df73c9f8b73c5e7b8212c79dd06e12bc90e19b",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[nodata]": "da4eb2ac8244114c0b0bdfe4e3e7b989d8ab37a67047349edad9fe558ea816dd",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559[unknown_erc20]": "c0f9f51122bef0fb4630901195ac655b6103b638c07b72e7e5df9070ca26c0fd",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559_access_list": "0d73046641e1d148ed01a36314509c7d38284c37d98b8a16b92f59cea543055c",
|
||||||
|
"ethereum-test_signtx.py::test_signtx_eip1559_access_list_larger": "0d73046641e1d148ed01a36314509c7d38284c37d98b8a16b92f59cea543055c",
|
||||||
"test_autolock.py::test_apply_auto_lock_delay": "d6b79c89a21e8979a6cede0715ea3d83a5c786ae7445dad797cf668ed6bf6180",
|
"test_autolock.py::test_apply_auto_lock_delay": "d6b79c89a21e8979a6cede0715ea3d83a5c786ae7445dad797cf668ed6bf6180",
|
||||||
"test_autolock.py::test_apply_auto_lock_delay_out_of_range[0]": "6badfcdd682ecaf16311749ef7a6c07c6a4d0df402427c8dd5a48d476751ed77",
|
"test_autolock.py::test_apply_auto_lock_delay_out_of_range[0]": "6badfcdd682ecaf16311749ef7a6c07c6a4d0df402427c8dd5a48d476751ed77",
|
||||||
"test_autolock.py::test_apply_auto_lock_delay_out_of_range[1]": "6badfcdd682ecaf16311749ef7a6c07c6a4d0df402427c8dd5a48d476751ed77",
|
"test_autolock.py::test_apply_auto_lock_delay_out_of_range[1]": "6badfcdd682ecaf16311749ef7a6c07c6a4d0df402427c8dd5a48d476751ed77",
|
||||||
@ -212,48 +263,6 @@
|
|||||||
"test_msg_eos_signtx.py-test_eos_signtx_updateauth": "99d701ad36b1e3293b16566e833dd7c16e5c441bbda9569d87d13254af8710da",
|
"test_msg_eos_signtx.py-test_eos_signtx_updateauth": "99d701ad36b1e3293b16566e833dd7c16e5c441bbda9569d87d13254af8710da",
|
||||||
"test_msg_eos_signtx.py-test_eos_signtx_vote": "4666845c90c5e681aba6f9eb0dc52f6487a953ee17cf03fb28ae8aca9ecd739e",
|
"test_msg_eos_signtx.py-test_eos_signtx_vote": "4666845c90c5e681aba6f9eb0dc52f6487a953ee17cf03fb28ae8aca9ecd739e",
|
||||||
"test_msg_eos_signtx.py-test_eos_signtx_vote_proxy": "2d8acb31c36e2533a840744b5a36318139186745503a44ac7cfc25eb4f1ddadc",
|
"test_msg_eos_signtx.py-test_eos_signtx_vote_proxy": "2d8acb31c36e2533a840744b5a36318139186745503a44ac7cfc25eb4f1ddadc",
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-5718350'-0'-0-0-0xe432a7533-782104b7": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-60'-0'-0-0-0x73d0385F4d8E00-2ba8b7b8": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-60'-0'-0-100-0x1e6E3708a059-df83b1d6": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-60'-0'-0xdA0b608bdb1a4A1543-a3c0a7fb": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-60'-100'-0x93Fb0Ff84F5BB6E7-3ec72a77": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-6060'-0'-0-0-0xA26a450ef46a-7bdafd6d": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getaddress.py::test_ethereum_getaddress[m-44'-61'-0'-0-0-0xF410e37E9C8BCf-def83718": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_getpublickey.py-test_ethereum_getpublickey": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[MsgLenIs10-0c8eb57decbb95d2a783e69d444b3747c49e-b8fcf517": "4b82bd4b8f1805f56e2e1d8bdf6c66f2653cd63f7ec80a5cdd5402b4b766be57",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[MsgLenIs11!-5f1ab8940c2137baf69a2b94f55f0f7e53a-5fc969e9": "af829dc1d5a1f8a21c6d7ca275c4ddd86d3e3032ba2213d439fef29025ebd156",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[MsgLenIs9-495b5b021517cd01cb05f02dfb6a1f79a8d9e-72cb8dee": "abd359c13dd66751e6332179ed143b7945ac5ee67e1e21db1d2b8e06197f61d9",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[This is an example of a signed message.-af4eac5-c7c58c05": "d24223d35e8b54fb54a51857c44e6b60f858057db428a6ff4cc0d4905c3ca877",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[This message has length 100!!!!!!!!!!!!!!!!!!!!-247a0b96": "7ed4b4879fc37ee56d313399494458eadbf5766cbca9eb3f95097e94b2b4fbe3",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[This message has length 101!!!!!!!!!!!!!!!!!!!!-ea9f1848": "49b7c6b607393c1f4e0bcd929eab3a96afb83934b19266279ba4b35765fb770b",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[This message has length 99!!!!!!!!!!!!!!!!!!!!!-032eb8ce": "982ec03750c783b1fe4f8f552d9917c4c0fee4ac6982dc044d8c4369f6eceffd",
|
|
||||||
"test_msg_ethereum_signmessage.py::test_sign[VeryLongMessage!VeryLongMessage!VeryLongMessage-b48bd842": "b002426e5ee74ea9e242b9b1ad59977e61570b2e1394afd4842709703d0f4a38",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_sanity_checks": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_data": "b3d7200366591838dff9e211887fadb284c1e2768af93e59fbeedf4a74816025",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_known_erc20_token": "2cda05063110c8eda4b7c77f4ad632cfeb76649eba0d1733be125890c9aab937",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_message": "924e507044eeab99d745d0676f3aa435d208daf7107a2a024c2ffe87cd15e428",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_newcontract": "d52d5b0444ba5ec77eafe1413a443aecc243341ced5c43cd17193f9ce2f5c266",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_nodata": "9d69b61aee19c42c22651cd9912d8a29b2ac6987b552966a6659e3505d4869e7",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_unknown_erc20_token": "67155719244f7ae33c3f9dde222cd51d1a8abed6801adc7b19ecc01e60e378b5",
|
|
||||||
"test_msg_ethereum_signtx.py-test_ethereum_signtx_wanchain": "4abb87c2b2836601971af8483fb95ff0f5913bdf912ff3e17a20c8c34872470a",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[1-60-sig0]": "4fb0b0b8fb5f803132a422d8b26d51e46ee6976c04ad0de29230adfc63d0e44c",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[28945486-344-sig4]": "09fc36e7699f5b7525e3edb99e5666cf869a41f661ed2b40966d35ce5382df86",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[3-1-sig1]": "991d61006e9b5df96d7125825a7d86c96c8c4ea30a8e3dd8d12ac8795c312678",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[3125659152-164-sig5]": "fa4957f52db037bcd9fdee74be00bee72b2efbdeeffb3cc04819123dc50e5855",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[4-1-sig2]": "aa53c8ba48faa3ac1227b0c187d73783d47063ce130c2a58fab1dcab841fa1dd",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[609112567-1-sig7]": "c8e01d20eccadcca4f05e4e8351c3bfc38d0fdbe4a61f63dfd74e065faea86e7",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[609112567-60-sig6]": "c8e01d20eccadcca4f05e4e8351c3bfc38d0fdbe4a61f63dfd74e065faea86e7",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_chain_ids[61-61-sig3]": "cd5f04cc7b055503e83f0538709a7ac577445c6089ead12f1fc3a3c45ad96419",
|
|
||||||
"test_msg_ethereum_signtx_eip155.py::test_with_data": "670913def0b7268671258f70dfbdc794a8405e1e432e423aae10b616028f3db9",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_access_list": "0d73046641e1d148ed01a36314509c7d38284c37d98b8a16b92f59cea543055c",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_access_list_larger": "0d73046641e1d148ed01a36314509c7d38284c37d98b8a16b92f59cea543055c",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_data": "17f52fa7d2edc36201050df432398839b2c27e82d6e01a2feafd58bbf5de19aa",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_known_erc20_token": "ca5c69923a79c1112bbdd81159adfbc389e1538c1776c141ce28fc72d0feeb81",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_large_chainid": "95ea813ceeb0782ff3554eafd463831f60490aa418385fc9cf113140dfa8c75c",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_nodata": "0d73046641e1d148ed01a36314509c7d38284c37d98b8a16b92f59cea543055c",
|
|
||||||
"test_msg_ethereum_signtx_eip1559.py::test_ethereum_signtx_unknown_erc20_token": "a25e1171b7dc9bdcfcfe02bf10e7ce8bfa02a0ec9b57fc3dce2b591cdec798e5",
|
|
||||||
"test_msg_ethereum_verifymessage.py-test_verify": "f97754c9168c436209997dc17b4cf4fa0b55171fb2dca4b06256ed87fd910fdc",
|
|
||||||
"test_msg_ethereum_verifymessage.py-test_verify_invalid": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
|
||||||
"test_msg_getaddress.py-test_bch": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
"test_msg_getaddress.py-test_bch": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
||||||
"test_msg_getaddress.py-test_bch_multisig": "f620ed42c682dd55ab7a1b4ac53686c03dd51966ad4bdd018bd24a3305b92148",
|
"test_msg_getaddress.py-test_bch_multisig": "f620ed42c682dd55ab7a1b4ac53686c03dd51966ad4bdd018bd24a3305b92148",
|
||||||
"test_msg_getaddress.py-test_btc": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
"test_msg_getaddress.py-test_btc": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586",
|
||||||
|
Loading…
Reference in New Issue
Block a user