Skip to content

Commit

Permalink
fix(core): Hold-to-confirm EIP-1559 transaction
Browse files Browse the repository at this point in the history
Make Ethereum EIP-1559 transaction a hold-to-confirm transaction.
  • Loading branch information
aloisklink committed Jan 13, 2022
1 parent 176b127 commit 0a1a2ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions core/src/apps/ethereum/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ async def require_confirm_eip1559_fee(
title="Confirm fee",
description="Maximum fee",
amount=format_ethereum_amount(max_gas_fee * gas_limit, None, chain_id),
hold=True,
)


Expand Down
5 changes: 4 additions & 1 deletion core/src/trezor/ui/layouts/tt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ async def confirm_text(
br_code: ButtonRequestType = ButtonRequestType.Other,
icon: str = ui.ICON_SEND, # TODO cleanup @ redesign
icon_color: int = ui.GREEN, # TODO cleanup @ redesign
hold: bool = False, # TODO Only supported if NOT paginating
) -> None:
"""Confirm textual data.
Expand All @@ -717,7 +718,7 @@ async def confirm_text(
text.normal(description)
text.br()
text.bold(data)
content: ui.Layout = Confirm(text)
content: ui.Layout = HoldToConfirm(text) if hold else Confirm(text)

else:
para = []
Expand All @@ -737,6 +738,7 @@ def confirm_amount(
br_code: ButtonRequestType = ButtonRequestType.Other,
icon: str = ui.ICON_SEND, # TODO cleanup @ redesign
icon_color: int = ui.GREEN, # TODO cleanup @ redesign
hold: bool = False,
) -> Awaitable[None]:
"""Confirm amount."""
# TODO clarify API - this should be pretty limited to support mainly confirming
Expand All @@ -750,6 +752,7 @@ def confirm_amount(
br_code=br_code,
icon=icon,
icon_color=icon_color,
hold=hold,
)


Expand Down
16 changes: 8 additions & 8 deletions tests/ui_tests/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@
"ethereum-test_signtx.py::test_signtx_data_pagination[input_flow_go_back]": "e0304501e6dd76d08052edd3ef518e4873f2029e8351bc1fb5ed5ba2a99e740a",
"ethereum-test_signtx.py::test_signtx_data_pagination[input_flow_scroll_down]": "f707da6726a2ebad6888af490eed2a1441147c795a8b72fb805fd0d3a8b071f9",
"ethereum-test_signtx.py::test_signtx_data_pagination[input_flow_skip]": "5d73d7f8366f4abd3eaf3e666f140ee0fcc0aca4f35483a6be27d96e2b64fd27",
"ethereum-test_signtx.py::test_signtx_eip1559[data_1]": "bf7fe1457c4fd99e74b8b9a2090321edfb20bdf68713505d92dd011f44d88184",
"ethereum-test_signtx.py::test_signtx_eip1559[data_2_bigdata]": "05cc77497ca4934f5472f4b8807208f54c734d1252e0eb186937a79e5ecec38b",
"ethereum-test_signtx.py::test_signtx_eip1559[known_erc20]": "fd068a40fb0d4729c49316122711d36a92b09c04f60eed6d1fa5ecee57ae6f7a",
"ethereum-test_signtx.py::test_signtx_eip1559[large_chainid]": "c8152a3f28ea1985d7c14844b3d8218a4a76e78fe0526e30c1d479f2cf200694",
"ethereum-test_signtx.py::test_signtx_eip1559[nodata]": "55faae526aa63bc536114c70f29d5e12a6e973c565ae4247c439b755b589d0df",
"ethereum-test_signtx.py::test_signtx_eip1559[unknown_erc20]": "6797940ee749fdf11a049eb1fccc7e2d6b34a907e4be26dbd8b9b442ce539ad1",
"ethereum-test_signtx.py::test_signtx_eip1559_access_list": "ceaf212625bb0d8696e3a46e5348639563bf2eb9c70865595dae118480b38d33",
"ethereum-test_signtx.py::test_signtx_eip1559_access_list_larger": "ceaf212625bb0d8696e3a46e5348639563bf2eb9c70865595dae118480b38d33",
"ethereum-test_signtx.py::test_signtx_eip1559[data_1]": "5449c33c45458b0c1b5a5367b46c188c59b02d857163a20c83065cc048d96cec",
"ethereum-test_signtx.py::test_signtx_eip1559[data_2_bigdata]": "041a2e78748c191c3a5bab6ecbed569ac30e25beb286737e2ff731874c123cd0",
"ethereum-test_signtx.py::test_signtx_eip1559[known_erc20]": "9e80079e0d83d00e372843f49e022f9338cb951b867eee588bc19d024c8339c1",
"ethereum-test_signtx.py::test_signtx_eip1559[large_chainid]": "0f0ac7f2b157f3b496b3e638b6dd19c20b7b55c7f6ab134c80e9fc5fc6f07eb4",
"ethereum-test_signtx.py::test_signtx_eip1559[nodata]": "22301d398a9241ecd3b706b2063b37eae8344c949b57f2e5a6c52e42ef6ac2f0",
"ethereum-test_signtx.py::test_signtx_eip1559[unknown_erc20]": "f1b606b0d83c1000925b9303dff6c4c58f4cbfdc1fb97896996adaa7559e92fd",
"ethereum-test_signtx.py::test_signtx_eip1559_access_list": "d2bb36ec58ac2f7fff652324468a1443174890f6ba0d375f2716bfe70404e2bc",
"ethereum-test_signtx.py::test_signtx_eip1559_access_list_larger": "d2bb36ec58ac2f7fff652324468a1443174890f6ba0d375f2716bfe70404e2bc",
"misc-test_msg_cipherkeyvalue.py::test_decrypt": "4d8563e8130e51628290f0acbced7c294457c4501f7767b00ff3dd1bddc809da",
"misc-test_msg_cipherkeyvalue.py::test_decrypt_badlen": "c09de07fbbf1e047442180e2facb5482d06a1a428891b875b7dd93c9e4704ae1",
"misc-test_msg_cipherkeyvalue.py::test_encrypt": "871df86a7553681c5f17ec6759204f9b0727cc16c4868f227a4b364146fd9293",
Expand Down

0 comments on commit 0a1a2ca

Please sign in to comment.