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

fix(tests): Add script_pubkey field to external inputs.

This commit is contained in:
Andrew Kozlik 2021-10-19 11:27:15 +02:00 committed by Andrew Kozlik
parent 7653efb415
commit ed9d3e3e9b
6 changed files with 32 additions and 0 deletions

View File

@ -95,6 +95,7 @@ def test_sign_tx(client):
prev_hash=TXHASH_e5b7e2,
prev_index=0,
script_type=messages.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
ownership_proof=bytearray.fromhex(
"534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002473044022072b4376c1b6c9e9e4d45158e1b6b4edfbe7b2292d8b4a60e8b0d273bcfef6b4a0220786169ab42a7663cb7d5f27ecb468da76dc2d1b7a10d1d18fbe5120e7890b9d2012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
),
@ -229,6 +230,7 @@ def test_unfair_fee(client):
prev_hash=TXHASH_e5b7e2,
prev_index=0,
script_type=messages.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
ownership_proof=bytearray.fromhex(
"534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002473044022072b4376c1b6c9e9e4d45158e1b6b4edfbe7b2292d8b4a60e8b0d273bcfef6b4a0220786169ab42a7663cb7d5f27ecb468da76dc2d1b7a10d1d18fbe5120e7890b9d2012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
),
@ -306,6 +308,7 @@ def test_no_anonymity(client):
prev_hash=TXHASH_e5b7e2,
prev_index=0,
script_type=messages.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
ownership_proof=bytearray.fromhex(
"534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002473044022072b4376c1b6c9e9e4d45158e1b6b4edfbe7b2292d8b4a60e8b0d273bcfef6b4a0220786169ab42a7663cb7d5f27ecb468da76dc2d1b7a10d1d18fbe5120e7890b9d2012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
),

View File

@ -443,6 +443,9 @@ class TestMsgSigntxBch:
prev_hash=TXHASH_502e85,
prev_index=0,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"76a914b1401fce7e8bf123c88a0467e0ed11e3b9fbef5488ac"
),
script_sig=bytes.fromhex(
"47304402207a2a955f1cb3dc5f03f2c82934f55654882af4e852e5159639f6349e9386ec4002205fb8419dce4e648eae8f67bc4e369adfb130a87d2ea2d668f8144213b12bb457412103174c61e9c5362507e8061e28d2c0ce3d4df4e73f3535ae0b12f37809e0f92d2d"
),

View File

@ -521,6 +521,9 @@ class TestMsgSigntxBitcoinGold:
prev_hash=TXHASH_f55c5b,
prev_index=0,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"a914aee37ad448e17438cabfee1756f2a08e33ed3ce887"
),
script_sig=bytes.fromhex("1600147c5edda9b293db2c8894b9d81efd77764910c445"),
witness=bytes.fromhex(
"024730440220091eece828409b3a9aa92dd2f9b032f9fb3a12b21b323a3fdea3cb18d08249af022065412107afcf76b0d28b90188c802f8f17b41790ed81c868d0ee23f1dd2ec53441210386789a34fe1a49bfc3e174adc6706c6222b0d80de76b884a0e3d32f8e9c4dc3e"

View File

@ -71,6 +71,9 @@ def test_p2pkh_presigned(client):
prev_index=0,
amount=31000000,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"76a914a579388225827d9f2fe9014add644487808c695d88ac"
),
script_sig=bytes.fromhex(
"473044022054fa66bfe1de1c850d59840f165143a66075bae78be3a6bc2809d1ac09431d380220019ecb086e16384f18cbae09b02bd2dce18763cd06454d33d93630561250965e0121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
),
@ -91,6 +94,9 @@ def test_p2pkh_presigned(client):
prev_index=1,
amount=600000000,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"76a9145b157a678a10021243307e4bb58f36375aa80e1088ac"
),
script_sig=bytearray.fromhex(
"463043021f3a0a7fdf27b340358ddf8b4e6e3e6cc0be728d6f1d9d3413ae59741f57599002204809d59a9432a2c7fcb10639c5efa82935d8c3cc21b185ff5e44f0e1a80e635401210294e3e5e77e22eea0e4c0d30d89beb4db7f69b4bf1ae709e411d6a06618b8f852"
),
@ -153,6 +159,7 @@ def test_p2wpkh_in_p2sh_presigned(client):
prev_hash=TXHASH_091446,
prev_index=1,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87"),
script_sig=bytearray.fromhex("160014d16b8c0680c61fc6ed2e407455715055e41052f5"),
witness=bytes.fromhex(
"02483045022100ead79ee134f25bb585b48aee6284a4bb14e07f03cc130253e83450d095515e5202201e161e9402c8b26b666f2b67e5b668a404ef7e57858ae9a6a68c3837e65fdc69012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b79"
@ -278,6 +285,7 @@ def test_p2wpkh_presigned(client):
prev_index=0,
amount=10000,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("0014fb7e49f4017dc951615dea221b66626189aa43b9"),
script_sig=bytes.fromhex(""),
witness=bytearray.fromhex(
"024730440220432ac60461de52713ad543cbb1484f7eca1a72c615d539b3f42f5668da4501d2022063786a6d6940a5c1ed9c2d2fd02cef90b6c01ddd84829c946561e15be6c0aae1012103dcf3bc936ecb2ec57b8f468050abce8c8756e75fd74273c9977744b1a0be7d03"
@ -341,6 +349,9 @@ def test_p2wsh_external_presigned(client):
prev_hash=TXHASH_a345b8,
prev_index=0,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"002008b681071cd896cd879102bce735080758ad48ad45a05505939e55f115391991"
),
amount=100,
witness=bytearray.fromhex(
"030047304402206b570b99c22c841548a35a9b9c673fa3b87a9563ed64ad7d979aa3e01b2e303802201d0bebf58b7243e09798e734fc32892936c4d0c4984bec755dc951ef646e4a9a0147512103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d2103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f86252ae"
@ -439,6 +450,7 @@ def test_p2wpkh_with_proof(client):
prev_hash=TXHASH_e5b7e2,
prev_index=0,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("00149c02608d469160a92f40fdf8c6ccced029493088"),
ownership_proof=bytearray.fromhex(
"534c001900016b2055d8190244b2ed2d46513c40658a574d3bc2deb6969c0535bb818b44d2c40002483045022100d4ad0374c922848c71d913fba59c81b9075e0d33e884d953f0c4b4806b8ffd0c022024740e6717a2b6a5aa03148c3a28b02c713b4e30fc8aeae67fa69eb20e8ddcd9012103505f0d82bbdd251511591b34f36ad5eea37d3220c2b81a1189084431ddb3aa3d"
),
@ -532,6 +544,7 @@ def test_p2wpkh_with_false_proof(client):
prev_index=0,
amount=10000,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex("0014fb7e49f4017dc951615dea221b66626189aa43b9"),
ownership_proof=bytes.fromhex(
"534c00190001b0b66657a824e41c063299fb4435dc70a6fd2e9db4c87e3c26a7ab7c0283547b0002473044022060bf60380142ed54fa907c82cb5ab438bfec22ebf8b5a92971fe104b7e3dd41002206f3fc4ac2f9c1a4a12255b5f678b6e57a088816051faea5a65a66951b394c150012103dcf3bc936ecb2ec57b8f468050abce8c8756e75fd74273c9977744b1a0be7d03"
),

View File

@ -332,6 +332,7 @@ def test_p2wpkh_payjoin(
script_type=messages.InputScriptType.EXTERNAL,
prev_hash=TXHASH_70f987,
prev_index=1,
script_pubkey=bytes.fromhex("0014167dae080bca35c9ea49c0c8335dcc4b252a1d70"),
witness=bytes.fromhex(copayer_witness),
)
@ -788,6 +789,7 @@ def test_attack_false_internal(client):
prev_index=0,
orig_hash=TXHASH_334cd7,
orig_index=1,
script_pubkey=bytes.fromhex("a914b9170a062fafcf4379729d104dd04859b1ce955887"),
script_sig=bytes.fromhex("160014209297fb46272a0b7e05139440dbd39daea3e25a"),
witness=bytes.fromhex(
"024730440220709798e66e44ee76d8b0858407b2098f2f0046703761e2617b2b870a346cb56c022010242f602cd41485934834ecf12c1647d003df8c9d4c0d8637514e1dc8a657a2012103c2c2e65556ca4b7371549324b99390725493c8a6792e093a0bdcbb3e2d7df4ab"
@ -894,6 +896,7 @@ def test_attack_fake_ext_input_amount(client):
prev_index=0,
orig_hash=TXHASH_ed89ac,
orig_index=1,
script_pubkey=bytes.fromhex("a914eb227e547838e56792d92ef597244d8b33767c8f87"),
script_sig=bytes.fromhex("160014681ea49259abb892460bf3373e8a0b43d877fa18"),
witness=bytes.fromhex(
"02483045022100d9c2d4364e104bf0d27886b4d7cd05f9a256bda8acbe84b7b2753f5c054b1a8602206a512575a89da5b5123e2769a5f73675b27b9f43d1a7b54bddeae039f6b83efa0121028cbc37e1816a23086fa738c8415def477e813e20f484dbbd6f5a33a37c322251"
@ -921,6 +924,10 @@ def test_attack_fake_ext_input_amount(client):
prev_tx_attack.inputs[1].amount -= 30000
prev_tx_attack.inputs[1].address_n = None
prev_tx_attack.inputs[1].script_type = messages.InputScriptType.EXTERNAL
prev_tx_attack.inputs[1].script_pubkey = bytes.fromhex(
"a914eb227e547838e56792d92ef597244d8b33767c8f87"
)
prev_txes = {
TXHASH_ed89ac: prev_tx_attack,
TXHASH_6673b7: TX_CACHE_TESTNET[TXHASH_6673b7],

View File

@ -238,6 +238,9 @@ class TestMsgSigntxZcash:
prev_hash=TXHASH_aaf51e,
prev_index=1,
script_type=proto.InputScriptType.EXTERNAL,
script_pubkey=bytes.fromhex(
"76a914a579388225827d9f2fe9014add644487808c695d88ac"
),
script_sig=bytes.fromhex(
"47304402202495a38e5b368569a1a0c9fc95aa7e57a0dd5ae43f51300d7222dc139015233d022047833eaa571578f72c8468c8b537b36410388b7eb5001d75d1f4b954e1997d590121030e669acac1f280d1ddf441cd2ba5e97417bf2689e4bbec86df4f831bf9f7ffd0"
),