mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
test(core/ui): fix bitcoin signtx for T3T1
This commit is contained in:
parent
198693259d
commit
38b0361ded
@ -355,6 +355,12 @@ class LayoutContent(UnstructuredJSONReader):
|
||||
choice_obj.get(choice, {}).get("content", "") for choice in choice_keys
|
||||
)
|
||||
|
||||
def footer(self) -> str:
|
||||
footer = self.find_unique_object_with_key_and_value("component", "Footer")
|
||||
if not footer:
|
||||
return ""
|
||||
return footer.get("description", "") + " " + footer.get("instruction", "")
|
||||
|
||||
|
||||
def multipage_content(layouts: List[LayoutContent]) -> str:
|
||||
"""Get overall content from multiple-page layout."""
|
||||
@ -804,6 +810,25 @@ class DebugUI:
|
||||
Generator[None, messages.ButtonRequest, None], object, None
|
||||
] = None
|
||||
|
||||
def _default_input_flow(self, br: messages.ButtonRequest) -> None:
|
||||
if br.code == messages.ButtonRequestType.PinEntry:
|
||||
self.debuglink.input(self.get_pin())
|
||||
else:
|
||||
# Paginating (going as further as possible) and pressing Yes
|
||||
if br.pages is not None:
|
||||
for _ in range(br.pages - 1):
|
||||
self.debuglink.swipe_up(wait=True)
|
||||
if self.debuglink.model is models.T3T1:
|
||||
layout = self.debuglink.read_layout()
|
||||
if "PromptScreen" in layout.all_components():
|
||||
self.debuglink.press_yes()
|
||||
elif "swipe up" in layout.footer().lower():
|
||||
self.debuglink.swipe_up()
|
||||
else:
|
||||
self.debuglink.press_yes()
|
||||
else:
|
||||
self.debuglink.press_yes()
|
||||
|
||||
def button_request(self, br: messages.ButtonRequest) -> None:
|
||||
self.debuglink.take_t1_screenshot_if_relevant()
|
||||
|
||||
@ -814,14 +839,7 @@ class DebugUI:
|
||||
# recording their screens that way (as well as
|
||||
# possible swipes below).
|
||||
self.debuglink.save_current_screen_if_relevant(wait=True)
|
||||
if br.code == messages.ButtonRequestType.PinEntry:
|
||||
self.debuglink.input(self.get_pin())
|
||||
else:
|
||||
# Paginating (going as further as possible) and pressing Yes
|
||||
if br.pages is not None:
|
||||
for _ in range(br.pages - 1):
|
||||
self.debuglink.swipe_up(wait=True)
|
||||
self.debuglink.press_yes()
|
||||
self._default_input_flow(br)
|
||||
elif self.input_flow is self.INPUT_FLOW_DONE:
|
||||
raise AssertionError("input flow ended prematurely")
|
||||
else:
|
||||
|
@ -344,4 +344,4 @@ def swipe_till_the_end(debug: "DebugLink", br: messages.ButtonRequest) -> None:
|
||||
|
||||
|
||||
def is_core(client: "Client") -> bool:
|
||||
return client.model in (models.T2T1, models.T2B1, models.T3T1)
|
||||
return client.model is not models.T1B1
|
||||
|
@ -23,6 +23,8 @@ from trezorlib.messages import SafetyCheckLevel
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ... import bip32
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
|
||||
|
||||
def getmultisig(chain, nr, xpubs):
|
||||
@ -202,6 +204,10 @@ def test_multisig(client: Client):
|
||||
xpubs.append(node.xpub)
|
||||
|
||||
for nr in range(1, 4):
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
@ -254,7 +260,10 @@ def test_multisig_missing(client: Client, show_display):
|
||||
)
|
||||
|
||||
for multisig in (multisig1, multisig2):
|
||||
with pytest.raises(TrezorFailure):
|
||||
with client, pytest.raises(TrezorFailure):
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
btc.get_address(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -275,6 +284,10 @@ def test_bch_multisig(client: Client):
|
||||
xpubs.append(node.xpub)
|
||||
|
||||
for nr in range(1, 4):
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
@ -342,6 +355,9 @@ def test_unknown_path(client: Client):
|
||||
messages.Address,
|
||||
]
|
||||
)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
# try again with a warning
|
||||
btc.get_address(client, "Bitcoin", UNKNOWN_PATH, show_display=True)
|
||||
|
||||
|
@ -21,6 +21,9 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
|
||||
|
||||
def test_show_segwit(client: Client):
|
||||
assert (
|
||||
@ -71,6 +74,10 @@ def test_show_segwit(client: Client):
|
||||
|
||||
@pytest.mark.altcoin
|
||||
def test_show_segwit_altcoin(client: Client):
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
|
@ -20,7 +20,9 @@ from trezorlib import btc, messages, tools
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.exceptions import Cancelled, TrezorFailure
|
||||
|
||||
from ...common import is_core
|
||||
from ...input_flows import (
|
||||
InputFlowConfirmAllWarnings,
|
||||
InputFlowShowAddressQRCode,
|
||||
InputFlowShowAddressQRCodeCancel,
|
||||
InputFlowShowMultisigXPUBs,
|
||||
@ -148,6 +150,10 @@ def test_show_multisig_3(client: Client):
|
||||
)
|
||||
|
||||
for i in [1, 2, 3]:
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
@ -289,6 +295,10 @@ def test_show_multisig_15(client: Client):
|
||||
)
|
||||
|
||||
for i in range(15):
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
assert (
|
||||
btc.get_address(
|
||||
client,
|
||||
|
@ -22,6 +22,7 @@ from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import MNEMONIC12, is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from ...tx_cache import TxCache
|
||||
from .signtx import (
|
||||
assert_tx_matches,
|
||||
@ -304,6 +305,9 @@ def test_attack_change_input(client: Client):
|
||||
|
||||
# Transaction can be signed without the attack processor
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
btc.sign_tx(
|
||||
client,
|
||||
"Testnet",
|
||||
|
@ -22,6 +22,7 @@ from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ... import bip32
|
||||
from ...common import MNEMONIC12, is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from ...tx_cache import TxCache
|
||||
from .signtx import request_finished, request_input, request_meta, request_output
|
||||
|
||||
@ -243,6 +244,9 @@ def test_external_internal(client: Client):
|
||||
client.set_expected_responses(
|
||||
_responses(client, INP1, INP2, change=2, foreign=True)
|
||||
)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -276,6 +280,9 @@ def test_internal_external(client: Client):
|
||||
client.set_expected_responses(
|
||||
_responses(client, INP1, INP2, change=1, foreign=True)
|
||||
)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client,
|
||||
"Bitcoin",
|
||||
|
@ -20,6 +20,8 @@ from trezorlib import btc, messages
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from .signtx import forge_prevtx
|
||||
|
||||
VECTORS = ( # path, script_types
|
||||
@ -113,6 +115,10 @@ def test_getaddress(
|
||||
script_types: list[messages.InputScriptType],
|
||||
):
|
||||
for script_type in script_types:
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
res = btc.get_address(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -130,6 +136,11 @@ def test_signmessage(
|
||||
client: Client, path: str, script_types: list[messages.InputScriptType]
|
||||
):
|
||||
for script_type in script_types:
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
|
||||
sig = btc.sign_message(
|
||||
client,
|
||||
coin_name="Bitcoin",
|
||||
@ -164,6 +175,10 @@ def test_signtx(
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes={prevhash: prevtx}
|
||||
)
|
||||
@ -187,6 +202,10 @@ def test_getaddress_multisig(
|
||||
]
|
||||
multisig = messages.MultisigRedeemScriptType(pubkeys=pubs, m=2)
|
||||
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
address = btc.get_address(
|
||||
client,
|
||||
"Bitcoin",
|
||||
@ -242,6 +261,10 @@ def test_signtx_multisig(client: Client, paths: list[str], address_index: list[i
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
sig, _ = btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes={prevhash: prevtx}
|
||||
)
|
||||
|
@ -24,7 +24,12 @@ from trezorlib.debuglink import message_filters
|
||||
from trezorlib.exceptions import Cancelled
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ...input_flows import InputFlowSignMessageInfo, InputFlowSignMessagePagination
|
||||
from ...common import is_core
|
||||
from ...input_flows import (
|
||||
InputFlowConfirmAllWarnings,
|
||||
InputFlowSignMessageInfo,
|
||||
InputFlowSignMessagePagination,
|
||||
)
|
||||
|
||||
S = messages.InputScriptType
|
||||
|
||||
@ -414,6 +419,9 @@ def test_signmessage_path_warning(client: Client):
|
||||
messages.MessageSignature,
|
||||
]
|
||||
)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
btc.sign_message(
|
||||
client,
|
||||
coin_name="Bitcoin",
|
||||
|
@ -21,6 +21,8 @@ from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from .signtx import forge_prevtx, request_input
|
||||
|
||||
B = messages.ButtonRequestType
|
||||
@ -78,6 +80,11 @@ def test_invalid_path_prompt(client: Client):
|
||||
client, safety_checks=messages.SafetyCheckLevel.PromptTemporarily
|
||||
)
|
||||
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
|
||||
btc.sign_tx(client, "Litecoin", [inp1], [out1], prev_txes=PREV_TXES)
|
||||
|
||||
|
||||
@ -99,6 +106,11 @@ def test_invalid_path_pass_forkid(client: Client):
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
with client:
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
|
||||
btc.sign_tx(client, "Bcash", [inp1], [out1], prev_txes=PREV_TXES)
|
||||
|
||||
|
||||
|
@ -8,6 +8,8 @@ from trezorlib import btc, messages, models, tools
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from .signtx import forge_prevtx
|
||||
|
||||
# address at seed "all all all..." path m/44h/0h/0h/0/0
|
||||
@ -130,6 +132,9 @@ def test_invalid_prev_hash_attack(client: Client, prev_hash):
|
||||
|
||||
with client, pytest.raises(TrezorFailure) as e:
|
||||
client.set_filter(messages.TxAck, attack_filter)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=PREV_TXES)
|
||||
|
||||
# check that injection was performed
|
||||
@ -163,6 +168,9 @@ def test_invalid_prev_hash_in_prevtx(client: Client, prev_hash):
|
||||
tx_hash = hash_tx(serialize_tx(prev_tx))
|
||||
inp0.prev_hash = tx_hash
|
||||
|
||||
with pytest.raises(TrezorFailure) as e:
|
||||
with client, pytest.raises(TrezorFailure) as e:
|
||||
if client.model is not models.T1B1:
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
btc.sign_tx(client, "Bitcoin", [inp0], [out1], prev_txes={tx_hash: prev_tx})
|
||||
_check_error_message(prev_hash, client.model, e.value.message)
|
||||
|
@ -22,6 +22,7 @@ from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ...bip32 import deserialize
|
||||
from ...common import is_core
|
||||
from ...input_flows import InputFlowConfirmAllWarnings
|
||||
from ...tx_cache import TxCache
|
||||
from .signtx import (
|
||||
assert_tx_matches,
|
||||
@ -612,6 +613,9 @@ def test_send_multisig_3_change(client: Client):
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(expected_responses)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET
|
||||
)
|
||||
@ -624,6 +628,9 @@ def test_send_multisig_3_change(client: Client):
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(expected_responses)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET
|
||||
)
|
||||
@ -698,6 +705,9 @@ def test_send_multisig_4_change(client: Client):
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(expected_responses)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
signatures, _ = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET
|
||||
)
|
||||
@ -710,6 +720,9 @@ def test_send_multisig_4_change(client: Client):
|
||||
|
||||
with client:
|
||||
client.set_expected_responses(expected_responses)
|
||||
if is_core(client):
|
||||
IF = InputFlowConfirmAllWarnings(client)
|
||||
client.set_input_flow(IF.get())
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET
|
||||
)
|
||||
|
@ -716,21 +716,20 @@ class InputFlowPaymentRequestDetails(InputFlowBase):
|
||||
|
||||
yield # confirm first output
|
||||
assert self.outputs[0].address[:16] in self.text_content() # type: ignore
|
||||
self.debug.press_yes()
|
||||
self.debug.swipe_up()
|
||||
yield # confirm first output
|
||||
self.debug.wait_layout()
|
||||
self.debug.press_yes()
|
||||
self.debug.swipe_up()
|
||||
|
||||
yield # confirm second output
|
||||
assert self.outputs[1].address[:16] in self.text_content() # type: ignore
|
||||
self.debug.press_yes()
|
||||
self.debug.swipe_up()
|
||||
yield # confirm second output
|
||||
self.debug.wait_layout()
|
||||
self.debug.press_yes()
|
||||
self.debug.swipe_up()
|
||||
|
||||
yield # confirm transaction
|
||||
self.debug.press_yes()
|
||||
yield # confirm transaction
|
||||
self.debug.swipe_up()
|
||||
self.debug.press_yes()
|
||||
|
||||
|
||||
@ -747,7 +746,7 @@ class InputFlowSignTxHighFee(InputFlowBase):
|
||||
|
||||
self.finished = True
|
||||
|
||||
def input_flow_common(self) -> BRGeneratorType:
|
||||
def input_flow_tt(self) -> BRGeneratorType:
|
||||
screens = [
|
||||
B.ConfirmOutput,
|
||||
B.ConfirmOutput,
|
||||
@ -756,6 +755,31 @@ class InputFlowSignTxHighFee(InputFlowBase):
|
||||
]
|
||||
yield from self.go_through_all_screens(screens)
|
||||
|
||||
def input_flow_tr(self) -> BRGeneratorType:
|
||||
screens = [
|
||||
B.ConfirmOutput,
|
||||
B.ConfirmOutput,
|
||||
B.FeeOverThreshold,
|
||||
B.SignTx,
|
||||
]
|
||||
yield from self.go_through_all_screens(screens)
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
screens = [
|
||||
B.ConfirmOutput,
|
||||
B.ConfirmOutput,
|
||||
B.FeeOverThreshold,
|
||||
B.SignTx,
|
||||
]
|
||||
for expected in screens:
|
||||
br = yield
|
||||
assert br.code == expected
|
||||
self.debug.swipe_up()
|
||||
if br.code == B.SignTx:
|
||||
self.debug.press_yes()
|
||||
|
||||
self.finished = True
|
||||
|
||||
|
||||
def sign_tx_go_to_info(client: Client) -> Generator[None, None, str]:
|
||||
yield # confirm output
|
||||
@ -777,6 +801,43 @@ def sign_tx_go_to_info(client: Client) -> Generator[None, None, str]:
|
||||
return content
|
||||
|
||||
|
||||
def sign_tx_go_to_info_t3t1(
|
||||
client: Client, multi_account: bool = False
|
||||
) -> Generator[None, None, str]:
|
||||
yield # confirm output
|
||||
client.debug.wait_layout()
|
||||
client.debug.swipe_up()
|
||||
yield # confirm output
|
||||
client.debug.wait_layout()
|
||||
client.debug.swipe_up()
|
||||
|
||||
if multi_account:
|
||||
yield
|
||||
client.debug.wait_layout()
|
||||
client.debug.swipe_up()
|
||||
|
||||
yield # confirm transaction
|
||||
client.debug.wait_layout()
|
||||
client.debug.click(buttons.CORNER_BUTTON)
|
||||
client.debug.synchronize_at("VerticalMenu")
|
||||
client.debug.click(buttons.VERTICAL_MENU[0])
|
||||
|
||||
layout = client.debug.wait_layout()
|
||||
content = layout.text_content()
|
||||
|
||||
client.debug.click(buttons.CORNER_BUTTON)
|
||||
client.debug.synchronize_at("VerticalMenu")
|
||||
client.debug.click(buttons.VERTICAL_MENU[1])
|
||||
|
||||
layout = client.debug.wait_layout()
|
||||
content += " " + layout.text_content()
|
||||
|
||||
client.debug.click(buttons.CORNER_BUTTON)
|
||||
client.debug.click(buttons.CORNER_BUTTON, wait=True)
|
||||
|
||||
return content
|
||||
|
||||
|
||||
def sign_tx_go_to_info_tr(
|
||||
client: Client,
|
||||
) -> Generator[None, None, str]:
|
||||
@ -829,8 +890,9 @@ class InputFlowSignTxInformation(InputFlowBase):
|
||||
self.debug.press_yes()
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
content = yield from sign_tx_go_to_info(self.client)
|
||||
content = yield from sign_tx_go_to_info_t3t1(self.client)
|
||||
self.assert_content(content, "confirm_total__sending_from_account")
|
||||
self.debug.swipe_up()
|
||||
self.debug.press_yes()
|
||||
|
||||
|
||||
@ -863,12 +925,9 @@ class InputFlowSignTxInformationMixed(InputFlowBase):
|
||||
self.debug.press_yes()
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
# multiple accounts warning
|
||||
yield
|
||||
self.debug.press_yes()
|
||||
|
||||
content = yield from sign_tx_go_to_info(self.client)
|
||||
content = yield from sign_tx_go_to_info_t3t1(self.client, multi_account=True)
|
||||
self.assert_content(content, "confirm_total__sending_from_account")
|
||||
self.debug.swipe_up()
|
||||
self.debug.press_yes()
|
||||
|
||||
|
||||
@ -885,8 +944,11 @@ class InputFlowSignTxInformationCancel(InputFlowBase):
|
||||
self.debug.press_left()
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
yield from sign_tx_go_to_info(self.client)
|
||||
self.debug.press_no()
|
||||
yield from sign_tx_go_to_info_t3t1(self.client)
|
||||
self.debug.click(buttons.CORNER_BUTTON)
|
||||
self.debug.click(buttons.VERTICAL_MENU[2])
|
||||
self.debug.synchronize_at("PromptScreen")
|
||||
self.debug.click(buttons.TAP_TO_CONFIRM)
|
||||
|
||||
|
||||
class InputFlowSignTxInformationReplacement(InputFlowBase):
|
||||
@ -984,6 +1046,30 @@ def lock_time_input_flow_tr(
|
||||
debug.press_yes()
|
||||
|
||||
|
||||
def lock_time_input_flow_t3t1(
|
||||
debug: DebugLink,
|
||||
layout_assert_func: Callable[[DebugLink, messages.ButtonRequest], None],
|
||||
double_confirm: bool = False,
|
||||
) -> BRGeneratorType:
|
||||
yield # confirm output
|
||||
debug.wait_layout()
|
||||
debug.swipe_up()
|
||||
yield # confirm output
|
||||
debug.wait_layout()
|
||||
debug.swipe_up()
|
||||
|
||||
br = yield # confirm locktime
|
||||
layout_assert_func(debug, br)
|
||||
debug.press_yes()
|
||||
|
||||
yield # confirm transaction
|
||||
debug.swipe_up()
|
||||
debug.press_yes()
|
||||
if double_confirm:
|
||||
yield # confirm transaction
|
||||
debug.press_yes()
|
||||
|
||||
|
||||
class InputFlowLockTimeBlockHeight(InputFlowBase):
|
||||
def __init__(self, client: Client, block_height: str):
|
||||
super().__init__(client)
|
||||
@ -1003,7 +1089,7 @@ class InputFlowLockTimeBlockHeight(InputFlowBase):
|
||||
yield from lock_time_input_flow_tr(self.debug, self.assert_func)
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
yield from lock_time_input_flow_tt(
|
||||
yield from lock_time_input_flow_t3t1(
|
||||
self.debug, self.assert_func, double_confirm=True
|
||||
)
|
||||
|
||||
@ -1025,7 +1111,7 @@ class InputFlowLockTimeDatetime(InputFlowBase):
|
||||
yield from lock_time_input_flow_tr(self.debug, self.assert_func)
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
yield from lock_time_input_flow_tt(self.debug, self.assert_func)
|
||||
yield from lock_time_input_flow_t3t1(self.debug, self.assert_func)
|
||||
|
||||
|
||||
class InputFlowEIP712ShowMore(InputFlowBase):
|
||||
@ -2048,3 +2134,42 @@ class InputFlowResetSkipBackup(InputFlowBase):
|
||||
yield # Confirm skip backup
|
||||
TR.assert_in(self.text_content(), "backup__want_to_skip")
|
||||
self.debug.press_no()
|
||||
|
||||
|
||||
class InputFlowConfirmAllWarnings(InputFlowBase):
|
||||
def __init__(self, client: Client):
|
||||
super().__init__(client)
|
||||
|
||||
def input_flow_tt(self) -> BRGeneratorType:
|
||||
br = yield
|
||||
while True:
|
||||
# wait for homescreen to go away
|
||||
self.debug.wait_layout()
|
||||
self.client.ui._default_input_flow(br)
|
||||
br = yield
|
||||
|
||||
def input_flow_tr(self) -> BRGeneratorType:
|
||||
return self.input_flow_tt()
|
||||
|
||||
def input_flow_t3t1(self) -> BRGeneratorType:
|
||||
br = yield
|
||||
while True:
|
||||
# wait for homescreen to go away
|
||||
# probably won't be needed after https://github.com/trezor/trezor-firmware/pull/3686
|
||||
self.debug.wait_layout()
|
||||
# Paginating (going as further as possible) and pressing Yes
|
||||
if br.pages is not None:
|
||||
for _ in range(br.pages - 1):
|
||||
self.debug.swipe_up(wait=True)
|
||||
layout = self.debug.read_layout()
|
||||
text = layout.text_content().lower()
|
||||
# hi priority warning
|
||||
if ("wrong derivation path" in text) or ("to a multisig" in text):
|
||||
self.debug.click(buttons.CORNER_BUTTON, wait=True)
|
||||
self.debug.synchronize_at("VerticalMenu")
|
||||
self.debug.click(buttons.VERTICAL_MENU[1])
|
||||
elif "swipe up" in layout.footer().lower():
|
||||
self.debug.swipe_up()
|
||||
else:
|
||||
self.debug.press_yes()
|
||||
br = yield
|
||||
|
Loading…
Reference in New Issue
Block a user