From e853cf0d163c8f2687a739130f3e400a36e90d00 Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Wed, 11 Sep 2024 18:54:31 +0200 Subject: [PATCH] fix Python typings Mintlayer --- .../modtrezormintlayer/modtrezormintlayer.c | 55 ++++- ...mintlayer-utils.h => modtrezormintlayer.h} | 108 +++----- core/mocks/generated/trezormintlayer.pyi | 86 +++---- core/src/all_modules.py | 2 - core/src/apps/mintlayer/sign_tx/helpers.py | 231 +----------------- core/src/apps/mintlayer/sign_tx/layout.py | 93 +------ core/src/apps/mintlayer/sign_tx/signer.py | 6 +- core/src/apps/mintlayer/writers.py | 110 --------- core/src/trezor/crypto/__init__.py | 2 +- rust/trezor-client/src/error.rs | 8 - 10 files changed, 135 insertions(+), 566 deletions(-) rename core/embed/extmod/modtrezormintlayer/{modtrezormintlayer-utils.h => modtrezormintlayer.h} (82%) delete mode 100644 core/src/apps/mintlayer/writers.py diff --git a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c index 40003da50..8128e353b 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.c @@ -29,21 +29,60 @@ // #if MICROPY_PY_TREZORMINTLAYER -#include "modtrezormintlayer-utils.h" +#include "modtrezormintlayer.h" -STATIC const mp_rom_map_elem_t mp_module_trezormintlayer_globals_table[] = { +STATIC const mp_rom_map_elem_t mod_trezormintlayer_globals_table[] = { {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezormintlayer)}, - {MP_ROM_QSTR(MP_QSTR_utils), MP_ROM_PTR(&mod_trezormintlayer_utils_module)}, + {MP_ROM_QSTR(MP_QSTR_encode_utxo_input), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_utxo_input_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_account_spending_input), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_account_spending_input_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_account_command_input), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_account_command_input_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_transfer_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_transfer_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_lock_then_transfer_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_burn_output), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_burn_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_create_stake_pool_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_produce_from_stake_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_create_delegation_id_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_delegate_staking_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_issue_fungible_token_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_issue_nft_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_data_deposit_output), + MP_ROM_PTR( + &mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_htlc_output), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_htlc_output_obj)}, + {MP_ROM_QSTR(MP_QSTR_encode_compact_length), + MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_comact_length_obj)}, }; -STATIC MP_DEFINE_CONST_DICT(mp_module_trezormintlayer_globals, - mp_module_trezormintlayer_globals_table); +STATIC MP_DEFINE_CONST_DICT(mod_trezormintlayer_globals, + mod_trezormintlayer_globals_table); -const mp_obj_module_t mp_module_trezormintlayer = { +STATIC const mp_obj_module_t mp_module_trezormintlayer = { .base = {&mp_type_module}, - .globals = (mp_obj_dict_t *)&mp_module_trezormintlayer_globals, + .globals = (mp_obj_dict_t *)&mod_trezormintlayer_globals, }; MP_REGISTER_MODULE(MP_QSTR_trezormintlayer, mp_module_trezormintlayer); // #endif // MICROPY_PY_TREZORMINTLAYER - diff --git a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h similarity index 82% rename from core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h rename to core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h index a92f603ad..b68521672 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer.h @@ -87,7 +87,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3( mod_trezormintlayer_utils_mintlayer_encode_utxo_input_obj, mod_trezormintlayer_utils_mintlayer_encode_utxo_input); -/// def encode_account_spending_input(nonce: int, delegation_id: str, amount: +/// def encode_account_spending_input(nonce: int, delegation_id: bytes, amount: /// bytes) -> bytes: /// """ /// encodes an utxo account spendinf from nonce and delegation id @@ -125,10 +125,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3( mod_trezormintlayer_utils_mintlayer_encode_account_spending_input_obj, mod_trezormintlayer_utils_mintlayer_encode_account_spending_input); -/// def encode_account_command_input(nonce: int, command: int token_id: str, +/// def encode_account_command_input(nonce: int, command: int token_id: bytes, /// data: bytes) -> bytes: /// """ -/// encodes an account command from the nonce, command, token id and additional command data +/// encodes an account command from the nonce, command, token id and +/// additional command data /// """ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_account_command_input( @@ -164,8 +165,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( mod_trezormintlayer_utils_mintlayer_encode_account_command_input_obj, 4, 4, mod_trezormintlayer_utils_mintlayer_encode_account_command_input); -/// def encode_transfer_output(amount: str, token_id: str, address: str) -> -/// bytes: +/// def encode_transfer_output(amount: bytes, token_id: bytes, address: bytes) +/// -> bytes: /// """ /// encodes a transfer output with given amount and destination address /// """ @@ -196,10 +197,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3( mod_trezormintlayer_utils_mintlayer_encode_transfer_output_obj, mod_trezormintlayer_utils_mintlayer_encode_transfer_output); -/// def encode_lock_then_transfer_output(amount: str, token_id: str, lock_type: -/// int, lock_amount:int, address: str) -> bytes: +/// def encode_lock_then_transfer_output(amount: bytes, token_id: bytes, +/// lock_type: int, lock_amount:int, address: bytes) -> bytes: /// """ -/// encodes a transfer output with given amount, lock type and amount, and destination address +/// encodes a transfer output with given amount, lock type and amount, and +/// destination address /// """ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output( @@ -231,7 +233,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output_obj, 5, 5, mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output); -/// def encode_burn_output(amount: str, token_id: str) -> +/// def encode_burn_output(amount: bytes, token_id: bytes) -> /// bytes: /// """ /// encodes a burn output with given amount @@ -260,9 +262,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2( mod_trezormintlayer_utils_mintlayer_encode_burn_output_obj, mod_trezormintlayer_utils_mintlayer_encode_burn_output); -/// def encode_create_stake_pool_output(pool_id: str, pledge_amount: str, -/// staker: str, vrf_public_key: str, decommission_key: str, -/// margin_ratio_per_thousand: int, cost_per_block: str) -> bytes: +/// def encode_create_stake_pool_output(pool_id: bytes, pledge_amount: bytes, +/// staker: bytes, vrf_public_key: bytes, decommission_key: bytes, +/// margin_ratio_per_thousand: int, cost_per_block: bytes) -> bytes: /// """ /// encodes a create stake pool output /// """ @@ -304,7 +306,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output_obj, 7, 7, mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output); -/// def encode_produce_from_stake_output(destination: str, pool_id: str) -> +/// def encode_produce_from_stake_output(destination: bytes, pool_id: bytes) -> /// bytes: /// """ /// encodes a produce from stake output @@ -334,8 +336,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2( mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output_obj, mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output); -/// def encode_create_delegation_id_output(destination: str, pool_id: str) -> -/// bytes: +/// def encode_create_delegation_id_output(destination: bytes, pool_id: bytes) +/// -> bytes: /// """ /// encodes a create delegation id output /// """ @@ -364,7 +366,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2( mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output_obj, mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output); -/// def encode_delegate_staking_output(amount: str, delegation_id: str) -> +/// def encode_delegate_staking_output(amount: bytes, delegation_id: bytes) -> /// bytes: /// """ /// encodes a delegation staking output, given the amount and delegation id @@ -394,9 +396,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2( mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output_obj, mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output); -/// def encode_issue_fungible_token_output(token_ticker: str, -/// number_of_decimals: int, metadata_uri: str, total_supply_type: int, -/// fixed_amount: str, authority: str, is_freezable: int) -> bytes: +/// def encode_issue_fungible_token_output(token_ticker: bytes, +/// number_of_decimals: int, metadata_uri: bytes, total_supply_type: int, +/// fixed_amount: bytes, authority: bytes, is_freezable: int) -> bytes: /// """ /// encodes a issue fungible token output /// """ @@ -436,10 +438,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( 7, 7, mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output); -/// def encode_issue_nft_output(token_id: str, -/// creator: str, name: str, destination: str, -/// ticker: str, icon_uri: str, additional_metadata_uri: str, media_uri: str, -/// media_hash: str, destination: str) -> bytes: +/// def encode_issue_nft_output(token_id: bytes, +/// creator: bytes, name: bytes, destination: bytes, +/// ticker: bytes, icon_uri: bytes, additional_metadata_uri: bytes, media_uri: +/// bytes, media_hash: bytes, destination: bytes) -> bytes: /// """ /// encodes a issue NFT output /// """ @@ -488,7 +490,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output_obj, 10, 10, mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output); -/// def encode_data_deposit_output(deposit: str) -> +/// def encode_data_deposit_output(deposit: bytes) -> /// bytes: /// """ /// encodes a data deposit output @@ -515,9 +517,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1( mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj, mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output); -/// def encode_htlc_output(amount: str, token_id: str, lock_type: -/// int, lock_amount:int, refund_key: str, spend_key: str, secret_has: bytes) -> -/// bytes: +/// def encode_htlc_output(amount: bytes, token_id: bytes, lock_type: +/// int, lock_amount:int, refund_key: bytes, spend_key: bytes, secret_has: +/// bytes) -> bytes: /// """ /// encodes an htlc output with given amount and lock /// """ @@ -578,55 +580,3 @@ mod_trezormintlayer_utils_mintlayer_encode_comact_length(mp_obj_t length) { STATIC MP_DEFINE_CONST_FUN_OBJ_1( mod_trezormintlayer_utils_mintlayer_encode_comact_length_obj, mod_trezormintlayer_utils_mintlayer_encode_comact_length); - -STATIC const mp_rom_map_elem_t mod_trezormintlayer_utils_globals_table[] = { - {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bip32)}, - {MP_ROM_QSTR(MP_QSTR_encode_utxo_input), - MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_utxo_input_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_account_spending_input), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_account_spending_input_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_account_command_input), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_account_command_input_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_transfer_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_transfer_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_lock_then_transfer_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_lock_then_transfer_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_burn_output), - MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_burn_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_create_stake_pool_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_create_stake_pool_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_produce_from_stake_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_produce_from_stake_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_create_delegation_id_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_create_delegation_id_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_delegate_staking_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_delegate_staking_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_issue_fungible_token_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_issue_fungible_token_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_issue_nft_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_issue_nft_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_data_deposit_output), - MP_ROM_PTR( - &mod_trezormintlayer_utils_mintlayer_encode_data_deposit_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_htlc_output), - MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_htlc_output_obj)}, - {MP_ROM_QSTR(MP_QSTR_encode_compact_length), - MP_ROM_PTR(&mod_trezormintlayer_utils_mintlayer_encode_comact_length_obj)}, -}; -STATIC MP_DEFINE_CONST_DICT(mod_trezormintlayer_utils_globals, - mod_trezormintlayer_utils_globals_table); - -STATIC const mp_obj_module_t mod_trezormintlayer_utils_module = { - .base = {&mp_type_module}, - .globals = (mp_obj_dict_t *)&mod_trezormintlayer_utils_globals, -}; diff --git a/core/mocks/generated/trezormintlayer.pyi b/core/mocks/generated/trezormintlayer.pyi index c97a6249d..00d52689c 100644 --- a/core/mocks/generated/trezormintlayer.pyi +++ b/core/mocks/generated/trezormintlayer.pyi @@ -1,123 +1,125 @@ from typing import * -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +# extmod/modtrezormintlayer/modtrezormintlayer.h def encode_utxo_input(tx_hash: bytes, index: int, utxo_type: int) -> bytes: """ encodes an utxo input from tx_hash and index """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_account_spending_input(nonce: int, delegation_id: str, amount: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_account_spending_input(nonce: int, delegation_id: bytes, amount: bytes) -> bytes: """ encodes an utxo account spendinf from nonce and delegation id """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_account_command_input(nonce: int, command: int token_id: str, +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_account_command_input(nonce: int, command: int token_id: bytes, data: bytes) -> bytes: """ - encodes an account command from the nonce, command, token id and additional command data + encodes an account command from the nonce, command, token id and + additional command data """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_transfer_output(amount: str, token_id: str, address: str) -> -bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_transfer_output(amount: bytes, token_id: bytes, address: bytes) +-> bytes: """ encodes a transfer output with given amount and destination address """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_lock_then_transfer_output(amount: str, token_id: str, lock_type: -int, lock_amount:int, address: str) -> bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_lock_then_transfer_output(amount: bytes, token_id: bytes, +lock_type: int, lock_amount:int, address: bytes) -> bytes: """ - encodes a transfer output with given amount, lock type and amount, and destination address + encodes a transfer output with given amount, lock type and amount, and + destination address """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_burn_output(amount: str, token_id: str) -> +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_burn_output(amount: bytes, token_id: bytes) -> bytes: """ encodes a burn output with given amount """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_create_stake_pool_output(pool_id: str, pledge_amount: str, -staker: str, vrf_public_key: str, decommission_key: str, -margin_ratio_per_thousand: int, cost_per_block: str) -> bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_create_stake_pool_output(pool_id: bytes, pledge_amount: bytes, +staker: bytes, vrf_public_key: bytes, decommission_key: bytes, +margin_ratio_per_thousand: int, cost_per_block: bytes) -> bytes: """ encodes a create stake pool output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_produce_from_stake_output(destination: str, pool_id: str) -> +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_produce_from_stake_output(destination: bytes, pool_id: bytes) -> bytes: """ encodes a produce from stake output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_create_delegation_id_output(destination: str, pool_id: str) -> -bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_create_delegation_id_output(destination: bytes, pool_id: bytes) +-> bytes: """ encodes a create delegation id output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_delegate_staking_output(amount: str, delegation_id: str) -> +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_delegate_staking_output(amount: bytes, delegation_id: bytes) -> bytes: """ encodes a delegation staking output, given the amount and delegation id """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_issue_fungible_token_output(token_ticker: str, -number_of_decimals: int, metadata_uri: str, total_supply_type: int, -fixed_amount: str, authority: str, is_freezable: int) -> bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_issue_fungible_token_output(token_ticker: bytes, +number_of_decimals: int, metadata_uri: bytes, total_supply_type: int, +fixed_amount: bytes, authority: bytes, is_freezable: int) -> bytes: """ encodes a issue fungible token output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_issue_nft_output(token_id: str, -creator: str, name: str, destination: str, -ticker: str, icon_uri: str, additional_metadata_uri: str, media_uri: str, -media_hash: str, destination: str) -> bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_issue_nft_output(token_id: bytes, +creator: bytes, name: bytes, destination: bytes, +ticker: bytes, icon_uri: bytes, additional_metadata_uri: bytes, media_uri: +bytes, media_hash: bytes, destination: bytes) -> bytes: """ encodes a issue NFT output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_data_deposit_output(deposit: str) -> +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_data_deposit_output(deposit: bytes) -> bytes: """ encodes a data deposit output """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h -def encode_htlc_output(amount: str, token_id: str, lock_type: -int, lock_amount:int, refund_key: str, spend_key: str, secret_has: bytes) -> -bytes: +# extmod/modtrezormintlayer/modtrezormintlayer.h +def encode_htlc_output(amount: bytes, token_id: bytes, lock_type: +int, lock_amount:int, refund_key: bytes, spend_key: bytes, secret_has: +bytes) -> bytes: """ encodes an htlc output with given amount and lock """ -# extmod/modtrezormintlayer/modtrezormintlayer-utils.h +# extmod/modtrezormintlayer/modtrezormintlayer.h def encode_compact_length(length: int) -> bytes: """ encodes a comapct length to bytes diff --git a/core/src/all_modules.py b/core/src/all_modules.py index 781d76ddf..68d64b78c 100644 --- a/core/src/all_modules.py +++ b/core/src/all_modules.py @@ -561,8 +561,6 @@ import apps.mintlayer.sign_tx.progress apps.mintlayer.sign_tx.signer import apps.mintlayer.sign_tx.signer - apps.mintlayer.writers - import apps.mintlayer.writers apps.monero import apps.monero apps.monero.diag diff --git a/core/src/apps/mintlayer/sign_tx/helpers.py b/core/src/apps/mintlayer/sign_tx/helpers.py index 215545c9e..951ca89b8 100644 --- a/core/src/apps/mintlayer/sign_tx/helpers.py +++ b/core/src/apps/mintlayer/sign_tx/helpers.py @@ -1,31 +1,28 @@ +from micropython import const from typing import TYPE_CHECKING, Tuple from trezor import utils from trezor.enums import MintlayerRequestType from trezor.wire import DataError -from ..writers import TX_HASH_SIZE from . import layout if TYPE_CHECKING: from typing import Any, Awaitable - from trezor.enums import AmountUnit from trezor.messages import ( - PrevInput, - PrevOutput, PrevTx, SignTx, - TxAckPaymentRequest, MintlayerTxInput, MintlayerTxOutput, MintlayerOutputTimeLock, - TxOutput, MintlayerTxRequest, ) from apps.common.coininfo import CoinInfo from apps.common.paths import Bip32Path +TX_HASH_SIZE = const(32) + # Machine instructions # === @@ -40,7 +37,7 @@ def confirm_dialog(self) -> Awaitable[Any]: class UiConfirmOutput(UiConfirm): def __init__( self, - output: TxOutput, + output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool, @@ -59,93 +56,6 @@ def confirm_dialog(self) -> Awaitable[Any]: ) -class UiConfirmDecredSSTXSubmission(UiConfirm): - def __init__(self, output: TxOutput, coin: CoinInfo, amount_unit: AmountUnit): - self.output = output - self.coin = coin - self.amount_unit = amount_unit - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_decred_sstx_submission( - self.output, self.coin, self.amount_unit - ) - - -class UiConfirmPaymentRequest(UiConfirm): - def __init__( - self, - payment_req: TxAckPaymentRequest, - coin: CoinInfo, - amount_unit: AmountUnit, - ): - self.payment_req = payment_req - self.amount_unit = amount_unit - self.coin = coin - - def confirm_dialog(self) -> Awaitable[bool]: - return layout.should_show_payment_request_details( - self.payment_req, self.coin, self.amount_unit - ) - - __eq__ = utils.obj_eq - - -class UiConfirmReplacement(UiConfirm): - def __init__(self, title: str, txid: bytes): - self.title = title - self.txid = txid - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_replacement(self.title, self.txid) - - -class UiConfirmModifyOutput(UiConfirm): - def __init__( - self, - txo: TxOutput, - orig_txo: TxOutput, - coin: CoinInfo, - amount_unit: AmountUnit, - ): - self.txo = txo - self.orig_txo = orig_txo - self.coin = coin - self.amount_unit = amount_unit - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_modify_output( - self.txo, self.orig_txo, self.coin, self.amount_unit - ) - - -class UiConfirmModifyFee(UiConfirm): - def __init__( - self, - title: str, - user_fee_change: int, - total_fee_new: int, - fee_rate: float, - coin: CoinInfo, - amount_unit: AmountUnit, - ): - self.title = title - self.user_fee_change = user_fee_change - self.total_fee_new = total_fee_new - self.fee_rate = fee_rate - self.coin = coin - self.amount_unit = amount_unit - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_modify_fee( - self.title, - self.user_fee_change, - self.total_fee_new, - self.fee_rate, - self.coin, - self.amount_unit, - ) - - class UiConfirmTotal(UiConfirm): def __init__( self, @@ -153,14 +63,12 @@ def __init__( fee: int, fee_rate: float, coin: CoinInfo, - amount_unit: AmountUnit, address_n: Bip32Path | None, ): self.spending = spending self.fee = fee self.fee_rate = fee_rate self.coin = coin - self.amount_unit = amount_unit self.address_n = address_n def confirm_dialog(self) -> Awaitable[Any]: @@ -169,36 +77,10 @@ def confirm_dialog(self) -> Awaitable[Any]: self.fee, self.fee_rate, self.coin, - self.amount_unit, self.address_n, ) -class UiConfirmJointTotal(UiConfirm): - def __init__( - self, spending: int, total: int, coin: CoinInfo, amount_unit: AmountUnit - ): - self.spending = spending - self.total = total - self.coin = coin - self.amount_unit = amount_unit - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_joint_total( - self.spending, self.total, self.coin, self.amount_unit - ) - - -class UiConfirmFeeOverThreshold(UiConfirm): - def __init__(self, fee: int, coin: CoinInfo, amount_unit: AmountUnit): - self.fee = fee - self.coin = coin - self.amount_unit = amount_unit - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_feeoverthreshold(self.fee, self.coin, self.amount_unit) - - class UiConfirmChangeCountOverThreshold(UiConfirm): def __init__(self, change_count: int): self.change_count = change_count @@ -222,60 +104,17 @@ def confirm_dialog(self) -> Awaitable[Any]: return paths.show_path_warning(self.address_n) -class UiConfirmNonDefaultLocktime(UiConfirm): - def __init__(self, lock_time: int, lock_time_disabled: bool): - self.lock_time = lock_time - self.lock_time_disabled = lock_time_disabled - - def confirm_dialog(self) -> Awaitable[Any]: - return layout.confirm_nondefault_locktime( - self.lock_time, self.lock_time_disabled - ) - - class UiConfirmMultipleAccounts(UiConfirm): def confirm_dialog(self) -> Awaitable[Any]: return layout.confirm_multiple_accounts() -def confirm_output(output: TxOutput, coin: CoinInfo, output_index: int, chunkify: bool) -> Awaitable[None]: # type: ignore [awaitable-is-generator] +def confirm_output(output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool) -> Awaitable[None]: # type: ignore [awaitable-is-generator] return (yield UiConfirmOutput(output, coin, output_index, chunkify)) -def confirm_decred_sstx_submission(output: TxOutput, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[None]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmDecredSSTXSubmission(output, coin, amount_unit)) - - -def should_show_payment_request_details(payment_req: TxAckPaymentRequest, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[bool]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmPaymentRequest(payment_req, coin, amount_unit)) - - -def confirm_replacement(description: str, txid: bytes) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmReplacement(description, txid)) - - -def confirm_modify_output(txo: TxOutput, orig_txo: TxOutput, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmModifyOutput(txo, orig_txo, coin, amount_unit)) - - -def confirm_modify_fee(title: str, user_fee_change: int, total_fee_new: int, fee_rate: float, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return ( - yield UiConfirmModifyFee( - title, user_fee_change, total_fee_new, fee_rate, coin, amount_unit - ) - ) - - -def confirm_total(spending: int, fee: int, fee_rate: float, coin: CoinInfo, amount_unit: AmountUnit, address_n: Bip32Path | None) -> Awaitable[None]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmTotal(spending, fee, fee_rate, coin, amount_unit, address_n)) - - -def confirm_joint_total(spending: int, total: int, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmJointTotal(spending, total, coin, amount_unit)) - - -def confirm_feeoverthreshold(fee: int, coin: CoinInfo, amount_unit: AmountUnit) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmFeeOverThreshold(fee, coin, amount_unit)) +def confirm_total(spending: int, fee: int, fee_rate: float, coin: CoinInfo, address_n: Bip32Path | None) -> Awaitable[None]: # type: ignore [awaitable-is-generator] + return (yield UiConfirmTotal(spending, fee, fee_rate, coin, address_n)) def confirm_change_count_over_threshold(change_count: int) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] @@ -290,25 +129,10 @@ def confirm_foreign_address(address_n: list) -> Awaitable[Any]: # type: ignore return (yield UiConfirmForeignAddress(address_n)) -def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) -> Awaitable[Any]: # type: ignore [awaitable-is-generator] - return (yield UiConfirmNonDefaultLocktime(lock_time, lock_time_disabled)) - - def confirm_multiple_accounts() -> Awaitable[Any]: # type: ignore [awaitable-is-generator] return (yield UiConfirmMultipleAccounts()) -def request_tx_meta(tx_req: TxRequest, coin: CoinInfo, tx_hash: bytes | None = None) -> Awaitable[PrevTx]: # type: ignore [awaitable-is-generator] - from trezor.messages import TxAckPrevMeta - - assert tx_req.details is not None - tx_req.request_type = MintlayerRequestType.TXMETA - tx_req.details.tx_hash = tx_hash - ack = yield TxAckPrevMeta, tx_req - _clear_tx_request(tx_req) - return _sanitize_tx_meta(ack.tx, coin) - - def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerTxInput]: # type: ignore [awaitable-is-generator] from trezor.messages import MintlayerTxAckUtxoInput @@ -320,19 +144,7 @@ def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerT return _sanitize_tx_input(ack.tx.input) -def request_tx_prev_input(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[PrevInput]: # type: ignore [awaitable-is-generator] - from trezor.messages import TxAckPrevInput - - assert tx_req.details is not None - tx_req.request_type = MintlayerRequestType.TXINPUT - tx_req.details.request_index = i - tx_req.details.tx_hash = tx_hash - ack = yield TxAckPrevInput, tx_req - _clear_tx_request(tx_req) - return _sanitize_tx_prev_input(ack.tx.input, coin) - - -def request_tx_output(tx_req: TxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTxOutput]: # type: ignore [awaitable-is-generator] +def request_tx_output(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTxOutput]: # type: ignore [awaitable-is-generator] from trezor.messages import MintlayerTxAckOutput assert tx_req.details is not None @@ -347,20 +159,7 @@ def request_tx_output(tx_req: TxRequest, i: int, tx_hash: bytes | None = None) - return _sanitize_tx_output(ack.tx.output) -def request_tx_prev_output(tx_req: TxRequest, i: int, coin: CoinInfo, tx_hash: bytes | None = None) -> Awaitable[PrevOutput]: # type: ignore [awaitable-is-generator] - from trezor.messages import TxAckPrevOutput - - assert tx_req.details is not None - tx_req.request_type = MintlayerRequestType.TXOUTPUT - tx_req.details.request_index = i - tx_req.details.tx_hash = tx_hash - ack = yield TxAckPrevOutput, tx_req - _clear_tx_request(tx_req) - # return sanitize_tx_prev_output(ack.tx, coin) # no sanitize is required - return ack.tx.output - - -def request_tx_finish(tx_req: TxRequest) -> Awaitable[None]: # type: ignore [awaitable-is-generator] +def request_tx_finish(tx_req: MintlayerTxRequest) -> Awaitable[None]: # type: ignore [awaitable-is-generator] tx_req.request_type = MintlayerRequestType.TXFINISHED yield None, tx_req _clear_tx_request(tx_req) @@ -470,16 +269,6 @@ def _sanitize_tx_input(txi: MintlayerTxInput) -> MintlayerTxInput: return txi -def _sanitize_tx_prev_input(txi: PrevInput, coin: CoinInfo) -> PrevInput: - if len(txi.prev_hash) != TX_HASH_SIZE: - raise DataError("Provided prev_hash is invalid.") - - if not coin.decred and txi.decred_tree is not None: - raise DataError("Decred details provided but Decred coin not specified.") - - return txi - - def _sanitize_tx_output(txo: MintlayerTxOutput) -> MintlayerTxOutput: from trezor.wire import DataError # local_cache_global @@ -518,5 +307,5 @@ def get_lock(x: MintlayerOutputTimeLock) -> Tuple[int, int]: lock_type = 3 lock_amount = x.for_seconds else: - raise Exception("unhandled mintlayer lock type") + raise DataError("unhandled mintlayer lock type") return (lock_type, lock_amount) diff --git a/core/src/apps/mintlayer/sign_tx/layout.py b/core/src/apps/mintlayer/sign_tx/layout.py index 031a55540..617bd107b 100644 --- a/core/src/apps/mintlayer/sign_tx/layout.py +++ b/core/src/apps/mintlayer/sign_tx/layout.py @@ -1,4 +1,3 @@ -from micropython import const from typing import TYPE_CHECKING from trezor import TR @@ -10,7 +9,6 @@ from trezor.crypto.bech32 import bech32_encode, convertbits, Encoding -from ...bitcoin import addresses from ...bitcoin.common import ( BIP32_WALLET_DEPTH, format_fee_rate, @@ -18,8 +16,7 @@ from ...bitcoin.keychain import address_n_to_name if TYPE_CHECKING: - from trezor.enums import AmountUnit - from trezor.messages import TxAckPaymentRequest, TxOutput, MintlayerTokenOutputValue, MintlayerOutputTimeLock + from trezor.messages import MintlayerTokenOutputValue, MintlayerOutputTimeLock from apps.common.coininfo import CoinInfo from apps.common.paths import Bip32Path @@ -28,8 +25,6 @@ MintlayerTxOutput, ) -_LOCKTIME_TIMESTAMP_MIN_VALUE = const(500_000_000) - ML_COIN = "ML" POOL_HRP = "mpool" DELEGATION_HRP = "mdeleg" @@ -110,6 +105,7 @@ async def confirm_output( x = output.create_delegation_id assert x.destination is not None amount = "" + # FIXME: extract those 2 into 1 helper function data = convertbits(x.pool_id, 8, 5) pool_id_address = bech32_encode(POOL_HRP, data, Encoding.BECH32M) address_short = f"Address: {x.destination}\nPoolId: {pool_id_address}" @@ -125,8 +121,6 @@ async def confirm_output( elif output.issue_fungible_token: x = output.issue_fungible_token ticker = x.token_ticker.decode('utf-8') - name = x.name.decode('utf-8') - additional_metadata_uri = x.additional_metadata_uri.decode('utf-8') if x.additional_metadata_uri else None metadata_uri = x.metadata_uri.decode('utf-8') if x.metadata_uri else None if x.total_supply.type == MintlayerTokenTotalSupplyType.UNLIMITED: total_supply = "UNLIMITED" @@ -201,65 +195,11 @@ async def confirm_output( await layout -async def confirm_decred_sstx_submission( - output: TxOutput, coin: CoinInfo, amount_unit: AmountUnit -) -> None: - assert output.address is not None - address_short = addresses.address_short(coin, output.address) - amount = format_coin_amount(output.amount, coin, amount_unit) - - await layouts.confirm_value( - TR.bitcoin__title_purchase_ticket, - amount, - TR.bitcoin__ticket_amount, - "confirm_decred_sstx_submission", - ButtonRequestType.ConfirmOutput, - verb=TR.buttons__confirm, - ) - - await layouts.confirm_value( - TR.bitcoin__title_purchase_ticket, - address_short, - TR.bitcoin__voting_rights, - "confirm_decred_sstx_submission", - ButtonRequestType.ConfirmOutput, - verb=TR.buttons__purchase, - ) - - -async def should_show_payment_request_details( - msg: TxAckPaymentRequest, - coin: CoinInfo, - amount_unit: AmountUnit, -) -> bool: - from trezor import wire - - memo_texts: list[str] = [] - for m in msg.memos: - if m.text_memo is not None: - memo_texts.append(m.text_memo.text) - elif m.refund_memo is not None: - pass - elif m.coin_purchase_memo is not None: - memo_texts.append(f"{TR.words__buying} {m.coin_purchase_memo.amount}.") - else: - raise wire.DataError("Unrecognized memo type in payment request memo.") - - assert msg.amount is not None - - return await layouts.should_show_payment_request_details( - msg.recipient_name, - format_coin_amount(msg.amount, coin, amount_unit), - memo_texts, - ) - - async def confirm_total( spending: int, fee: int, fee_rate: float, coin: CoinInfo, - amount_unit: AmountUnit, address_n: Bip32Path | None, ) -> None: @@ -298,32 +238,3 @@ async def confirm_multiple_accounts() -> None: button=TR.buttons__continue, br_code=ButtonRequestType.SignTx, ) - - -async def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) -> None: - from trezor.strings import format_timestamp - - if lock_time_disabled: - await layouts.show_warning( - "nondefault_locktime", - TR.bitcoin__locktime_no_effect, - TR.words__continue_anyway, - button=TR.buttons__continue, - br_code=ButtonRequestType.SignTx, - ) - else: - if lock_time < _LOCKTIME_TIMESTAMP_MIN_VALUE: - text = TR.bitcoin__locktime_set_to_blockheight - value = str(lock_time) - else: - text = TR.bitcoin__locktime_set_to - value = format_timestamp(lock_time) - await layouts.confirm_value( - TR.bitcoin__confirm_locktime, - value, - text, - "nondefault_locktime", - br_code=ButtonRequestType.SignTx, - verb=TR.buttons__confirm, - ) - diff --git a/core/src/apps/mintlayer/sign_tx/signer.py b/core/src/apps/mintlayer/sign_tx/signer.py index 041bb2e47..4d653222e 100644 --- a/core/src/apps/mintlayer/sign_tx/signer.py +++ b/core/src/apps/mintlayer/sign_tx/signer.py @@ -70,13 +70,11 @@ async def signer(self) -> None: fee = input_totals[ML_COIN] - output_totals[ML_COIN] fee_rate = 0 coin = by_name('Bitcoin') - amount_unit = AmountUnit.BITCOIN await helpers.confirm_total( output_totals[ML_COIN], fee, fee_rate, coin, - amount_unit, None, ) @@ -120,7 +118,7 @@ def __init__( ) -> None: from trezor.messages import ( MintlayerTxRequest, - TxRequestDetailsType, + MintlayerTxRequestDetailsType, ) global _SERIALIZED_TX_BUFFER @@ -144,7 +142,7 @@ def __init__( self.serialized_tx = _SERIALIZED_TX_BUFFER self.serialize = tx.serialize self.tx_req = MintlayerTxRequest() - self.tx_req.details = TxRequestDetailsType() + self.tx_req.details = MintlayerTxRequestDetailsType() self.tx_req.serialized = [] # The digest of the presigned external inputs streamed for approval in Step 1. This is diff --git a/core/src/apps/mintlayer/writers.py b/core/src/apps/mintlayer/writers.py deleted file mode 100644 index 13f89e63c..000000000 --- a/core/src/apps/mintlayer/writers.py +++ /dev/null @@ -1,110 +0,0 @@ -from micropython import const -from typing import TYPE_CHECKING - -from trezor.utils import ensure - -from apps.common.writers import ( # noqa: F401 - write_bytes_fixed, - write_bytes_reversed, - write_bytes_unchecked, - write_compact_size, - write_uint8, - write_uint16_le, - write_uint32_le, - write_uint64_le, -) - -if TYPE_CHECKING: - from trezor.messages import PrevInput, PrevOutput, TxInput, TxOutput - from trezor.utils import HashWriter - - from apps.common.writers import Writer - -write_uint16 = write_uint16_le -write_uint32 = write_uint32_le -write_uint64 = write_uint64_le - -TX_HASH_SIZE = const(32) - - -def write_bytes_prefixed(w: Writer, b: bytes) -> None: - write_compact_size(w, len(b)) - write_bytes_unchecked(w, b) - - -def write_tx_input(w: Writer, i: TxInput | PrevInput, script: bytes) -> None: - write_bytes_reversed(w, i.prev_hash, TX_HASH_SIZE) - write_uint32(w, i.prev_index) - write_bytes_prefixed(w, script) - write_uint32(w, i.sequence) - - -def write_tx_input_check(w: Writer, i: TxInput) -> None: - from .multisig import multisig_fingerprint - - write_uint32(w, len(i.address_n)) - for n in i.address_n: - write_uint32(w, n) - write_bytes_fixed(w, i.prev_hash, TX_HASH_SIZE) - write_uint32(w, i.prev_index) - write_bytes_prefixed(w, i.script_sig or b"") - write_uint32(w, i.sequence) - write_uint32(w, i.script_type) - multisig_fp = multisig_fingerprint(i.multisig) if i.multisig else b"" - write_bytes_prefixed(w, multisig_fp) - write_uint64(w, i.amount or 0) - write_bytes_prefixed(w, i.witness or b"") - write_bytes_prefixed(w, i.ownership_proof or b"") - write_bytes_prefixed(w, i.orig_hash or b"") - write_uint32(w, i.orig_index or 0) - write_bytes_prefixed(w, i.script_pubkey or b"") - - -def write_tx_output(w: Writer, o: TxOutput | PrevOutput, script_pubkey: bytes) -> None: - write_uint64(w, o.amount) - write_bytes_prefixed(w, script_pubkey) - - -def write_op_push(w: Writer, n: int) -> None: - append = w.append # local_cache_attribute - - ensure(0 <= n <= 0xFFFF_FFFF) - if n < 0x4C: - append(n & 0xFF) - elif n < 0x100: - append(0x4C) - append(n & 0xFF) - elif n < 0x1_0000: - append(0x4D) - append(n & 0xFF) - append((n >> 8) & 0xFF) - else: - append(0x4E) - append(n & 0xFF) - append((n >> 8) & 0xFF) - append((n >> 16) & 0xFF) - append((n >> 24) & 0xFF) - - -def op_push_length(n: int) -> int: - ensure(0 <= n <= 0xFFFF_FFFF) - if n < 0x4C: - return 1 - elif n < 0x100: - return 2 - elif n < 0x1_0000: - return 3 - else: - return 4 - - -def get_tx_hash(w: HashWriter, double: bool = False, reverse: bool = False) -> bytes: - from trezor.crypto.hashlib import sha256 - - d = w.get_digest() - if double: - d = sha256(d).digest() - if reverse: - d = bytes(reversed(d)) - return d - diff --git a/core/src/trezor/crypto/__init__.py b/core/src/trezor/crypto/__init__.py index 7f7756fbd..4ae21b762 100644 --- a/core/src/trezor/crypto/__init__.py +++ b/core/src/trezor/crypto/__init__.py @@ -18,7 +18,7 @@ if not utils.BITCOIN_ONLY: from trezorcrypto import cardano, monero, nem # noqa: F401 - from trezormintlayer import utils as mintlayer_utils + import trezormintlayer as mintlayer_utils if utils.USE_OPTIGA: from trezorcrypto import optiga # noqa: F401 diff --git a/rust/trezor-client/src/error.rs b/rust/trezor-client/src/error.rs index 18c273ab5..e38c90d9e 100644 --- a/rust/trezor-client/src/error.rs +++ b/rust/trezor-client/src/error.rs @@ -103,11 +103,3 @@ pub enum Error { #[error("malformed MintlayerTxRequest: {0:?}")] MalformedMintlayerTxRequest(protos::MintlayerTxRequest), } - -impl PartialEq for Error { - fn eq(&self, _other: &Self) -> bool { - false - } -} - -impl Eq for Error {}