1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

feat(tests): add device tests for chunkifying addresses

[no changelog]
This commit is contained in:
grdddj 2023-09-14 12:22:18 +02:00 committed by Jiří Musil
parent 8e48f354ab
commit 04e3b02030
22 changed files with 167 additions and 61 deletions

View File

@ -32,9 +32,14 @@ BINANCE_ADDRESS_TEST_VECTORS = [
@pytest.mark.setup_client( @pytest.mark.setup_client(
mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin" mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin"
) )
@pytest.mark.parametrize("chunkify", (True, False))
@pytest.mark.parametrize("path, expected_address", BINANCE_ADDRESS_TEST_VECTORS) @pytest.mark.parametrize("path, expected_address", BINANCE_ADDRESS_TEST_VECTORS)
def test_binance_get_address(client: Client, path, expected_address): def test_binance_get_address(
client: Client, chunkify: bool, path: str, expected_address: str
):
# data from https://github.com/binance-chain/javascript-sdk/blob/master/__tests__/crypto.test.js#L50 # data from https://github.com/binance-chain/javascript-sdk/blob/master/__tests__/crypto.test.js#L50
address = get_address(client, parse_path(path), show_display=True) address = get_address(
client, parse_path(path), show_display=True, chunkify=chunkify
)
assert address == expected_address assert address == expected_address

View File

@ -108,8 +108,13 @@ BINANCE_TEST_VECTORS = [
mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin" mnemonic="offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin"
) )
@pytest.mark.parametrize("message, expected_response", BINANCE_TEST_VECTORS) @pytest.mark.parametrize("message, expected_response", BINANCE_TEST_VECTORS)
def test_binance_sign_message(client: Client, message, expected_response): @pytest.mark.parametrize("chunkify", (True, False))
response = binance.sign_tx(client, parse_path("m/44h/714h/0h/0/0"), message) def test_binance_sign_message(
client: Client, chunkify: bool, message: dict, expected_response: dict
):
response = binance.sign_tx(
client, parse_path("m/44h/714h/0h/0/0"), message, chunkify=chunkify
)
assert response.public_key.hex() == expected_response["public_key"] assert response.public_key.hex() == expected_response["public_key"]

View File

@ -56,8 +56,9 @@ ROUND_ID_LEN = 32
SLIP25_PATH = parse_path("m/10025h") SLIP25_PATH = parse_path("m/10025h")
@pytest.mark.parametrize("chunkify", (True, False))
@pytest.mark.setup_client(pin=PIN) @pytest.mark.setup_client(pin=PIN)
def test_sign_tx(client: Client): def test_sign_tx(client: Client, chunkify: bool):
# NOTE: FAKE input tx # NOTE: FAKE input tx
commitment_data = b"\x0fwww.example.com" + (1).to_bytes(ROUND_ID_LEN, "big") commitment_data = b"\x0fwww.example.com" + (1).to_bytes(ROUND_ID_LEN, "big")
@ -228,6 +229,7 @@ def test_sign_tx(client: Client):
coinjoin_request=coinjoin_req, coinjoin_request=coinjoin_req,
preauthorized=True, preauthorized=True,
serialize=False, serialize=False,
chunkify=chunkify,
) )
assert serialized_tx == b"" assert serialized_tx == b""
@ -247,6 +249,7 @@ def test_sign_tx(client: Client):
prev_txes=TX_CACHE_TESTNET, prev_txes=TX_CACHE_TESTNET,
coinjoin_request=coinjoin_req, coinjoin_request=coinjoin_req,
preauthorized=True, preauthorized=True,
chunkify=chunkify,
) )
# Test for a third time, number of rounds should be exceeded. # Test for a third time, number of rounds should be exceeded.
@ -259,6 +262,7 @@ def test_sign_tx(client: Client):
prev_txes=TX_CACHE_TESTNET, prev_txes=TX_CACHE_TESTNET,
coinjoin_request=coinjoin_req, coinjoin_request=coinjoin_req,
preauthorized=True, preauthorized=True,
chunkify=chunkify,
) )
@ -728,6 +732,7 @@ def test_get_address(client: Client):
unlock_path_mac = device.unlock_path(client, SLIP25_PATH) unlock_path_mac = device.unlock_path(client, SLIP25_PATH)
# Ensure that the SLIP-0025 external chain is accessible after user confirmation. # Ensure that the SLIP-0025 external chain is accessible after user confirmation.
for chunkify in (True, False):
resp = btc.get_address( resp = btc.get_address(
client, client,
"Testnet", "Testnet",
@ -736,6 +741,7 @@ def test_get_address(client: Client):
show_display=True, show_display=True,
unlock_path=SLIP25_PATH, unlock_path=SLIP25_PATH,
unlock_path_mac=unlock_path_mac, unlock_path_mac=unlock_path_mac,
chunkify=chunkify,
) )
assert resp == "tb1pl3y9gf7xk2ryvmav5ar66ra0d2hk7lhh9mmusx3qvn0n09kmaghqh32ru7" assert resp == "tb1pl3y9gf7xk2ryvmav5ar66ra0d2hk7lhh9mmusx3qvn0n09kmaghqh32ru7"

