From fee0d70211e89629e682f6cda95a83d17ea88825 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Wed, 31 May 2023 13:16:07 +0200 Subject: [PATCH] fix(core/ui): workaround different TT and TR UI API [no changelog] --- core/embed/rust/src/ui/model_tr/layout.rs | 1 + core/embed/rust/src/ui/model_tt/layout.rs | 2 + core/mocks/generated/trezorui2.pyi | 3 + core/src/trezor/ui/layouts/tr/__init__.py | 2 + core/src/trezor/ui/layouts/tt_v2/__init__.py | 2 + tests/ui_tests/fixtures.json | 60 ++++++++++---------- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index eeb3657376..fa2cc6db59 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -1414,6 +1414,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// def confirm_modify_fee( /// *, + /// title: str, # ignored /// sign: int, /// user_fee_change: str, /// total_fee_new: str, diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index 5e568b31e5..dd6fd4df28 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -1693,6 +1693,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// def confirm_modify_output( /// *, + /// address: str, # ignored /// sign: int, /// amount_change: str, /// amount_new: str, @@ -1706,6 +1707,7 @@ pub static mp_module_trezorui2: Module = obj_module! { /// sign: int, /// user_fee_change: str, /// total_fee_new: str, + /// fee_rate_amount: str | None, # ignored /// ) -> object: /// """Decrease or increase transaction fee.""" Qstr::MP_QSTR_confirm_modify_fee => obj_fn_kw!(0, new_confirm_modify_fee).as_obj(), diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index 94e9eef00f..a84092e89c 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -150,6 +150,7 @@ def tutorial() -> object: # rust/src/ui/model_tr/layout.rs def confirm_modify_fee( *, + title: str, # ignored sign: int, user_fee_change: str, total_fee_new: str, @@ -505,6 +506,7 @@ def confirm_total( # rust/src/ui/model_tt/layout.rs def confirm_modify_output( *, + address: str, # ignored sign: int, amount_change: str, amount_new: str, @@ -519,6 +521,7 @@ def confirm_modify_fee( sign: int, user_fee_change: str, total_fee_new: str, + fee_rate_amount: str | None, # ignored ) -> object: """Decrease or increase transaction fee.""" diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index ffe6210cd4..dd37960e63 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -1033,6 +1033,7 @@ async def confirm_modify_output( async def confirm_modify_fee( ctx: GenericContext, + title: str, sign: int, user_fee_change: str, total_fee_new: str, @@ -1043,6 +1044,7 @@ async def confirm_modify_fee( ctx, RustLayout( trezorui2.confirm_modify_fee( + title=title, sign=sign, user_fee_change=user_fee_change, total_fee_new=total_fee_new, diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index bda9fe6407..30a2de76c8 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -1013,6 +1013,7 @@ async def confirm_modify_output( result = await ctx.wait( RustLayout( trezorui2.confirm_modify_output( + address=address, sign=sign, amount_change=amount_change, amount_new=amount_new, @@ -1062,6 +1063,7 @@ async def confirm_modify_fee( sign=sign, user_fee_change=user_fee_change, total_fee_new=total_fee_new, + fee_rate_amount=fee_rate_amount, ) ) info_layout = RustLayout( diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index 3b6945ae42..f1313ac476 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -1919,13 +1919,13 @@ "TT_test_pin.py::test_pin_short": "b5377990e4a1f324133601e3ca4726cde7af50b3e2c3f53738022ed9108a6a79", "TT_test_pin.py::test_wipe_code_same_as_pin": "cb8aa7d781b689452e863a3e704c1df06d217cbf8761b698cd912e0417da1513", "TT_test_pin.py::test_wipe_code_setup": "353855511c20bcf4f8ec01d141c11a108472dc64e3dac06c5f567b42bddbaba9", -"TT_test_recovery.py::test_recovery_bip39": "85f92b26902f1ce64913d6ca9874a508fcb21fff8411145c438de69077a4989a", -"TT_test_recovery.py::test_recovery_slip39_basic": "53fa3abfe1ce7b11ec189fa359f463763b53802ae5925e84a6593271fe4e8f9a", -"TT_test_reset_bip39.py::test_reset_bip39": "21633fd88045835f5ee6ca8e37f10e994345ccc0031662adbd58434db218c590", -"TT_test_reset_slip39_advanced.py::test_reset_slip39_advanced[16of16]": "34680359511117bce691dc377169f55f515c07ab1d958a15757a81bee3314aed", -"TT_test_reset_slip39_advanced.py::test_reset_slip39_advanced[2of2]": "a5e043a743d239181ecf73d2e6c48ae05485cee7cdcd4626ac8599709bcded47", -"TT_test_reset_slip39_basic.py::test_reset_slip39_basic[16of16]": "ed849cb2b3b0c3917f78289e415f0d89fdba34821b8ed8126ee5653abfa8169b", -"TT_test_reset_slip39_basic.py::test_reset_slip39_basic[1of1]": "309c4136c0621f4ffb3c1ff64796736111e95544165fa5bfd4147d9a75d1c71b" +"TT_test_recovery.py::test_recovery_bip39": "6ff84bfab19bec7db2d5672a2059a69dbae56cc1e06464700024e431c9a1349f", +"TT_test_recovery.py::test_recovery_slip39_basic": "e038348233dc15169cd2678482f4512ed863fedca5cd70d94e571d88fa40c0a7", +"TT_test_reset_bip39.py::test_reset_bip39": "1c89472bdb4a764d0340a7613ae708be1e539b7c4c6cbcc3e08cdf64436d544d", +"TT_test_reset_slip39_advanced.py::test_reset_slip39_advanced[16of16]": "1d84f6525969fc44b4dbc271680b52774e9431dfbc6137bdc047565e08910d28", +"TT_test_reset_slip39_advanced.py::test_reset_slip39_advanced[2of2]": "e07555e9c3023186d19a31cffb3d2e9260035371112cacd9be058b2e0fcb8a0a", +"TT_test_reset_slip39_basic.py::test_reset_slip39_basic[16of16]": "62451c768fcff13e6649db3325bf12e38e5610b9792aafac9f7cebb5389f24ee", +"TT_test_reset_slip39_basic.py::test_reset_slip39_basic[1of1]": "27fbf92592f9598da2ed037e76698eb93452f7b758c841510add5c42d15a250b" }, "device_tests": { "TT_binance-test_get_address.py::test_binance_get_address[m-44h-714h-0h-0-0-bnb1hgm0p7khfk85zpz-68e2cb5a": "483ff25f0ff24de80631dfb202ac681c38dfbf44c5905505281c2d0719a94fc6", @@ -2877,24 +2877,24 @@ "TT_reset_recovery-test_recovery_slip39_basic.py::test_wrong_nth_word[2]": "be1dd4ecbfc29a767dd3f1faf6ee12282422f0504175b996afa352b39a7f540b", "TT_reset_recovery-test_recovery_slip39_basic_dryrun.py::test_2of3_dryrun": "87718399c69d11e8656d4af3af448f542970fbfca524a53955adcd911903efd0", "TT_reset_recovery-test_recovery_slip39_basic_dryrun.py::test_2of3_invalid_seed_dryrun": "0fbabbe652adc6a4e0d7285b165687dce0ad617762ed228f6a21d56de409d799", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Bip39-backup_flow_bip39]": "0109cf31e69f4bd666644b866ca26dfd47e5cc3cb211d4b7863dcbfd94f5a542", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Slip39_Advanced-bac-f67baa1c": "c631c45a838fd1f167fd2149886fc54c28cf0fe032fe846a7f7e0f27dea7270a", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Slip39_Basic-backup-6348e7fe": "1180763b4f38e2836fef413f7107483375d1c4c851ee825528f9c6278b6ed992", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Bip39-backup_flow_bip39]": "2f8a27fa1fb5c5454a74885d361aa5507b029679e35032611e5bb032e2195bcf", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Advanced-backup-dcbda5cf": "aa094ca5d4658b33cd08260b8a465ebbe4862d1f22e76d34cd576d57f1027908", -"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Basic-backup_fl-1577de4d": "eb31a91d2d8f3be95aff992c6ba69e38b3db5cbb7355194aebb6ad4f042f587a", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Bip39-backup_flow_bip39]": "41e7e16005c3697e31a2388ca7d2fc163ef21ba27edd46a300e0d18b4b22242e", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Slip39_Advanced-bac-f67baa1c": "5c695d69a56f3d03989d363225dba2bd916ca451b52443515ba5ae7d5d913318", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_manual[BackupType.Slip39_Basic-backup-6348e7fe": "8dfd052239416b598e101016c1a2bbdb992c8c4d929b47c1dd78b3e8637e7bd5", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Bip39-backup_flow_bip39]": "eb33b00cc41e24b02664d2d638b00afdb5b9d9af90ce32540875ec47b97e76c9", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Advanced-backup-dcbda5cf": "4c31ebedbaa5eccf55ad8f3be4497f8d5fa0f66f56bccb4de40e44f20fc09758", +"TT_reset_recovery-test_reset_backup.py::test_skip_backup_msg[BackupType.Slip39_Basic-backup_fl-1577de4d": "9a24be56fac80c9b5b26a50065de1ca3bfafbcec404aabf43b2523755db5dc6e", "TT_reset_recovery-test_reset_bip39_t2.py::test_already_initialized": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", -"TT_reset_recovery-test_reset_bip39_t2.py::test_failed_pin": "3ec95417936f90e01b92ab89b50d1a5acb98befb51c5767914f501298e1a794c", -"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device": "36f6689acdafb02680f061608792295b0136a9ab5789ab82f2952266d5823107", -"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device_192": "e6d944b6e94a8810354026a454c3d7b918865e230897d4027b453011105eb5ad", -"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device_pin": "7c8a9725873c105663ed7b78cd9f01c236850de356012d4e99f24d90dfc66bb1", -"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_failed_check": "12b3e2b0f6df93af5ce1e88b9c6d99d0be18c60e6b67e42a172badbd2cd9c100", -"TT_reset_recovery-test_reset_recovery_bip39.py::test_reset_recovery": "51944865c548c77adc948bfa068bc9631d2e6f5f6df3af1089cf53bc5b43a28b", -"TT_reset_recovery-test_reset_recovery_slip39_advanced.py::test_reset_recovery": "822dc0f5e2dd89d5d7c1aca7d0b932de459f400622c59c8fd4a56e28022c02c1", -"TT_reset_recovery-test_reset_recovery_slip39_basic.py::test_reset_recovery": "ee89833730540c24f204fc1fad392393b3177d12bacd2d602b1b7434350ea0a8", -"TT_reset_recovery-test_reset_slip39_advanced.py::test_reset_device_slip39_advanced": "f472b076ffdec128622e39b121f05f9bcb29733ea751da968c51a6dfe4942d7e", -"TT_reset_recovery-test_reset_slip39_basic.py::test_reset_device_slip39_basic": "390c996a1d11b47696a6a03c019a2e4ec37485b795c1dcc9885679201003cb83", -"TT_reset_recovery-test_reset_slip39_basic.py::test_reset_device_slip39_basic_256": "c91bf595acacba296a3fcb9db979a0475a86cfba67f92f260ef3827a00472bc0", +"TT_reset_recovery-test_reset_bip39_t2.py::test_failed_pin": "cb7f55d17ebf06888ff02ab3db0a5bd2b5355dcc465eab5fc009089845623c72", +"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device": "24c1a604c673a7c2abf5866cd1fc901d1914016148eef97a8f1f67109353b716", +"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device_192": "b1c25566ed19c2f4cc209a56d61fda0971d1948b65a3357e0f6ef2af1bdc9a83", +"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_device_pin": "31b0231ab0fc31b06d86a33a0ed7b4b5c625248b0d5ccb424639e89088f7428b", +"TT_reset_recovery-test_reset_bip39_t2.py::test_reset_failed_check": "fb9014674746b338c81d86e535cf01842e82dedd948ee98716817a564ed76647", +"TT_reset_recovery-test_reset_recovery_bip39.py::test_reset_recovery": "bd23df987d673737e9e2043ede65bc81beae39aa858b365cd714cf0c0351ab5b", +"TT_reset_recovery-test_reset_recovery_slip39_advanced.py::test_reset_recovery": "f1302f5123557c8da866fa51c0b5eaaa65c97137bd974bcb46b0b6339db6546e", +"TT_reset_recovery-test_reset_recovery_slip39_basic.py::test_reset_recovery": "ea6be44f6cc20ba0346577b8cabd9cda53371898d5ebe4be3befe2a9b1c98caf", +"TT_reset_recovery-test_reset_slip39_advanced.py::test_reset_device_slip39_advanced": "638b810871d71d89ebef46b7a909b2927a3944fe0c306c54452686f88af89b43", +"TT_reset_recovery-test_reset_slip39_basic.py::test_reset_device_slip39_basic": "a42f8f2562f6dcc9da8028ecd9ff50afcd73e1ffce67ef8116d7f33a8f52a93c", +"TT_reset_recovery-test_reset_slip39_basic.py::test_reset_device_slip39_basic_256": "e7b439dca8fb355eebe7c6ead8f58f100f6ddfa5dd7b41ec22d47ad000cf5520", "TT_ripple-test_get_address.py::test_ripple_get_address": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_ripple-test_get_address.py::test_ripple_get_address_other": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_ripple-test_sign_tx.py::test_ripple_sign_invalid_fee": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", @@ -2979,12 +2979,12 @@ "TT_test_msg_applysettings.py::test_experimental_features": "e7bdcfa8708fc0fbe88f5f4cc7f93497c94fa5ae9e08282496c04e993123674c", "TT_test_msg_applysettings.py::test_label_too_long": "80a6e289138a604cf351a29511cf6f85e2243591317894703152787e1351a1a3", "TT_test_msg_applysettings.py::test_safety_checks": "4ec93f34a54d13317c2d5434ed5853d0edf0f6d91772aab2a15acf7e3de75458", -"TT_test_msg_backup_device.py::test_backup_bip39": "443cbf213767f7152abe6ca70dbc09f8a8b1e325bbb866805b404dc345232d67", -"TT_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "1a04ac093951e611863a6a52a6ea14360eb13caeabfda438b5ac7c379f66cb8a", -"TT_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "1e2d27cf6d2634293b2a971065e809498f4ade47530d4f1d6aa04f01d87a6349", -"TT_test_msg_backup_device.py::test_backup_slip39_basic[click_info]": "999e1072a46dd9576d1ac51aede71c0ae650e8d0bb5cd140c68bad3826592601", -"TT_test_msg_backup_device.py::test_backup_slip39_basic[no_click_info]": "ff61a3e19bfde5105e727484fccb919febb0bf02c61c92dbad548439bdd0339d", -"TT_test_msg_backup_device.py::test_interrupt_backup_fails": "cdf801e16b046079569e4055f43a86a45d7eace58793427ef5433f71e75961f9", +"TT_test_msg_backup_device.py::test_backup_bip39": "a01b8e554380d678021934d3ff1465b9e822079bc6d98a94660b3d11c7ad0e10", +"TT_test_msg_backup_device.py::test_backup_slip39_advanced[click_info]": "68e40646b072519421cec361b5ab4c4fe3c2d9beb75a682886cd66e05a68e0d9", +"TT_test_msg_backup_device.py::test_backup_slip39_advanced[no_click_info]": "429705b499c18f938d924c49cfb11a06dce3a9172853424f48429d516d777676", +"TT_test_msg_backup_device.py::test_backup_slip39_basic[click_info]": "e07788a0f3cbdc6d4d989569bece9338d8c3618241a010429d58205bdada5874", +"TT_test_msg_backup_device.py::test_backup_slip39_basic[no_click_info]": "6a96da3ba9ada810a826d79cb501eec0e43293d783b6ec2191885cfd9cc856b9", +"TT_test_msg_backup_device.py::test_interrupt_backup_fails": "ae147498028d68aa71c7337544e4a5049c4c943897f905c6fe29e88e5c3ab056", "TT_test_msg_backup_device.py::test_no_backup_fails": "fada9d38ec099b3c6a4fd8bf994bb1f3431e40085128b4e0cd9deb8344dec53e", "TT_test_msg_backup_device.py::test_no_backup_show_entropy_fails": "001377ce61dcd189e6a9d17e20dcd71130e951dc3314b40ff26f816bd9355bdd", "TT_test_msg_change_wipe_code_t2.py::test_set_pin_to_wipe_code": "b3abe56cbc85b9012e1fa27dce0e869f0a01de7a72db24e44177690a57392b52",