mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-15 09:02:02 +00:00
chore(tests): removing classes from device test files
This commit is contained in:
parent
782f868717
commit
a92d29ddbf
@ -25,9 +25,8 @@ from ...common import MNEMONIC12
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.eos
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgEosGetpublickey:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_eos_get_public_key(self, client):
|
||||
def test_eos_get_public_key(client):
|
||||
public_key = get_public_key(
|
||||
client, parse_path("m/44'/194'/0'/0/0"), show_display=True
|
||||
)
|
||||
|
@ -25,13 +25,15 @@ from ...common import MNEMONIC12
|
||||
CHAIN_ID = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"
|
||||
ADDRESS_N = parse_path("m/44'/194'/0'/0/0")
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.eos,
|
||||
pytest.mark.skip_t1,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.eos
|
||||
@pytest.mark.skip_t1
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
class TestMsgEosSignTx:
|
||||
def test_eos_signtx_transfer_token(self, client):
|
||||
|
||||
def test_eos_signtx_transfer_token(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -44,9 +46,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio.token",
|
||||
"name": "transfer",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"from": "miniminimini",
|
||||
"to": "maximaximaxi",
|
||||
@ -66,7 +66,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JveDuew7oyKjgLmApra3NmKArx3QH6HVmatgkLYeUYWv7aGaoQPFyjBwAdcxuo2Skq9wRgsizos92h9iq9i5JbeHh7zNuo"
|
||||
)
|
||||
|
||||
def test_eos_signtx_buyram(self, client):
|
||||
|
||||
def test_eos_signtx_buyram(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -79,9 +80,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "buyram",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"payer": "miniminimini",
|
||||
"receiver": "miniminimini",
|
||||
@ -100,7 +99,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_K4gU5S9g7rS6MojaPwWppEBCBbPrJm1pyJtVR9mts1sBq5xyN7nJv3FGnrBR7ByjanboCtK4ogY35sNPFX1F5qoZW7BkF9"
|
||||
)
|
||||
|
||||
def test_eos_signtx_buyrambytes(self, client):
|
||||
|
||||
def test_eos_signtx_buyrambytes(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -113,9 +113,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "buyrambytes",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"payer": "miniminimini",
|
||||
"receiver": "miniminimini",
|
||||
@ -134,7 +132,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_K618wK9f27YxHoPG9hoUCsazZXzxumBj3V9MqcTUh9yCocvP1uFZQAmGmZLhsAtuC2TRR4gtqbeQj57FniYd5i4faQCb6t"
|
||||
)
|
||||
|
||||
def test_eos_signtx_sellram(self, client):
|
||||
|
||||
def test_eos_signtx_sellram(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -147,9 +146,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "sellram",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {"account": "miniminimini", "bytes": 1024},
|
||||
}
|
||||
],
|
||||
@ -164,7 +161,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JusrCS7H5DR53qke7edoWvJuLiQS2VQ84CsN5NWmWYVa7wmJVjh3Hcg5hH42zF8KjAmmvHtaJZ3wkortTW9eds1eoiKsrj"
|
||||
)
|
||||
|
||||
def test_eos_signtx_delegate(self, client):
|
||||
|
||||
def test_eos_signtx_delegate(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -177,9 +175,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "delegatebw",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"from": "miniminimini",
|
||||
"receiver": "maximaximaxi",
|
||||
@ -200,7 +196,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_Juju8Wjzyn38nuvgS1KT3koKQLHxMMfqVHrp5jMjv4QLU2pUG6EbiJD7D1EHE6xP8DRuwFLVUNR38nTyUKC1Eiz33WocUE"
|
||||
)
|
||||
|
||||
def test_eos_signtx_undelegate(self, client):
|
||||
|
||||
def test_eos_signtx_undelegate(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -213,9 +210,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "undelegatebw",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"from": "miniminimini",
|
||||
"receiver": "maximaximaxi",
|
||||
@ -235,7 +230,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_K3XXUzCUkT2HEdrJTz1CdDDKZbLMShmyEjknQozGhy4F21yUetr1nEe2vUgmGebk2nyYe49R5nkA155J5yFBBaLsTcSdBL"
|
||||
)
|
||||
|
||||
def test_eos_signtx_refund(self, client):
|
||||
|
||||
def test_eos_signtx_refund(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -248,9 +244,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "refund",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {"owner": "miniminimini"},
|
||||
}
|
||||
],
|
||||
@ -265,7 +259,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JwWZSSKQZL1hCdMmwEAKjs3r15kau5gaBrQczKy65QANANzovV6U4XbVUZQkZzaQrNGYAtgxrU1WJ1smWgXZNqtKVQUZqc"
|
||||
)
|
||||
|
||||
def test_eos_signtx_linkauth(self, client):
|
||||
|
||||
def test_eos_signtx_linkauth(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -278,9 +273,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "linkauth",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"account": "maximaximaxi",
|
||||
"code": "eosbet",
|
||||
@ -300,7 +293,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_Kgs3JdLNqTyGz7uyNiuYLK8sy5qhVQWozrBY7bJWKsjrWAxNyDQUKqHsHmTom5rGY21vYdXmCpi4msU6XeMgWvi4bsBxTx"
|
||||
)
|
||||
|
||||
def test_eos_signtx_unlinkauth(self, client):
|
||||
|
||||
def test_eos_signtx_unlinkauth(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -313,9 +307,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "unlinkauth",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"account": "miniminimini",
|
||||
"code": "eosbet",
|
||||
@ -334,7 +326,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_K1ioB5KMRC2mmTwYsGwsFU51ENp1XdSBUrb4bxUCLYhoq7Y733WaLZ4Soq9fdrkaJS8uJ3R7Z1ZjyEKRHU8HU4s4MA86zB"
|
||||
)
|
||||
|
||||
def test_eos_signtx_updateauth(self, client):
|
||||
|
||||
def test_eos_signtx_updateauth(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -347,9 +340,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "updateauth",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"account": "miniminimini",
|
||||
"permission": "active",
|
||||
@ -391,7 +382,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JuNuwmJm7nLfpxbCqXZMxZoU56TzBh8F5PH7ZyPvQMti6QxJbErDGbKCAaHhoRxwWKzv5kj6kX3WyWys6jAzVe9pDhXB1k"
|
||||
)
|
||||
|
||||
def test_eos_signtx_deleteauth(self, client):
|
||||
|
||||
def test_eos_signtx_deleteauth(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -404,9 +396,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "deleteauth",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {"account": "maximaximaxi", "permission": "active"},
|
||||
}
|
||||
],
|
||||
@ -421,7 +411,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_KjPTp8jCtgBKQWqsndhrH4pdCGiks76Q1qBt9e8MtexW6FQg3FzfVFKDU4SvyVDyFs3worn6RyW6WYavw76ACNqcqkCYjf"
|
||||
)
|
||||
|
||||
def test_eos_signtx_vote(self, client):
|
||||
|
||||
def test_eos_signtx_vote(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -434,9 +425,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "voteproducer",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"account": "miniminimini",
|
||||
"proxy": "",
|
||||
@ -485,7 +474,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JxgVhc6ExoTHee3Djrciwmmf2Xck7NLgvAtC2gfgV4Wj2AqMXEb6aKMhpUcTV59VTR1DdnPF1XbiCcJViJiU3zsk1kQz89"
|
||||
)
|
||||
|
||||
def test_eos_signtx_vote_proxy(self, client):
|
||||
|
||||
def test_eos_signtx_vote_proxy(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -498,9 +488,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "voteproducer",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {"account": "miniminimini", "proxy": "", "producers": []},
|
||||
}
|
||||
],
|
||||
@ -515,7 +503,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_KjJzcDg9MT8XbLeP1fgQjdmdE6oNQQisMwbXikqrEZYmJe6GCYg89Wr2donYV6zRfg9h7dJKQDCHugdtsxjtmEdqLtPv25"
|
||||
)
|
||||
|
||||
def test_eos_signtx_unknown(self, client):
|
||||
|
||||
def test_eos_signtx_unknown(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -528,9 +517,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "foocontract",
|
||||
"name": "baraction",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": "deadbeef",
|
||||
}
|
||||
],
|
||||
@ -545,7 +532,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_JvoJtrHpQJjHAZzEBhiQm75iimYabcAVNDvz8mkempLh6avSJgnXm5JzCCUEBjDtW3syByfXknmgr93Sw3P9RNLnwySmv6"
|
||||
)
|
||||
|
||||
def test_eos_signtx_newaccount(self, client):
|
||||
|
||||
def test_eos_signtx_newaccount(client):
|
||||
transaction = {
|
||||
"expiration": "2018-07-14T10:43:28",
|
||||
"ref_block_num": 6439,
|
||||
@ -558,9 +546,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "newaccount",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"creator": "miniminimini",
|
||||
"name": "maximaximaxi",
|
||||
@ -591,9 +577,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "buyrambytes",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"payer": "miniminimini",
|
||||
"receiver": "maximaximaxi",
|
||||
@ -603,9 +587,7 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio",
|
||||
"name": "delegatebw",
|
||||
"authorization": [
|
||||
{"actor": "miniminimini", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "miniminimini", "permission": "active"}],
|
||||
"data": {
|
||||
"from": "miniminimini",
|
||||
"receiver": "maximaximaxi",
|
||||
@ -626,7 +608,8 @@ class TestMsgEosSignTx:
|
||||
== "SIG_K1_KhjdS1gKUHR4jKbN3YSdNbPbEqnUVM1Nt6ybdzEAwsUtfbCRJDwpQwPRuEau48CyvhYC5fKo5BiWMPQJbQPrg5ErHThieU"
|
||||
)
|
||||
|
||||
def test_eos_signtx_setcontract(self, client):
|
||||
|
||||
def test_eos_signtx_setcontract(client):
|
||||
transaction = {
|
||||
"expiration": "2018-06-19T13:29:53",
|
||||
"ref_block_num": 30587,
|
||||
@ -639,17 +622,13 @@ class TestMsgEosSignTx:
|
||||
{
|
||||
"account": "eosio1",
|
||||
"name": "setcode",
|
||||
"authorization": [
|
||||
{"actor": "ednazztokens", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "ednazztokens", "permission": "active"}],
|
||||
"data": "00" * 1024,
|
||||
},
|
||||
{
|
||||
"account": "eosio1",
|
||||
"name": "setabi",
|
||||
"authorization": [
|
||||
{"actor": "ednazztokens", "permission": "active"}
|
||||
],
|
||||
"authorization": [{"actor": "ednazztokens", "permission": "active"}],
|
||||
"data": "00" * 1024,
|
||||
},
|
||||
],
|
||||
|
@ -25,9 +25,8 @@ from ...common import MNEMONIC12
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.monero
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgMoneroGetaddress:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_monero_getaddress(self, client):
|
||||
def test_monero_getaddress(client):
|
||||
assert (
|
||||
monero.get_address(client, parse_path("m/44h/128h/0h"), show_display=True)
|
||||
== b"4Ahp23WfMrMFK3wYL2hLWQFGt87ZTeRkufS6JoQZu6MEFDokAQeGWmu9MA3GFq1yVLSJQbKJqVAn9F9DLYGpRzRAEXqAXKM"
|
||||
|
@ -25,9 +25,8 @@ from ...common import MNEMONIC12
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.monero
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgMoneroGetwatchkey:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_monero_getwatchkey(self, client):
|
||||
def test_monero_getwatchkey(client):
|
||||
res = monero.get_watch_key(client, parse_path("m/44h/128h/0h"))
|
||||
assert (
|
||||
res.address
|
||||
|
@ -24,9 +24,8 @@ from ...common import MNEMONIC12
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
class TestMsgNEMGetaddress:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_getaddress(self, client):
|
||||
def test_nem_getaddress(client):
|
||||
assert (
|
||||
nem.get_address(
|
||||
client, parse_path("m/44'/1'/0'/0'/0'"), 0x68, show_display=True
|
||||
|
@ -21,14 +21,15 @@ from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.nem,
|
||||
pytest.mark.skip_t2,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
# assertion data from T1
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgNEMSignTxMosaics:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_supply_change(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_supply_change(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -56,8 +57,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "928b03c4a69fff35ecf0912066ea705895b3028fad141197d7ea2b56f1eef2a2516455e6f35d318f6fa39e2bb40492ac4ae603260790f7ebc7ea69feb4ca4c0a"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -88,8 +89,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "537adf4fd9bd5b46e204b2db0a435257a951ed26008305e0aa9e1201dafa4c306d7601a8dbacabf36b5137724386124958d53202015ab31fb3d0849dfed2df0e"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation_properties(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation_properties(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -125,8 +126,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "f17c859710060f2ea9a0ab740ef427431cf36bdc7d263570ca282bd66032e9f5737a921be9839429732e663be2bb74ccc16f34f5157ff2ef00a65796b54e800e"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation_levy(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation_levy(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
|
@ -23,14 +23,18 @@ from ...common import MNEMONIC12
|
||||
|
||||
ADDRESS_N = parse_path("m/44'/1'/0'/0'/0'")
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.nem,
|
||||
pytest.mark.skip_t1,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
|
||||
# assertion data from T1
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgNEMSignTxMosaics:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_supply_change(self, client):
|
||||
|
||||
|
||||
def test_nem_signtx_mosaic_supply_change(client):
|
||||
with client:
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
@ -59,8 +63,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "928b03c4a69fff35ecf0912066ea705895b3028fad141197d7ea2b56f1eef2a2516455e6f35d318f6fa39e2bb40492ac4ae603260790f7ebc7ea69feb4ca4c0a"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation(client):
|
||||
test_suite = {
|
||||
"timeStamp": 74649215,
|
||||
"fee": 2000000,
|
||||
@ -89,8 +93,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "537adf4fd9bd5b46e204b2db0a435257a951ed26008305e0aa9e1201dafa4c306d7601a8dbacabf36b5137724386124958d53202015ab31fb3d0849dfed2df0e"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation_properties(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation_properties(client):
|
||||
test_suite = {
|
||||
"timeStamp": 74649215,
|
||||
"fee": 2000000,
|
||||
@ -124,8 +128,8 @@ class TestMsgNEMSignTxMosaics:
|
||||
== "f17c859710060f2ea9a0ab740ef427431cf36bdc7d263570ca282bd66032e9f5737a921be9839429732e663be2bb74ccc16f34f5157ff2ef00a65796b54e800e"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_mosaic_creation_levy(self, client):
|
||||
|
||||
def test_nem_signtx_mosaic_creation_levy(client):
|
||||
test_suite = {
|
||||
"timeStamp": 74649215,
|
||||
"fee": 2000000,
|
||||
|
@ -21,13 +21,15 @@ from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.nem,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
|
||||
# assertion data from T1
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
class TestMsgNEMSignTxMultisig:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_aggregate_modification(self, client):
|
||||
def test_nem_signtx_aggregate_modification(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -56,8 +58,8 @@ class TestMsgNEMSignTxMultisig:
|
||||
== "1200e552d8732ce3eae96719731194abfc5a09d98f61bb35684f4eeaeff15b1bdf326ee7b1bbbe89d3f68c8e07ad3daf72e4c7f031094ad2236b97918ad98601"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_multisig(self, client):
|
||||
|
||||
def test_nem_signtx_multisig(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -127,8 +129,8 @@ class TestMsgNEMSignTxMultisig:
|
||||
== "c915ca3332380925f4050301cdc62269cf29437ac5955321b18da34e570c7fdbb1aec2940a2a553a2a5c90950a4db3c8d3ef899c1a108582e0657f66fbbb0b04"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_multisig_signer(self, client):
|
||||
|
||||
def test_nem_signtx_multisig_signer(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
|
@ -21,13 +21,15 @@ from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.nem,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
|
||||
# assertion data from T1
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
class TestMsgNEMSignTxOther:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_importance_transfer(self, client):
|
||||
def test_nem_signtx_importance_transfer(client):
|
||||
with client:
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
@ -55,8 +57,8 @@ class TestMsgNEMSignTxOther:
|
||||
== "b6d9434ec5df80e65e6e45d7f0f3c579b4adfe8567c42d981b06e8ac368b1aad2b24eebecd5efd41f4497051fca8ea8a5e77636a79afc46ee1a8e0fe9e3ba90b"
|
||||
)
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_provision_namespace(self, client):
|
||||
|
||||
def test_nem_signtx_provision_namespace(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
|
@ -21,13 +21,15 @@ from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.nem,
|
||||
pytest.mark.setup_client(mnemonic=MNEMONIC12),
|
||||
]
|
||||
|
||||
|
||||
# assertion data from T1
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.nem
|
||||
class TestMsgNEMSignTx:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_simple(self, client):
|
||||
def test_nem_signtx_simple(client):
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
[
|
||||
@ -68,8 +70,9 @@ class TestMsgNEMSignTx:
|
||||
== "9cda2045324d05c791a4fc312ecceb62954e7740482f8df8928560d63cf273dea595023640179f112de755c79717757ef76962175378d6d87360ddb3f3e5f70f"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_encrypted_payload(self, client):
|
||||
def test_nem_signtx_encrypted_payload(client):
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
[
|
||||
@ -113,8 +116,9 @@ class TestMsgNEMSignTx:
|
||||
# because IV and salt are random (therefore the encrypted payload as well) those data can't be asserted
|
||||
assert len(tx.signature) == 64
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_xem_as_mosaic(self, client):
|
||||
def test_nem_signtx_xem_as_mosaic(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -146,8 +150,9 @@ class TestMsgNEMSignTx:
|
||||
== "7b25a84b65adb489ea55739f1ca2d83a0ae069c3c58d0ea075fc30bfe8f649519199ad2324ca229c6c3214191469f95326e99712124592cae7cd3a092c93ac0c"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_unknown_mosaic(self, client):
|
||||
def test_nem_signtx_unknown_mosaic(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -179,8 +184,9 @@ class TestMsgNEMSignTx:
|
||||
== "2f0280420eceb41ef9e5d94fa44ddda9cdc70b8f423ae18af577f6d85df64bb4aaf40cf24fc6eef47c63b0963611f8682348cecdc49a9b64eafcbe7afcb49102"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_known_mosaic(self, client):
|
||||
def test_nem_signtx_known_mosaic(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -212,8 +218,9 @@ class TestMsgNEMSignTx:
|
||||
== "e7f14ef8c39727bfd257e109cd5acac31542f2e41f2e5deb258fc1db602b690eb1cabca41a627fe2adc51f3193db85c76b41c80bb60161eb8738ebf20b507104"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_known_mosaic_with_levy(self, client):
|
||||
def test_nem_signtx_known_mosaic_with_levy(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
@ -245,8 +252,9 @@ class TestMsgNEMSignTx:
|
||||
== "d3222dd7b83d66bda0539827ac6f909d06e40350b5e5e893d6fa762f954e9bf7da61022ef04950e7b6dfa88a2278f2f8a1b21df2bc3af22b388cb3a90bf76f07"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_nem_signtx_multiple_mosaics(self, client):
|
||||
def test_nem_signtx_multiple_mosaics(client):
|
||||
tx = nem.sign_tx(
|
||||
client,
|
||||
parse_path("m/44'/1'/0'/0'/0'"),
|
||||
|
@ -23,11 +23,11 @@ from ...common import MNEMONIC12
|
||||
PIN4 = "1234"
|
||||
PIN6 = "789456"
|
||||
|
||||
pytestmark = [pytest.mark.skip_t2]
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgRecoverydevice:
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_pin_passphrase(self, client):
|
||||
def test_pin_passphrase(client):
|
||||
mnemonic = MNEMONIC12.split(" ")
|
||||
ret = client.call_raw(
|
||||
proto.RecoveryDevice(
|
||||
@ -87,8 +87,9 @@ class TestMsgRecoverydevice:
|
||||
assert isinstance(resp, proto.PassphraseRequest)
|
||||
client.call_raw(proto.Cancel())
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_nopin_nopassphrase(self, client):
|
||||
def test_nopin_nopassphrase(client):
|
||||
mnemonic = MNEMONIC12.split(" ")
|
||||
ret = client.call_raw(
|
||||
proto.RecoveryDevice(
|
||||
@ -136,8 +137,9 @@ class TestMsgRecoverydevice:
|
||||
resp = client.call_raw(proto.GetAddress())
|
||||
assert isinstance(resp, proto.Address)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_word_fail(self, client):
|
||||
def test_word_fail(client):
|
||||
ret = client.call_raw(
|
||||
proto.RecoveryDevice(
|
||||
word_count=12,
|
||||
@ -164,8 +166,9 @@ class TestMsgRecoverydevice:
|
||||
else:
|
||||
client.call_raw(proto.WordAck(word=word))
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_pin_fail(self, client):
|
||||
def test_pin_fail(client):
|
||||
ret = client.call_raw(
|
||||
proto.RecoveryDevice(
|
||||
word_count=12,
|
||||
@ -196,7 +199,8 @@ class TestMsgRecoverydevice:
|
||||
# Failure should be raised
|
||||
assert isinstance(ret, proto.Failure)
|
||||
|
||||
def test_already_initialized(self, client):
|
||||
|
||||
def test_already_initialized(client):
|
||||
with pytest.raises(RuntimeError):
|
||||
device.recover(
|
||||
client, 12, False, False, "label", "en-US", client.mnemonic_callback
|
||||
|
@ -21,6 +21,8 @@ from trezorlib import device, messages as proto
|
||||
|
||||
from ...common import generate_entropy
|
||||
|
||||
pytestmark = [pytest.mark.skip_t1]
|
||||
|
||||
|
||||
def reset_device(client, strength):
|
||||
# No PIN, no passphrase
|
||||
@ -88,18 +90,18 @@ def reset_device(client, strength):
|
||||
assert isinstance(resp, proto.Address)
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgResetDevice:
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_128(self, client):
|
||||
def test_reset_device_128(client):
|
||||
reset_device(client, 128)
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_192(self, client):
|
||||
reset_device(client, 192)
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_256_pin(self, client):
|
||||
def test_reset_device_192(client):
|
||||
reset_device(client, 192)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_256_pin(client):
|
||||
external_entropy = b"zlutoucky kun upel divoke ody" * 2
|
||||
strength = 256
|
||||
|
||||
@ -187,8 +189,9 @@ class TestMsgResetDevice:
|
||||
assert isinstance(resp, proto.PassphraseRequest)
|
||||
client.call_raw(proto.Cancel())
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_failed_pin(self, client):
|
||||
def test_failed_pin(client):
|
||||
# external_entropy = b'zlutoucky kun upel divoke ody' * 2
|
||||
strength = 128
|
||||
|
||||
@ -231,6 +234,7 @@ class TestMsgResetDevice:
|
||||
|
||||
assert isinstance(ret, proto.Failure)
|
||||
|
||||
def test_already_initialized(self, client):
|
||||
|
||||
def test_already_initialized(client):
|
||||
with pytest.raises(Exception):
|
||||
device.reset(client, False, 128, True, True, "label", "en-US")
|
||||
|
@ -21,19 +21,18 @@ from trezorlib import messages as proto
|
||||
|
||||
from ...common import generate_entropy
|
||||
|
||||
pytestmark = [pytest.mark.skip_t2]
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgResetDeviceSkipbackup:
|
||||
EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
|
||||
STRENGTH = 128
|
||||
|
||||
external_entropy = b"zlutoucky kun upel divoke ody" * 2
|
||||
strength = 128
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_skip_backup(self, client):
|
||||
def test_reset_device_skip_backup(client):
|
||||
ret = client.call_raw(
|
||||
proto.ResetDevice(
|
||||
display_random=False,
|
||||
strength=self.strength,
|
||||
strength=STRENGTH,
|
||||
passphrase_protection=False,
|
||||
pin_protection=False,
|
||||
language="en-US",
|
||||
@ -49,7 +48,7 @@ class TestMsgResetDeviceSkipbackup:
|
||||
# Provide entropy
|
||||
assert isinstance(ret, proto.EntropyRequest)
|
||||
internal_entropy = client.debug.state().reset_entropy
|
||||
ret = client.call_raw(proto.EntropyAck(entropy=self.external_entropy))
|
||||
ret = client.call_raw(proto.EntropyAck(entropy=EXTERNAL_ENTROPY))
|
||||
assert isinstance(ret, proto.Success)
|
||||
|
||||
# Check if device is properly initialized
|
||||
@ -60,16 +59,14 @@ class TestMsgResetDeviceSkipbackup:
|
||||
assert ret.no_backup is False
|
||||
|
||||
# Generate mnemonic locally
|
||||
entropy = generate_entropy(
|
||||
self.strength, internal_entropy, self.external_entropy
|
||||
)
|
||||
entropy = generate_entropy(STRENGTH, internal_entropy, EXTERNAL_ENTROPY)
|
||||
expected_mnemonic = Mnemonic("english").to_mnemonic(entropy)
|
||||
|
||||
# start Backup workflow
|
||||
ret = client.call_raw(proto.BackupDevice())
|
||||
|
||||
mnemonic = []
|
||||
for _ in range(self.strength // 32 * 3):
|
||||
for _ in range(STRENGTH // 32 * 3):
|
||||
assert isinstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(client.debug.read_reset_word())
|
||||
client.debug.press_yes()
|
||||
@ -81,7 +78,7 @@ class TestMsgResetDeviceSkipbackup:
|
||||
assert mnemonic == expected_mnemonic
|
||||
|
||||
mnemonic = []
|
||||
for _ in range(self.strength // 32 * 3):
|
||||
for _ in range(STRENGTH // 32 * 3):
|
||||
assert isinstance(ret, proto.ButtonRequest)
|
||||
mnemonic.append(client.debug.read_reset_word())
|
||||
client.debug.press_yes()
|
||||
@ -98,12 +95,13 @@ class TestMsgResetDeviceSkipbackup:
|
||||
ret = client.call_raw(proto.BackupDevice())
|
||||
assert isinstance(ret, proto.Failure)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_skip_backup_break(self, client):
|
||||
def test_reset_device_skip_backup_break(client):
|
||||
ret = client.call_raw(
|
||||
proto.ResetDevice(
|
||||
display_random=False,
|
||||
strength=self.strength,
|
||||
strength=STRENGTH,
|
||||
passphrase_protection=False,
|
||||
pin_protection=False,
|
||||
language="en-US",
|
||||
@ -118,7 +116,7 @@ class TestMsgResetDeviceSkipbackup:
|
||||
|
||||
# Provide entropy
|
||||
assert isinstance(ret, proto.EntropyRequest)
|
||||
ret = client.call_raw(proto.EntropyAck(entropy=self.external_entropy))
|
||||
ret = client.call_raw(proto.EntropyAck(entropy=EXTERNAL_ENTROPY))
|
||||
assert isinstance(ret, proto.Success)
|
||||
|
||||
# Check if device is properly initialized
|
||||
@ -151,16 +149,18 @@ class TestMsgResetDeviceSkipbackup:
|
||||
assert ret.unfinished_backup is True
|
||||
assert ret.no_backup is False
|
||||
|
||||
def test_initialized_device_backup_fail(self, client):
|
||||
|
||||
def test_initialized_device_backup_fail(client):
|
||||
ret = client.call_raw(proto.BackupDevice())
|
||||
assert isinstance(ret, proto.Failure)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_skip_backup_show_entropy_fail(self, client):
|
||||
def test_reset_device_skip_backup_show_entropy_fail(client):
|
||||
ret = client.call_raw(
|
||||
proto.ResetDevice(
|
||||
display_random=True,
|
||||
strength=self.strength,
|
||||
strength=STRENGTH,
|
||||
passphrase_protection=False,
|
||||
pin_protection=False,
|
||||
language="en-US",
|
||||
|
@ -30,6 +30,8 @@ from ...common import (
|
||||
read_and_confirm_mnemonic,
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.skip_t1]
|
||||
|
||||
EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
|
||||
|
||||
|
||||
@ -105,18 +107,18 @@ def reset_device(client, strength):
|
||||
device.backup(client)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgResetDeviceT2:
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device(self, client):
|
||||
def test_reset_device(client):
|
||||
reset_device(client, 128) # 12 words
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_192(self, client):
|
||||
reset_device(client, 192) # 18 words
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_pin(self, client):
|
||||
def test_reset_device_192(client):
|
||||
reset_device(client, 192) # 18 words
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_pin(client):
|
||||
mnemonic = None
|
||||
strength = 256 # 24 words
|
||||
|
||||
@ -210,8 +212,9 @@ class TestMsgResetDeviceT2:
|
||||
assert resp.pin_protection is True
|
||||
assert resp.passphrase_protection is True
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_failed_check(self, client):
|
||||
def test_reset_failed_check(client):
|
||||
mnemonic = None
|
||||
strength = 256 # 24 words
|
||||
|
||||
@ -223,9 +226,7 @@ class TestMsgResetDeviceT2:
|
||||
yield from click_through(client.debug, screens=3, code=B.ResetDevice)
|
||||
|
||||
# mnemonic phrases, wrong answer
|
||||
mnemonic = yield from read_and_confirm_mnemonic(
|
||||
client.debug, choose_wrong=True
|
||||
)
|
||||
mnemonic = yield from read_and_confirm_mnemonic(client.debug, choose_wrong=True)
|
||||
|
||||
# warning screen
|
||||
br = yield
|
||||
@ -291,8 +292,9 @@ class TestMsgResetDeviceT2:
|
||||
assert resp.passphrase_protection is False
|
||||
assert resp.backup_type is proto.BackupType.Bip39
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_failed_pin(self, client):
|
||||
def test_failed_pin(client):
|
||||
# external_entropy = b'zlutoucky kun upel divoke ody' * 2
|
||||
strength = 128
|
||||
ret = client.call_raw(
|
||||
@ -316,7 +318,8 @@ class TestMsgResetDeviceT2:
|
||||
|
||||
assert isinstance(ret, proto.ButtonRequest)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_already_initialized(self, client):
|
||||
def test_already_initialized(client):
|
||||
with pytest.raises(Exception):
|
||||
device.reset(client, False, 128, True, True, "label", "en-US")
|
||||
|
@ -25,14 +25,14 @@ from trezorlib.messages import BackupType, ButtonRequestType as B
|
||||
|
||||
from ...common import click_through, generate_entropy, read_and_confirm_mnemonic
|
||||
|
||||
pytestmark = [pytest.mark.skip_t1]
|
||||
|
||||
EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgResetDeviceT2:
|
||||
# TODO: test with different options
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_slip39_advanced(self, client):
|
||||
def test_reset_device_slip39_advanced(client):
|
||||
strength = 128
|
||||
member_threshold = 3
|
||||
all_mnemonics = []
|
||||
|
@ -31,6 +31,8 @@ from ...common import (
|
||||
read_and_confirm_mnemonic,
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.skip_t1]
|
||||
|
||||
|
||||
def reset_device(client, strength):
|
||||
member_threshold = 3
|
||||
@ -122,14 +124,13 @@ def reset_device(client, strength):
|
||||
device.backup(client)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgResetDeviceT2:
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_slip39_basic(self, client):
|
||||
def test_reset_device_slip39_basic(client):
|
||||
reset_device(client, 128)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
def test_reset_device_slip39_basic_256(self, client):
|
||||
def test_reset_device_slip39_basic_256(client):
|
||||
reset_device(client, 256)
|
||||
|
||||
|
||||
|
@ -25,12 +25,14 @@ CUSTOM_MNEMONIC = (
|
||||
"whip snack decide blur unfold fiction pumpkin athlete"
|
||||
)
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.ripple,
|
||||
pytest.mark.skip_t1, # T1 support is not planned
|
||||
]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.ripple
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
class TestMsgRippleGetAddress:
|
||||
def test_ripple_get_address(self, client):
|
||||
|
||||
def test_ripple_get_address(client):
|
||||
# data from https://iancoleman.io/bip39/
|
||||
address = get_address(client, parse_path("m/44'/144'/0'/0/0"))
|
||||
assert address == "rNaqKtKrMSwpwZSzRckPf7S96DkimjkF4H"
|
||||
@ -39,8 +41,9 @@ class TestMsgRippleGetAddress:
|
||||
address = get_address(client, parse_path("m/44'/144'/1'/0/0"))
|
||||
assert address == "rJX2KwzaLJDyFhhtXKi3htaLfaUH2tptEX"
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=CUSTOM_MNEMONIC)
|
||||
def test_ripple_get_address_other(self, client):
|
||||
def test_ripple_get_address_other(client):
|
||||
# data from https://github.com/you21979/node-ripple-bip32/blob/master/test/test.js
|
||||
address = get_address(client, parse_path("m/44'/144'/0'/0/0"))
|
||||
assert address == "r4ocGE47gm4G4LkA9mriVHQqzpMLBTgnTY"
|
||||
|
@ -20,12 +20,14 @@ from trezorlib import ripple
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.ripple,
|
||||
pytest.mark.skip_t1, # T1 support is not planned
|
||||
]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.ripple
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
class TestMsgRippleSignTx:
|
||||
def test_ripple_sign_simple_tx(self, client):
|
||||
|
||||
def test_ripple_sign_simple_tx(client):
|
||||
msg = ripple.create_sign_tx_msg(
|
||||
{
|
||||
"TransactionType": "Payment",
|
||||
@ -93,7 +95,8 @@ class TestMsgRippleSignTx:
|
||||
== "120000228000000024000000642e0001e240201b00051537614000000005f5e109684000000000000064732103dbed1e77cb91a005e2ec71afbccce5444c9be58276665a3859040f692de8fed2744730450221008770743a472bb2d1c746a53ef131cc17cc118d538ec910ca928d221db4494cf702201e4ef242d6c3bff110c3cc3897a471fed0f5ac10987ea57da63f98dfa01e94df8114bdf86f3ae715ba346b7772ea0e133f48828b766483148fb40e1ffa5d557ce9851a535af94965e0dd0988"
|
||||
)
|
||||
|
||||
def test_ripple_sign_invalid_fee(self, client):
|
||||
|
||||
def test_ripple_sign_invalid_fee(client):
|
||||
msg = ripple.create_sign_tx_msg(
|
||||
{
|
||||
"TransactionType": "Payment",
|
||||
|
@ -17,19 +17,20 @@
|
||||
from trezorlib import device, messages
|
||||
|
||||
|
||||
class TestBasic:
|
||||
def test_features(self, client):
|
||||
def test_features(client):
|
||||
f0 = client.features
|
||||
# client erases session_id from its features
|
||||
f0.session_id = client.session_id
|
||||
f1 = client.call(messages.Initialize(session_id=f0.session_id))
|
||||
assert f0 == f1
|
||||
|
||||
def test_ping(self, client):
|
||||
|
||||
def test_ping(client):
|
||||
ping = client.call(messages.Ping(message="ahoj!"))
|
||||
assert ping == messages.Success(message="ahoj!")
|
||||
|
||||
def test_device_id_same(self, client):
|
||||
|
||||
def test_device_id_same(client):
|
||||
id1 = client.get_device_id()
|
||||
client.init_device()
|
||||
id2 = client.get_device_id()
|
||||
@ -40,7 +41,8 @@ class TestBasic:
|
||||
# Every resulf of UUID must be the same
|
||||
assert id1 == id2
|
||||
|
||||
def test_device_id_different(self, client):
|
||||
|
||||
def test_device_id_different(client):
|
||||
id1 = client.get_device_id()
|
||||
device.wipe(client)
|
||||
id2 = client.get_device_id()
|
||||
|
@ -21,11 +21,13 @@ import pytest
|
||||
from trezorlib import btc
|
||||
from trezorlib.tools import H_
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_t2,
|
||||
pytest.mark.flaky(max_runs=5),
|
||||
]
|
||||
|
||||
@pytest.mark.flaky(max_runs=5)
|
||||
class TestBip32Speed:
|
||||
@pytest.mark.skip_t2
|
||||
def test_public_ckd(self, client):
|
||||
|
||||
def test_public_ckd(client):
|
||||
btc.get_address(client, "Bitcoin", []) # to compute root node via BIP39
|
||||
|
||||
for depth in range(8):
|
||||
@ -36,8 +38,8 @@ class TestBip32Speed:
|
||||
print("DEPTH", depth, "EXPECTED DELAY", expected, "REAL DELAY", delay)
|
||||
assert delay <= expected
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_private_ckd(self, client):
|
||||
|
||||
def test_private_ckd(client):
|
||||
btc.get_address(client, "Bitcoin", []) # to compute root node via BIP39
|
||||
|
||||
for depth in range(8):
|
||||
@ -49,8 +51,8 @@ class TestBip32Speed:
|
||||
print("DEPTH", depth, "EXPECTED DELAY", expected, "REAL DELAY", delay)
|
||||
assert delay <= expected
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_cache(self, client):
|
||||
|
||||
def test_cache(client):
|
||||
start = time.time()
|
||||
for x in range(10):
|
||||
btc.get_address(client, "Bitcoin", [x, 2, 3, 4, 5, 6, 7, 8])
|
||||
|
@ -21,10 +21,10 @@ import pytest
|
||||
from trezorlib import cosi
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
pytestmark = pytest.mark.skip_t2
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestCosi:
|
||||
def test_cosi_commit(self, client):
|
||||
|
||||
def test_cosi_commit(client):
|
||||
digest = sha256(b"this is a message").digest()
|
||||
|
||||
c0 = cosi.commit(client, parse_path("10018'/0'"), digest)
|
||||
@ -53,7 +53,8 @@ class TestCosi:
|
||||
assert c1.commitment != c1b.commitment
|
||||
assert c2.commitment != c2b.commitment
|
||||
|
||||
def test_cosi_sign(self, client):
|
||||
|
||||
def test_cosi_sign(client):
|
||||
digest = sha256(b"this is a message").digest()
|
||||
|
||||
c0 = cosi.commit(client, parse_path("10018'/0'"), digest)
|
||||
@ -69,13 +70,12 @@ class TestCosi:
|
||||
sig2 = cosi.sign(client, parse_path("10018'/2'"), digest, global_R, global_pk)
|
||||
# fmt: on
|
||||
|
||||
sig = cosi.combine_sig(
|
||||
global_R, [sig0.signature, sig1.signature, sig2.signature]
|
||||
)
|
||||
sig = cosi.combine_sig(global_R, [sig0.signature, sig1.signature, sig2.signature])
|
||||
|
||||
cosi.verify_combined(sig, digest, global_pk)
|
||||
|
||||
def test_cosi_compat(self, client):
|
||||
|
||||
def test_cosi_compat(client):
|
||||
digest = sha256(b"this is not a pipe").digest()
|
||||
remote_commit = cosi.commit(client, parse_path("10018'/0'"), digest)
|
||||
|
||||
@ -86,9 +86,7 @@ class TestCosi:
|
||||
global_pk = cosi.combine_keys([remote_commit.pubkey, local_pubkey])
|
||||
global_R = cosi.combine_keys([remote_commit.commitment, local_commitment])
|
||||
|
||||
remote_sig = cosi.sign(
|
||||
client, parse_path("10018'/0'"), digest, global_R, global_pk
|
||||
)
|
||||
remote_sig = cosi.sign(client, parse_path("10018'/0'"), digest, global_R, global_pk)
|
||||
local_sig = cosi.sign_with_privkey(
|
||||
digest, local_privkey, global_pk, local_nonce, global_R
|
||||
)
|
||||
|
@ -23,19 +23,22 @@ from ..common import MNEMONIC12
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestDebuglink:
|
||||
def test_layout(self, client):
|
||||
def test_layout(client):
|
||||
layout = client.debug.state().layout
|
||||
assert len(layout) == 1024
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_mnemonic(self, client):
|
||||
def test_mnemonic(client):
|
||||
client.ensure_unlocked()
|
||||
mnemonic = client.debug.state().mnemonic_secret
|
||||
assert mnemonic == MNEMONIC12.encode()
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase="")
|
||||
def test_pin(self, client):
|
||||
def test_pin(client):
|
||||
resp = client.call_raw(messages.GetAddress())
|
||||
assert isinstance(resp, messages.PinMatrixRequest)
|
||||
|
||||
|
@ -29,6 +29,8 @@ EXPECTED_RESPONSES_PIN_TT = [messages.ButtonRequest()] + EXPECTED_RESPONSES_NOPI
|
||||
|
||||
PIN4 = "1234"
|
||||
|
||||
pytestmark = pytest.mark.setup_client(pin=PIN4)
|
||||
|
||||
|
||||
def _set_expected_responses(client):
|
||||
client.use_pin_sequence([PIN4])
|
||||
@ -38,9 +40,7 @@ def _set_expected_responses(client):
|
||||
client.set_expected_responses(EXPECTED_RESPONSES_PIN_TT)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(pin=PIN4)
|
||||
class TestMsgApplysettings:
|
||||
def test_apply_settings(self, client):
|
||||
def test_apply_settings(client):
|
||||
assert client.features.label == "test"
|
||||
|
||||
with client:
|
||||
@ -49,8 +49,9 @@ class TestMsgApplysettings:
|
||||
|
||||
assert client.features.label == "new label"
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_apply_settings_rotation(self, client):
|
||||
def test_apply_settings_rotation(client):
|
||||
assert client.features.display_rotation is None
|
||||
|
||||
with client:
|
||||
@ -59,8 +60,9 @@ class TestMsgApplysettings:
|
||||
|
||||
assert client.features.display_rotation == 270
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_invalid_language(self, client):
|
||||
def test_invalid_language(client):
|
||||
assert client.features.language == "en-US"
|
||||
|
||||
with client:
|
||||
@ -69,8 +71,9 @@ class TestMsgApplysettings:
|
||||
|
||||
assert client.features.language == "en-US"
|
||||
|
||||
|
||||
@pytest.mark.setup_client(pin=PIN4, passphrase=False)
|
||||
def test_apply_settings_passphrase(self, client):
|
||||
def test_apply_settings_passphrase(client):
|
||||
with client:
|
||||
_set_expected_responses(client)
|
||||
device.apply_settings(client, use_passphrase=True)
|
||||
@ -89,9 +92,10 @@ class TestMsgApplysettings:
|
||||
|
||||
assert client.features.passphrase_protection is True
|
||||
|
||||
|
||||
@pytest.mark.setup_client(passphrase=False)
|
||||
@pytest.mark.skip_t1
|
||||
def test_apply_settings_passphrase_on_device(self, client):
|
||||
def test_apply_settings_passphrase_on_device(client):
|
||||
# enable passphrase
|
||||
with client:
|
||||
client.set_expected_responses(EXPECTED_RESPONSES_NOPIN)
|
||||
@ -123,8 +127,9 @@ class TestMsgApplysettings:
|
||||
assert client.features.passphrase_protection is True
|
||||
assert client.features.passphrase_always_on_device is False
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_apply_homescreen_toif(self, client):
|
||||
def test_apply_homescreen_toif(client):
|
||||
img = b"TOIf\x90\x00\x90\x00~\x00\x00\x00\xed\xd2\xcb\r\x83@\x10D\xc1^.\xde#!\xac31\x99\x10\x8aC%\x14~\x16\x92Y9\x02WI3\x01<\xf5cI2d\x1es(\xe1[\xdbn\xba\xca\xe8s7\xa4\xd5\xd4\xb3\x13\xbdw\xf6:\xf3\xd1\xe7%\xc7]\xdd_\xb3\x9e\x9f\x9e\x9fN\xed\xaaE\xef\xdc\xcf$D\xa7\xa4X\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0OV"
|
||||
|
||||
with client:
|
||||
@ -134,6 +139,7 @@ class TestMsgApplysettings:
|
||||
client.set_expected_responses(EXPECTED_RESPONSES_NOPIN)
|
||||
device.apply_settings(client, homescreen=b"")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"toif_data",
|
||||
[
|
||||
@ -150,29 +156,29 @@ class TestMsgApplysettings:
|
||||
],
|
||||
)
|
||||
@pytest.mark.skip_t1
|
||||
def test_apply_homescreen_toif_fail(self, client, toif_data):
|
||||
def test_apply_homescreen_toif_fail(client, toif_data):
|
||||
with pytest.raises(exceptions.TrezorFailure), client:
|
||||
client.use_pin_sequence([PIN4])
|
||||
device.apply_settings(client, homescreen=toif_data)
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_apply_homescreen(self, client):
|
||||
def test_apply_homescreen(client):
|
||||
img = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x04\x88\x02\x00\x00\x00\x02\x91\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x90@\x00\x11@\x00\x00\x00\x00\x00\x00\x08\x00\x10\x92\x12\x04\x00\x00\x05\x12D\x00\x00\x00\x00\x00 \x00\x00\x08\x00Q\x00\x00\x02\xc0\x00\x00\x00\x00\x00\x00\x00\x10\x02 \x01\x04J\x00)$\x00\x00\x00\x00\x80\x00\x00\x00\x00\x08\x10\xa1\x00\x00\x02\x81 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\tP\x00\x00\x00\x00\x00\x00 \x00\x00\xa0\x00\xa0R \x12\x84\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x08\x00\tP\x00\x00\x00\x00 \x00\x04 \x00\x80\x02\x00@\x02T\xc2 \x00\x00\x00\x00\x00\x00\x00\x10@\x00)\t@\n\xa0\x80\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x80@\x14\xa9H\x04\x00\x00\x88@\x00\x00\x00\x00\x00\x02\x02$\x00\x15B@\x00\nP\x00\x00\x00\x00\x00\x80\x00\x00\x91\x01UP\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x02\x08@ Z\xa5 \x00\x00\x80\x00\x00\x00\x00\x00\x00\x08\xa1%\x14*\xa0\x00\x00\x02\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00@\xaa\x91 \x00\x05E\x80\x00\x00\x00\x00\x00\x02*T\x05-D\x00\x00\x05 @\x00\x00\x00\x00\x00%@\x80\x11V\xa0\x88\x00\x05@\xb0\x00\x00\x00\x00\x00\x818$\x04\xabD \x00\x06\xa1T\x00\x00\x00\x00\x02\x03\xb8\x01R\xd5\x01\x00\x00\x05AP\x00\x00\x00\x00\x08\xadT\x00\x05j\xa4@\x00\x87ah\x00\x00\x00\x00\x02\x8d\xb8\x08\x00.\x01\x00\x00\x02\xa5\xa8\x10\x00\x00\x00*\xc1\xec \n\xaa\x88 \x02@\xf6\xd0\x02\x00\x00\x00\x0bB\xb6\x14@U"\x80\x00\x01{`\x00\x00\x00\x00M\xa3\xf8 \x15*\x00\x00\x00\x10n\xc0\x04\x00\x00\x02\x06\xc2\xa8)\x00\x96\x84\x80\x00\x00\x1b\x00\x00\x80@\x10\x87\xa7\xf0\x84\x10\xaa\x10\x00\x00D\x00\x00\x02 \x00\x8a\x06\xfa\xe0P\n-\x02@\x00\x12\x00\x00\x00\x00\x10@\x83\xdf\xa0\x00\x08\xaa@\x00\x00\x01H\x00\x05H\x04\x12\x01\xf7\x81P\x02T\t\x00\x00\x00 \x00\x00\x84\x10\x00\x00z\x00@)* \x00\x00\x01\n\xa0\x02 \x05\n\x00\x00\x05\x10\x84\xa8\x84\x80\x00\x00@\x14\x00\x92\x10\x80\x00\x04\x11@\tT\x00\x00\x00\x00\n@\x00\x08\x84@$\x00H\x00\x12Q\x02\x00\x00\x00\x00\x90\x02A\x12\xa8\n\xaa\x92\x10\x04\xa8\x10@\x00\x00\x04\x04\x00\x04I\x00\x04\x14H\x80"R\x01\x00\x00\x00!@\x00\x00$\xa0EB\x80\x08\x95hH\x00\x00\x00\x84\x10 \x05Z\x00\x00(\x00\x02\x00\xa1\x01\x00\x00\x04\x00@\x82\x00\xadH*\x92P\x00\xaaP\x00\x00\x00\x00\x11\x02\x01*\xad\x01\x00\x01\x01"\x11D\x08\x00\x00\x10\x80 \x00\x81W\x80J\x94\x04\x08\xa5 !\x00\x00\x00\x02\x00B*\xae\xa1\x00\x80\x10\x01\x08\xa4\x00\x00\x00\x00\x00\x84\x00\t[@"HA\x04E\x00\x84\x00\x00\x00\x10\x00\x01J\xd5\x82\x90\x02\x00!\x02\xa2\x00\x00\x00\x00\x00\x00\x00\x05~\xa0\x00 \x10\n)\x00\x11\x00\x00\x00\x00\x00\x00!U\x80\xa8\x88\x82\x80\x01\x00\x00\x00\x00\x00\x00H@\x11\xaa\xc0\x82\x00 *\n\x00\x00\x00\x00\x00\x00\x00\x00\n\xabb@ \x04\x00! \x84\x00\x00\x00\x00\x02@\xa5\x15A$\x04\x81(\n\x00\x00\x00\x00\x00\x00 \x01\x10\x02\xe0\x91\x02\x00\x00\x04\x00\x00\x00\x00\x00\x00\x01 \xa9\tQH@\x91 P\x00\x00\x00\x00\x00\x00\x08\x00\x00\xa0T\xa5\x00@\x80\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\xa2\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00 T\xa0\t\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00@\x02\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00*\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x10\x00\x00\x10\x02\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00@\x04\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x08@\x10\x00\x00\x00\x00'
|
||||
|
||||
with client:
|
||||
_set_expected_responses(client)
|
||||
device.apply_settings(client, homescreen=img)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(pin=None)
|
||||
def test_safety_checks(self, client):
|
||||
def test_safety_checks(client):
|
||||
def get_bad_address():
|
||||
btc.get_address(client, "Bitcoin", parse_path("m/44'"), show_display=True)
|
||||
|
||||
assert client.features.safety_checks == messages.SafetyCheckLevel.Strict
|
||||
|
||||
with pytest.raises(
|
||||
exceptions.TrezorFailure, match="Forbidden key path"
|
||||
), client:
|
||||
with pytest.raises(exceptions.TrezorFailure, match="Forbidden key path"), client:
|
||||
client.set_expected_responses([messages.Failure])
|
||||
get_bad_address()
|
||||
|
||||
@ -183,9 +189,7 @@ class TestMsgApplysettings:
|
||||
client, safety_checks=messages.SafetyCheckLevel.PromptAlways
|
||||
)
|
||||
|
||||
assert (
|
||||
client.features.safety_checks == messages.SafetyCheckLevel.PromptAlways
|
||||
)
|
||||
assert client.features.safety_checks == messages.SafetyCheckLevel.PromptAlways
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
@ -195,15 +199,11 @@ class TestMsgApplysettings:
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(EXPECTED_RESPONSES_NOPIN)
|
||||
device.apply_settings(
|
||||
client, safety_checks=messages.SafetyCheckLevel.Strict
|
||||
)
|
||||
device.apply_settings(client, safety_checks=messages.SafetyCheckLevel.Strict)
|
||||
|
||||
assert client.features.safety_checks == messages.SafetyCheckLevel.Strict
|
||||
|
||||
with pytest.raises(
|
||||
exceptions.TrezorFailure, match="Forbidden key path"
|
||||
), client:
|
||||
with pytest.raises(exceptions.TrezorFailure, match="Forbidden key path"), client:
|
||||
client.set_expected_responses([messages.Failure])
|
||||
get_bad_address()
|
||||
|
||||
@ -213,9 +213,7 @@ class TestMsgApplysettings:
|
||||
client, safety_checks=messages.SafetyCheckLevel.PromptTemporarily
|
||||
)
|
||||
|
||||
assert (
|
||||
client.features.safety_checks == messages.SafetyCheckLevel.PromptTemporarily
|
||||
)
|
||||
assert client.features.safety_checks == messages.SafetyCheckLevel.PromptTemporarily
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
@ -223,8 +221,9 @@ class TestMsgApplysettings:
|
||||
)
|
||||
get_bad_address()
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_experimental_features(self, client):
|
||||
def test_experimental_features(client):
|
||||
def experimental_call():
|
||||
btc.authorize_coinjoin(
|
||||
client,
|
||||
@ -276,8 +275,9 @@ class TestMsgApplysettings:
|
||||
client.set_expected_responses([messages.Failure])
|
||||
experimental_call()
|
||||
|
||||
|
||||
@pytest.mark.setup_client(pin=None)
|
||||
def test_label_too_long(self, client):
|
||||
def test_label_too_long(client):
|
||||
with pytest.raises(exceptions.TrezorFailure), client:
|
||||
client.set_expected_responses([messages.Failure])
|
||||
device.apply_settings(client, label="A" * 33)
|
||||
|
@ -21,9 +21,8 @@ from trezorlib import misc
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
class TestMsgCipherkeyvalue:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_encrypt(self, client):
|
||||
def test_encrypt(client):
|
||||
res = misc.encrypt_keyvalue(
|
||||
client,
|
||||
[0, 1, 2],
|
||||
@ -85,8 +84,7 @@ class TestMsgCipherkeyvalue:
|
||||
ask_on_decrypt=True,
|
||||
)
|
||||
assert (
|
||||
res.hex()
|
||||
== "676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d"
|
||||
res.hex() == "676faf8f13272af601776bc31bc14e8f3ae1c88536bf18f1b44f1e4c2c4a613d"
|
||||
)
|
||||
|
||||
# different path
|
||||
@ -100,8 +98,9 @@ class TestMsgCipherkeyvalue:
|
||||
)
|
||||
assert res.hex() == "b4811a9d492f5355a5186ddbfccaae7b"
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_decrypt(self, client):
|
||||
def test_decrypt(client):
|
||||
res = misc.decrypt_keyvalue(
|
||||
client,
|
||||
[0, 1, 2],
|
||||
@ -177,10 +176,12 @@ class TestMsgCipherkeyvalue:
|
||||
)
|
||||
assert res == b"testing message!"
|
||||
|
||||
def test_encrypt_badlen(self, client):
|
||||
|
||||
def test_encrypt_badlen(client):
|
||||
with pytest.raises(Exception):
|
||||
misc.encrypt_keyvalue(client, [0, 1, 2], "test", b"testing")
|
||||
|
||||
def test_decrypt_badlen(self, client):
|
||||
|
||||
def test_decrypt_badlen(client):
|
||||
with pytest.raises(Exception):
|
||||
misc.decrypt_keyvalue(client, [0, 1, 2], "test", b"testing")
|
||||
|
@ -33,8 +33,7 @@ def getmultisig(chain, nr, xpubs):
|
||||
)
|
||||
|
||||
|
||||
class TestMsgGetaddress:
|
||||
def test_btc(self, client):
|
||||
def test_btc(client):
|
||||
assert (
|
||||
btc.get_address(client, "Bitcoin", parse_path("m/44'/0'/0'/0/0"))
|
||||
== "1JAd7XCBzGudGpJQSDSfpmJhiygtLQWaGL"
|
||||
@ -48,8 +47,9 @@ class TestMsgGetaddress:
|
||||
== "1DyHzbQUoQEsLxJn6M7fMD8Xdt1XvNiwNE"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_ltc(self, client):
|
||||
def test_ltc(client):
|
||||
assert (
|
||||
btc.get_address(client, "Litecoin", parse_path("m/44'/2'/0'/0/0"))
|
||||
== "LcubERmHD31PWup1fbozpKuiqjHZ4anxcL"
|
||||
@ -63,7 +63,8 @@ class TestMsgGetaddress:
|
||||
== "LWj6ApswZxay4cJEJES2sGe7fLMLRvvv8h"
|
||||
)
|
||||
|
||||
def test_tbtc(self, client):
|
||||
|
||||
def test_tbtc(client):
|
||||
assert (
|
||||
btc.get_address(client, "Testnet", parse_path("m/44'/1'/0'/0/0"))
|
||||
== "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q"
|
||||
@ -77,8 +78,9 @@ class TestMsgGetaddress:
|
||||
== "mm6kLYbGEL1tGe4ZA8xacfgRPdW1NLjCbZ"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_bch(self, client):
|
||||
def test_bch(client):
|
||||
assert (
|
||||
btc.get_address(client, "Bcash", parse_path("44'/145'/0'/0/0"))
|
||||
== "bitcoincash:qr08q88p9etk89wgv05nwlrkm4l0urz4cyl36hh9sv"
|
||||
@ -92,8 +94,9 @@ class TestMsgGetaddress:
|
||||
== "bitcoincash:qzc5q87w069lzg7g3gzx0c8dz83mn7l02scej5aluw"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_grs(self, client):
|
||||
def test_grs(client):
|
||||
assert (
|
||||
btc.get_address(client, "Groestlcoin", parse_path("44'/17'/0'/0/0"))
|
||||
== "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM"
|
||||
@ -107,15 +110,17 @@ class TestMsgGetaddress:
|
||||
== "Fmhtxeh7YdCBkyQF7AQG4QnY8y3rJg89di"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_elements(self, client):
|
||||
def test_elements(client):
|
||||
assert (
|
||||
btc.get_address(client, "Elements", parse_path("m/44'/1'/0'/0/0"))
|
||||
== "2dpWh6jbhAowNsQ5agtFzi7j6nKscj6UnEr"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_multisig(self, client):
|
||||
def test_multisig(client):
|
||||
xpubs = []
|
||||
for n in range(1, 4):
|
||||
node = btc.get_public_node(client, parse_path(f"44'/0'/{n}'"))
|
||||
@ -143,9 +148,10 @@ class TestMsgGetaddress:
|
||||
== "36gP3KVx1ooStZ9quZDXbAF3GCr42b2zzd"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.parametrize("show_display", (True, False))
|
||||
def test_multisig_missing(self, client, show_display):
|
||||
def test_multisig_missing(client, show_display):
|
||||
# Multisig with global suffix specification.
|
||||
# Use account numbers 1, 2 and 3 to create a valid multisig,
|
||||
# but not containing the keys from account 0 used below.
|
||||
@ -182,9 +188,10 @@ class TestMsgGetaddress:
|
||||
multisig=multisig,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.multisig
|
||||
def test_bch_multisig(self, client):
|
||||
def test_bch_multisig(client):
|
||||
xpubs = []
|
||||
for n in range(1, 4):
|
||||
node = btc.get_public_node(
|
||||
@ -214,7 +221,8 @@ class TestMsgGetaddress:
|
||||
== "bitcoincash:pp6kcpkhua7789g2vyj0qfkcux3yvje7euhyhltn0a"
|
||||
)
|
||||
|
||||
def test_public_ckd(self, client):
|
||||
|
||||
def test_public_ckd(client):
|
||||
node = btc.get_public_node(client, parse_path("m/44'/0'/0'")).node
|
||||
node_sub1 = btc.get_public_node(client, parse_path("m/44'/0'/0'/1/0")).node
|
||||
node_sub2 = bip32.public_ckd(node, [1, 0])
|
||||
|
@ -21,8 +21,7 @@ from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
|
||||
class TestMsgGetaddressSegwit:
|
||||
def test_show_segwit(self, client):
|
||||
def test_show_segwit(client):
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
@ -68,8 +67,9 @@ class TestMsgGetaddressSegwit:
|
||||
== "mvbu1Gdy8SUjTenqerxUaZyYjmveZvt33q"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_show_segwit_altcoin(self, client):
|
||||
def test_show_segwit_altcoin(client):
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
@ -93,8 +93,9 @@ class TestMsgGetaddressSegwit:
|
||||
== "XNW67ZQA9K3AuXPBWvJH4zN2y5QBDTwy2Z"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_show_multisig_3(self, client):
|
||||
def test_show_multisig_3(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"49'/1'/{i}'"), coin_name="Testnet"
|
||||
@ -123,9 +124,10 @@ class TestMsgGetaddressSegwit:
|
||||
== "2MwuUwUzPG17wiKQpfXmzfxJEoe7RXZDRad"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.parametrize("show_display", (True, False))
|
||||
def test_multisig_missing(self, client, show_display):
|
||||
def test_multisig_missing(client, show_display):
|
||||
# Multisig with global suffix specification.
|
||||
# Use account numbers 1, 2 and 3 to create a valid multisig,
|
||||
# but not containing the keys from account 0 used below.
|
||||
|
@ -21,9 +21,8 @@ from trezorlib import messages as proto, misc
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
class TestMsgGetECDHSessionKey:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_ecdh(self, client):
|
||||
def test_ecdh(client):
|
||||
identity = proto.IdentityType(
|
||||
proto="gpg",
|
||||
user="",
|
||||
|
@ -26,10 +26,10 @@ from ..common import (
|
||||
get_test_address,
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.setup_client(uninitialized=True)
|
||||
|
||||
@pytest.mark.setup_client(uninitialized=True)
|
||||
class TestDeviceLoad:
|
||||
def test_load_device_1(self, client):
|
||||
|
||||
def test_load_device_1(client):
|
||||
debuglink.load_device(
|
||||
client,
|
||||
mnemonic=MNEMONIC12,
|
||||
@ -45,7 +45,8 @@ class TestDeviceLoad:
|
||||
address = get_test_address(client)
|
||||
assert address == "mkqRFzxmkCGX9jxgpqqFHcxRUmLJcLDBer"
|
||||
|
||||
def test_load_device_2(self, client):
|
||||
|
||||
def test_load_device_2(client):
|
||||
debuglink.load_device(
|
||||
client,
|
||||
mnemonic=MNEMONIC12,
|
||||
@ -65,8 +66,9 @@ class TestDeviceLoad:
|
||||
address = get_test_address(client)
|
||||
assert address == "mx77VZjTVixVsU7nCtAKHnGFdsyNCnsWWw"
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_load_device_slip39_basic(self, client):
|
||||
def test_load_device_slip39_basic(client):
|
||||
debuglink.load_device(
|
||||
client,
|
||||
mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6,
|
||||
@ -76,8 +78,9 @@ class TestDeviceLoad:
|
||||
)
|
||||
assert client.features.backup_type == BackupType.Slip39_Basic
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_load_device_slip39_advanced(self, client):
|
||||
def test_load_device_slip39_advanced(client):
|
||||
debuglink.load_device(
|
||||
client,
|
||||
mnemonic=MNEMONIC_SLIP39_ADVANCED_20,
|
||||
@ -87,7 +90,8 @@ class TestDeviceLoad:
|
||||
)
|
||||
assert client.features.backup_type == BackupType.Slip39_Advanced
|
||||
|
||||
def test_load_device_utf(self, client):
|
||||
|
||||
def test_load_device_utf(client):
|
||||
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
|
||||
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
|
||||
words_nfkc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
|
||||
@ -96,12 +100,8 @@ class TestDeviceLoad:
|
||||
passphrase_nfkd = (
|
||||
u"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
|
||||
)
|
||||
passphrase_nfc = (
|
||||
u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
|
||||
)
|
||||
passphrase_nfkc = (
|
||||
u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
|
||||
)
|
||||
passphrase_nfc = u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
|
||||
passphrase_nfkc = u"Neuv\u011b\u0159iteln\u011b bezpe\u010dn\xe9 hesl\xed\u010dko"
|
||||
passphrase_nfd = (
|
||||
u"Neuve\u030cr\u030citelne\u030c bezpec\u030cne\u0301 hesli\u0301c\u030cko"
|
||||
)
|
||||
|
@ -21,9 +21,8 @@ from trezorlib import messages as proto, misc
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
|
||||
class TestMsgSignidentity:
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_sign(self, client):
|
||||
def test_sign(client):
|
||||
hidden = bytes.fromhex(
|
||||
"cd8552569d6e4509266ef137584d1e62c7579b5b8ed69bbafa4b864c6521e7c2"
|
||||
)
|
||||
|
@ -75,8 +75,7 @@ TXHASH_2bac7a = bytes.fromhex(
|
||||
)
|
||||
|
||||
|
||||
class TestMsgSigntx:
|
||||
def test_one_one_fee(self, client):
|
||||
def test_one_one_fee(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -121,7 +120,8 @@ class TestMsgSigntx:
|
||||
== "f6b22f324894c708e32d340a60af670c8accb3b62d05906d31e60ae49696c0c3"
|
||||
)
|
||||
|
||||
def test_testnet_one_two_fee(self, client):
|
||||
|
||||
def test_testnet_one_two_fee(client):
|
||||
# see 87be0736f202f7c2bff0781b42bad3e0cdcb54761939da69ea793a3735552c56
|
||||
|
||||
# tx: e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd
|
||||
@ -175,7 +175,8 @@ class TestMsgSigntx:
|
||||
== "0100000001cd3b93f5b24ae190ce5141235091cd93fbb2908e24e5b9ff6776aec11b0e04e5000000006b483045022100eba3bbcbb82ab1ebac88a394e8fb53b0263dadbb3e8072f0a21ee62818c911060220686a9b7f306d028b54a228b5c47cc6c27b1d01a3b0770440bcc64d55d8bace2c0121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0ffffffff021023cb01000000001976a91485eb47fe98f349065d6f044e27a4ac541af79ee288aca0bb0d00000000001976a9143d3cca567e00a04819742b21a696a67da796498b88ac00000000"
|
||||
)
|
||||
|
||||
def test_testnet_fee_high_warning(self, client):
|
||||
|
||||
def test_testnet_fee_high_warning(client):
|
||||
# tx: 6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54
|
||||
# input 1: 10.00000000 BTC
|
||||
inp1 = messages.TxInputType(
|
||||
@ -229,22 +230,19 @@ class TestMsgSigntx:
|
||||
== "54fd5e9b65b8acc10144c1e78ea9720df7606d7d4a543e4c547ecd45b2ae226b"
|
||||
)
|
||||
|
||||
def test_one_two_fee(self, client):
|
||||
|
||||
def test_one_two_fee(client):
|
||||
# tx: c275c333fd1b36bef4af316226c66a8b3693fbfcc081a5e16a2ae5fcb09e92bf
|
||||
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path(
|
||||
"m/44'/0'/0'/0/5"
|
||||
), # 1GA9u9TfCG7SWmKCveBumdA1TZpfom6ZdJ
|
||||
address_n=parse_path("m/44'/0'/0'/0/5"), # 1GA9u9TfCG7SWmKCveBumdA1TZpfom6ZdJ
|
||||
amount=50000,
|
||||
prev_hash=TXHASH_50f6f1,
|
||||
prev_index=1,
|
||||
)
|
||||
|
||||
out1 = messages.TxOutputType(
|
||||
address_n=parse_path(
|
||||
"m/44'/0'/0'/1/3"
|
||||
), # 1EcL6AyfQTyWKGvXwNSfsWoYnD3whzVFdu
|
||||
address_n=parse_path("m/44'/0'/0'/1/3"), # 1EcL6AyfQTyWKGvXwNSfsWoYnD3whzVFdu
|
||||
amount=30000,
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
@ -285,7 +283,8 @@ class TestMsgSigntx:
|
||||
== "01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a47304402203429bd3ce7b38c5c1e8a15340edd79ced41a2939aae62e259d2e3d18e0c5ee7602201b83b10ebc4d6dcee3f9eb42ba8f1ef8a059a05397e0c1b9223d1565a3e6ec01012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0230750000000000001976a914954820f1de627a703596ac0396f986d958e3de4c88ac10270000000000001976a91405427736705cfbfaff76b1cff48283707fb1037088ac00000000"
|
||||
)
|
||||
|
||||
def test_one_three_fee(self, client):
|
||||
|
||||
def test_one_three_fee(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -352,7 +351,8 @@ class TestMsgSigntx:
|
||||
== "fedbba83b115725a713c2b1a13db09fd33de582132d520a3f6ff72503ca5da61"
|
||||
)
|
||||
|
||||
def test_two_two(self, client):
|
||||
|
||||
def test_two_two(client):
|
||||
# tx: c6be22d34946593bcad1d2b013e12f74159e69574ffea21581dad115572e031c
|
||||
# input 1: 0.0010 BTC
|
||||
# tx: 58497a7757224d1ff1941488d23087071103e5bf855f4c1c44e5c8d9d82ca46e
|
||||
@ -432,8 +432,9 @@ class TestMsgSigntx:
|
||||
== "6f9775545830731a316a4c2a39515b1890e9c8ab0f9e21e7c6a6ca2c1499116d"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_lots_of_inputs(self, client):
|
||||
def test_lots_of_inputs(client):
|
||||
# Tests if device implements serialization of len(inputs) correctly
|
||||
# tx 4a7b7e0403ae5607e473949cfa03f09f2cd8b0f404bf99ce10b7303d86280bf7 : 100 UTXO for spending for unit tests
|
||||
inputs = []
|
||||
@ -459,8 +460,9 @@ class TestMsgSigntx:
|
||||
== "f90cdc2224366312be28166e2afe198ece7a60e86e25f5a50f5b14d811713da8"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_lots_of_outputs(self, client):
|
||||
def test_lots_of_outputs(client):
|
||||
# Tests if device implements serialization of len(outputs) correctly
|
||||
|
||||
# tx: c63e24ed820c5851b60c54613fbc4bcb37df6cd49b4c96143e99580a472f79fb
|
||||
@ -501,8 +503,9 @@ class TestMsgSigntx:
|
||||
== "aa0cfe57938b71db47a3992b25d4bee39f258a5de513c907727b982478648a7d"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_lots_of_change(self, client):
|
||||
def test_lots_of_change(client):
|
||||
# Tests if device implements prompting for multiple change addresses correctly
|
||||
|
||||
# tx: c63e24ed820c5851b60c54613fbc4bcb37df6cd49b4c96143e99580a472f79fb
|
||||
@ -587,7 +590,8 @@ class TestMsgSigntx:
|
||||
== "fae68e4a3a4b0540eb200e2218a6d8465eac469788ccb236e0d5822d105ddde9"
|
||||
)
|
||||
|
||||
def test_fee_high_warning(self, client):
|
||||
|
||||
def test_fee_high_warning(client):
|
||||
# tx: 1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6
|
||||
# input 0: 1.0 BTC
|
||||
|
||||
@ -632,8 +636,9 @@ class TestMsgSigntx:
|
||||
== "c36928aca6452d50cb63e2592200bbcc3722ce6b631b1dfd185ccdf9a954af28"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_fee_high_hardfail(self, client):
|
||||
def test_fee_high_hardfail(client):
|
||||
# tx: 1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6
|
||||
# input 0: 1.0 BTC
|
||||
|
||||
@ -680,7 +685,8 @@ class TestMsgSigntx:
|
||||
== "0fadc325662e84fd1a5efcb20c5369cf9134a24b6d29bce99f61e69680397a79"
|
||||
)
|
||||
|
||||
def test_not_enough_funds(self, client):
|
||||
|
||||
def test_not_enough_funds(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -707,11 +713,10 @@ class TestMsgSigntx:
|
||||
]
|
||||
)
|
||||
with pytest.raises(TrezorFailure, match="NotEnoughFunds"):
|
||||
btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=TX_CACHE_MAINNET
|
||||
)
|
||||
btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=TX_CACHE_MAINNET)
|
||||
|
||||
def test_p2sh(self, client):
|
||||
|
||||
def test_p2sh(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("44h/0h/0h/0/0"),
|
||||
amount=400000,
|
||||
@ -752,7 +757,8 @@ class TestMsgSigntx:
|
||||
== "5042aed319b9f018d693dbf8f3db926ee4ab4dae670a2911625b440a1366f79d"
|
||||
)
|
||||
|
||||
def test_testnet_big_amount(self, client):
|
||||
|
||||
def test_testnet_big_amount(client):
|
||||
# This test is testing transaction with amount bigger than fits to uint32
|
||||
|
||||
# tx: 2bac7ad1dec654579a71ea9555463f63ac7b7df9d8ba67b4682bba4e514d0f0c:1
|
||||
@ -777,8 +783,9 @@ class TestMsgSigntx:
|
||||
== "01000000010c0f4d514eba2b68b467bad8f97d7bac633f465595ea719a5754c6ded17aac2b010000006b4830450221008e3b926f04d8830bd5b67698af25c9e00c9db1b1ef3e5d69af794446753da94a02202d4a7509f26bba29ff643a7ac0d43fb128c1a632cc502b8f44eada8930fb9c9b0121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0ffffffff014ac39eb75f0000001976a9145b157a678a10021243307e4bb58f36375aa80e1088ac00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_attack_change_outputs(self, client):
|
||||
def test_attack_change_outputs(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("44h/0h/0h/0/0"),
|
||||
amount=100000,
|
||||
@ -842,9 +849,10 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_MAINNET,
|
||||
)
|
||||
|
||||
|
||||
# Ensure that if the change output is modified after the user confirms the
|
||||
# transaction, then signing fails.
|
||||
def test_attack_modify_change_address(self, client):
|
||||
def test_attack_modify_change_address(client):
|
||||
# see 87be0736f202f7c2bff0781b42bad3e0cdcb54761939da69ea793a3735552c56
|
||||
|
||||
# tx: e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd
|
||||
@ -887,11 +895,10 @@ class TestMsgSigntx:
|
||||
# Set up attack processors
|
||||
client.set_filter(messages.TxAck, attack_processor)
|
||||
|
||||
btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET
|
||||
)
|
||||
btc.sign_tx(client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET)
|
||||
|
||||
def test_attack_change_input_address(self, client):
|
||||
|
||||
def test_attack_change_input_address(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("44'/1'/4'/0/0"),
|
||||
# moUJnmge8SRXuediK7bW6t4YfrPqbE6hD7
|
||||
@ -967,7 +974,8 @@ class TestMsgSigntx:
|
||||
assert exc.value.code == messages.FailureType.ProcessError
|
||||
assert exc.value.message.endswith("Transaction has changed during signing")
|
||||
|
||||
def test_spend_coinbase(self, client):
|
||||
|
||||
def test_spend_coinbase(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("44h/1h/0h/0/0"),
|
||||
amount=2500278230,
|
||||
@ -1008,7 +1016,8 @@ class TestMsgSigntx:
|
||||
== "cf5a8ad5a4f0211953e0d40d9145d6651f0d90203e52913e780065bd00840da3"
|
||||
)
|
||||
|
||||
def test_two_changes(self, client):
|
||||
|
||||
def test_two_changes(client):
|
||||
# see 87be0736f202f7c2bff0781b42bad3e0cdcb54761939da69ea793a3735552c56
|
||||
|
||||
# tx: e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd
|
||||
@ -1071,7 +1080,8 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_TESTNET,
|
||||
)
|
||||
|
||||
def test_change_on_main_chain_allowed(self, client):
|
||||
|
||||
def test_change_on_main_chain_allowed(client):
|
||||
# see 87be0736f202f7c2bff0781b42bad3e0cdcb54761939da69ea793a3735552c56
|
||||
|
||||
# tx: e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd
|
||||
@ -1126,7 +1136,8 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_TESTNET,
|
||||
)
|
||||
|
||||
def test_not_enough_vouts(self, client):
|
||||
|
||||
def test_not_enough_vouts(client):
|
||||
prev_tx = TX_CACHE_MAINNET[TXHASH_157041]
|
||||
|
||||
# tx has two vouts
|
||||
@ -1171,6 +1182,7 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_MAINNET,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"field, value",
|
||||
(
|
||||
@ -1181,7 +1193,7 @@ class TestMsgSigntx:
|
||||
("branch_id", 13),
|
||||
),
|
||||
)
|
||||
def test_prevtx_forbidden_fields(self, client, field, value):
|
||||
def test_prevtx_forbidden_fields(client, field, value):
|
||||
inp0 = messages.TxInputType(
|
||||
address_n=parse_path("44h/0h/0h/0/0"),
|
||||
prev_hash=TXHASH_157041,
|
||||
@ -1197,18 +1209,17 @@ class TestMsgSigntx:
|
||||
prev_tx = TX_CACHE_MAINNET[TXHASH_157041]
|
||||
setattr(prev_tx, field, value)
|
||||
name = field.replace("_", " ")
|
||||
with pytest.raises(
|
||||
TrezorFailure, match=rf"(?i){name} not enabled on this coin"
|
||||
):
|
||||
with pytest.raises(TrezorFailure, match=rf"(?i){name} not enabled on this coin"):
|
||||
btc.sign_tx(
|
||||
client, "Bitcoin", [inp0], [out1], prev_txes={TXHASH_157041: prev_tx}
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"field, value",
|
||||
(("expiry", 9), ("timestamp", 42), ("version_group_id", 69), ("branch_id", 13)),
|
||||
)
|
||||
def test_signtx_forbidden_fields(self, client, field, value):
|
||||
def test_signtx_forbidden_fields(client, field, value):
|
||||
inp0 = messages.TxInputType(
|
||||
address_n=parse_path("44h/0h/0h/0/0"),
|
||||
prev_hash=TXHASH_157041,
|
||||
@ -1223,18 +1234,17 @@ class TestMsgSigntx:
|
||||
|
||||
kwargs = {field: value}
|
||||
name = field.replace("_", " ")
|
||||
with pytest.raises(
|
||||
TrezorFailure, match=rf"(?i){name} not enabled on this coin"
|
||||
):
|
||||
with pytest.raises(TrezorFailure, match=rf"(?i){name} not enabled on this coin"):
|
||||
btc.sign_tx(
|
||||
client, "Bitcoin", [inp0], [out1], prev_txes=TX_CACHE_MAINNET, **kwargs
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"script_type",
|
||||
(messages.InputScriptType.SPENDADDRESS, messages.InputScriptType.EXTERNAL),
|
||||
)
|
||||
def test_incorrect_input_script_type(self, client, script_type):
|
||||
def test_incorrect_input_script_type(client, script_type):
|
||||
address_n = parse_path("44'/1'/0'/0/0")
|
||||
attacker_multisig_public_key = bytes.fromhex(
|
||||
"030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
||||
@ -1278,9 +1288,8 @@ class TestMsgSigntx:
|
||||
with pytest.raises(
|
||||
TrezorFailure, match="Multisig field provided but not expected."
|
||||
):
|
||||
btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET
|
||||
)
|
||||
btc.sign_tx(client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"script_type",
|
||||
@ -1289,7 +1298,7 @@ class TestMsgSigntx:
|
||||
messages.OutputScriptType.PAYTOSCRIPTHASH,
|
||||
),
|
||||
)
|
||||
def test_incorrect_output_script_type(self, client, script_type):
|
||||
def test_incorrect_output_script_type(client, script_type):
|
||||
address_n = parse_path("44'/1'/0'/0/0")
|
||||
attacker_multisig_public_key = bytes.fromhex(
|
||||
"030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
||||
@ -1332,15 +1341,14 @@ class TestMsgSigntx:
|
||||
with pytest.raises(
|
||||
TrezorFailure, match="Multisig field provided but not expected."
|
||||
):
|
||||
btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET
|
||||
)
|
||||
btc.sign_tx(client, "Testnet", [inp1], [out1, out2], prev_txes=TX_CACHE_TESTNET)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"lock_time, sequence",
|
||||
((499999999, 0xFFFFFFFE), (500000000, 0xFFFFFFFE), (1, 0xFFFFFFFF)),
|
||||
)
|
||||
def test_lock_time(self, client, lock_time, sequence):
|
||||
def test_lock_time(client, lock_time, sequence):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -1387,8 +1395,9 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_MAINNET,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1(reason="Cannot test layouts on T1")
|
||||
def test_lock_time_blockheight(self, client):
|
||||
def test_lock_time_blockheight(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -1433,11 +1442,12 @@ class TestMsgSigntx:
|
||||
prev_txes=TX_CACHE_MAINNET,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1(reason="Cannot test layouts on T1")
|
||||
@pytest.mark.parametrize(
|
||||
"lock_time_str", ("1985-11-05 00:53:20", "2048-08-16 22:14:00")
|
||||
)
|
||||
def test_lock_time_datetime(self, client, lock_time_str):
|
||||
def test_lock_time_datetime(client, lock_time_str):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
|
@ -39,10 +39,10 @@ TXHASH_8b6db9 = bytes.fromhex(
|
||||
"8b6db9b8ba24235d86b053ea2ccb484fc32b96f89c3c39f98d86f90db16076a0"
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.altcoin
|
||||
|
||||
@pytest.mark.altcoin
|
||||
class TestMsgSigntxBch:
|
||||
def test_send_bch_change(self, client):
|
||||
|
||||
def test_send_bch_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/145'/0'/0/0"),
|
||||
# bitcoincash:qr08q88p9etk89wgv05nwlrkm4l0urz4cyl36hh9sv
|
||||
@ -88,7 +88,8 @@ class TestMsgSigntxBch:
|
||||
== "0100000001781a716b1e15b41b07157933e5d777392a75bf87132650cb2e7d46fb8dc237bc000000006a473044022061aee4f17abe044d5df8c52c9ffd3b84e5a29743517e488b20ecf1ae0b3e4d3a02206bb84c55e407f3b684ff8d9bea0a3409cfd865795a19d10b3d3c31f12795c34a412103a020b36130021a0f037c1d1a02042e325c0cb666d6478c1afdcd9d913b9ef080ffffffff0272ee1c00000000001976a914b1401fce7e8bf123c88a0467e0ed11e3b9fbef5488acec1e0100000000001976a914d51eca49695cdf47e7f4b55507893e3ad53fe9d888ac00000000"
|
||||
)
|
||||
|
||||
def test_send_bch_nochange(self, client):
|
||||
|
||||
def test_send_bch_nochange(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/145'/0'/1/0"),
|
||||
# bitcoincash:qzc5q87w069lzg7g3gzx0c8dz83mn7l02scej5aluw
|
||||
@ -143,7 +144,8 @@ class TestMsgSigntxBch:
|
||||
== "01000000022c06cf6f215c5cbfd7caa8e71b1b32630cabf1f816a4432815b037b277852e50000000006a47304402207a2a955f1cb3dc5f03f2c82934f55654882af4e852e5159639f6349e9386ec4002205fb8419dce4e648eae8f67bc4e369adfb130a87d2ea2d668f8144213b12bb457412103174c61e9c5362507e8061e28d2c0ce3d4df4e73f3535ae0b12f37809e0f92d2dffffffff2c06cf6f215c5cbfd7caa8e71b1b32630cabf1f816a4432815b037b277852e50010000006a473044022062151cf960b71823bbe68c7ed2c2a93ad1b9706a30255fddb02fcbe056d8c26102207bad1f0872bc5f0cfaf22e45c925c35d6c1466e303163b75cb7688038f1a5541412102595caf9aeb6ffdd0e82b150739a83297358b9a77564de382671056ad9e5b8c58ffffffff0170861d00000000001976a91434e9cec317896e818619ab7dc99d2305216ff4af88ac00000000"
|
||||
)
|
||||
|
||||
def test_send_bch_oldaddr(self, client):
|
||||
|
||||
def test_send_bch_oldaddr(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/145'/0'/1/0"),
|
||||
# bitcoincash:qzc5q87w069lzg7g3gzx0c8dz83mn7l02scej5aluw
|
||||
@ -198,7 +200,8 @@ class TestMsgSigntxBch:
|
||||
== "01000000022c06cf6f215c5cbfd7caa8e71b1b32630cabf1f816a4432815b037b277852e50000000006a47304402207a2a955f1cb3dc5f03f2c82934f55654882af4e852e5159639f6349e9386ec4002205fb8419dce4e648eae8f67bc4e369adfb130a87d2ea2d668f8144213b12bb457412103174c61e9c5362507e8061e28d2c0ce3d4df4e73f3535ae0b12f37809e0f92d2dffffffff2c06cf6f215c5cbfd7caa8e71b1b32630cabf1f816a4432815b037b277852e50010000006a473044022062151cf960b71823bbe68c7ed2c2a93ad1b9706a30255fddb02fcbe056d8c26102207bad1f0872bc5f0cfaf22e45c925c35d6c1466e303163b75cb7688038f1a5541412102595caf9aeb6ffdd0e82b150739a83297358b9a77564de382671056ad9e5b8c58ffffffff0170861d00000000001976a91434e9cec317896e818619ab7dc99d2305216ff4af88ac00000000"
|
||||
)
|
||||
|
||||
def test_attack_change_input(self, client):
|
||||
|
||||
def test_attack_change_input(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/145'/10'/0/0"),
|
||||
amount=1995344,
|
||||
@ -250,8 +253,9 @@ class TestMsgSigntxBch:
|
||||
with pytest.raises(TrezorFailure):
|
||||
btc.sign_tx(client, "Bcash", [inp1], [out1, out2], prev_txes=TX_API)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_bch_multisig_wrongchange(self, client):
|
||||
def test_send_bch_multisig_wrongchange(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"48'/145'/{i}'/0'"), coin_name="Bcash"
|
||||
@ -330,8 +334,9 @@ class TestMsgSigntxBch:
|
||||
== "01000000015f3d291cae106548f3be5ed0f4cbedc65668fa881d60347ab0d512df10af8cf601000000fc0047304402205ce02f7bf3ef225e4a17e2b5a98dc6ca5536a6b68088f94200390a1d505c4f3e022045657781095e01422736c5541b03b014101d76e54089eda030cb016dfce10e984147304402207274b5a4d15e75f3df7319a375557b0efba9b27bc63f9f183a17da95a6125c94022000efac57629f1522e2d3958430e2ef073b0706cfac06cce492651b79858f09ae414c69522102962724052105f03332ab700812afc5ca665d264b13339be1fe7f7fdd3a2a685821024364cd1fdc2aa05bc8b09874a57aa1082a47ac9062d35f22ed5f4afefb3f67fc21024d375b44804f3b0c3493ea0806eb25cc85f51e0d616d6bd6e4ef0388e71cd29e53aeffffffff01d85900000000000017a9140d5566bfc721e6c3d5ab583841d387f3939ffed38700000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_bch_multisig_change(self, client):
|
||||
def test_send_bch_multisig_change(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"48'/145'/{i}'/0'"), coin_name="Bcash"
|
||||
@ -434,8 +439,9 @@ class TestMsgSigntxBch:
|
||||
== "0100000001a07660b10df9868df9393c9cf8962bc34f48cb2cea53b0865d2324bab8b96d8b00000000fdfd0000483045022100cc12faf18a489d8014e978ef7ca0760aa6487cdb40b49dd991bfe9c66625f5a802206088fef49ecad30679d55eaa870741bbb8b83fac08eb078872ac276c8139015d4147304402202b75dbb307d2556b9a85851d27ab118b3f06344bccb6e21b0a5dfcf74e0e644f02206611c59396d44741d34fd7bb602be06ef91690b22b47c3f3c271e15e20176ac0414c6952210290cc724ccb90a6c7c1c3b291938449464ea474390183909e51bcd2807ecb779d210222f537684e2933563f737192fbf1947fd9034402e5708d10f6decd8e1f03e172210350df5cb41013d6b06581230556006b0a85ccccd205745cc10c927755193c241b53aeffffffff02c05d0000000000001976a91400741952f6a6eab5394f366db5cc5a54b0c2429f88acc05d00000000000017a914dfc8c2dda26f7151ed7df8aeeca24089e6410fdd8700000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_send_bch_external_presigned(self, client):
|
||||
def test_send_bch_external_presigned(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# address_n=parse_path("44'/145'/0'/1/0"),
|
||||
# bitcoincash:qzc5q87w069lzg7g3gzx0c8dz83mn7l02scej5aluw
|
||||
|
@ -36,11 +36,11 @@ TXHASH_f55c5b = bytes.fromhex(
|
||||
"f55c5bc925eb2a0bf9de0ac142b24bed81ec46dd2151d5f69728070eaea1aded"
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.altcoin
|
||||
|
||||
|
||||
# All data taken from T1
|
||||
@pytest.mark.altcoin
|
||||
class TestMsgSigntxBitcoinGold:
|
||||
def test_send_bitcoin_gold_change(self, client):
|
||||
def test_send_bitcoin_gold_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/156'/0'/0/0"),
|
||||
amount=1252382934,
|
||||
@ -86,7 +86,8 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "39a0716c361610724c7c40916baa20808cbdd7538b6c38689ce80cb73e7f51d1"
|
||||
)
|
||||
|
||||
def test_send_bitcoin_gold_nochange(self, client):
|
||||
|
||||
def test_send_bitcoin_gold_nochange(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/156'/0'/1/0"),
|
||||
amount=1252382934,
|
||||
@ -140,7 +141,8 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "ac9d452b900eb747d3137e1f3044bb0f46efaeb6e0fc8c27b02d1d08d238a904"
|
||||
)
|
||||
|
||||
def test_attack_change_input(self, client):
|
||||
|
||||
def test_attack_change_input(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/156'/11'/0/0"),
|
||||
amount=1252382934,
|
||||
@ -193,8 +195,9 @@ class TestMsgSigntxBitcoinGold:
|
||||
with pytest.raises(TrezorFailure):
|
||||
btc.sign_tx(client, "Bgold", [inp1], [out1, out2], prev_txes=TX_API)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_btg_multisig_change(self, client):
|
||||
def test_send_btg_multisig_change(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"48'/156'/{i}'/0'"), coin_name="Bgold"
|
||||
@ -299,7 +302,8 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "2677130ec0c5eea2249787fe17b85770cfb35dfce550830a7fb6c6acd9375114"
|
||||
)
|
||||
|
||||
def test_send_p2sh(self, client):
|
||||
|
||||
def test_send_p2sh(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/156'/0'/1/0"),
|
||||
amount=1252382934,
|
||||
@ -347,7 +351,8 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "d5732fc8a594ae3b7ba695d7b276b2186f8572b0eb157120e0ba35d3511c6060"
|
||||
)
|
||||
|
||||
def test_send_p2sh_witness_change(self, client):
|
||||
|
||||
def test_send_p2sh_witness_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/156'/0'/1/0"),
|
||||
amount=1252382934,
|
||||
@ -394,8 +399,9 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "eed4ef86a408602e35ae416591f349847db38cdaddef1429a9bb0e39520d100d"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_1(self, client):
|
||||
def test_send_multisig_1(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"49'/156'/{i}'"), coin_name="Bgold"
|
||||
@ -439,9 +445,7 @@ class TestMsgSigntxBitcoinGold:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Bgold", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Bgold", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[0] = signatures[0]
|
||||
# sign with third key
|
||||
@ -472,7 +476,8 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "efa5b21916ac7ea5316c38b2d7d5520d80cbe563c58304f956ea6ddb241001d1"
|
||||
)
|
||||
|
||||
def test_send_mixed_inputs(self, client):
|
||||
|
||||
def test_send_mixed_inputs(client):
|
||||
# First is non-segwit, second is segwit.
|
||||
|
||||
inp1 = proto.TxInputType(
|
||||
@ -505,8 +510,9 @@ class TestMsgSigntxBitcoinGold:
|
||||
== "2c64109fba890657e37f0782efda29bbc277dfd521658f185d302ddffcacffd2"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_send_btg_external_presigned(self, client):
|
||||
def test_send_btg_external_presigned(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/156'/0'/1/0"),
|
||||
amount=1252382934,
|
||||
@ -521,9 +527,7 @@ class TestMsgSigntxBitcoinGold:
|
||||
prev_hash=TXHASH_f55c5b,
|
||||
prev_index=0,
|
||||
script_type=proto.InputScriptType.EXTERNAL,
|
||||
script_pubkey=bytes.fromhex(
|
||||
"a914aee37ad448e17438cabfee1756f2a08e33ed3ce887"
|
||||
),
|
||||
script_pubkey=bytes.fromhex("a914aee37ad448e17438cabfee1756f2a08e33ed3ce887"),
|
||||
script_sig=bytes.fromhex("1600147c5edda9b293db2c8894b9d81efd77764910c445"),
|
||||
witness=bytes.fromhex(
|
||||
"024730440220091eece828409b3a9aa92dd2f9b032f9fb3a12b21b323a3fdea3cb18d08249af022065412107afcf76b0d28b90188c802f8f17b41790ed81c868d0ee23f1dd2ec53441210386789a34fe1a49bfc3e174adc6706c6222b0d80de76b884a0e3d32f8e9c4dc3e"
|
||||
|
@ -38,10 +38,10 @@ TXHASH_15575a = bytes.fromhex(
|
||||
"15575a1c874bd60a819884e116c42e6791c8283ce1fc3b79f0d18531a61bbb8a"
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.altcoin
|
||||
|
||||
@pytest.mark.altcoin
|
||||
class TestMsgSigntxDash:
|
||||
def test_send_dash(self, client):
|
||||
|
||||
def test_send_dash(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/5'/0'/0/0"),
|
||||
# dash:XdTw4G5AWW4cogGd7ayybyBNDbuB45UpgH
|
||||
@ -74,16 +74,15 @@ class TestMsgSigntxDash:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Dash", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(client, "Dash", [inp1], [out1], prev_txes=TX_API)
|
||||
|
||||
assert (
|
||||
serialized_tx.hex()
|
||||
== "01000000014fb02af26dca339e7e06c4f148dfce57c9afa5f537d0d8e733022a4ba6ea7955010000006a4730440220387be4d1e4b5e355614091416373e99e1a3532b8cc9a8629368060aff2681bdb02200a0c4a5e9eb2ce6adb6c2e01ec8f954463dcc04f531ed8a89a2b40019d5aeb0b012102936f80cac2ba719ddb238646eb6b78a170a55a52a9b9f08c43523a4a6bd5c896ffffffff0118c69a3b000000001976a9149710d6545407e78c326aa8c8ae386ec7f883b0af88ac00000000"
|
||||
)
|
||||
|
||||
def test_send_dash_dip2_input(self, client):
|
||||
|
||||
def test_send_dash_dip2_input(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/5'/0'/0/0"),
|
||||
# dash:XdTw4G5AWW4cogGd7ayybyBNDbuB45UpgH
|
||||
|
@ -51,11 +51,10 @@ TXHASH_1f00fc = bytes.fromhex(
|
||||
"1f00fc54530d7c4877f5032e91b6c507f6a1531861dede2ab134e5c0b5dfe8c8"
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.altcoin, pytest.mark.decred]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.decred
|
||||
class TestMsgSigntxDecred:
|
||||
def test_send_decred(self, client):
|
||||
|
||||
def test_send_decred(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# TscqTv1he8MZrV321SfRghw7LFBCJDKB3oz
|
||||
address_n=parse_path("m/44'/1'/0'/0/0"),
|
||||
@ -98,8 +97,9 @@ class TestMsgSigntxDecred:
|
||||
== "0100000001edd579e9462ee0e80127a817e0500d4f942a4cf8f2d6530e0c0a9ab3f04862e10100000000ffffffff01802b530b0000000000001976a914819d291a2f7fbf770e784bfd78b5ce92c58e95ea88ac00000000000000000100c2eb0b0000000000000000ffffffff6a473044022009e394c7dec76ab6988270b467839b1462ad781556bce37383b76e026418ce6302204f7f6ef535d2986b095d7c96232a0990a0b9ce3004894b39c167bb18e5833ac30121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_purchase_ticket_decred(self, client):
|
||||
def test_purchase_ticket_decred(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("m/44'/1'/0'/0/0"),
|
||||
prev_hash=TXHASH_e16248,
|
||||
@ -157,8 +157,9 @@ class TestMsgSigntxDecred:
|
||||
== "0100000001edd579e9462ee0e80127a817e0500d4f942a4cf8f2d6530e0c0a9ab3f04862e10100000000ffffffff03603bea0b0000000000001aba76a914819d291a2f7fbf770e784bfd78b5ce92c58e95ea88ac00000000000000000000206a1edc1a98d791735eb9a8715a2a219c23680edcedad00c2eb0b000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac00000000000000000100c2eb0b0000000000000000ffffffff6b4830450221008ced5411a6d92b761bdd8b9f7fbc5bfae3c31f9369050c218977f4540ab1ec9602206e89c821878ebfd959d1c4a63100eec5b1154c8d9508c039bb78e333498a73b40121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_spend_from_stake_generation_and_revocation_decred(self, client):
|
||||
def test_spend_from_stake_generation_and_revocation_decred(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("m/44'/1'/0'/0/0"),
|
||||
prev_hash=TXHASH_8b6890,
|
||||
@ -218,7 +219,8 @@ class TestMsgSigntxDecred:
|
||||
== "010000000254e249113666e84c70de1dbee976f18d1438e4b7c58b376ffe64370ac190688b0200000001ffffffffc8e8dfb5c0e534b12adede611853a1f607c5b6912e03f577487c0d5354fc001f0000000001ffffffff0160fdd5170000000000001976a914819d291a2f7fbf770e784bfd78b5ce92c58e95ea88ac00000000000000000200c2eb0b0000000000000000ffffffff6b483045022100bdcb877c97d72db74eca06fefa21a7f7b00afcd5d916fce2155ed7df1ca5546102201e1f9efd7d652b449474c2c70171bfc4535544927bed62021f7334447d1ea4740121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd000c2eb0b0000000000000000ffffffff6a473044022030c5743c442bd696d19dcf73d54e95526e726de965c2e2b4b9fd70248eaae21d02201305a3bcc2bb0e33122277763990e3b48f317d61264a68d190fb8acfc004cc640121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
|
||||
)
|
||||
|
||||
def test_send_decred_change(self, client):
|
||||
|
||||
def test_send_decred_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# TscqTv1he8MZrV321SfRghw7LFBCJDKB3oz
|
||||
address_n=parse_path("m/44'/1'/0'/0/0"),
|
||||
@ -305,8 +307,9 @@ class TestMsgSigntxDecred:
|
||||
== "010000000370b95980a47b9bcb4ec2c2b450888a53179b1a5fdb23f5023cc533a300356e5e0000000000ffffffff74bc93bcfce18aff2e522d6822817522e2815a00175b2eae59ef20d20f5bf9cc0100000000ffffffff13317ab453832deabd684d2302eed42580c28ba3e715db66a731a8723eef95f30000000000ffffffff02d86c341d0000000000001976a9143eb656115197956125365348c542e37b6d3d259988ac00e1f5050000000000001976a9143ee6f9d662e7be18373d80e5eb44627014c2bf6688ac000000000000000003802b530b0000000000000000ffffffff6a47304402200e50a6d43c462045917792e7d03b4354900c3baccb7abef66f556a32b12f2ca6022031ae94fdf2a41dd6ed2e081faf0f8f1c64411a1b46eb26f7f35d94402b2bde110121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd000c2eb0b0000000000000000ffffffff6a47304402204894c2f8e76c4645d2df600cdd01443aeb48807b72150c4bc10eebd126529532022054cd37462a3f0ddb85c75b4e874ab0c2aad7eebcff3e6c1ac20e1c16babe36720121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd000c2eb0b0000000000000000ffffffff6b4830450221009f1ba584023da8aafd57374e83be68f1a097b906967ec9e50736f31bfc7989f102204a190fc2885e394572b5c2ced046657b1dd07abdb19144e21e78987968c7f17601210294e3e5e77e22eea0e4c0d30d89beb4db7f69b4bf1ae709e411d6a06618b8f852"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_decred_multisig_change(self, client):
|
||||
def test_decred_multisig_change(client):
|
||||
paths = [parse_path(f"m/48'/1'/{index}'/0'") for index in range(3)]
|
||||
nodes = [
|
||||
btc.get_public_node(client, address_n, coin_name="Decred Testnet").node
|
||||
|
@ -35,10 +35,10 @@ TXHASH_4f2f85 = bytes.fromhex(
|
||||
"4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.altcoin
|
||||
|
||||
@pytest.mark.altcoin
|
||||
class TestMsgSigntxGRS:
|
||||
def test_legacy(self, client):
|
||||
|
||||
def test_legacy(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
|
||||
address_n=parse_path("44'/17'/0'/0/2"),
|
||||
@ -59,7 +59,8 @@ class TestMsgSigntxGRS:
|
||||
== "01000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac00000000"
|
||||
)
|
||||
|
||||
def test_legacy_change(self, client):
|
||||
|
||||
def test_legacy_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
|
||||
address_n=parse_path("44'/17'/0'/0/2"),
|
||||
@ -68,9 +69,7 @@ class TestMsgSigntxGRS:
|
||||
prev_index=0,
|
||||
)
|
||||
out1 = proto.TxOutputType(
|
||||
address_n=parse_path(
|
||||
"44'/17'/0'/0/3"
|
||||
), # FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9
|
||||
address_n=parse_path("44'/17'/0'/0/3"), # FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9
|
||||
amount=210016 - 192,
|
||||
script_type=proto.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
@ -82,7 +81,8 @@ class TestMsgSigntxGRS:
|
||||
== "01000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac00000000"
|
||||
)
|
||||
|
||||
def test_send_segwit_p2sh(self, client):
|
||||
|
||||
def test_send_segwit_p2sh(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
@ -115,7 +115,8 @@ class TestMsgSigntxGRS:
|
||||
== "01000000000101cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
|
||||
)
|
||||
|
||||
def test_send_segwit_p2sh_change(self, client):
|
||||
|
||||
def test_send_segwit_p2sh_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
@ -148,7 +149,8 @@ class TestMsgSigntxGRS:
|
||||
== "01000000000101cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
|
||||
)
|
||||
|
||||
def test_send_segwit_native(self, client):
|
||||
|
||||
def test_send_segwit_native(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("84'/1'/0'/0/0"),
|
||||
amount=12300000,
|
||||
@ -180,7 +182,8 @@ class TestMsgSigntxGRS:
|
||||
== "01000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900"
|
||||
)
|
||||
|
||||
def test_send_segwit_native_change(self, client):
|
||||
|
||||
def test_send_segwit_native_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("84'/1'/0'/0/0"),
|
||||
amount=12300000,
|
||||
|
@ -32,15 +32,13 @@ TXHASH_d5f65e = bytes.fromhex(
|
||||
"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"
|
||||
)
|
||||
|
||||
|
||||
class TestMsgSigntxInvalidPath:
|
||||
pytestmark = pytest.mark.altcoin
|
||||
|
||||
# Adapted from TestMsgSigntx.test_one_one_fee,
|
||||
# only changed the coin from Bitcoin to Litecoin.
|
||||
# Litecoin does not have strong replay protection using SIGHASH_FORKID,
|
||||
# spending from Bitcoin path should fail.
|
||||
@pytest.mark.altcoin
|
||||
def test_invalid_path_fail(self, client):
|
||||
def test_invalid_path_fail(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -64,12 +62,12 @@ class TestMsgSigntxInvalidPath:
|
||||
assert exc.value.code == proto.FailureType.DataError
|
||||
assert exc.value.message.endswith("Forbidden key path")
|
||||
|
||||
|
||||
# Adapted from TestMsgSigntx.test_one_one_fee,
|
||||
# only changed the coin from Bitcoin to Litecoin and set safety checks to prompt.
|
||||
# Litecoin does not have strong replay protection using SIGHASH_FORKID, but
|
||||
# spending from Bitcoin path should pass with safety checks set to prompt.
|
||||
@pytest.mark.altcoin
|
||||
def test_invalid_path_prompt(self, client):
|
||||
def test_invalid_path_prompt(client):
|
||||
# tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
@ -93,12 +91,12 @@ class TestMsgSigntxInvalidPath:
|
||||
|
||||
btc.sign_tx(client, "Litecoin", [inp1], [out1], prev_txes=TX_CACHE_MAINNET)
|
||||
|
||||
|
||||
# Adapted from TestMsgSigntx.test_one_one_fee,
|
||||
# only changed the coin from Bitcoin to Bcash.
|
||||
# Bcash does have strong replay protection using SIGHASH_FORKID,
|
||||
# spending from Bitcoin path should work.
|
||||
@pytest.mark.altcoin
|
||||
def test_invalid_path_pass_forkid(self, client):
|
||||
def test_invalid_path_pass_forkid(client):
|
||||
# tx: 8cc1f4adf7224ce855cf535a5104594a0004cb3b640d6714fdb00b9128832dd5
|
||||
# input 0: 0.0039 BTC
|
||||
|
||||
|
@ -38,11 +38,10 @@ TXHASH_7b28bd = bytes.fromhex(
|
||||
"7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1"
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.altcoin, pytest.mark.komodo]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.komodo
|
||||
class TestMsgSigntxKomodo:
|
||||
def test_one_one_fee_sapling(self, client):
|
||||
|
||||
def test_one_one_fee_sapling(client):
|
||||
# prevout: 2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d:0
|
||||
# input 1: 10.9998 KMD
|
||||
|
||||
@ -97,7 +96,8 @@ class TestMsgSigntxKomodo:
|
||||
== "0400008085202f89011d0f8e0c6ba2dcf8be8e5f9024771dceb4c8e4120fab8c072b8eec26b1c50728000000006a4730440220158c970ca2fc6bcc33026eb5366f0342f63b35d178f7efb334b1df78fe90b67202207bc4ff69f67cf843b08564a5adc77bf5593e28ab4d5104911824ac13fe885d8f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5ffffffff01d0359041000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acb8302a5d000000000000000000000000000000"
|
||||
)
|
||||
|
||||
def test_one_one_rewards_claim(self, client):
|
||||
|
||||
def test_one_one_rewards_claim(client):
|
||||
# prevout: 7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1:0
|
||||
# input 1: 10.9997 KMD
|
||||
|
||||
|
@ -40,8 +40,7 @@ TXHASH_e5040e = bytes.fromhex(
|
||||
)
|
||||
|
||||
|
||||
class TestMsgSigntxSegwit:
|
||||
def test_send_p2sh(self, client):
|
||||
def test_send_p2sh(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -90,7 +89,8 @@ class TestMsgSigntxSegwit:
|
||||
== "0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff02e0aebb00000000001976a91414fdede0ddc3be652a0ce1afbc1b509a55b6b94888ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100ccd253bfdf8a5593cd7b6701370c531199f0f05a418cd547dfc7da3f21515f0f02203fa08a0753688871c220648f9edadbdb98af42e5d8269364a326572cf703895b012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7900000000"
|
||||
)
|
||||
|
||||
def test_send_p2sh_change(self, client):
|
||||
|
||||
def test_send_p2sh_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -138,7 +138,8 @@ class TestMsgSigntxSegwit:
|
||||
== "0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff02e0aebb00000000001976a91414fdede0ddc3be652a0ce1afbc1b509a55b6b94888ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100ccd253bfdf8a5593cd7b6701370c531199f0f05a418cd547dfc7da3f21515f0f02203fa08a0753688871c220648f9edadbdb98af42e5d8269364a326572cf703895b012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7900000000"
|
||||
)
|
||||
|
||||
def test_testnet_segwit_big_amount(self, client):
|
||||
|
||||
def test_testnet_segwit_big_amount(client):
|
||||
# This test is testing transaction with amount bigger than fits to uint32
|
||||
|
||||
inp1 = proto.TxInputType(
|
||||
@ -177,8 +178,9 @@ class TestMsgSigntxSegwit:
|
||||
== "01000000000101023a2995a4a60c59df1b9559b49b6d8940cb740d47cea10881b27a9e463ce1de00000000171600140099a7ecbd938ed1839f5f6bf6d50933c6db9d5cffffffff01010000000100000017a914097c569095163e84475d07aa95a1f736df895b7b8702483045022100965aa8897c7cd5f0bff830481ed5259bf662ed0415ab497a6a152a3c335eb0a1022060acbbbada909b6575ac6f19382a6bdf4cab2fa1c5421aa66677806f380ddb870121033add1f0e8e3c3136f7428dd4a4de1057380bd311f5b0856e2269170b4ffa65bf00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_1(self, client):
|
||||
def test_send_multisig_1(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"49'/1'/{i}'"), coin_name="Testnet"
|
||||
@ -223,9 +225,7 @@ class TestMsgSigntxSegwit:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[0] = signatures[0]
|
||||
# sign with third key
|
||||
@ -256,7 +256,8 @@ class TestMsgSigntxSegwit:
|
||||
== "01000000000101be0210025c5be68a473f6a38bf53b53bc88d5c46567616026dc056e72b92319c0100000023220020cf28684ff8a6dda1a7a9704dde113ddfcf236558da5ce35ad3f8477474dbdaf7ffffffff01887d1800000000001976a91414fdede0ddc3be652a0ce1afbc1b509a55b6b94888ac040047304402203fc3fbe6cd6250d82ace4a585debc07587c07d2efc8bb56558c91e1f810fe65402206025bd9a4e80960f617b6e5bfdd568e34aa085d093471b7976e6b14c2a2402a7014730440220327abf491a57964d75c67fad204eb782fa74aa4abde40e5ad30fb0b7696102b7022049e31f2302417be0a87e2f818b93a862a7e67d4178b7cbeee680264f0882113f0169522103d54ab3c8b81cb7f8f8088df4c62c105e8acaa2fb53b180f6bc6f922faecf3fdc21036aa47994f3f18f0976d6073ca79997003c3fa29c4f93907998fefc1151b4529b2102a092580f2828272517c402da9461425c5032860ab40180e041fbbb88ea2a520453ae00000000"
|
||||
)
|
||||
|
||||
def test_attack_change_input_address(self, client):
|
||||
|
||||
def test_attack_change_input_address(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -342,7 +343,8 @@ class TestMsgSigntxSegwit:
|
||||
assert exc.value.code == proto.FailureType.ProcessError
|
||||
assert exc.value.message.endswith("Transaction has changed during signing")
|
||||
|
||||
def test_attack_mixed_inputs(self, client):
|
||||
|
||||
def test_attack_mixed_inputs(client):
|
||||
TRUE_AMOUNT = 123456789
|
||||
FAKE_AMOUNT = 120000000
|
||||
|
||||
|
@ -58,8 +58,7 @@ TXHASH_ec16dc = bytes.fromhex(
|
||||
)
|
||||
|
||||
|
||||
class TestMsgSigntxSegwitNative:
|
||||
def test_send_p2sh(self, client):
|
||||
def test_send_p2sh(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -108,7 +107,8 @@ class TestMsgSigntxSegwitNative:
|
||||
== "0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff02e0aebb00000000001600140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100bd3d8b8ad35c094e01f6282277300e575f1021678fc63ec3f9945d6e35670da3022052e26ef0dd5f3741c9d5939d1dec5464c15ab5f2c85245e70a622df250d4eb7c012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7900000000"
|
||||
)
|
||||
|
||||
def test_send_p2sh_change(self, client):
|
||||
|
||||
def test_send_p2sh_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -156,7 +156,8 @@ class TestMsgSigntxSegwitNative:
|
||||
== "0100000000010137c361fb8f2d9056ba8c98c5611930fcb48cacfdd0fe2e0449d83eea982f91200000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff02e0aebb00000000001600140099a7ecbd938ed1839f5f6bf6d50933c6db9d5c3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100bd3d8b8ad35c094e01f6282277300e575f1021678fc63ec3f9945d6e35670da3022052e26ef0dd5f3741c9d5939d1dec5464c15ab5f2c85245e70a622df250d4eb7c012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7900000000"
|
||||
)
|
||||
|
||||
def test_send_native(self, client):
|
||||
|
||||
def test_send_native(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("84'/1'/0'/0/0"),
|
||||
amount=12300000,
|
||||
@ -204,7 +205,8 @@ class TestMsgSigntxSegwitNative:
|
||||
== "010000000001018a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014d16b8c0680c61fc6ed2e407455715055e41052f502473044022073ce72dcf2f6e42eeb44adbe7d5038cf3763f168d1c04bd8b873a19b53331f51022016b051725731e7f53a567021bcd9c370727f551c81e857ebae7c128472119652012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f86200000000"
|
||||
)
|
||||
|
||||
def test_send_to_taproot(self, client):
|
||||
|
||||
def test_send_to_taproot(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("84'/1'/0'/0/0"),
|
||||
amount=10000,
|
||||
@ -232,7 +234,8 @@ class TestMsgSigntxSegwitNative:
|
||||
== "0100000000010131223ed7300b8707bdf87dc789c294520bbb7dc371741a00605d9c535adc16ec0000000000ffffffff02581b0000000000002251206b1bf9065ef5634d34368ab0ab41e4033c0f62a929c26534b9f6a1e8b03c684df00a000000000000160014c62b932e83874e1103aadbe2f95b5e7bb73a275502473044022008ce0e893e91935ada9a31fe6b2f6228070dd2a5bdebc413429e658be761901502207086e0d3aa6abbad29c966444d3b791e43c174f88154381d07c92a84fec7c527012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f86200000000"
|
||||
)
|
||||
|
||||
def test_send_native_change(self, client):
|
||||
|
||||
def test_send_native_change(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("84'/1'/0'/0/0"),
|
||||
amount=12300000,
|
||||
@ -279,7 +282,8 @@ class TestMsgSigntxSegwitNative:
|
||||
== "010000000001018a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090000000000ffffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b024730440220067675423ca6a0be3ddd5e13da00a9433775041e5cebc838873d2686f1d2840102201a5819e0312e6451d6b6180689101bce995685a51524cc4c3a5383f7bdab979a012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f86200000000"
|
||||
)
|
||||
|
||||
def test_send_both(self, client):
|
||||
|
||||
def test_send_both(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("49'/1'/0'/1/0"),
|
||||
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
|
||||
@ -354,12 +358,11 @@ class TestMsgSigntxSegwitNative:
|
||||
== "010000000001028a44999c07bba32df1cacdc50987944e68e3205b4429438fdde35c76024614090100000017160014d16b8c0680c61fc6ed2e407455715055e41052f5ffffffff7b010c5faeb41cc5c253121b6bf69bf1a7c5867cd7f2d91569fea0ecd311b8650100000000ffffffff03e0aebb0000000000160014a579388225827d9f2fe9014add644487808c695d00cdb7020000000017a91491233e24a9bf8dbb19c1187ad876a9380c12e787870d859b03000000001976a914a579388225827d9f2fe9014add644487808c695d88ac02483045022100ead79ee134f25bb585b48aee6284a4bb14e07f03cc130253e83450d095515e5202201e161e9402c8b26b666f2b67e5b668a404ef7e57858ae9a6a68c3837e65fdc69012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7902463043021f585c54a84dc7326fa60e22729accd41153c7dd4725bd4c8f751aa3a8cd8d6a0220631bfd83fc312cc6d5d129572a25178696d81eaf50c8c3f16c6121be4f4c029d012103505647c017ff2156eb6da20fae72173d3b681a1d0a629f95f49e884db300689f00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_1(self, client):
|
||||
def test_send_multisig_1(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"49'/1'/{index}'"), coin_name="Testnet"
|
||||
)
|
||||
btc.get_public_node(client, parse_path(f"49'/1'/{index}'"), coin_name="Testnet")
|
||||
for index in range(1, 4)
|
||||
]
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
@ -402,9 +405,7 @@ class TestMsgSigntxSegwitNative:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[0] = signatures[0]
|
||||
# sign with third key
|
||||
@ -435,12 +436,11 @@ class TestMsgSigntxSegwitNative:
|
||||
== "01000000000101be0210025c5be68a473f6a38bf53b53bc88d5c46567616026dc056e72b92319c01000000232200208d398cfb58a1d9cdb59ccbce81559c095e8c6f4a3e64966ca385078d9879f95effffffff01887d180000000000220020c5f4a0a4ea7c0392efe0a9670a73264cffa90b19107cd8a8e9750ff93c77fdfb0400483045022100dd6342c65197af27d7894d8b8b88b16b568ee3b5ebfdc55fdfb7caa9650e3b4c02200c7074a5bcb0068f63d9014c7cd2b0490aba75822d315d41aad444e9b86adf5201483045022100e7e6c2d21109512ba0609e93903e84bfb7731ac3962ee2c1cad54a7a30ff99a20220421497930226c39fc3834e8d6da3fc876516239518b0e82e2dc1e3c46271a17c01695221021630971f20fa349ba940a6ba3706884c41579cd760c89901374358db5dd545b92102f2ff4b353702d2bb03d4c494be19d77d0ab53d16161b53fbcaf1afeef4ad0cb52103e9b6b1c691a12ce448f1aedbbd588e064869c79fbd760eae3b8cd8a5f1a224db53ae00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_2(self, client):
|
||||
def test_send_multisig_2(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"84'/1'/{index}'"), coin_name="Testnet"
|
||||
)
|
||||
btc.get_public_node(client, parse_path(f"84'/1'/{index}'"), coin_name="Testnet")
|
||||
for index in range(1, 4)
|
||||
]
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
@ -482,9 +482,7 @@ class TestMsgSigntxSegwitNative:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[1] = signatures[0]
|
||||
# sign with first key
|
||||
@ -514,12 +512,11 @@ class TestMsgSigntxSegwitNative:
|
||||
== "010000000001012812fe3916f228cda6c7b57d5464541265a63ad118f430a805eeec8bddbe1cf40000000000ffffffff01a0791800000000002200201e8dda334f11171190b3da72e526d441491464769679a319a2f011da5ad312a10400473044022001b7f4f21a8ddcd5e0faaaee3b95515bf8b84f2a7cbfdf66996c64123617a5cf02202fc6a776a7225420dbca759ad4ac83a61d15bf8d2883b6bf1aa31de7437f9b6e0147304402206c4125c1189a3b3e93a77cdf54c60c0538b80e5a03ec74e6ac776dfa77706ee4022035be14de76259b9d8a24863131a06a65b95df02f7d3ace90d52b37e8d94b167f0169522103bab8ecdd9ae2c51a0dc858f4c751b27533143bf6013ba1725ba8a4ecebe7de8c21027d5e55696c875308b03f2ca3d8637f51d3e35da9456a5187aa14b3de8a89534f2103b78eabaea8b3a4868be4f4bb96d6f66973f7081faa7f1cafba321444611c241e53ae00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_3_change(self, client):
|
||||
def test_send_multisig_3_change(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"84'/1'/{index}'"), coin_name="Testnet"
|
||||
)
|
||||
btc.get_public_node(client, parse_path(f"84'/1'/{index}'"), coin_name="Testnet")
|
||||
for index in range(1, 4)
|
||||
]
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
@ -567,9 +564,7 @@ class TestMsgSigntxSegwitNative:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[0] = signatures[0]
|
||||
# sign with third key
|
||||
@ -599,12 +594,11 @@ class TestMsgSigntxSegwitNative:
|
||||
== "01000000000101fc7901dd033f8c02da14f3ac916b6498036b80b4a0b4dc124e02c2bb408034c90000000000ffffffff01b87518000000000017a914536250d41937e5b641082447580ff6a8e46c122a870400473044022003c26107a5a47f1f900ef8aa758977530cd13ea37a33971abae8d75cac2f9f34022039e2b8c2c1d0c24ff4fc026652e1f27ad8e3ed6c9bf485f61d9aa691cb57830801483045022100963b0dc0ab46e963a66ab6e69e5e41bac6c4fedc127cac12c560b029d54fe87402205b3bcdcf313dccd78e5dce0540e7d3c8cc1bf83f13c1f9f01811eb791fd35c8101695221039dba3a72f5dc3cad17aa924b5a03c34561465f997d0cb15993f2ca2c0be771c42103cd39f3f08bbd508dce4d307d57d0c70c258c285878bfda579fa260acc738c25d2102cd631ba95beca1d64766f5540885092d0bb384a3c13b6c3a5334d0ebacf51b9553ae00000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.multisig
|
||||
def test_send_multisig_4_change(self, client):
|
||||
def test_send_multisig_4_change(client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, parse_path(f"49'/1'/{index}'"), coin_name="Testnet"
|
||||
)
|
||||
btc.get_public_node(client, parse_path(f"49'/1'/{index}'"), coin_name="Testnet")
|
||||
for index in range(1, 4)
|
||||
]
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
@ -652,9 +646,7 @@ class TestMsgSigntxSegwitNative:
|
||||
request_finished(),
|
||||
]
|
||||
)
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API
|
||||
)
|
||||
signatures, _ = btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
# store signature
|
||||
inp1.multisig.signatures[0] = signatures[0]
|
||||
# sign with third key
|
||||
@ -684,9 +676,10 @@ class TestMsgSigntxSegwitNative:
|
||||
== "01000000000101e5918f661488bb7f0a7d04fc1dad61b5d0bad5167a05b3a637e36ace881cbc310000000023220020fa6c73de618ec134eeec0c16f6dd04d46d4347e9a4fd0a95fd7938403a4949f9ffffffff01d071180000000000220020bcea2324dacbcde5a9db90cc26b8df9cbc72010e05cb68cf034df6f0e05239a2040047304402206bbddb45f12e31e77610fd85b50a83bad4426433b1c4860b1c5ddc0a69f803720220087b0607daab14830f4b4941f16b953b38e606ad70029bac24af7267f93c4242014730440220551a0cb6b0d5b3fa0cfd0b07bb5d751494b827b1c6a08702186696cfbc18278302204f37c382876c4117cca656654599b508f2d55fc3b083dc938e3cd8491b29719601695221036a5ec3abd10501409092246fe59c6d7a15fff1a933479483c3ba98b866c5b9742103559be875179d44e438db2c74de26e0bc9842cbdefd16018eae8a2ed989e474722103067b56aad037cd8b5f569b21f9025b76470a72dc69457813d2b76e98dc0cd01a53ae00000000"
|
||||
)
|
||||
|
||||
|
||||
# Ensure that if there is a non-multisig input, then a multisig output
|
||||
# will not be identified as a change output.
|
||||
def test_multisig_mismatch_inputs_single(self, client):
|
||||
def test_multisig_mismatch_inputs_single(client):
|
||||
# m/84'/1'/0' for "alcohol woman abuse ..." seed.
|
||||
node_int = deserialize(
|
||||
"Vpub5kFDCYhiYuAzjk7TBQPNFffbexHF7iAd8AVVgHQKUany7e6NQvthgk86d7DfH57DY2dwBK4PyVTDDaS1r2gjkdyJyUYGoV9qNujGSrW9Dpe"
|
||||
|
@ -52,11 +52,10 @@ TXHASH_v4 = bytes.fromhex(
|
||||
"5d8de67264b08eecc8e3bee19a11a7f54a2bce1dc4f2a699538e372ae92e9c0f"
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.altcoin, pytest.mark.zcash]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.zcash
|
||||
class TestMsgSigntxZcash:
|
||||
def test_v3_not_supported(self, client):
|
||||
|
||||
def test_v3_not_supported(client):
|
||||
# prevout: aaf51e4606c264e47e5c42c958fe4cf1539c5172684721e38e69f4ef634d75dc:1
|
||||
# input 1: 3.0 TAZ
|
||||
|
||||
@ -86,7 +85,8 @@ class TestMsgSigntxZcash:
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
|
||||
def test_one_one_fee_sapling(self, client):
|
||||
|
||||
def test_one_one_fee_sapling(client):
|
||||
# prevout: e3820602226974b1dd87b7113cc8aea8c63e5ae29293991e7bfa80c126930368:0
|
||||
# input 1: 3.0 TAZ
|
||||
|
||||
@ -141,7 +141,8 @@ class TestMsgSigntxZcash:
|
||||
== "0400008085202f890168039326c180fa7b1e999392e25a3ec6a8aec83c11b787ddb1746922020682e3000000006b483045022100f28298891f48706697a6f898ac18e39ce2c7cebe547b585d51cc22d80b1b21a602201a807b8a18544832d95d1e3ada82c0617bc6d97d3f24d1fb4801ac396647aa880121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0ffffffff016c9be111000000001976a9145b157a678a10021243307e4bb58f36375aa80e1088ac00000000000000000000000000000000000000"
|
||||
)
|
||||
|
||||
def test_version_group_id_missing(self, client):
|
||||
|
||||
def test_version_group_id_missing(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# tmQoJ3PTXgQLaRRZZYT6xk8XtjRbr2kCqwu
|
||||
address_n=parse_path("m/44h/1h/0h/0/0"),
|
||||
@ -165,7 +166,8 @@ class TestMsgSigntxZcash:
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
|
||||
def test_spend_old_versions(self, client):
|
||||
|
||||
def test_spend_old_versions(client):
|
||||
# inputs are NOT OWNED by this seed
|
||||
input_v1 = proto.TxInputType(
|
||||
address_n=parse_path("m/44h/1h/0h/0/0"),
|
||||
@ -221,8 +223,9 @@ class TestMsgSigntxZcash:
|
||||
== "0400008085202f890446828054c6c81a8c370c47dc1cfd6f1b200af5623ac3d5b62501121b74ae91fb000000006b483045022100d40e85efbadd378fc603dc8b11c70774086de631fe5b1418ac2b95a478f86507022072e999d8ddd75a0b33bd2adcc88e7234e6251b9e73c9223e7c59e0d1f8d1ff220121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0ffffffffef42e249deb8e7bc1d5ec7c4590c70c5b89734b2b896c72ad6469d95190ed303000000006b483045022100917d96445d64c80f9569cb9ca45c04c9b6d7b0fda6b9fd0b1d311837366c699202202cd6140489cf38b5d97ed271ba28603f4693c2a36113cc6ec423301f077c5a8e01210294e3e5e77e22eea0e4c0d30d89beb4db7f69b4bf1ae709e411d6a06618b8f852ffffffff6cb78ae689ae1334f4b03c6f613b280c70088b963f1c965f814081d1298841f9010000006a473044022058768c74c9b1698070636388d7d2ae8223748f13b0a5f402716e4d49fc5bc5f30220658d1e6095dcfbe66669b4141d23af28c9ed5bae73480889429b41742be85f32012103f5008445568548bd745a3dedccc6048969436bf1a49411f60938ff1938941f14ffffffff0f9c2ee92a378e5399a6f2c41dce2b4af5a7119ae1bee3c8ec8eb06472e68d5d000000006b483045022100e64853d86bed039c4edce4abaf80d41486cd21c63bec79c0308ea05a351663e302206732aa22a5dee7bd7f3cc8268faebe31a08abadb4b7e3a4257509bc7baa052b60121029ad0b9519779c540b34fa8d11d24d14a5475546bfa28c7de50573d22a503ce21ffffffff01d0c7321c000000001976a91490ede9de4bed6e39008375eace793949de9a533288ac00000000000000000000000000000000000000"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
def test_external_presigned(self, client):
|
||||
def test_external_presigned(client):
|
||||
inp1 = proto.TxInputType(
|
||||
# tmQoJ3PTXgQLaRRZZYT6xk8XtjRbr2kCqwu
|
||||
address_n=parse_path("m/44h/1h/0h/0/0"),
|
||||
|
@ -21,8 +21,7 @@ import pytest
|
||||
from trezorlib import btc
|
||||
|
||||
|
||||
class TestMsgVerifymessage:
|
||||
def test_message_long(self, client):
|
||||
def test_message_long(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -34,7 +33,8 @@ class TestMsgVerifymessage:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_testnet(self, client):
|
||||
|
||||
def test_message_testnet(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Testnet",
|
||||
@ -46,8 +46,9 @@ class TestMsgVerifymessage:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_message_grs(self, client):
|
||||
def test_message_grs(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Groestlcoin",
|
||||
@ -59,7 +60,8 @@ class TestMsgVerifymessage:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_verify(self, client):
|
||||
|
||||
def test_message_verify(client):
|
||||
res = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -167,8 +169,9 @@ class TestMsgVerifymessage:
|
||||
)
|
||||
assert res is False
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_message_verify_bcash(self, client):
|
||||
def test_message_verify_bcash(client):
|
||||
res = btc.verify_message(
|
||||
client,
|
||||
"Bcash",
|
||||
@ -180,7 +183,8 @@ class TestMsgVerifymessage:
|
||||
)
|
||||
assert res is True
|
||||
|
||||
def test_verify_bitcoind(self, client):
|
||||
|
||||
def test_verify_bitcoind(client):
|
||||
res = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -193,7 +197,8 @@ class TestMsgVerifymessage:
|
||||
|
||||
assert res is True
|
||||
|
||||
def test_verify_utf(self, client):
|
||||
|
||||
def test_verify_utf(client):
|
||||
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
|
||||
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
from trezorlib import btc
|
||||
|
||||
|
||||
class TestMsgVerifymessageSegwit:
|
||||
def test_message_long(self, client):
|
||||
def test_message_long(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -30,7 +29,8 @@ class TestMsgVerifymessageSegwit:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_testnet(self, client):
|
||||
|
||||
def test_message_testnet(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Testnet",
|
||||
@ -42,7 +42,8 @@ class TestMsgVerifymessageSegwit:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_verify(self, client):
|
||||
|
||||
def test_message_verify(client):
|
||||
res = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -78,7 +79,8 @@ class TestMsgVerifymessageSegwit:
|
||||
)
|
||||
assert res is False
|
||||
|
||||
def test_verify_utf(self, client):
|
||||
|
||||
def test_verify_utf(client):
|
||||
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
|
||||
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
from trezorlib import btc
|
||||
|
||||
|
||||
class TestMsgVerifymessageSegwitNative:
|
||||
def test_message_long(self, client):
|
||||
def test_message_long(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -30,7 +29,8 @@ class TestMsgVerifymessageSegwitNative:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_testnet(self, client):
|
||||
|
||||
def test_message_testnet(client):
|
||||
ret = btc.verify_message(
|
||||
client,
|
||||
"Testnet",
|
||||
@ -42,7 +42,8 @@ class TestMsgVerifymessageSegwitNative:
|
||||
)
|
||||
assert ret is True
|
||||
|
||||
def test_message_verify(self, client):
|
||||
|
||||
def test_message_verify(client):
|
||||
res = btc.verify_message(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -78,7 +79,8 @@ class TestMsgVerifymessageSegwitNative:
|
||||
)
|
||||
assert res is False
|
||||
|
||||
def test_verify_utf(self, client):
|
||||
|
||||
def test_verify_utf(client):
|
||||
words_nfkd = u"Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a"
|
||||
words_nfc = u"P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f"
|
||||
|
||||
|
@ -37,10 +37,10 @@ TXHASH_fbbff7 = bytes.fromhex(
|
||||
"fbbff7f3c85f8067453d7c062bd5efb8ad839953376ae5eceaf92774102c6e39"
|
||||
)
|
||||
|
||||
pytestmark = pytest.mark.multisig
|
||||
|
||||
class TestMultisig:
|
||||
@pytest.mark.multisig
|
||||
def test_2_of_3(self, client):
|
||||
|
||||
def test_2_of_3(client):
|
||||
nodes = [
|
||||
btc.get_public_node(client, parse_path(f"48'/0'/{index}'/0'")).node
|
||||
for index in range(1, 4)
|
||||
@ -150,9 +150,9 @@ class TestMultisig:
|
||||
== "010000000152ba4dfcde9c4bed88f55479cdea03e711ae586e9a89352a98230c4cdf1a09c601000000fdfe00004830450221009276eea820aa54a24bd9f1a056cb09a15f50c0816570a7c7878bd1c5ee7248540220677d200aec5e2f25bcf4000bdfab3faa9e1746d7f80c4ae4bfa1f5892eb5dcbf01483045022100c2a9fbfbff1be87036d8a6a22745512b158154f7f3d8f4cad4ba7ed130b37b83022058f5299b4c26222588dcc669399bd88b6f2bc6e04b48276373683853187a4fd6014c69522103dc0ff15b9c85c0d2c87099758bf47d36229c2514aeefcf8dea123f0f93c679762102bfe426e8671601ad46d54d09ee15aa035610d36d411961c87474908d403fbc122102a5d57129c6c96df663ad29492aa18605dad97231e043be8a92f9406073815c5d53aeffffffff01a0860100000000001976a91412e8391ad256dcdc023365978418d658dfecba1c88ac00000000"
|
||||
)
|
||||
|
||||
@pytest.mark.multisig
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_15_of_15(self, client):
|
||||
def test_15_of_15(client):
|
||||
node = btc.get_public_node(
|
||||
client, parse_path("48h/0h/1h/0h"), coin_name="Bitcoin"
|
||||
).node
|
||||
@ -191,9 +191,9 @@ class TestMultisig:
|
||||
== "63b16e3107df552c5c74bb5d91bb8fcd0069bac461fb42ebef982c5b2cfc4cf4"
|
||||
)
|
||||
|
||||
@pytest.mark.multisig
|
||||
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_missing_pubkey(self, client):
|
||||
def test_missing_pubkey(client):
|
||||
node = btc.get_public_node(
|
||||
client, parse_path("48h/0h/1h/0h/0"), coin_name="Bitcoin"
|
||||
).node
|
||||
@ -232,7 +232,8 @@ class TestMultisig:
|
||||
else:
|
||||
assert exc.value.message.endswith("Pubkey not found in multisig script")
|
||||
|
||||
def test_attack_change_input(self, client):
|
||||
|
||||
def test_attack_change_input(client):
|
||||
"""
|
||||
In Phases 1 and 2 the attacker replaces a non-multisig input
|
||||
`input_real` with a multisig input `input_fake`, which allows the
|
||||
|
@ -40,27 +40,28 @@ TXHASH_b0946d = bytes.fromhex(
|
||||
"b0946dc27ba308a749b11afecc2018980af18f79e89ad6b080b58220d856f739"
|
||||
)
|
||||
|
||||
pytestmark = [pytest.mark.multisig, pytest.mark.setup_client(mnemonic=MNEMONIC12)]
|
||||
|
||||
class TestMultisigChange:
|
||||
node_ext1 = bip32.deserialize(
|
||||
|
||||
NODE_EXT1 = bip32.deserialize(
|
||||
"xpub69qexv5TppjJQtXwSGeGXNtgGWyUzvsHACMt4Rr61Be4CmCf55eFcuXX828aySNuNR7hQYUCvUgZpioNxfs2HTAZWUUSFywhErg7JfTPv3Y"
|
||||
)
|
||||
# m/1 => 02c0d0c5fee952620757c6128dbf327c996cd72ed3358d15d6518a1186099bc15e
|
||||
# m/2 => 0375b9dfaad928ce1a7eed88df7c084e67d99e9ab74332419458a9a45779706801
|
||||
|
||||
node_ext2 = bip32.deserialize(
|
||||
NODE_EXT2 = bip32.deserialize(
|
||||
"xpub69qexv5TppjJRiLLK2K1FZNCFcErkXprCo3jabCXMiqX5CFF4LHedwcXvXkTuBL9tFLWVxuGWrdeerXjiWpC1gynTNUaySDsr8SU5xMpj5R"
|
||||
)
|
||||
# m/1 => 0388460dc439f4c8f5bcfc268c36e11b4375cad5c3535c336cfdf8c32c3afad5c1
|
||||
# m/2 => 03a04f945d5a3685729dde697d574076de4bdf38e904f813b22a851548e1110fc0
|
||||
|
||||
node_ext3 = bip32.deserialize(
|
||||
NODE_EXT3 = bip32.deserialize(
|
||||
"xpub69qexv5TppjJVYtxFKSBFxcVGyaC8VJDa1RugAYwEDLVUBuaXrVgznvQB44piM8MRerfVf1pNCBK1L1NzhyKd4Ay25BVZX3S8twWfZDxmz7"
|
||||
)
|
||||
# m/1 => 02e0c21e2a7cf00b94c5421725acff97f9826598b91f2340c5ddda730caca7d648
|
||||
# m/2 => 03928301ffb8c0d7a364b794914c716ba3107cc78a6fe581028b0d8638b22e8573
|
||||
|
||||
node_int = bip32.deserialize(
|
||||
NODE_INT = bip32.deserialize(
|
||||
"xpub69qexv5TppjJNEK5bfX8vQ6ASXDUQ5PohSajrHgeknHZ4SJipn7edmpRmiiBLLDtPur71mekZFazhgas8rkUMnS7quk5qp64TLLV8ShrxZJ"
|
||||
)
|
||||
# m/1 => 03f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff35
|
||||
@ -85,28 +86,28 @@ class TestMultisigChange:
|
||||
# input 1: 0.555 BTC
|
||||
|
||||
multisig_in1 = proto.MultisigRedeemScriptType(
|
||||
nodes=[node_ext2, node_ext1, node_int],
|
||||
nodes=[NODE_EXT2, NODE_EXT1, NODE_INT],
|
||||
address_n=[0, 0],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
)
|
||||
|
||||
multisig_in2 = proto.MultisigRedeemScriptType(
|
||||
nodes=[node_ext1, node_ext2, node_int],
|
||||
nodes=[NODE_EXT1, NODE_EXT2, NODE_INT],
|
||||
address_n=[0, 1],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
)
|
||||
|
||||
multisig_in3 = proto.MultisigRedeemScriptType(
|
||||
nodes=[node_ext1, node_ext3, node_int],
|
||||
nodes=[NODE_EXT1, NODE_EXT3, NODE_INT],
|
||||
address_n=[0, 1],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
)
|
||||
|
||||
# 2N9W4z9AhAPaHghtqVQPbaTAGHdbrhKeBQw
|
||||
inp1 = proto.TxInputType(
|
||||
INP1 = proto.TxInputType(
|
||||
address_n=[H_(45), 0, 0, 0],
|
||||
amount=50000000,
|
||||
prev_hash=TXHASH_16c6c8,
|
||||
@ -116,7 +117,7 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
# 2NDBG6QXQLtnQ3jRGkrqo53BiCeXfQXLdj4
|
||||
inp2 = proto.TxInputType(
|
||||
INP2 = proto.TxInputType(
|
||||
address_n=[H_(45), 0, 0, 1],
|
||||
amount=34500000,
|
||||
prev_hash=TXHASH_d80c34,
|
||||
@ -126,7 +127,7 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
# 2MvwPWfp2XPU3S1cMwgEMKBPUw38VP5SBE4
|
||||
inp3 = proto.TxInputType(
|
||||
INP3 = proto.TxInputType(
|
||||
address_n=[H_(45), 0, 0, 1],
|
||||
amount=55500000,
|
||||
prev_hash=TXHASH_b0946d,
|
||||
@ -135,7 +136,7 @@ class TestMultisigChange:
|
||||
multisig=multisig_in3,
|
||||
)
|
||||
|
||||
def _responses(self, inp1, inp2, change=0):
|
||||
def _responses(INP1, INP2, change=0):
|
||||
resp = [
|
||||
request_input(0),
|
||||
request_input(1),
|
||||
@ -149,15 +150,15 @@ class TestMultisigChange:
|
||||
resp += [
|
||||
proto.ButtonRequest(code=B.SignTx),
|
||||
request_input(0),
|
||||
request_meta(inp1.prev_hash),
|
||||
request_input(0, inp1.prev_hash),
|
||||
request_output(0, inp1.prev_hash),
|
||||
request_output(1, inp1.prev_hash),
|
||||
request_meta(INP1.prev_hash),
|
||||
request_input(0, INP1.prev_hash),
|
||||
request_output(0, INP1.prev_hash),
|
||||
request_output(1, INP1.prev_hash),
|
||||
request_input(1),
|
||||
request_meta(inp2.prev_hash),
|
||||
request_input(0, inp2.prev_hash),
|
||||
request_output(0, inp2.prev_hash),
|
||||
request_output(1, inp2.prev_hash),
|
||||
request_meta(INP2.prev_hash),
|
||||
request_input(0, INP2.prev_hash),
|
||||
request_output(0, INP2.prev_hash),
|
||||
request_output(1, INP2.prev_hash),
|
||||
request_input(0),
|
||||
request_input(1),
|
||||
request_output(0),
|
||||
@ -172,10 +173,9 @@ class TestMultisigChange:
|
||||
]
|
||||
return resp
|
||||
|
||||
|
||||
# both outputs are external
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_external_external(self, client):
|
||||
def test_external_external(client):
|
||||
out1 = proto.TxOutputType(
|
||||
address="1F8yBZB2NZhPZvJekhjTwjhQRRvQeTjjXr",
|
||||
amount=40000000,
|
||||
@ -189,11 +189,11 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(self._responses(self.inp1, self.inp2))
|
||||
client.set_expected_responses(_responses(INP1, INP2))
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -203,10 +203,9 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000"
|
||||
)
|
||||
|
||||
|
||||
# first external, second internal
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_external_internal(self, client):
|
||||
def test_external_internal(client):
|
||||
out1 = proto.TxOutputType(
|
||||
address="1F8yBZB2NZhPZvJekhjTwjhQRRvQeTjjXr",
|
||||
amount=40000000,
|
||||
@ -221,12 +220,12 @@ class TestMultisigChange:
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
self._responses(self.inp1, self.inp2, change=2)
|
||||
_responses(INP1, INP2, change=2)
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -236,10 +235,9 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000"
|
||||
)
|
||||
|
||||
|
||||
# first internal, second external
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_internal_external(self, client):
|
||||
def test_internal_external(client):
|
||||
out1 = proto.TxOutputType(
|
||||
address_n=parse_path("45'/0/1/0"),
|
||||
amount=40000000,
|
||||
@ -254,12 +252,12 @@ class TestMultisigChange:
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
self._responses(self.inp1, self.inp2, change=1)
|
||||
_responses(INP1, INP2, change=1)
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -269,10 +267,9 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000"
|
||||
)
|
||||
|
||||
|
||||
# both outputs are external
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_multisig_external_external(self, client):
|
||||
def test_multisig_external_external(client):
|
||||
out1 = proto.TxOutputType(
|
||||
address="3B23k4kFBRtu49zvpG3Z9xuFzfpHvxBcwt",
|
||||
amount=40000000,
|
||||
@ -286,11 +283,11 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(self._responses(self.inp1, self.inp2))
|
||||
client.set_expected_responses(_responses(INP1, INP2))
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -300,12 +297,11 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022059394e0dfcb2d2f4a6108703f801545ca5a820c0ac6a1859d0a3854813de55fa02207b6a57d70b82932ff58163336c461653a2dc82c78ed8157159e5178ac7325390014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b40047304402205a911685f5b974b2fc4a19d5ce056218773a4d20b5eaae2c2f9594929308182002201e03449f5a8813ec19f408bf1b6f4f334886d6fcf9920e300fd7678ef0724f81014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a62020000000017a91466528dd543f94d162c8111d2ec248d25ba9b90948700639f020000000017a914f1fc92c0aed1712911c70a2e09ac15ff0922652f8700000000"
|
||||
)
|
||||
|
||||
|
||||
# inputs match, change matches (first is change)
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_multisig_change_match_first(self, client):
|
||||
def test_multisig_change_match_first(client):
|
||||
multisig_out1 = proto.MultisigRedeemScriptType(
|
||||
nodes=[self.node_ext2, self.node_ext1, self.node_int],
|
||||
nodes=[NODE_EXT2, NODE_EXT1, NODE_INT],
|
||||
address_n=[1, 0],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
@ -326,12 +322,12 @@ class TestMultisigChange:
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
self._responses(self.inp1, self.inp2, change=1)
|
||||
_responses(INP1, INP2, change=1)
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -341,12 +337,11 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022059394e0dfcb2d2f4a6108703f801545ca5a820c0ac6a1859d0a3854813de55fa02207b6a57d70b82932ff58163336c461653a2dc82c78ed8157159e5178ac7325390014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b40047304402205a911685f5b974b2fc4a19d5ce056218773a4d20b5eaae2c2f9594929308182002201e03449f5a8813ec19f408bf1b6f4f334886d6fcf9920e300fd7678ef0724f81014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a62020000000017a91466528dd543f94d162c8111d2ec248d25ba9b90948700639f020000000017a914f1fc92c0aed1712911c70a2e09ac15ff0922652f8700000000"
|
||||
)
|
||||
|
||||
|
||||
# inputs match, change matches (second is change)
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_multisig_change_match_second(self, client):
|
||||
def test_multisig_change_match_second(client):
|
||||
multisig_out2 = proto.MultisigRedeemScriptType(
|
||||
nodes=[self.node_ext1, self.node_ext2, self.node_int],
|
||||
nodes=[NODE_EXT1, NODE_EXT2, NODE_INT],
|
||||
address_n=[1, 1],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
@ -367,12 +362,12 @@ class TestMultisigChange:
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(
|
||||
self._responses(self.inp1, self.inp2, change=2)
|
||||
_responses(INP1, INP2, change=2)
|
||||
)
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -382,12 +377,11 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022059394e0dfcb2d2f4a6108703f801545ca5a820c0ac6a1859d0a3854813de55fa02207b6a57d70b82932ff58163336c461653a2dc82c78ed8157159e5178ac7325390014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b40047304402205a911685f5b974b2fc4a19d5ce056218773a4d20b5eaae2c2f9594929308182002201e03449f5a8813ec19f408bf1b6f4f334886d6fcf9920e300fd7678ef0724f81014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a62020000000017a91466528dd543f94d162c8111d2ec248d25ba9b90948700639f020000000017a914f1fc92c0aed1712911c70a2e09ac15ff0922652f8700000000"
|
||||
)
|
||||
|
||||
|
||||
# inputs match, change mismatches (second tries to be change but isn't)
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_multisig_mismatch_change(self, client):
|
||||
def test_multisig_mismatch_change(client):
|
||||
multisig_out2 = proto.MultisigRedeemScriptType(
|
||||
nodes=[self.node_ext1, self.node_int, self.node_ext3],
|
||||
nodes=[NODE_EXT1, NODE_INT, NODE_EXT3],
|
||||
address_n=[1, 0],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
@ -407,11 +401,11 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(self._responses(self.inp1, self.inp2))
|
||||
client.set_expected_responses(_responses(INP1, INP2))
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp2],
|
||||
[INP1, INP2],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
@ -421,12 +415,11 @@ class TestMultisigChange:
|
||||
== "0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b40047304402207f9992cc0230527faf54ec6bd233307db82bc8fac039dcee418bc6feb4e96a3a02206bb4cb157ad27c123277328a877572563a45d70b844d9ab07cc42238112f8c2a014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b400473044022078a41bfa87d72d6ba810d84bf568b5a29acf8b851ba6c3a8dbff079b34a7feb0022037b770c776db0b6c883c38a684a121b90a59ed1958774cbf64de70e53e29639f014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a62020000000017a91466528dd543f94d162c8111d2ec248d25ba9b90948700639f020000000017a914e6a3e2fbadb7f559f8d20c46aceae78c96fcf1d18700000000"
|
||||
)
|
||||
|
||||
|
||||
# inputs mismatch, change matches with first input
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_multisig_mismatch_inputs(self, client):
|
||||
def test_multisig_mismatch_inputs(client):
|
||||
multisig_out1 = proto.MultisigRedeemScriptType(
|
||||
nodes=[self.node_ext2, self.node_ext1, self.node_int],
|
||||
nodes=[NODE_EXT2, NODE_EXT1, NODE_INT],
|
||||
address_n=[1, 0],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
@ -446,11 +439,11 @@ class TestMultisigChange:
|
||||
)
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(self._responses(self.inp1, self.inp3))
|
||||
client.set_expected_responses(_responses(INP1, INP3))
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
[self.inp1, self.inp3],
|
||||
[INP1, INP3],
|
||||
[out1, out2],
|
||||
prev_txes=TX_API,
|
||||
)
|
||||
|
@ -31,8 +31,7 @@ TXHASH_d5f65e = bytes.fromhex(
|
||||
)
|
||||
|
||||
|
||||
class TestOpReturn:
|
||||
def test_opreturn(self, client):
|
||||
def test_opreturn(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/0'/0'/0/2"),
|
||||
amount=390000,
|
||||
@ -83,7 +82,8 @@ class TestOpReturn:
|
||||
== "010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100bc36e1227b334e856c532bbef86d30a96823a5f2461738f4dbf969dfbcf1b40b022078c5353ec9a4bce2bb05bd1ec466f2ab379c1aad926e208738407bba4e09784b012103330236b68aa6fdcaca0ea72e11b360c84ed19a338509aa527b678a7ec9076882ffffffff0260cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000000000001c6a1a74657374206f6620746865206f705f72657475726e206461746100000000"
|
||||
)
|
||||
|
||||
def test_nonzero_opreturn(self, client):
|
||||
|
||||
def test_nonzero_opreturn(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/0'/10'/0/5"),
|
||||
amount=390000,
|
||||
@ -107,7 +107,8 @@ class TestOpReturn:
|
||||
):
|
||||
btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=TX_API)
|
||||
|
||||
def test_opreturn_address(self, client):
|
||||
|
||||
def test_opreturn_address(client):
|
||||
inp1 = proto.TxInputType(
|
||||
address_n=parse_path("44'/0'/0'/0/2"),
|
||||
amount=390000,
|
||||
|
@ -23,8 +23,7 @@ from trezorlib.tools import parse_path
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.tezos
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgTezosGetAddress:
|
||||
def test_tezos_get_address(self, client):
|
||||
def test_tezos_get_address(client):
|
||||
path = parse_path("m/44'/1729'/0'")
|
||||
address = get_address(client, path, show_display=True)
|
||||
assert address == "tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9"
|
||||
|
@ -23,8 +23,7 @@ from trezorlib.tools import parse_path
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.tezos
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgTezosGetPublicKey:
|
||||
def test_tezos_get_public_key(self, client):
|
||||
def test_tezos_get_public_key(client):
|
||||
path = parse_path("m/44'/1729'/0'")
|
||||
pk = get_public_key(client, path)
|
||||
assert pk == "edpkttLhEbVfMC3DhyVVFzdwh8ncRnEWiLD1x8TAuPU7vSJak7RtBX"
|
||||
|
@ -24,12 +24,14 @@ TEZOS_PATH = parse_path("m/44'/1729'/0'")
|
||||
TEZOS_PATH_10 = parse_path("m/44'/1729'/10'")
|
||||
TEZOS_PATH_15 = parse_path("m/44'/1729'/15'")
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.altcoin,
|
||||
pytest.mark.tezos,
|
||||
pytest.mark.skip_t1,
|
||||
]
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.tezos
|
||||
@pytest.mark.skip_t1
|
||||
class TestMsgTezosSignTx:
|
||||
def test_tezos_sign_tx_proposal(self, client):
|
||||
|
||||
def test_tezos_sign_tx_proposal(client):
|
||||
with client:
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
@ -57,11 +59,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "dee04042c0832d68a43699b2001c0a38065436eb05e578071a763e1972d0bc8105005f450441f41ee11eee78a31d1e1e55627c783bd60000001100000020dfa974df171c2dad9a9b8f25d99af41fd9702ce5d04521d2f9943c84d88aa5723b12621296a679b3a74ea790df5347995a76e20a09e76590baaacf4e09341965a04123f5cbbba8427f045b5f7d59157a3098e44839babe7c247d19b58bbb2405"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "opLqntFUu984M7LnGsFvfGW6kWe9QjAz4AfPDqQvwJ1wPM4Si4c"
|
||||
)
|
||||
assert resp.operation_hash == "opLqntFUu984M7LnGsFvfGW6kWe9QjAz4AfPDqQvwJ1wPM4Si4c"
|
||||
|
||||
def test_tezos_sign_tx_multiple_proposals(self, client):
|
||||
|
||||
def test_tezos_sign_tx_multiple_proposals(client):
|
||||
with client:
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
@ -90,11 +91,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "7e0be36a90c663c73c60da3889ffefff1383fb65cc29f0639f173d8f95a52df705005f450441f41ee11eee78a31d1e1e55627c783bd600000011000000402a6ff28ab4d0ccb18f7129aaaf9a4b8027d794f2562849665fdb6999db2a4e5747cd60c09ab8437cc9fe19add494dce1b9844100f660f02ce77510a0c66d2762f813361ac00ada7e3256f23973ae25b112229476a3cb3e506fe929ea1e9358299fed22178d1be689cddeedd1f303abfef859b664f159a528576a1c807079f005"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "onobSyNgiitGXxSVFJN6949MhUomkkxvH4ZJ2owgWwNeDdntF9Y"
|
||||
)
|
||||
assert resp.operation_hash == "onobSyNgiitGXxSVFJN6949MhUomkkxvH4ZJ2owgWwNeDdntF9Y"
|
||||
|
||||
def test_tezos_sing_tx_ballot_yay(self, client):
|
||||
|
||||
def test_tezos_sing_tx_ballot_yay(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -117,7 +117,8 @@ class TestMsgTezosSignTx:
|
||||
== "edsigtkxNm6YXwtV24DqeuimeZFTeFCn2jDYheSsXT4rHMcEjNvzsiSo55nVyVsQxtEe8M7U4PWJWT4rGYYGckQCgtkNJkd2roX"
|
||||
)
|
||||
|
||||
def test_tezos_sing_tx_ballot_nay(self, client):
|
||||
|
||||
def test_tezos_sing_tx_ballot_nay(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -139,7 +140,8 @@ class TestMsgTezosSignTx:
|
||||
== "edsigtqLaizfF6Cfc2JQL7TrsyniGhpZEojZAKMFW6AeudaUoU8KGXEHJH69Q4Lf27qFyUSTfbeHNnnCt69SGEPWkmpkgkgqMbL"
|
||||
)
|
||||
|
||||
def test_tezos_sing_tx_ballot_pass(self, client):
|
||||
|
||||
def test_tezos_sing_tx_ballot_pass(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -162,7 +164,8 @@ class TestMsgTezosSignTx:
|
||||
== "edsigu6YX7EegPwrpcEbdNQsNhrRiEagBNGJBmFamP4mixZZw1UynhahGQ8RNiZLSUVLERUZwygrsSVenBqXGt9VnknTxtzjKzv"
|
||||
)
|
||||
|
||||
def test_tezos_sign_tx_tranasaction(self, client):
|
||||
|
||||
def test_tezos_sign_tx_tranasaction(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -193,11 +196,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "3b85532b5a468cd26b6d3c7e762ae53b795d19c6db4838ed2750df8e063aedb86c005f450441f41ee11eee78a31d1e1e55627c783bd6904e9202a09c0100a08d0600003325df8851047421605ae7d6b09b49f70c8ce46000acdcd3df9daaa79c7345c068ffddc2113047fc00c1eed3503838d15fc6690821ee6eaa1e67b4a8d40dcf30a9ec456bbbda18ef2bcc021053d7d8c3f1473df809"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "oon8PNUsPETGKzfESv1Epv4535rviGS7RdCfAEKcPvzojrcuufb"
|
||||
)
|
||||
assert resp.operation_hash == "oon8PNUsPETGKzfESv1Epv4535rviGS7RdCfAEKcPvzojrcuufb"
|
||||
|
||||
def test_tezos_sign_tx_delegation(self, client):
|
||||
|
||||
def test_tezos_sign_tx_delegation(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_15,
|
||||
@ -224,11 +226,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "447d51450749763989c1aa5e1939aae623abb5a050f9cf1c04c247d91ca675936e0002eca091abc1e0f5c38a155c1313c410b47e1549a09c01d5fa1ba09c0100ff005f450441f41ee11eee78a31d1e1e55627c783bd6dbd53f9129387e82548e5d20b1479a46a876ac7516001fae01488dfbe9dcfc732cb8664d52fd7e1bc25a9845714131fd498ef65ea91f84e180688a41e06fe700"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "op79C1tR7wkUgYNid2zC1WNXmGorS38mTXZwtAjmCQm2kG7XG59"
|
||||
)
|
||||
assert resp.operation_hash == "op79C1tR7wkUgYNid2zC1WNXmGorS38mTXZwtAjmCQm2kG7XG59"
|
||||
|
||||
def test_tezos_sign_tx_origination(self, client):
|
||||
|
||||
def test_tezos_sign_tx_origination(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -256,11 +257,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "927ac7cd7969bde606e7537712584eb0d34fc52d9f5a88cc908994d817170a166d005f450441f41ee11eee78a31d1e1e55627c783bd6a09c019402a09c01904ea08d06000000001c02000000170500036805010368050202000000080316053d036d03420000000a010000000568656c6c6f2151774735e1659a7d0f54659e98fbcbd86a667717a9a2a9961292a170e5e8d1608a1dbf805a03981be2f7389ba1738841ac8b1069fe5978a72d441a97de3505"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "onmq9FFZzvG2zghNdr1bgv9jzdbzNycXjSSNmCVhXCGSnV3WA9g"
|
||||
)
|
||||
assert resp.operation_hash == "onmq9FFZzvG2zghNdr1bgv9jzdbzNycXjSSNmCVhXCGSnV3WA9g"
|
||||
|
||||
def test_tezos_sign_tx_reveal(self, client):
|
||||
|
||||
def test_tezos_sign_tx_reveal(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH,
|
||||
@ -299,11 +299,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "f26502c204619c4bdab2e59efc50c79bc0136d781304b8f7fad389263550300e6b00001e65c88ae6317cd62a638c8abd1e71c83c8475a09c01d0ba22a09c010000200da2c0200927dd8168b2b62e1322637521fcefb3184e61c1c3123c7c00bb956c00001e65c88ae6317cd62a638c8abd1e71c83c8475d08603d1ba22a09c0100a08d0600005f450441f41ee11eee78a31d1e1e55627c783bd60026690d65407d6cda03cde8e3c17a22ffd0351f78c18c500f3997cbe311e12e6cc4b5ff40b339c7fba8b4c7d62329ea45da662340113a6da98b7510b40042f204"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "oo9JFiWTnTSvUZfajMNwQe1VyFN2pqwiJzZPkpSAGfGD57Z6mZJ"
|
||||
)
|
||||
assert resp.operation_hash == "oo9JFiWTnTSvUZfajMNwQe1VyFN2pqwiJzZPkpSAGfGD57Z6mZJ"
|
||||
|
||||
def test_tezos_smart_contract_delegation(self, client):
|
||||
|
||||
def test_tezos_smart_contract_delegation(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -337,11 +336,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "49eead995833934ee2571c6cd6439897ee71b72a9e4d22f127e0c3d4ca69ba156c005f450441f41ee11eee78a31d1e1e55627c783bd6904e9602dec901000001c116a6c74bf00a5839b593838215fe1fcf2db59c00ff020000002f020000002a0320053d036d0743035d0a00000015005f450441f41ee11eee78a31d1e1e55627c783bd60346034e031bb2534eb5478c31d5ffbc13b4692a7f2b73aad16e2d8e0f7068110955aa9480a6432775ba301f24bc20e4c12cffc9fd1f27b44204f830ea7f4dec23a18e25450d"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "oo75gfQGGPEPChXZzcPPAGtYqCpsg2BS5q9gmhrU3NQP7CEffpU"
|
||||
)
|
||||
assert resp.operation_hash == "oo75gfQGGPEPChXZzcPPAGtYqCpsg2BS5q9gmhrU3NQP7CEffpU"
|
||||
|
||||
def test_tezos_kt_remove_delegation(self, client):
|
||||
|
||||
def test_tezos_kt_remove_delegation(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -373,11 +371,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "77a1800dd37b54f61755bd97b2a6759627c53a5f8afb00bdcf8255b5d23eff446c005f450441f41ee11eee78a31d1e1e55627c783bd6904e9702dec901000001c116a6c74bf00a5839b593838215fe1fcf2db59c00ff0200000013020000000e0320053d036d053e035d034e031b87b6a5f01c0689f8f453f2b23582a2891792087197e01276648eec734850999e54e9edd687efb9297e24a96d126dc1e6636e772aeab80d5bc6b3f9b55aa3a701"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "ootMi1tXbfoVgFyzJa8iXyR4mnHd5TxLm9hmxVzMVRkbyVjKaHt"
|
||||
)
|
||||
assert resp.operation_hash == "ootMi1tXbfoVgFyzJa8iXyR4mnHd5TxLm9hmxVzMVRkbyVjKaHt"
|
||||
|
||||
def test_tezos_smart_contract_transfer(self, client):
|
||||
|
||||
def test_tezos_smart_contract_transfer(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -417,11 +414,10 @@ class TestMsgTezosSignTx:
|
||||
resp.sig_op_contents.hex()
|
||||
== "442b86e27a7b79d893262b4daee229818f71073827570c74fa3aa1da7929d16d6c005f450441f41ee11eee78a31d1e1e55627c783bd6904e9802a09902000001c116a6c74bf00a5839b593838215fe1fcf2db59c00ff020000003902000000340320053d036d0743035d0a00000015005f450441f41ee11eee78a31d1e1e55627c783bd6031e0743036a00a0b802034f034d031b14dc70ef8db46c4b8f53e387ff3d642644af458f757ab85f9291727dc18bb09d7ec5790136b8cc428b165aec9cf628eeefc90aad526dc75e2aab203e57b8920f"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "ooRGGtCmoQDgB36XvQqmM7govc3yb77YDUoa7p2QS7on27wGRns"
|
||||
)
|
||||
assert resp.operation_hash == "ooRGGtCmoQDgB36XvQqmM7govc3yb77YDUoa7p2QS7on27wGRns"
|
||||
|
||||
def test_tezos_smart_contract_transfer_to_contract(self, client):
|
||||
|
||||
def test_tezos_smart_contract_transfer_to_contract(client):
|
||||
resp = tezos.sign_tx(
|
||||
client,
|
||||
TEZOS_PATH_10,
|
||||
@ -461,6 +457,4 @@ class TestMsgTezosSignTx:
|
||||
resp.signature
|
||||
== "edsigtrnr4jXpPZK1yFVGtsapR4VHKp9Gnz1Uj7G4AdAXVn8ug16tgUx5u3TsyYJFp9MzENKuVqotaEwco3JhAhKpbjxbBQhEsT"
|
||||
)
|
||||
assert (
|
||||
resp.operation_hash == "opUE4xNkiUyYmJwUUgAab9xqHE66FXEc6VNZq4ZXDiBJcYwqNJX"
|
||||
)
|
||||
assert resp.operation_hash == "opUE4xNkiUyYmJwUUgAab9xqHE66FXEc6VNZq4ZXDiBJcYwqNJX"
|
||||
|
Loading…
Reference in New Issue
Block a user