View File

@ -140,7 +140,14 @@ BIP86_VECTORS = ( # path, address for "abandon ... abandon about" seed
@pytest.mark.parametrize("show_display", (True, False)) @pytest.mark.parametrize("show_display", (True, False))
@pytest.mark.parametrize("coin, path, script_type, address", VECTORS) @pytest.mark.parametrize("coin, path, script_type, address", VECTORS)
def test_show_segwit(client: Client, show_display, coin, path, script_type, address): def test_show_segwit(
client: Client,
show_display: bool,
coin: str,
path: str,
script_type: messages.InputScriptType,
address: str,
):
assert ( assert (
btc.get_address( btc.get_address(
client, client,
@ -159,7 +166,7 @@ def test_show_segwit(client: Client, show_display, coin, path, script_type, addr
mnemonic="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" mnemonic="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
) )
@pytest.mark.parametrize("path, address", BIP86_VECTORS) @pytest.mark.parametrize("path, address", BIP86_VECTORS)
def test_bip86(client: Client, path, address): def test_bip86(client: Client, path: str, address: str):
assert ( assert (
btc.get_address( btc.get_address(
client, client,
@ -214,7 +221,7 @@ def test_show_multisig_3(client: Client):
@pytest.mark.multisig @pytest.mark.multisig
@pytest.mark.parametrize("show_display", (True, False)) @pytest.mark.parametrize("show_display", (True, False))
def test_multisig_missing(client: Client, show_display): def test_multisig_missing(client: Client, show_display: bool):
# Multisig with global suffix specification. # Multisig with global suffix specification.
# Use account numbers 1, 2 and 3 to create a valid multisig, # Use account numbers 1, 2 and 3 to create a valid multisig,
# but not containing the keys from account 0 used below. # but not containing the keys from account 0 used below.

View File

@ -78,9 +78,14 @@ def test_show_t1(
@pytest.mark.skip_t1 @pytest.mark.skip_t1
@pytest.mark.parametrize("chunkify", (True, False))
@pytest.mark.parametrize("path, script_type, address", VECTORS) @pytest.mark.parametrize("path, script_type, address", VECTORS)
def test_show_tt( def test_show_tt(
client: Client, path: str, script_type: messages.InputScriptType, address: str client: Client,
chunkify: bool,
path: str,
script_type: messages.InputScriptType,
address: str,
): ):
with client: with client:
IF = InputFlowShowAddressQRCode(client) IF = InputFlowShowAddressQRCode(client)
@ -92,6 +97,7 @@ def test_show_tt(
tools.parse_path(path), tools.parse_path(path),
script_type=script_type, script_type=script_type,
show_display=True, show_display=True,
chunkify=chunkify,
) )
== address == address
) )

View File

@ -52,7 +52,8 @@ pytestmark = pytest.mark.multisig
@pytest.mark.multisig @pytest.mark.multisig
def test_2_of_3(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_2_of_3(client: Client, chunkify: bool):
# input tx: 6b07c1321b52d9c85743f9695e13eb431b41708cdf4e1585258d51208e5b93fc # input tx: 6b07c1321b52d9c85743f9695e13eb431b41708cdf4e1585258d51208e5b93fc
nodes = [ nodes = [
@ -104,7 +105,12 @@ def test_2_of_3(client: Client):
# Now we have first signature # Now we have first signature
signatures1, _ = btc.sign_tx( signatures1, _ = btc.sign_tx(
client, "Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET client,
"Testnet",
[inp1],
[out1],
prev_txes=TX_API_TESTNET,
chunkify=chunkify,
) )
assert ( assert (

View File

@ -93,7 +93,9 @@ VECTORS_MULTISIG = ( # paths, address_index
# Has AlwaysMatchingSchema but let's make sure the nonstandard paths are # Has AlwaysMatchingSchema but let's make sure the nonstandard paths are
# accepted in case we make this more restrictive in the future. # accepted in case we make this more restrictive in the future.
@pytest.mark.parametrize("path, script_types", VECTORS) @pytest.mark.parametrize("path, script_types", VECTORS)
def test_getpublicnode(client: Client, path, script_types): def test_getpublicnode(
client: Client, path: str, script_types: list[messages.InputScriptType]
):
for script_type in script_types: for script_type in script_types:
res = btc.get_public_node( res = btc.get_public_node(
client, parse_path(path), coin_name="Bitcoin", script_type=script_type client, parse_path(path), coin_name="Bitcoin", script_type=script_type
@ -102,8 +104,14 @@ def test_getpublicnode(client: Client, path, script_types):
assert res.xpub assert res.xpub
@pytest.mark.parametrize("chunkify", (True, False))
@pytest.mark.parametrize("path, script_types", VECTORS) @pytest.mark.parametrize("path, script_types", VECTORS)
def test_getaddress(client: Client, path, script_types): def test_getaddress(
client: Client,
chunkify: bool,
path: str,
script_types: list[messages.InputScriptType],
):
for script_type in script_types: for script_type in script_types:
res = btc.get_address( res = btc.get_address(
client, client,
@ -111,13 +119,16 @@ def test_getaddress(client: Client, path, script_types):
parse_path(path), parse_path(path),
show_display=True, show_display=True,
script_type=script_type, script_type=script_type,
chunkify=chunkify,
) )
assert res assert res
@pytest.mark.parametrize("path, script_types", VECTORS) @pytest.mark.parametrize("path, script_types", VECTORS)
def test_signmessage(client: Client, path, script_types): def test_signmessage(
client: Client, path: str, script_types: list[messages.InputScriptType]
):
for script_type in script_types: for script_type in script_types:
sig = btc.sign_message( sig = btc.sign_message(
client, client,
@ -131,7 +142,9 @@ def test_signmessage(client: Client, path, script_types):
@pytest.mark.parametrize("path, script_types", VECTORS) @pytest.mark.parametrize("path, script_types", VECTORS)
def test_signtx(client: Client, path, script_types): def test_signtx(
client: Client, path: str, script_types: list[messages.InputScriptType]
):
address_n = parse_path(path) address_n = parse_path(path)
for script_type in script_types: for script_type in script_types:
@ -160,7 +173,9 @@ def test_signtx(client: Client, path, script_types):
@pytest.mark.multisig @pytest.mark.multisig
@pytest.mark.parametrize("paths, address_index", VECTORS_MULTISIG) @pytest.mark.parametrize("paths, address_index", VECTORS_MULTISIG)
def test_getaddress_multisig(client: Client, paths, address_index): def test_getaddress_multisig(
client: Client, paths: list[str], address_index: list[int]
):
pubs = [ pubs = [
messages.HDNodePathType( messages.HDNodePathType(
node=btc.get_public_node( node=btc.get_public_node(
@ -186,7 +201,7 @@ def test_getaddress_multisig(client: Client, paths, address_index):
@pytest.mark.multisig @pytest.mark.multisig
@pytest.mark.parametrize("paths, address_index", VECTORS_MULTISIG) @pytest.mark.parametrize("paths, address_index", VECTORS_MULTISIG)
def test_signtx_multisig(client: Client, paths, address_index): def test_signtx_multisig(client: Client, paths: list[str], address_index: list[int]):
pubs = [ pubs = [
messages.HDNodePathType( messages.HDNodePathType(
node=btc.get_public_node( node=btc.get_public_node(

View File

@ -318,7 +318,8 @@ def test_one_two_fee(client: Client):
) )
def test_one_three_fee(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_one_three_fee(client: Client, chunkify: bool):
# input tx: bb5169091f09e833e155b291b662019df56870effe388c626221c5ea84274bc4 # input tx: bb5169091f09e833e155b291b662019df56870effe388c626221c5ea84274bc4
inp1 = messages.TxInputType( inp1 = messages.TxInputType(
@ -379,6 +380,7 @@ def test_one_three_fee(client: Client):
[inp1], [inp1],
[out1, out2, out3], [out1, out2, out3],
prev_txes=TX_CACHE_TESTNET, prev_txes=TX_CACHE_TESTNET,
chunkify=chunkify,
) )
assert_tx_matches( assert_tx_matches(

View File

@ -45,7 +45,8 @@ TXHASH_e5040e = bytes.fromhex(
) )
def test_send_p2sh(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_send_p2sh(client: Client, chunkify: bool):
inp1 = messages.TxInputType( inp1 = messages.TxInputType(
address_n=parse_path("m/49h/1h/0h/1/0"), address_n=parse_path("m/49h/1h/0h/1/0"),
# 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX # 2N1LGaGg836mqSQqiuUBLfcyGBhyZbremDX
@ -89,7 +90,12 @@ def test_send_p2sh(client: Client):
] ]
) )
_, serialized_tx = btc.sign_tx( _, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1], [out1, out2], prev_txes=TX_API_TESTNET client,
"Testnet",
[inp1],
[out1, out2],
prev_txes=TX_API_TESTNET,
chunkify=chunkify,
) )
# Transaction does not exist on the blockchain, not using assert_tx_matches() # Transaction does not exist on the blockchain, not using assert_tx_matches()

View File

@ -62,7 +62,8 @@ TXHASH_c96621 = bytes.fromhex(
) )
def test_send_p2tr(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_send_p2tr(client: Client, chunkify: bool):
inp1 = messages.TxInputType( inp1 = messages.TxInputType(
# tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c # tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c
address_n=parse_path("m/86h/1h/0h/1/0"), address_n=parse_path("m/86h/1h/0h/1/0"),
@ -93,7 +94,7 @@ def test_send_p2tr(client: Client):
] ]
) )
_, serialized_tx = btc.sign_tx( _, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1], [out1], prev_txes=TX_API client, "Testnet", [inp1], [out1], prev_txes=TX_API, chunkify=chunkify
) )
assert_tx_matches( assert_tx_matches(

View File

@ -47,7 +47,8 @@ pytestmark = [
"cardano/get_reward_address.json", "cardano/get_reward_address.json",
"cardano/get_base_address.derivations.json", "cardano/get_base_address.derivations.json",
) )
def test_cardano_get_address(client: Client, parameters, result): @pytest.mark.parametrize("chunkify", (True, False))
def test_cardano_get_address(client: Client, chunkify: bool, parameters, result):
client.init_device(new_session=True, derive_cardano=True) client.init_device(new_session=True, derive_cardano=True)
derivation_type = CardanoDerivationType.__members__[ derivation_type = CardanoDerivationType.__members__[
@ -81,6 +82,7 @@ def test_cardano_get_address(client: Client, parameters, result):
network_id=parameters["network_id"], network_id=parameters["network_id"],
show_display=True, show_display=True,
derivation_type=derivation_type, derivation_type=derivation_type,
chunkify=chunkify,
) )
assert address == result["expected_address"] assert address == result["expected_address"]

View File

@ -57,7 +57,7 @@ def test_cardano_sign_tx(client: Client, parameters, result):
@parametrize_using_common_fixtures("cardano/sign_tx.show_details.json") @parametrize_using_common_fixtures("cardano/sign_tx.show_details.json")
def test_cardano_sign_tx_show_details(client: Client, parameters, result): def test_cardano_sign_tx_show_details(client: Client, parameters, result):
response = call_sign_tx(client, parameters, show_details_input_flow) response = call_sign_tx(client, parameters, show_details_input_flow, chunkify=True)
assert response == _transform_expected_result(result) assert response == _transform_expected_result(result)
@ -72,7 +72,7 @@ def test_cardano_sign_tx_failed(client: Client, parameters, result):
call_sign_tx(client, parameters, None) call_sign_tx(client, parameters, None)
def call_sign_tx(client: Client, parameters, input_flow=None): def call_sign_tx(client: Client, parameters, input_flow=None, chunkify: bool = False):
client.init_device(new_session=True, derive_cardano=True) client.init_device(new_session=True, derive_cardano=True)
signing_mode = messages.CardanoTxSigningMode.__members__[parameters["signing_mode"]] signing_mode = messages.CardanoTxSigningMode.__members__[parameters["signing_mode"]]
@ -136,6 +136,7 @@ def call_sign_tx(client: Client, parameters, input_flow=None):
reference_inputs=reference_inputs, reference_inputs=reference_inputs,
additional_witness_requests=additional_witness_requests, additional_witness_requests=additional_witness_requests,
include_network_id=parameters["include_network_id"], include_network_id=parameters["include_network_id"],
chunkify=chunkify,
) )

View File

@ -35,7 +35,8 @@ pytestmark = [
] ]
def test_eos_signtx_transfer_token(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_eos_signtx_transfer_token(client: Client, chunkify: bool):
transaction = { transaction = {
"expiration": "2018-07-14T10:43:28", "expiration": "2018-07-14T10:43:28",
"ref_block_num": 6439, "ref_block_num": 6439,
@ -61,7 +62,7 @@ def test_eos_signtx_transfer_token(client: Client):
} }
with client: with client:
resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID) resp = eos.sign_tx(client, ADDRESS_N, transaction, CHAIN_ID, chunkify=chunkify)
assert isinstance(resp, EosSignedTx) assert isinstance(resp, EosSignedTx)
assert ( assert (
resp.signature resp.signature

View File

@ -26,8 +26,10 @@ pytestmark = [pytest.mark.altcoin, pytest.mark.ethereum]
@parametrize_using_common_fixtures("ethereum/getaddress.json") @parametrize_using_common_fixtures("ethereum/getaddress.json")
def test_getaddress(client: Client, parameters, result): @pytest.mark.parametrize("chunkify", (True, False))
def test_getaddress(client: Client, chunkify: bool, parameters, result):
address_n = parse_path(parameters["path"]) address_n = parse_path(parameters["path"])
assert ( assert (
ethereum.get_address(client, address_n, show_display=True) == result["address"] ethereum.get_address(client, address_n, show_display=True, chunkify=chunkify)
== result["address"]
) )

View File

@ -52,11 +52,18 @@ def make_defs(parameters: dict) -> messages.EthereumDefinitions:
"ethereum/sign_tx.json", "ethereum/sign_tx.json",
"ethereum/sign_tx_eip155.json", "ethereum/sign_tx_eip155.json",
) )
def test_signtx(client: Client, parameters: dict, result: dict): @pytest.mark.parametrize("chunkify", (True, False))
_do_test_signtx(client, parameters, result) def test_signtx(client: Client, chunkify: bool, parameters: dict, result: dict):
_do_test_signtx(client, parameters, result, chunkify=chunkify)
def _do_test_signtx(client: Client, parameters: dict, result: dict, input_flow=None): def _do_test_signtx(
client: Client,
parameters: dict,
result: dict,
input_flow=None,
chunkify: bool = False,
):
with client: with client:
if input_flow: if input_flow:
client.watch_layout() client.watch_layout()
@ -73,6 +80,7 @@ def _do_test_signtx(client: Client, parameters: dict, result: dict, input_flow=N
tx_type=parameters["tx_type"], tx_type=parameters["tx_type"],
data=bytes.fromhex(parameters["data"]), data=bytes.fromhex(parameters["data"]),
definitions=make_defs(parameters), definitions=make_defs(parameters),
chunkify=chunkify,
) )
expected_v = 2 * parameters["chain_id"] + 35 expected_v = 2 * parameters["chain_id"] + 35
@ -106,7 +114,8 @@ def test_signtx_fee_info(client: Client):
@parametrize_using_common_fixtures("ethereum/sign_tx_eip1559.json") @parametrize_using_common_fixtures("ethereum/sign_tx_eip1559.json")
def test_signtx_eip1559(client: Client, parameters: dict, result: dict): @pytest.mark.parametrize("chunkify", (True, False))
def test_signtx_eip1559(client: Client, chunkify: bool, parameters: dict, result: dict):
with client: with client:
sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559( sig_v, sig_r, sig_s = ethereum.sign_tx_eip1559(
client, client,
@ -120,6 +129,7 @@ def test_signtx_eip1559(client: Client, parameters: dict, result: dict):
value=int(parameters["value"], 16), value=int(parameters["value"], 16),
data=bytes.fromhex(parameters["data"]), data=bytes.fromhex(parameters["data"]),
definitions=make_defs(parameters), definitions=make_defs(parameters),
chunkify=chunkify,
) )
assert sig_r.hex() == result["sig_r"] assert sig_r.hex() == result["sig_r"]

View File

@ -27,16 +27,23 @@ from ...common import MNEMONIC12
@pytest.mark.monero @pytest.mark.monero
@pytest.mark.skip_t1 @pytest.mark.skip_t1
@pytest.mark.setup_client(mnemonic=MNEMONIC12) @pytest.mark.setup_client(mnemonic=MNEMONIC12)
def test_monero_getaddress(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_monero_getaddress(client: Client, chunkify: bool):
assert ( assert (
monero.get_address(client, parse_path("m/44h/128h/0h"), show_display=True) monero.get_address(
client, parse_path("m/44h/128h/0h"), show_display=True, chunkify=chunkify
)
== b"4Ahp23WfMrMFK3wYL2hLWQFGt87ZTeRkufS6JoQZu6MEFDokAQeGWmu9MA3GFq1yVLSJQbKJqVAn9F9DLYGpRzRAEXqAXKM" == b"4Ahp23WfMrMFK3wYL2hLWQFGt87ZTeRkufS6JoQZu6MEFDokAQeGWmu9MA3GFq1yVLSJQbKJqVAn9F9DLYGpRzRAEXqAXKM"
) )
assert ( assert (
monero.get_address(client, parse_path("m/44h/128h/1h"), show_display=True) monero.get_address(
client, parse_path("m/44h/128h/1h"), show_display=True, chunkify=chunkify
)
== b"44iAazhoAkv5a5RqLNVyh82a1n3ceNggmN4Ho7bUBJ14WkEVR8uFTe9f7v5rNnJ2kEbVXxfXiRzsD5Jtc6NvBi4D6WNHPie" == b"44iAazhoAkv5a5RqLNVyh82a1n3ceNggmN4Ho7bUBJ14WkEVR8uFTe9f7v5rNnJ2kEbVXxfXiRzsD5Jtc6NvBi4D6WNHPie"
) )
assert ( assert (
monero.get_address(client, parse_path("m/44h/128h/2h"), show_display=True) monero.get_address(
client, parse_path("m/44h/128h/2h"), show_display=True, chunkify=chunkify
)
== b"47ejhmbZ4wHUhXaqA4b7PN667oPMkokf4ZkNdWrMSPy9TNaLVr7vLqVUQHh2MnmaAEiyrvLsX8xUf99q3j1iAeMV8YvSFcH" == b"47ejhmbZ4wHUhXaqA4b7PN667oPMkokf4ZkNdWrMSPy9TNaLVr7vLqVUQHh2MnmaAEiyrvLsX8xUf99q3j1iAeMV8YvSFcH"
) )

View File

@ -27,16 +27,25 @@ from ...common import MNEMONIC12
@pytest.mark.nem @pytest.mark.nem
@pytest.mark.skip_tr # coin not supported, @pytest.mark.skip_tr # coin not supported,
@pytest.mark.setup_client(mnemonic=MNEMONIC12) @pytest.mark.setup_client(mnemonic=MNEMONIC12)
def test_nem_getaddress(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_nem_getaddress(client: Client, chunkify: bool):
assert ( assert (
nem.get_address( nem.get_address(
client, parse_path("m/44h/1h/0h/0h/0h"), 0x68, show_display=True client,
parse_path("m/44h/1h/0h/0h/0h"),
0x68,
show_display=True,
chunkify=chunkify,
) )
== "NB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQGHUBWQN" == "NB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQGHUBWQN"
) )
assert ( assert (
nem.get_address( nem.get_address(
client, parse_path("m/44h/1h/0h/0h/0h"), 0x98, show_display=True client,
parse_path("m/44h/1h/0h/0h/0h"),
0x98,
show_display=True,
chunkify=chunkify,
) )
== "TB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQHSBNBMF" == "TB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQHSBNBMF"
) )

View File

@ -31,7 +31,8 @@ pytestmark = [
# assertion data from T1 # assertion data from T1
def test_nem_signtx_simple(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_nem_signtx_simple(client: Client, chunkify: bool):
tt = client.features.model == "T" tt = client.features.model == "T"
with client: with client:
client.set_expected_responses( client.set_expected_responses(
@ -68,6 +69,7 @@ def test_nem_signtx_simple(client: Client):
}, },
"version": (0x98 << 24), "version": (0x98 << 24),
}, },
chunkify=chunkify,
) )
assert ( assert (

View File

@ -28,7 +28,8 @@ pytestmark = [
] ]
def test_ripple_sign_simple_tx(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_ripple_sign_simple_tx(client: Client, chunkify: bool):
msg = ripple.create_sign_tx_msg( msg = ripple.create_sign_tx_msg(
{ {
"TransactionType": "Payment", "TransactionType": "Payment",
@ -41,7 +42,9 @@ def test_ripple_sign_simple_tx(client: Client):
"Sequence": 25, "Sequence": 25,
} }
) )
resp = ripple.sign_tx(client, parse_path("m/44h/144h/0h/0/0"), msg) resp = ripple.sign_tx(
client, parse_path("m/44h/144h/0h/0/0"), msg, chunkify=chunkify
)
assert ( assert (
resp.signature.hex() resp.signature.hex()
== "3045022100e243ef623675eeeb95965c35c3e06d63a9fc68bb37e17dc87af9c0af83ec057e02206ca8aa5eaab8396397aef6d38d25710441faf7c79d292ee1d627df15ad9346c0" == "3045022100e243ef623675eeeb95965c35c3e06d63a9fc68bb37e17dc87af9c0af83ec057e02206ca8aa5eaab8396397aef6d38d25710441faf7c79d292ee1d627df15ad9346c0"
@ -62,7 +65,9 @@ def test_ripple_sign_simple_tx(client: Client):
"Sequence": 1, "Sequence": 1,
} }
) )
resp = ripple.sign_tx(client, parse_path("m/44h/144h/0h/0/2"), msg) resp = ripple.sign_tx(
client, parse_path("m/44h/144h/0h/0/2"), msg, chunkify=chunkify
)
assert ( assert (
resp.signature.hex() resp.signature.hex()
== "3044022069900e6e578997fad5189981b74b16badc7ba8b9f1052694033fa2779113ddc002206c8006ada310edf099fb22c0c12073550c8fc73247b236a974c5f1144831dd5f" == "3044022069900e6e578997fad5189981b74b16badc7ba8b9f1052694033fa2779113ddc002206c8006ada310edf099fb22c0c12073550c8fc73247b236a974c5f1144831dd5f"
@ -86,7 +91,9 @@ def test_ripple_sign_simple_tx(client: Client):
"LastLedgerSequence": 333111, "LastLedgerSequence": 333111,
} }
) )
resp = ripple.sign_tx(client, parse_path("m/44h/144h/0h/0/2"), msg) resp = ripple.sign_tx(
client, parse_path("m/44h/144h/0h/0/2"), msg, chunkify=chunkify
)
assert ( assert (
resp.signature.hex() resp.signature.hex()
== "30450221008770743a472bb2d1c746a53ef131cc17cc118d538ec910ca928d221db4494cf702201e4ef242d6c3bff110c3cc3897a471fed0f5ac10987ea57da63f98dfa01e94df" == "30450221008770743a472bb2d1c746a53ef131cc17cc118d538ec910ca928d221db4494cf702201e4ef242d6c3bff110c3cc3897a471fed0f5ac10987ea57da63f98dfa01e94df"

View File

@ -112,8 +112,11 @@ def test_xdr(parameters, result):
@pytest.mark.altcoin @pytest.mark.altcoin
@pytest.mark.stellar @pytest.mark.stellar
@pytest.mark.parametrize("chunkify", (True, False))
@parametrize_using_common_fixtures("stellar/get_address.json") @parametrize_using_common_fixtures("stellar/get_address.json")
def test_get_address(client: Client, parameters, result): def test_get_address(client: Client, chunkify: bool, parameters, result):
address_n = parse_path(parameters["path"]) address_n = parse_path(parameters["path"])
address = stellar.get_address(client, address_n, show_display=True) address = stellar.get_address(
client, address_n, show_display=True, chunkify=chunkify
)
assert address == result["address"] assert address == result["address"]

View File

@ -24,11 +24,12 @@ from trezorlib.tools import parse_path
@pytest.mark.altcoin @pytest.mark.altcoin
@pytest.mark.tezos @pytest.mark.tezos
@pytest.mark.skip_t1 @pytest.mark.skip_t1
def test_tezos_get_address(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_tezos_get_address(client: Client, chunkify: bool):
path = parse_path("m/44h/1729h/0h") path = parse_path("m/44h/1729h/0h")
address = get_address(client, path, show_display=True) address = get_address(client, path, show_display=True, chunkify=chunkify)
assert address == "tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9" assert address == "tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9"
path = parse_path("m/44h/1729h/1h") path = parse_path("m/44h/1729h/1h")
address = get_address(client, path, show_display=True) address = get_address(client, path, show_display=True, chunkify=chunkify)
assert address == "tz1ekQapZCX4AXxTJhJZhroDKDYLHDHegvm1" assert address == "tz1ekQapZCX4AXxTJhJZhroDKDYLHDHegvm1"

View File

@ -166,7 +166,8 @@ def test_tezos_sing_tx_ballot_pass(client: Client):
) )
def test_tezos_sign_tx_tranasaction(client: Client): @pytest.mark.parametrize("chunkify", (True, False))
def test_tezos_sign_tx_tranasaction(client: Client, chunkify: bool):
resp = tezos.sign_tx( resp = tezos.sign_tx(
client, client,
TEZOS_PATH_10, TEZOS_PATH_10,
@ -188,6 +189,7 @@ def test_tezos_sign_tx_tranasaction(client: Client):
}, },
}, },
), ),
chunkify=chunkify,
) )
assert ( assert (
resp.signature resp.signature