diff --git a/core/.changelog.d/3666.fixed b/core/.changelog.d/3666.fixed index bba3dee515..ae3f743ed1 100644 --- a/core/.changelog.d/3666.fixed +++ b/core/.changelog.d/3666.fixed @@ -1 +1 @@ -[T3T1] Show confirmation layout after sending address, public key or signature to host. +[T3T1] Show confirmation layout after sending response to host. diff --git a/core/src/apps/bitcoin/sign_tx/__init__.py b/core/src/apps/bitcoin/sign_tx/__init__.py index 33a4c49954..17063fc3de 100644 --- a/core/src/apps/bitcoin/sign_tx/__init__.py +++ b/core/src/apps/bitcoin/sign_tx/__init__.py @@ -17,7 +17,6 @@ if TYPE_CHECKING: TxAckPrevOutput, TxRequest, ) - from trezor.wire import EarlyResponse from apps.common.coininfo import CoinInfo from apps.common.keychain import Keychain @@ -52,12 +51,9 @@ async def sign_tx( keychain: Keychain, coin: CoinInfo, authorization: CoinJoinAuthorization | None = None, -) -> EarlyResponse[TxRequest]: - from trezor import TR +) -> TxRequest: from trezor.enums import RequestType from trezor.messages import TxRequest - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import early_response from trezor.wire.context import call from ..common import BITCOIN_NAMES @@ -97,9 +93,7 @@ async def sign_tx( request_class, req = req assert TxRequest.is_type_of(req) if req.request_type == RequestType.TXFINISHED: - return await early_response( - req, show_continue_in_app(TR.send__transaction_signed) - ) + return req res = await call(req, request_class) elif isinstance(req, helpers.UiConfirm): res = await req.confirm_dialog() diff --git a/core/src/apps/cardano/sign_tx/__init__.py b/core/src/apps/cardano/sign_tx/__init__.py index 0eb328a081..c9144580e5 100644 --- a/core/src/apps/cardano/sign_tx/__init__.py +++ b/core/src/apps/cardano/sign_tx/__init__.py @@ -6,18 +6,15 @@ if TYPE_CHECKING: from typing import Type from trezor.messages import CardanoSignTxFinished, CardanoSignTxInit - from trezor.wire import EarlyResponse @seed.with_keychain async def sign_tx( msg: CardanoSignTxInit, keychain: seed.Keychain -) -> EarlyResponse[CardanoSignTxFinished]: - from trezor import TR, log, wire +) -> CardanoSignTxFinished: + from trezor import log, wire from trezor.enums import CardanoTxSigningMode from trezor.messages import CardanoSignTxFinished - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import early_response from .signer import Signer @@ -52,5 +49,4 @@ async def sign_tx( log.exception(__name__, e) raise wire.ProcessError("Signing failed") - resp = CardanoSignTxFinished() - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) + return CardanoSignTxFinished() diff --git a/core/src/apps/eos/sign_tx.py b/core/src/apps/eos/sign_tx.py index 3f04aae213..11c66a8b0b 100644 --- a/core/src/apps/eos/sign_tx.py +++ b/core/src/apps/eos/sign_tx.py @@ -4,20 +4,17 @@ from apps.common.keychain import auto_keychain if TYPE_CHECKING: from trezor.messages import EosSignedTx, EosSignTx - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain @auto_keychain(__name__) -async def sign_tx(msg: EosSignTx, keychain: Keychain) -> EarlyResponse[EosSignedTx]: - from trezor import TR +async def sign_tx(msg: EosSignTx, keychain: Keychain) -> EosSignedTx: from trezor.crypto.curve import secp256k1 from trezor.crypto.hashlib import sha256 from trezor.messages import EosSignedTx, EosTxActionAck, EosTxActionRequest - from trezor.ui.layouts import show_continue_in_app from trezor.utils import HashWriter - from trezor.wire import DataError, early_response + from trezor.wire import DataError from trezor.wire.context import call from apps.common import paths @@ -58,5 +55,4 @@ async def sign_tx(msg: EosSignTx, keychain: Keychain) -> EarlyResponse[EosSigned node.private_key(), digest, True, secp256k1.CANONICAL_SIG_EOS ) - resp = EosSignedTx(signature=base58_encode("SIG_", "K1", signature)) - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) + return EosSignedTx(signature=base58_encode("SIG_", "K1", signature)) diff --git a/core/src/apps/ethereum/sign_tx.py b/core/src/apps/ethereum/sign_tx.py index cb53e81cab..4de0fae6b4 100644 --- a/core/src/apps/ethereum/sign_tx.py +++ b/core/src/apps/ethereum/sign_tx.py @@ -19,7 +19,6 @@ if TYPE_CHECKING: EthereumTokenInfo, EthereumTxAck, ) - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain @@ -38,13 +37,11 @@ async def sign_tx( msg: EthereumSignTx, keychain: Keychain, defs: Definitions, -) -> EarlyResponse[EthereumTxRequest]: +) -> EthereumTxRequest: from trezor import TR from trezor.crypto.hashlib import sha3_256 - from trezor.ui.layouts import show_continue_in_app from trezor.ui.layouts.progress import progress from trezor.utils import HashWriter - from trezor.wire import early_response from apps.common import paths @@ -114,9 +111,7 @@ async def sign_tx( progress_obj.stop() - return await early_response( - result, show_continue_in_app(TR.send__transaction_signed) - ) + return result async def confirm_tx_data( diff --git a/core/src/apps/ethereum/sign_tx_eip1559.py b/core/src/apps/ethereum/sign_tx_eip1559.py index e6785653eb..a4cb1d2862 100644 --- a/core/src/apps/ethereum/sign_tx_eip1559.py +++ b/core/src/apps/ethereum/sign_tx_eip1559.py @@ -2,7 +2,6 @@ from micropython import const from typing import TYPE_CHECKING from trezor.crypto import rlp -from trezor.wire import EarlyResponse from .helpers import bytes_from_address from .keychain import with_keychain_from_chain_id @@ -35,13 +34,11 @@ async def sign_tx_eip1559( msg: EthereumSignTxEIP1559, keychain: Keychain, defs: Definitions, -) -> EarlyResponse[EthereumTxRequest]: - from trezor import TR, wire +) -> EthereumTxRequest: + from trezor import wire from trezor.crypto import rlp # local_cache_global from trezor.crypto.hashlib import sha3_256 - from trezor.ui.layouts import show_continue_in_app from trezor.utils import HashWriter - from trezor.wire import early_response from apps.common import paths @@ -124,9 +121,7 @@ async def sign_tx_eip1559( digest = sha.get_digest() result = _sign_digest(msg, keychain, digest) - return await early_response( - result, show_continue_in_app(TR.send__transaction_signed) - ) + return result def _get_total_length(msg: EthereumSignTxEIP1559, data_total: int) -> int: diff --git a/core/src/apps/monero/sign_tx.py b/core/src/apps/monero/sign_tx.py index f5a15f868d..842b7c589f 100644 --- a/core/src/apps/monero/sign_tx.py +++ b/core/src/apps/monero/sign_tx.py @@ -5,21 +5,16 @@ from apps.monero.layout import MoneroTransactionProgress if TYPE_CHECKING: from trezor.messages import MoneroTransactionFinalAck - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain from apps.monero.signing.state import State @auto_keychain(__name__) -async def sign_tx( - received_msg, keychain: Keychain -) -> EarlyResponse[MoneroTransactionFinalAck]: +async def sign_tx(received_msg, keychain: Keychain) -> MoneroTransactionFinalAck: import gc - from trezor import TR, log, utils - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import early_response + from trezor import log, utils from trezor.wire.context import get_context from apps.monero.signing.state import State @@ -50,9 +45,7 @@ async def sign_tx( received_msg = await ctx.read(accept_msgs) utils.unimport_end(mods) - return await early_response( - result_msg, show_continue_in_app(TR.send__transaction_signed) - ) + return result_msg async def _sign_tx_dispatch( diff --git a/core/src/apps/ripple/sign_tx.py b/core/src/apps/ripple/sign_tx.py index b7ea05f981..c8957bec4d 100644 --- a/core/src/apps/ripple/sign_tx.py +++ b/core/src/apps/ripple/sign_tx.py @@ -4,23 +4,18 @@ from apps.common.keychain import auto_keychain if TYPE_CHECKING: from trezor.messages import RippleSignedTx, RippleSignTx - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain # NOTE: it is one big function because that way it is the most flash-space-efficient @auto_keychain(__name__) -async def sign_tx( - msg: RippleSignTx, keychain: Keychain -) -> EarlyResponse[RippleSignedTx]: - from trezor import TR +async def sign_tx(msg: RippleSignTx, keychain: Keychain) -> RippleSignedTx: from trezor.crypto import der from trezor.crypto.curve import secp256k1 from trezor.crypto.hashlib import sha512 from trezor.messages import RippleSignedTx - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import ProcessError, early_response + from trezor.wire import ProcessError from apps.common import paths @@ -63,5 +58,4 @@ async def sign_tx( sig_encoded = der.encode_seq((sig[1:33], sig[33:65])) tx = serialize(msg, source_address, node.public_key(), sig_encoded) - resp = RippleSignedTx(signature=sig_encoded, serialized_tx=tx) - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) + return RippleSignedTx(signature=sig_encoded, serialized_tx=tx) diff --git a/core/src/apps/solana/sign_tx.py b/core/src/apps/solana/sign_tx.py index 54259c56d1..c98985e57d 100644 --- a/core/src/apps/solana/sign_tx.py +++ b/core/src/apps/solana/sign_tx.py @@ -1,6 +1,6 @@ from typing import TYPE_CHECKING -from trezor.wire import DataError, EarlyResponse +from trezor.wire import DataError from apps.common.keychain import with_slip44_keychain @@ -18,13 +18,12 @@ if TYPE_CHECKING: async def sign_tx( msg: SolanaSignTx, keychain: Keychain, -) -> EarlyResponse[SolanaTxSignature]: +) -> SolanaTxSignature: from trezor import TR from trezor.crypto.curve import ed25519 from trezor.enums import ButtonRequestType from trezor.messages import SolanaTxSignature - from trezor.ui.layouts import confirm_metadata, show_continue_in_app, show_warning - from trezor.wire import early_response + from trezor.ui.layouts import confirm_metadata, show_warning from apps.common import seed @@ -81,8 +80,7 @@ async def sign_tx( signature = ed25519.sign(node.private_key(), serialized_tx) - resp = SolanaTxSignature(signature=signature) - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) + return SolanaTxSignature(signature=signature) def _has_unsupported_instructions(transaction: Transaction) -> bool: diff --git a/core/src/apps/stellar/sign_tx.py b/core/src/apps/stellar/sign_tx.py index 3970b0ff64..f151eaeaf1 100644 --- a/core/src/apps/stellar/sign_tx.py +++ b/core/src/apps/stellar/sign_tx.py @@ -4,24 +4,19 @@ from apps.common.keychain import auto_keychain if TYPE_CHECKING: from trezor.messages import StellarSignedTx, StellarSignTx - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain @auto_keychain(__name__) -async def sign_tx( - msg: StellarSignTx, keychain: Keychain -) -> EarlyResponse[StellarSignedTx]: +async def sign_tx(msg: StellarSignTx, keychain: Keychain) -> StellarSignedTx: from ubinascii import hexlify - from trezor import TR from trezor.crypto.curve import ed25519 from trezor.crypto.hashlib import sha256 from trezor.enums import StellarMemoType from trezor.messages import StellarSignedTx, StellarTxOpRequest - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import DataError, ProcessError, early_response + from trezor.wire import DataError, ProcessError from trezor.wire.context import call_any from apps.common import paths, seed @@ -121,5 +116,4 @@ async def sign_tx( signature = ed25519.sign(node.private_key(), digest) # Add the public key for verification that the right account was used for signing - resp = StellarSignedTx(public_key=pubkey, signature=signature) - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) + return StellarSignedTx(public_key=pubkey, signature=signature) diff --git a/core/src/apps/tezos/sign_tx.py b/core/src/apps/tezos/sign_tx.py index 3ae4503b95..648decf88d 100644 --- a/core/src/apps/tezos/sign_tx.py +++ b/core/src/apps/tezos/sign_tx.py @@ -26,20 +26,16 @@ if TYPE_CHECKING: TezosTransactionOp, ) from trezor.utils import Writer - from trezor.wire import EarlyResponse from apps.common.keychain import Keychain @with_slip44_keychain(*PATTERNS, slip44_id=SLIP44_ID, curve=CURVE) -async def sign_tx(msg: TezosSignTx, keychain: Keychain) -> EarlyResponse[TezosSignedTx]: - from trezor import TR +async def sign_tx(msg: TezosSignTx, keychain: Keychain) -> TezosSignedTx: from trezor.crypto import hashlib from trezor.crypto.curve import ed25519 from trezor.enums import TezosBallotType from trezor.messages import TezosSignedTx - from trezor.ui.layouts import show_continue_in_app - from trezor.wire import early_response from apps.common.paths import validate_path @@ -159,10 +155,9 @@ async def sign_tx(msg: TezosSignTx, keychain: Keychain) -> EarlyResponse[TezosSi sig_prefixed = base58_encode_check(signature, helpers.TEZOS_SIGNATURE_PREFIX) - resp = TezosSignedTx( + return TezosSignedTx( signature=sig_prefixed, sig_op_contents=sig_op_contents, operation_hash=ophash ) - return await early_response(resp, show_continue_in_app(TR.send__transaction_signed)) def _get_address_by_tag(address_hash: bytes) -> str: