mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 19:01:04 +00:00
feat(test): Device test for invalid Taproot addresses.
This commit is contained in:
parent
146c1fe721
commit
1ee443e8f8
@ -351,3 +351,35 @@ def test_attack_script_type(client: Client):
|
||||
btc.sign_tx(client, "Testnet", [inp1, inp2], [out1], prev_txes=TX_API)
|
||||
assert exc.value.code == messages.FailureType.ProcessError
|
||||
assert exc.value.message.endswith("Transaction has changed during signing")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"address",
|
||||
(
|
||||
# SegWit v1 pubkey not on the curve.
|
||||
"tb1pam775nxmvam4pfpqlm5q06k0y84e3x9w0xuhdpmxuna2qj3dfg6qy2pq29",
|
||||
# SegWit v1 invalid address length.
|
||||
"tb1plycg5qvjtrp3qjf5f7zl382j9x6nrjz9n0dh50",
|
||||
# Unrecognized SegWit version.
|
||||
"tb1zlycg5qvjtrp3qjf5f7zl382j9x6nrjz9sdhenvyxq8c3808qxmusxanpxu",
|
||||
# SegWit v1 pubkey x-coordinate exceeds the field size.
|
||||
"tb1pllllllllllllllllllllllllllllllllllllllllllllallllscqgl4zhn",
|
||||
),
|
||||
)
|
||||
def test_send_invalid_address(client, address):
|
||||
inp1 = messages.TxInputType(
|
||||
# tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c
|
||||
address_n=parse_path("86'/1'/0'/1/0"),
|
||||
amount=4600,
|
||||
prev_hash=TXHASH_7956f1,
|
||||
prev_index=1,
|
||||
script_type=messages.InputScriptType.SPENDTAPROOT,
|
||||
)
|
||||
out1 = messages.TxOutputType(
|
||||
address=address,
|
||||
amount=4450,
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
with pytest.raises(TrezorFailure):
|
||||
btc.sign_tx(client, "Testnet", [inp1], [out1], prev_txes=TX_API)
|
||||
|
@ -372,6 +372,10 @@
|
||||
"bitcoin-test_signtx_segwit_native.py::test_send_p2sh_change": "8288ac83c0e6d5924780ee3b1278e36063ad6c86a288d0b8abbb52eaaf0cc4e7",
|
||||
"bitcoin-test_signtx_segwit_native.py::test_send_to_taproot": "9a138b34e18e310617cc7d79cf2efa1c180948d1a4d3647f6de1e48d94a441b8",
|
||||
"bitcoin-test_signtx_taproot.py::test_attack_script_type": "9e6fc83df9e604e233e709f37dc8c7c6194de828d11a023ee7bca376d5304f60",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_invalid_address[tb1pam775nxmvam4pfpqlm5q06k0y84e3-a257be51": "1c100ce4b7c1e47e72428f390de0846c1ff933e9f07894872644a369a9422738",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_invalid_address[tb1plllllllllllllllllllllllllllll-aaa668e3": "1c100ce4b7c1e47e72428f390de0846c1ff933e9f07894872644a369a9422738",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_invalid_address[tb1plycg5qvjtrp3qjf5f7zl382j9x6nr-5447628e": "1c100ce4b7c1e47e72428f390de0846c1ff933e9f07894872644a369a9422738",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_invalid_address[tb1zlycg5qvjtrp3qjf5f7zl382j9x6nr-880d4a6b": "1c100ce4b7c1e47e72428f390de0846c1ff933e9f07894872644a369a9422738",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_mixed": "750648ddd29e1eee28bf2d4f292a131821cdf6413ccafbfed88ee5c8f70841b4",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_p2tr": "3ea24494ae8e004645d31afcd798066a784c44acb613588c407c4717ad9a56d6",
|
||||
"bitcoin-test_signtx_taproot.py::test_send_two_with_change": "b394ee2dcdc7d8b5906b9b4d7f52ac69af7e9e5f93229980f6450a1d4e83bd9b",
|
||||
|
Loading…
Reference in New Issue
Block a user