1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-30 10:28:14 +00:00

chore(core): promote multiple_accounts_warning to danger

- for eckhart and delizia layouts
This commit is contained in:
Lukas Bielesch 2025-06-18 17:21:13 +02:00 committed by Lukáš Bielesch
parent 5272f2af8f
commit f32d747f88
19 changed files with 87 additions and 16 deletions

View File

@ -0,0 +1 @@
[T3T1] Change multiple accounts warning to danger.

View File

@ -677,6 +677,7 @@ static void _librust_qstrs(void) {
MP_QSTR_select_word;
MP_QSTR_select_word_count;
MP_QSTR_send__cancel_sign;
MP_QSTR_send__cancel_transaction;
MP_QSTR_send__confirm_sending;
MP_QSTR_send__from_multiple_accounts;
MP_QSTR_send__incl_transaction_fee;

View File

@ -1446,6 +1446,7 @@ pub enum TranslatedString {
reset__check_share_backup_template = 1042, // "Let's do a quick check of Share #{0}."
reset__select_word_from_share_template = 1043, // "Select word #{0} from\nShare #{1}"
recovery__share_from_group_entered_template = 1044, // "Share #{0} from Group #{1} entered."
send__cancel_transaction = 1045, // "Cancel transaction"
}
impl TranslatedString {
@ -3197,6 +3198,7 @@ impl TranslatedString {
(Self::reset__check_share_backup_template, "Let's do a quick check of Share #{0}."),
(Self::reset__select_word_from_share_template, "Select word #{0} from\nShare #{1}"),
(Self::recovery__share_from_group_entered_template, "Share #{0} from Group #{1} entered."),
(Self::send__cancel_transaction, "Cancel transaction"),
];
#[cfg(feature = "micropython")]
@ -4261,6 +4263,7 @@ impl TranslatedString {
(Qstr::MP_QSTR_sd_card__wanna_format, Self::sd_card__wanna_format),
(Qstr::MP_QSTR_sd_card__wrong_sd_card, Self::sd_card__wrong_sd_card),
(Qstr::MP_QSTR_send__cancel_sign, Self::send__cancel_sign),
(Qstr::MP_QSTR_send__cancel_transaction, Self::send__cancel_transaction),
(Qstr::MP_QSTR_send__confirm_sending, Self::send__confirm_sending),
(Qstr::MP_QSTR_send__from_multiple_accounts, Self::send__from_multiple_accounts),
(Qstr::MP_QSTR_send__incl_transaction_fee, Self::send__incl_transaction_fee),

View File

@ -1350,11 +1350,12 @@ impl FirmwareUI for UIEckhart {
danger: bool,
) -> Result<Gc<LayoutObj>, Error> {
let paragraphs = ParagraphVecShort::from_iter([
Paragraph::new(&theme::TEXT_SMALL, description),
Paragraph::new(&theme::TEXT_REGULAR, description),
Paragraph::new(&theme::TEXT_REGULAR, value),
])
.into_paragraphs()
.with_placement(LinearPlacement::vertical());
.with_placement(LinearPlacement::vertical())
.with_spacing(theme::TEXT_VERTICAL_SPACING);
let (color, style) = if danger {
(theme::ORANGE, theme::label_title_danger())
@ -1367,7 +1368,7 @@ impl FirmwareUI for UIEckhart {
.with_text_style(style);
let action_bar = if allow_cancel {
ActionBar::new_double(
Button::with_icon(theme::ICON_CROSS).styled(theme::button_cancel()),
Button::with_icon(theme::ICON_CROSS),
Button::with_single_line_text(button),
)
} else {

View File

@ -761,6 +761,7 @@ class TR:
sd_card__wanna_format: str = "Do you really want to format the SD card?"
sd_card__wrong_sd_card: str = "Wrong SD card."
send__cancel_sign: str = "Cancel sign"
send__cancel_transaction: str = "Cancel transaction"
send__confirm_sending: str = "Sending amount"
send__from_multiple_accounts: str = "Sending from multiple accounts."
send__incl_transaction_fee: str = "incl. Transaction fee"

View File

@ -283,13 +283,7 @@ async def confirm_unverified_external_input() -> None:
async def confirm_multiple_accounts() -> None:
await layouts.show_warning(
"sending_from_multiple_accounts",
TR.send__from_multiple_accounts,
TR.words__continue_anyway_question,
button=TR.buttons__continue,
br_code=ButtonRequestType.SignTx,
)
await layouts.confirm_multiple_accounts_warning()
async def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) -> None:

View File

@ -180,6 +180,16 @@ def confirm_multisig_different_paths_warning() -> Awaitable[None]:
)
def confirm_multiple_accounts_warning() -> Awaitable[None]:
return show_warning(
"sending_from_multiple_accounts",
TR.send__from_multiple_accounts,
TR.words__continue_anyway_question,
button=TR.buttons__continue,
br_code=ButtonRequestType.SignTx,
)
def confirm_homescreen(image: bytes) -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui_api.confirm_homescreen(

View File

@ -197,6 +197,16 @@ def confirm_multisig_different_paths_warning() -> Awaitable[ui.UiResult]:
)
def confirm_multiple_accounts_warning() -> Awaitable[ui.UiResult]:
return show_warning(
"sending_from_multiple_accounts",
TR.send__from_multiple_accounts,
TR.words__continue_anyway_question,
button=TR.buttons__continue,
br_code=ButtonRequestType.SignTx,
)
def confirm_homescreen(image: bytes) -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui_api.confirm_homescreen(

View File

@ -165,6 +165,15 @@ def confirm_multisig_different_paths_warning() -> Awaitable[None]:
)
def confirm_multiple_accounts_warning() -> Awaitable[None]:
return show_danger(
"sending_from_multiple_accounts",
TR.send__from_multiple_accounts,
verb_cancel=TR.send__cancel_transaction,
br_code=ButtonRequestType.SignTx,
)
def confirm_homescreen(
image: bytes,
) -> Awaitable[None]:

View File

@ -174,6 +174,16 @@ def confirm_multisig_different_paths_warning() -> Awaitable[None]:
)
def confirm_multiple_accounts_warning() -> Awaitable[None]:
return show_danger(
"sending_from_multiple_accounts",
TR.send__from_multiple_accounts,
title=TR.words__important,
verb_cancel=TR.send__cancel_transaction,
br_code=ButtonRequestType.SignTx,
)
def confirm_homescreen(
image: bytes,
) -> Awaitable[None]:

View File

@ -976,6 +976,7 @@
"send__maximum_fee": "Maximum fee",
"send__receiving_to_multisig": "Receiving to a multisig address.",
"send__send_from": "Send from",
"send__cancel_transaction": "Cancel transaction",
"send__sign_transaction": "Sign transaction",
"send__send_in_the_app": "After signing, send the transaction in the app.",
"send__title_confirm_sending": "Confirm sending",

View File

@ -1043,5 +1043,6 @@
"1041": "instructions__shares_start_with_x_template",
"1042": "reset__check_share_backup_template",
"1043": "reset__select_word_from_share_template",
"1044": "recovery__share_from_group_entered_template"
"1044": "recovery__share_from_group_entered_template",
"1045": "send__cancel_transaction"
}

View File

@ -1,8 +1,8 @@
{
"current": {
"merkle_root": "c17219dfef87f023e53dd6470f633d38a8f8572466f987e0efe4536652b0d805",
"datetime": "2025-06-23T08:18:59.627189+00:00",
"commit": "1312054ba96c9037aa99cf48709d9cdafdeb708c"
"merkle_root": "4a06e39dde3af691ccef119898d3124fb596e384b777a55044f29d27a7ebbd8e",
"datetime": "2025-06-23T10:46:39.805001+00:00",
"commit": "f8327ed2c85209eafbe0c73eeea8861bf1cb57d7"
},
"history": [
{

View File

@ -179,6 +179,8 @@ def test_attack_path_segwit(client: Client):
return msg
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
client.set_filter(messages.TxAck, attack_processor)
with pytest.raises(TrezorFailure):
btc.sign_tx(

View File

@ -18,6 +18,7 @@ from trezorlib import btc, messages
from trezorlib.debuglink import TrezorClientDebugLink as Client
from trezorlib.tools import parse_path
from ...input_flows import InputFlowConfirmAllWarnings
from ...tx_cache import TxCache
from .signtx import assert_tx_matches
@ -59,6 +60,8 @@ def test_non_segwit_segwit_inputs(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
signatures, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1, inp2], [out1], prev_txes=TX_API
)
@ -95,6 +98,8 @@ def test_segwit_non_segwit_inputs(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
signatures, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1, inp2], [out1], prev_txes=TX_API
)
@ -139,6 +144,8 @@ def test_segwit_non_segwit_segwit_inputs(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
signatures, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1, inp2, inp3], [out1], prev_txes=TX_API
)
@ -181,6 +188,8 @@ def test_non_segwit_segwit_non_segwit_inputs(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
signatures, serialized_tx = btc.sign_tx(
client, "Testnet", [inp1, inp2, inp3], [out1], prev_txes=TX_API
)

View File

@ -22,6 +22,7 @@ from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path
from ...common import is_core
from ...input_flows import InputFlowConfirmAllWarnings
from ...tx_cache import TxCache
from .signtx import (
assert_tx_matches,
@ -422,6 +423,8 @@ def test_attack_mixed_inputs(client: Client):
expected_responses.insert(-2, request_input(0))
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
# Sign unmodified transaction.
# "Fee over threshold" warning is displayed - fee is the whole TRUE_AMOUNT
client.set_expected_responses(expected_responses)
@ -447,6 +450,8 @@ def test_attack_mixed_inputs(client: Client):
)
with pytest.raises(TrezorFailure) as e, client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
client.set_expected_responses(expected_responses)
btc.sign_tx(
client,

View File

@ -345,6 +345,8 @@ def test_send_both(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
client.set_expected_responses(
[
request_input(0),

View File

@ -22,6 +22,7 @@ from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path
from ...common import is_core
from ...input_flows import InputFlowConfirmAllWarnings
from ...tx_cache import TxCache
from .signtx import (
assert_tx_matches,
@ -223,6 +224,8 @@ def test_send_mixed(client: Client):
)
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
client.set_expected_responses(
[
# process inputs
@ -355,6 +358,8 @@ def test_attack_script_type(client: Client):
return msg
with client:
IF = InputFlowConfirmAllWarnings(client)
client.set_input_flow(IF.get())
client.set_filter(messages.TxAck, attack_processor)
client.set_expected_responses(
[

View File

@ -1130,7 +1130,9 @@ def sign_tx_go_to_info_delizia(
if multi_account:
yield
client.debug.read_layout()
client.debug.swipe_up()
client.debug.click(client.debug.screen_buttons.menu())
client.debug.synchronize_at("VerticalMenu")
client.debug.click(client.debug.screen_buttons.vertical_menu_items()[1])
yield # confirm transaction
client.debug.read_layout()
@ -1168,7 +1170,9 @@ def sign_tx_go_to_info_eckhart(
if multi_account:
yield
client.debug.read_layout()
client.debug.press_yes()
client.debug.click(client.debug.screen_buttons.menu())
client.debug.synchronize_at("VerticalMenuScreen")
client.debug.click(client.debug.screen_buttons.vertical_menu_items()[1])
yield # confirm transaction
client.debug.read_layout()
@ -2939,6 +2943,7 @@ class InputFlowConfirmAllWarnings(InputFlowBase):
hi_prio = (
TR.words__cancel_and_exit,
TR.send__cancel_sign,
TR.send__cancel_transaction,
)
if any(needle.lower() in text for needle in hi_prio):
self.debug.click(self.debug.screen_buttons.menu())
@ -2967,6 +2972,7 @@ class InputFlowConfirmAllWarnings(InputFlowBase):
hi_prio = (
TR.words__cancel_and_exit,
TR.send__cancel_sign,
TR.send__cancel_transaction,
)
if any(needle.lower() in text for needle in hi_prio):
self.debug.click(self.debug.screen_buttons.menu())