mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
chore(cardano): add show_details
tests
This commit is contained in:
parent
1a68650c43
commit
f2be6b9d91
460
common/tests/fixtures/cardano/sign_tx.show_details.json
vendored
Normal file
460
common/tests/fixtures/cardano/sign_tx.show_details.json
vendored
Normal file
@ -0,0 +1,460 @@
|
||||
{
|
||||
"setup": {
|
||||
"mnemonic": "all all all all all all all all all all all all",
|
||||
"passphrase": ""
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "Mainnet transaction without change",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/44'/1815'/0'/0/1",
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "Ae2tdPwUPEZCanmBz5g2GEwFqKTKpNJcGYPKfDxoNeKZ8bRHr8366kseiK2",
|
||||
"amount": "3003112"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "ORDINARY_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "73e09bdebf98a9e0f17f86a2d11e0f14f4f8dae77cdf26ff1678e821f20c8db6",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 0,
|
||||
"pub_key": "89053545a6c254b0d9b1464e48d2b5fcf91d4e25c128afb1fcfc61d0843338ea",
|
||||
"signature": "da07ac5246e3f20ebd1276476a4ae34a019dd4b264ffc22eea3c28cb0f1a6bb1c7764adeecf56bcb0bc6196fd1dbe080f3a7ef5b49f56980fe5b2881a4fdfa00",
|
||||
"chain_code": "26308151516f3b0e02bb1638142747863c520273ce9bd3e5cd91e1d46fe2a635"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "transaction with stake deregistration and withdrawal",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [
|
||||
{
|
||||
"type": 1,
|
||||
"path": "m/1852'/1815'/0'/2/0"
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/2/0",
|
||||
"amount": "1000"
|
||||
}
|
||||
],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
|
||||
"amount": "1"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "ORDINARY_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "22c67f12e6f6aa0f2f09fd27d472b19c7208ccd7c3af4b09604fd5d462c1de2b",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "7efa634e42fa844cad5f60bf005d645817cc674f30eaab0da398b99034850780b40ab5a1028da033330a0f82b01648ec92cff8ca85a072594efb298016f38d0d",
|
||||
"chain_code": null
|
||||
},
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "bc65be1b0b9d7531778a1317c2aa6de936963c3f9ac7d5ee9e9eda25e0c97c5e",
|
||||
"signature": "0202826a8b9688cf978000e7d1591582c65b149bb9f55dc883ae1acf85432618ca32be8a06fef37e69df503a294e7093006f63ababf9fcea639390226934020a",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Ordinary transaction with output datum hash",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1w9rhu54nz94k9l5v6d9rzfs47h7dv7xffcwkekuxcx3evnqpvuxu0",
|
||||
"amount": "1",
|
||||
"datum_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "ORDINARY_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "8ea2765f1e46d84f02d8b25a5f0cf445aaeaadcab913e17e59388a4f898ca812",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "ccc4e3c2adbf63561881212c8dffd42a02850460256da9b393aaed2cbd131fbb2798a92a2adf59c31d22e1e33c3dad011d91e09aa2d5b15ba64fa995bf241900",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Ordinary transaction with a required signer",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
|
||||
"amount": "1"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [
|
||||
{
|
||||
"key_path": "m/1852'/1815'/0'/0/1"
|
||||
}
|
||||
],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "ORDINARY_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "8c328640f974f47cecbcaed56e46c3ba4f2ea6769e6e3528915deb3bb518aa06",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "795cde3de6c43c4cd8030d80b5eb29c8bf60c6d90a641aa86b6590fce97e920261f947a7783193faad2ad26bf8e8f1f2c2eab3ee4a56f105c0acd97b0a779d00",
|
||||
"chain_code": null
|
||||
},
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "36a8ef21d5b98fdf23a27325cf643deaac35e912c835e35037f23d1061ae5b16",
|
||||
"signature": "53635fa332a154b8d345279e47d264c55533a897490016da76542fb960434afe99a759580b273e89233c45c7a2a193d7fae2e3b1181fcfba24988a045f7aea03",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Ordinary transaction with long inline datum, long reference script and change address",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"addressType": 0,
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"stakingPath": "m/1852'/1815'/0'/2/0",
|
||||
"amount": "1",
|
||||
"format": 1,
|
||||
"inline_datum": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"reference_script": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b73b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7b3"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "ORDINARY_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "ea6d50d786a7c252451704379a05bb21d3f9ad47d043d90fcc88cad5b78ca3bc",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "5b2e8f6874e4e842a31624582c7c4f7b13fb2602d4b28456ce712f3ccea3804c9fcdad728bc66a17f10fb8b1cad9cc3f77b0ecf2d70818a085c31ac230347b02",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Multisig transaction with a required signer",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"prev_hash": "3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1w9rhu54nz94k9l5v6d9rzfs47h7dv7xffcwkekuxcx3evnqpvuxu0",
|
||||
"amount": "1"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": null,
|
||||
"collateral_inputs": [],
|
||||
"required_signers": [
|
||||
{
|
||||
"key_path": "m/1854'/1815'/0'/0/1"
|
||||
}
|
||||
],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "MULTISIG_TRANSACTION",
|
||||
"additional_witness_requests": [
|
||||
{
|
||||
"path": "m/1854'/1815'/0'/0/2"
|
||||
}
|
||||
],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "dae07f98f82878ecd1a6ad988c55f80870c2fb299705ed181458664906583e51",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "021a000e3be05eb09051983cbf728322149cc5687a79f0a1dbccd25b3a754c59",
|
||||
"signature": "4ed37408b650b3fcf94f68007b4501dee814b27363eb7d19e6593966bc758d502114562c72698d9900eb0f5fdd06540922a4bc975fb4219e5d381a37a8dbd407",
|
||||
"chain_code": null
|
||||
},
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "e03c8b809288457c44e6dac9bc03d7c91cc0b26b482ae370f6b58da7c1fa90ec",
|
||||
"signature": "295b4f5b5c8775e3bbca87796979dc552ad5b3c41cdfac5c0ca4e5d00ad3a6138f764bcdaf771964f5b3582c9067b88f5ec62b1412ef682f818310c62208320a",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Plutus transaction with total collateral and device-owned collateral return",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
|
||||
"amount": "1"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": "d593fd793c377ac50a3169bb8378ffc257c944da31aa8f355dfa5a4f6ff89e02",
|
||||
"collateral_inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"required_signers": [],
|
||||
"collateral_return": {
|
||||
"addressType": 0,
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"stakingPath": "m/1852'/1815'/0'/2/0",
|
||||
"amount": "2000000",
|
||||
"token_bundle": [
|
||||
{
|
||||
"policy_id": "95a292ffee938be03e9bae5657982a74e9014eb4960108c9e23a5b39",
|
||||
"tokens": [
|
||||
{
|
||||
"asset_name_bytes": "74652474436f696e",
|
||||
"amount": "7878754"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"total_collateral": 1000,
|
||||
"reference_inputs": [],
|
||||
"signing_mode": "PLUTUS_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "1bef5859c3e23fad63141b61e03aa45537c5ec10ad7c4780a4ed198c17bee165",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "418c59ec2159f7a91e8608d9ee4bf1d6426b101a99ac8eedae04988c9c5342fdbed4d0b905e7ad7b0b0b58db3859b1b1ede51453d43803e1901546c508f7c308",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Plutus transaction with reference input",
|
||||
"parameters": {
|
||||
"protocol_magic": 764824073,
|
||||
"network_id": 1,
|
||||
"fee": 42,
|
||||
"ttl": 10,
|
||||
"validity_interval_start": null,
|
||||
"certificates": [],
|
||||
"withdrawals": [],
|
||||
"auxiliary_data": null,
|
||||
"inputs": [
|
||||
{
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"address": "addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r",
|
||||
"amount": "1"
|
||||
}
|
||||
],
|
||||
"mint": [],
|
||||
"script_data_hash": "d593fd793c377ac50a3169bb8378ffc257c944da31aa8f355dfa5a4f6ff89e02",
|
||||
"collateral_inputs": [
|
||||
{
|
||||
"path": "m/1852'/1815'/0'/0/0",
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"required_signers": [],
|
||||
"collateral_return": null,
|
||||
"total_collateral": null,
|
||||
"reference_inputs": [
|
||||
{
|
||||
"prev_hash": "1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc",
|
||||
"prev_index": 0
|
||||
}
|
||||
],
|
||||
"signing_mode": "PLUTUS_TRANSACTION",
|
||||
"additional_witness_requests": [],
|
||||
"include_network_id": false
|
||||
},
|
||||
"result": {
|
||||
"tx_hash": "98657251d3014dfd98e1eab94bf0a7f6252968d683df9bc8585bf431b4c72a51",
|
||||
"witnesses": [
|
||||
{
|
||||
"type": 1,
|
||||
"pub_key": "5d010cf16fdeff40955633d6c565f3844a288a24967cf6b76acbeb271b4f13c1",
|
||||
"signature": "6405f001eece1ad30e2807f2fc9b8585052003b059aacd41ef7c79994774fc074ca98936174290b02b46d2b8eeae1c5b7773123ba123097e5134b5c156a00900",
|
||||
"chain_code": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -29,6 +29,17 @@ pytestmark = [
|
||||
]
|
||||
|
||||
|
||||
def show_details_input_flow(client: Client):
|
||||
SHOW_ALL_BUTTON_POSITION = (143, 167)
|
||||
|
||||
yield
|
||||
client.debug.wait_layout()
|
||||
client.debug.click(SHOW_ALL_BUTTON_POSITION)
|
||||
# reset ui flow to continue "automatically"
|
||||
client.ui.input_flow = None
|
||||
yield
|
||||
|
||||
|
||||
@parametrize_using_common_fixtures(
|
||||
"cardano/sign_tx_stake_pool_registration.json",
|
||||
"cardano/sign_tx.json",
|
||||
@ -37,66 +48,13 @@ pytestmark = [
|
||||
"cardano/sign_tx.slip39.json",
|
||||
)
|
||||
def test_cardano_sign_tx(client: Client, parameters, result):
|
||||
client.init_device(new_session=True, derive_cardano=True)
|
||||
response = call_sign_tx(client, parameters)
|
||||
assert response == _transform_expected_result(result)
|
||||
|
||||
signing_mode = messages.CardanoTxSigningMode.__members__[parameters["signing_mode"]]
|
||||
inputs = [cardano.parse_input(i) for i in parameters["inputs"]]
|
||||
outputs = [cardano.parse_output(o) for o in parameters["outputs"]]
|
||||
certificates = [cardano.parse_certificate(c) for c in parameters["certificates"]]
|
||||
withdrawals = [cardano.parse_withdrawal(w) for w in parameters["withdrawals"]]
|
||||
auxiliary_data = cardano.parse_auxiliary_data(parameters["auxiliary_data"])
|
||||
mint = cardano.parse_mint(parameters["mint"])
|
||||
script_data_hash = cardano.parse_script_data_hash(parameters["script_data_hash"])
|
||||
collateral_inputs = [
|
||||
cardano.parse_collateral_input(i) for i in parameters["collateral_inputs"]
|
||||
]
|
||||
required_signers = [
|
||||
cardano.parse_required_signer(s) for s in parameters["required_signers"]
|
||||
]
|
||||
collateral_return = (
|
||||
cardano.parse_output(parameters["collateral_return"])
|
||||
if parameters["collateral_return"] is not None
|
||||
else None
|
||||
)
|
||||
reference_inputs = [
|
||||
cardano.parse_reference_input(i) for i in parameters["reference_inputs"]
|
||||
]
|
||||
additional_witness_requests = [
|
||||
cardano.parse_additional_witness_request(p)
|
||||
for p in parameters["additional_witness_requests"]
|
||||
]
|
||||
|
||||
if parameters.get("security_checks") == "prompt":
|
||||
device.apply_settings(
|
||||
client, safety_checks=messages.SafetyCheckLevel.PromptTemporarily
|
||||
)
|
||||
else:
|
||||
device.apply_settings(client, safety_checks=messages.SafetyCheckLevel.Strict)
|
||||
|
||||
with client:
|
||||
response = cardano.sign_tx(
|
||||
client=client,
|
||||
signing_mode=signing_mode,
|
||||
inputs=inputs,
|
||||
outputs=outputs,
|
||||
fee=parameters["fee"],
|
||||
ttl=parameters["ttl"],
|
||||
validity_interval_start=parameters["validity_interval_start"],
|
||||
certificates=certificates,
|
||||
withdrawals=withdrawals,
|
||||
protocol_magic=parameters["protocol_magic"],
|
||||
network_id=parameters["network_id"],
|
||||
auxiliary_data=auxiliary_data,
|
||||
mint=mint,
|
||||
script_data_hash=script_data_hash,
|
||||
collateral_inputs=collateral_inputs,
|
||||
required_signers=required_signers,
|
||||
collateral_return=collateral_return,
|
||||
total_collateral=parameters["total_collateral"],
|
||||
reference_inputs=reference_inputs,
|
||||
additional_witness_requests=additional_witness_requests,
|
||||
include_network_id=parameters["include_network_id"],
|
||||
)
|
||||
@parametrize_using_common_fixtures("cardano/sign_tx.show_details.json")
|
||||
def test_cardano_sign_tx_show_details(client: Client, parameters, result):
|
||||
response = call_sign_tx(client, parameters, show_details_input_flow)
|
||||
assert response == _transform_expected_result(result)
|
||||
|
||||
|
||||
@ -107,6 +65,11 @@ def test_cardano_sign_tx(client: Client, parameters, result):
|
||||
"cardano/sign_tx.plutus.failed.json",
|
||||
)
|
||||
def test_cardano_sign_tx_failed(client: Client, parameters, result):
|
||||
with pytest.raises(TrezorFailure, match=result["error_message"]):
|
||||
call_sign_tx(client, parameters, None)
|
||||
|
||||
|
||||
def call_sign_tx(client: Client, parameters, input_flow=None):
|
||||
client.init_device(new_session=True, derive_cardano=True)
|
||||
|
||||
signing_mode = messages.CardanoTxSigningMode.__members__[parameters["signing_mode"]]
|
||||
@ -144,8 +107,11 @@ def test_cardano_sign_tx_failed(client: Client, parameters, result):
|
||||
device.apply_settings(client, safety_checks=messages.SafetyCheckLevel.Strict)
|
||||
|
||||
with client:
|
||||
with pytest.raises(TrezorFailure, match=result["error_message"]):
|
||||
cardano.sign_tx(
|
||||
if input_flow is not None:
|
||||
client.watch_layout()
|
||||
client.set_input_flow(input_flow(client))
|
||||
|
||||
return cardano.sign_tx(
|
||||
client=client,
|
||||
signing_mode=signing_mode,
|
||||
inputs=inputs,
|
||||
|
Loading…
Reference in New Issue
Block a user