Conversation
WalkthroughThis update introduces extendable SLIP-39 backup support across firmware, UI, and cryptography layers. It adds new backup types, refactors backup and recovery flows, enhances mnemonic keyboard and haptic feedback, and improves Safe transaction confirmations. Localization strings and UI components are updated for clarity and new features. Several internal APIs and constants are extended for SLIP-39 compatibility. Changes
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this comment.
Actionable comments posted: 19
🔭 Outside diff range comments (1)
core/src/trezor/lvglui/scrs/template.py (1)
1551-1551: Hard-coded strings need i18n."Hash", "DomainHash", "MessageHash", "SafeTxHash" should use i18n keys.
Also applies to: 1557-1557, 1563-1563, 1568-1568
🧹 Nitpick comments (17)
core/src/trezor/ui/components/tt/keyboard_slip39.py (2)
126-128: Type checking suppression may indicate deeper issues.Consider fixing the underlying type issue instead of suppressing warnings.
180-182: Same type checking suppression pattern.Address the root cause rather than suppressing type warnings.
core/src/trezor/lvglui/scrs/components/button.py (1)
273-275: Commented code suggests incomplete implementationDead code about switch state check.
- # if self.switch.get_state() != lv.STATE.CHECKED: - # motor.vibrate(motor.WHISPER, force=True)core/src/apps/common/backup.py (1)
3-8: Commented imports suggest incomplete work.Dead code should be removed or implemented.
core/src/trezor/pin.py (1)
25-28: Use ternary operator.Simplify the if-else block.
- if message == "read fp data": - text = "" - else: - text = message + text = "" if message == "read fp data" else messagecore/src/apps/common/backup_types.py (1)
70-86: Consider using a dictionary for cleaner code.def get_num_of_words_per_share( backup_type: BackupType, secret_length_bytes: int ) -> int: if is_slip39_backup_type(backup_type): - if secret_length_bytes == 16: - return 20 - elif secret_length_bytes == 32: - return 33 + word_counts = {16: 20, 32: 33} + if secret_length_bytes in word_counts: + return word_counts[secret_length_bytes] else: - if secret_length_bytes == 16: - return 12 - elif secret_length_bytes == 24: - return 18 - elif secret_length_bytes == 32: - return 24 + word_counts = {16: 12, 24: 18, 32: 24} + if secret_length_bytes in word_counts: + return word_counts[secret_length_bytes] # Invalid backup type and secret length combination raise RuntimeErrorcore/src/trezor/ui/layouts/lvgl/reset.py (1)
103-104: Remove commented code.# remove duplicates non_duplicates = list(set(share_words)) - # # remove current checked words - # non_duplicates.remove(share_words[offset]) # shuffle list random.shuffle(non_duplicates)core/src/apps/ethereum/onekey/sign_tx.py (2)
339-352: Return the condition directly.def is_safe_approve_hash(msg: EthereumSignTxAny) -> bool: - if ( + return ( len(msg.to) in (40, 42) and len(msg.value) == 0 and msg.data_length == 36 and msg.data_initial_chunk[:4] == b"\xd4\xd9\xbd\xcd" # approveHash(bytes32 hashToApprove) 0xd4d9bdcd - ): - return True - return False + )
355-365: Return the condition directly.def is_safe_exec_transaction(msg: EthereumSignTxAny) -> bool: - if ( + return ( len(msg.to) in (40, 42) and len(msg.value) == 0 and 437 <= msg.data_length <= 1024 and msg.data_initial_chunk[:16] == b"\x6a\x76\x12\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" # 0x6a761202 == keccak("execTransaction(address,uint256,bytes,uint8,uint256,uint256,uint256,address,address,bytes)")[:4].hex() - ): - return True - return False + )core/src/apps/management/reset_device/layout.py (1)
55-71: Remove the commented code.Dead code should be deleted, not commented out.
- # elif share_index == num_of_shares - 1: - # if group_index is None: - # subheader = "You have finished\nverifying your\nrecovery shares." - # else: - # subheader = f"You have finished\nverifying your\nrecovery shares\nfor group {group_index + 1}." - # text = "" else: if group_index is None: - # subheader = f"Recovery share #{share_index + 1}\nchecked successfully." - # text = f"Continue with share #{share_index + 2}." text = _(i18n_keys.TITLE__VERIFIED)core/src/apps/management/recovery_device/homescreen.py (2)
116-120: Remove the commented code blocks.Dead code should be deleted.
- # from apps.common import backup_types - - # if backup_types.is_slip39_word_count(word_count): - # word_count = 12 # ...and only then show the starting screen with word count. ... break - # except BaseException as e: - # import sys - - # sys.print_exception(e) assert backup_type is not NoneAlso applies to: 176-179
335-338: Remove the commented code.Clean up unused dialog implementations.
Also applies to: 357-365
core/src/trezor/lvglui/scrs/reset_device.py (3)
134-140: Combine the nested if statements.def on_event(self, event_obj: lv.event_t): code = event_obj.code target = event_obj.get_target() - if code == lv.EVENT.CLICKED: - if target == self.word_count_indicator: - BackupTypeSelector(self) + if code == lv.EVENT.CLICKED and target == self.word_count_indicator: + BackupTypeSelector(self)
401-402: Combine the nested if statements.- if target == self.nav_back.nav_btn: - self.parent.channel.publish(None) + if code == lv.EVENT.CLICKED and target == self.nav_back.nav_btn: + self.parent.channel.publish(None)
576-577: Combine the nested if statements.- if code == lv.EVENT.CLICKED: - if target in self.num_list: - self.set_btn_selected(target) + if code == lv.EVENT.CLICKED and target in self.num_list: + self.set_btn_selected(target)core/src/trezor/lvglui/scrs/template.py (1)
1091-1091: Hard-coded color value.Consider moving
#FF1100to color constants.core/src/apps/ethereum/onekey/sign_tx_eip1559.py (1)
181-182: Remove debug print.Debug prints clutter logs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (3)
core/mocks/generated/trezorcrypto/slip39.pyiis excluded by!**/generated/**core/src/trezor/lvglui/res/s-arrow-down.pngis excluded by!**/*.pngcore/src/trezor/lvglui/res/ss-mul-share.pngis excluded by!**/*.png
📒 Files selected for processing (83)
common/protob/messages-management.proto(1 hunks)common/protob/messages-tron.proto(1 hunks)core/embed/extmod/modtrezorconfig/modtrezorconfig.c(3 hunks)core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip39.h(2 hunks)core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h(3 hunks)core/embed/extmod/modtrezorcrypto/modtrezorcrypto-slip39.h(4 hunks)core/embed/firmware/version.h(1 hunks)core/embed/rust/src/trezorhal/bip39.rs(1 hunks)core/embed/trezorhal/se_thd89.c(1 hunks)core/embed/trezorhal/se_thd89.h(1 hunks)core/src/all_modules.py(2 hunks)core/src/apps/cardano/seed.py(1 hunks)core/src/apps/common/backup.py(1 hunks)core/src/apps/common/backup_types.py(1 hunks)core/src/apps/common/mnemonic.py(2 hunks)core/src/apps/debug/load_device.py(2 hunks)core/src/apps/ethereum/layout.py(4 hunks)core/src/apps/ethereum/onekey/sign_safe_tx.py(3 hunks)core/src/apps/ethereum/onekey/sign_tx.py(6 hunks)core/src/apps/ethereum/onekey/sign_tx_eip1559.py(3 hunks)core/src/apps/ethereum/sign_tx.py(2 hunks)core/src/apps/ethereum/sign_tx_eip1559.py(2 hunks)core/src/apps/ethereum/tokens.py(1 hunks)core/src/apps/ethereum/tokens.py.mako(1 hunks)core/src/apps/management/backup_types.py(0 hunks)core/src/apps/management/recovery_device/__init__.py(1 hunks)core/src/apps/management/recovery_device/create_mul_shares.py(1 hunks)core/src/apps/management/recovery_device/homescreen.py(13 hunks)core/src/apps/management/recovery_device/layout.py(9 hunks)core/src/apps/management/recovery_device/recover.py(6 hunks)core/src/apps/management/recovery_device/word_validity.py(4 hunks)core/src/apps/management/reset_device/__init__.py(6 hunks)core/src/apps/management/reset_device/layout.py(7 hunks)core/src/apps/tron/serialize.py(1 hunks)core/src/storage/device.py(3 hunks)core/src/storage/recovery.py(1 hunks)core/src/storage/recovery_shares.py(2 hunks)core/src/trezor/crypto/slip39.py(24 hunks)core/src/trezor/enums/BackupType.py(1 hunks)core/src/trezor/enums/__init__.py(1 hunks)core/src/trezor/lvglui/i18n/keys.py(3 hunks)core/src/trezor/lvglui/i18n/locales/de.py(3 hunks)core/src/trezor/lvglui/i18n/locales/en.py(3 hunks)core/src/trezor/lvglui/i18n/locales/es.py(4 hunks)core/src/trezor/lvglui/i18n/locales/fr.py(4 hunks)core/src/trezor/lvglui/i18n/locales/it.py(3 hunks)core/src/trezor/lvglui/i18n/locales/ja.py(4 hunks)core/src/trezor/lvglui/i18n/locales/ko.py(3 hunks)core/src/trezor/lvglui/i18n/locales/pt_br.py(4 hunks)core/src/trezor/lvglui/i18n/locales/ru.py(4 hunks)core/src/trezor/lvglui/i18n/locales/zh_cn.py(4 hunks)core/src/trezor/lvglui/i18n/locales/zh_hk.py(4 hunks)core/src/trezor/lvglui/scrs/address.py(9 hunks)core/src/trezor/lvglui/scrs/common.py(4 hunks)core/src/trezor/lvglui/scrs/components/button.py(4 hunks)core/src/trezor/lvglui/scrs/components/container.py(1 hunks)core/src/trezor/lvglui/scrs/components/keyboard.py(13 hunks)core/src/trezor/lvglui/scrs/components/listitem.py(4 hunks)core/src/trezor/lvglui/scrs/components/navigation.py(1 hunks)core/src/trezor/lvglui/scrs/components/radio.py(2 hunks)core/src/trezor/lvglui/scrs/components/slider.py(3 hunks)core/src/trezor/lvglui/scrs/fingerprints.py(6 hunks)core/src/trezor/lvglui/scrs/homescreen.py(72 hunks)core/src/trezor/lvglui/scrs/recovery_device.py(7 hunks)core/src/trezor/lvglui/scrs/reset_device.py(7 hunks)core/src/trezor/lvglui/scrs/template.py(16 hunks)core/src/trezor/motor.py(1 hunks)core/src/trezor/pin.py(1 hunks)core/src/trezor/qr.py(1 hunks)core/src/trezor/uart.py(4 hunks)core/src/trezor/ui/components/tt/keyboard_slip39.py(2 hunks)core/src/trezor/ui/layouts/lvgl/__init__.py(4 hunks)core/src/trezor/ui/layouts/lvgl/altcoin.py(2 hunks)core/src/trezor/ui/layouts/lvgl/recovery.py(3 hunks)core/src/trezor/ui/layouts/lvgl/reset.py(4 hunks)core/src/trezor/utils.py(1 hunks)crypto/bip39.c(4 hunks)crypto/bip39.h(1 hunks)crypto/slip39.c(6 hunks)crypto/slip39.h(2 hunks)crypto/slip39_wordlist.h(2 hunks)python/src/trezorlib/messages.py(1 hunks)vendor/lvgl_mp(1 hunks)
💤 Files with no reviewable changes (1)
- core/src/apps/management/backup_types.py
👮 Files not reviewed due to content moderation or server errors (1)
- vendor/lvgl_mp
🧰 Additional context used
🧬 Code Graph Analysis (15)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip39.h (2)
crypto/bip39.c (2)
mnemonic_complete_word(280-310)mnemonic_word_completion_mask(320-333)crypto/bip39.h (2)
mnemonic_complete_word(56-56)mnemonic_word_completion_mask(58-58)
core/src/apps/management/recovery_device/__init__.py (1)
core/src/storage/recovery.py (2)
is_in_progress(47-48)end_progress(167-178)
core/src/trezor/qr.py (1)
core/src/trezor/motor.py (2)
vibrate(24-47)vibrate(51-54)
core/src/trezor/motor.py (1)
core/src/storage/device.py (1)
keyboard_haptic_enabled(700-709)
core/embed/rust/src/trezorhal/bip39.rs (2)
crypto/bip39.c (1)
mnemonic_word_completion_mask(320-333)crypto/bip39.h (1)
mnemonic_word_completion_mask(58-58)
core/src/trezor/ui/layouts/lvgl/altcoin.py (2)
core/src/trezor/strings.py (1)
strip_amount(24-38)core/src/trezor/lvglui/scrs/template.py (1)
TransactionDetailsETHNew(1234-1328)
core/src/apps/management/recovery_device/word_validity.py (2)
core/src/trezor/enums/__init__.py (1)
BackupType(605-611)core/src/apps/common/backup_types.py (2)
is_slip39_backup_type(25-32)is_slip39_advanced_backup_type(35-39)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-slip39.h (2)
crypto/bip39.c (2)
mnemonic_complete_word(280-310)mnemonic_word_completion_mask(320-333)crypto/bip39.h (2)
mnemonic_complete_word(56-56)mnemonic_word_completion_mask(58-58)
core/src/apps/common/backup_types.py (2)
core/src/trezor/enums/__init__.py (1)
BackupType(605-611)core/src/trezor/crypto/slip39.py (1)
Share(127-152)
core/src/trezor/pin.py (3)
core/src/trezor/lvglui/scrs/common.py (4)
FullSizeWindow(362-703)refresh(151-157)refresh(310-316)refresh(697-703)core/embed/rust/src/trezorhal/display.rs (2)
loader(153-174)bar(82-84)core/src/trezor/ui/__init__.py (1)
refresh(39-45)
core/src/trezor/lvglui/scrs/homescreen.py (8)
core/src/trezor/lvglui/scrs/address.py (1)
chains_brief_info(409-410)core/src/storage/device.py (33)
get_homescreen(916-924)is_fido_enabled(643-651)is_animation_enabled(660-668)set_homescreen(927-932)is_airgap_mode(1228-1232)is_passphrase_enabled(899-903)get_backup_type(876-896)get_brightness(513-528)get_language(840-849)get_autolock_delay_ms(1057-1066)get_autoshutdown_delay_ms(1083-1092)set_autolock_delay_ms(1069-1074)set_language(852-866)set_brightness(502-510)keyboard_haptic_enabled(700-709)toggle_keyboard_haptic(712-720)is_tap_awake_enabled(621-629)set_tap_awake_enable(632-640)set_autoshutdown_delay_ms(1095-1101)is_random_pin_map_enabled(537-543)set_random_pin_map_enable(531-534)get_ble_name(438-445)enable_trezor_compatible(1217-1225)is_initialized(769-776)get_firmware_version(417-418)get_serial(493-499)is_usb_lock_enabled(546-552)set_usb_lock_enable(555-558)is_fingerprint_unlock_enabled(568-576)enable_fingerprint_unlock(561-565)is_trezor_compatible(1204-1214)is_turbomode_enabled(682-686)set_turbomode_enable(689-697)core/src/trezor/lvglui/scrs/components/navigation.py (1)
Navigation(5-24)core/src/apps/common/passphrase.py (1)
is_enabled(10-11)core/src/apps/base.py (1)
set_homescreen(397-440)core/src/trezor/qr.py (3)
retrieval_hd_key(270-271)get_hd_key(36-37)get_hd_key(274-275)core/src/trezor/uart.py (1)
get_ble_name(688-690)core/src/apps/management/recovery_device/create_mul_shares.py (1)
create_multi_share_backup(7-69)
core/src/trezor/lvglui/scrs/components/listitem.py (5)
core/src/trezor/lvglui/scrs/components/button.py (1)
NormalButton(15-85)core/src/trezor/lvglui/scrs/components/container.py (1)
ContainerFlexCol(8-48)core/src/trezor/lvglui/lv_colors.py (1)
lv_colors(9-69)core/src/trezor/lvglui/scrs/components/pageable.py (1)
PageAbleMessage(10-108)core/src/trezor/lvglui/i18n/__init__.py (1)
gettext(31-32)
core/src/apps/management/reset_device/layout.py (7)
core/src/trezor/enums/__init__.py (1)
ButtonRequestType(466-486)core/src/trezor/lvglui/i18n/__init__.py (1)
gettext(31-32)core/src/trezor/ui/layouts/lvgl/__init__.py (2)
show_success(535-554)show_warning(508-532)core/src/trezor/ui/layouts/lvgl/common.py (1)
interact(40-47)core/src/trezor/ui/layouts/lvgl/reset.py (2)
confirm_word(93-134)show_share_words(26-90)core/src/trezor/utils.py (3)
chunks(446-448)unimport_begin(347-348)unimport_end(351-377)core/src/trezor/wire/errors.py (1)
ActionCancelled(26-28)
core/src/trezor/lvglui/scrs/common.py (4)
core/src/trezor/lvglui/scrs/homescreen.py (16)
eventhandler(985-1009)eventhandler(1194-1223)eventhandler(1455-1479)eventhandler(1491-1502)eventhandler(3474-3482)eventhandler(4184-4198)eventhandler(4211-4220)eventhandler(4239-4248)eventhandler(4284-4309)eventhandler(4506-4530)eventhandler(5133-5142)eventhandler(5169-5179)eventhandler(5350-5365)eventhandler(5473-5485)eventhandler(5583-5595)destroy(2164-2165)core/src/trezor/motor.py (2)
vibrate(24-47)vibrate(51-54)core/src/trezor/lvglui/scrs/components/navigation.py (1)
Navigation(5-24)core/src/trezor/loop.py (1)
publish(461-466)
core/src/trezor/lvglui/scrs/components/keyboard.py (4)
core/src/trezor/lvglui/scrs/homescreen.py (16)
on_click(503-509)on_click(1357-1392)on_click(1587-1612)on_click(1667-1679)on_click(1735-1836)on_click(1904-1922)on_click(2013-2047)on_click(2389-2390)on_click(2746-2801)on_click(3126-3135)on_click(3222-3233)on_click(3334-3357)on_click(3395-3411)on_click(3749-3774)on_click(3841-3859)on_click(4136-4141)core/src/trezor/motor.py (2)
vibrate(24-47)vibrate(51-54)core/src/trezor/utils.py (1)
lcd_resume(168-197)core/src/trezor/crypto/slip39.py (2)
complete_word(709-710)word_completion_mask(713-714)
🪛 Ruff (0.12.2)
core/src/apps/ethereum/onekey/sign_tx.py
344-352: Return the condition directly
(SIM103)
356-365: Return the condition directly
(SIM103)
core/src/apps/common/backup_types.py
79-84: Use a dictionary instead of consecutive if statements
(SIM116)
core/src/trezor/pin.py
25-28: Use ternary operator text = "" if message == "read fp data" else message instead of if-else-block
Replace if-else-block with text = "" if message == "read fp data" else message
(SIM108)
core/src/trezor/lvglui/scrs/reset_device.py
137-138: Use a single if statement instead of nested if statements
Combine if statements using and
(SIM102)
401-402: Use a single if statement instead of nested if statements
Combine if statements using and
(SIM102)
576-577: Use a single if statement instead of nested if statements
Combine if statements using and
(SIM102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Defs check
- GitHub Check: Gen check
- GitHub Check: Style check
🔇 Additional comments (164)
common/protob/messages-tron.proto (2)
102-102: AI summary doesn't match the actual changes.Summary claims SLIP-39 backup support but changes are for Tron lock_period field.
Likely an incorrect or invalid review comment.
102-102: Field addition looks correct.Proper protobuf syntax and field numbering.
core/src/apps/tron/serialize.py (1)
201-203: Serialization logic is correct.Follows established patterns and handles optional field properly.
core/embed/firmware/version.h (1)
12-12: Version bump looks correct.Standard firmware version increment to reflect new features.
core/src/trezor/qr.py (1)
241-241: Good improvement in haptic feedback specificity.Explicitly specifying success vibration style is clearer than using the default.
core/src/trezor/enums/__init__.py (1)
609-611: Clean enum extension for new backup types.The new extendable SLIP-39 backup types follow existing naming patterns and sequential values.
core/src/apps/management/recovery_device/__init__.py (1)
83-84: Proper recovery state cleanup.Good practice to clean up existing progress before starting dry run recovery.
core/src/trezor/lvglui/scrs/components/container.py (1)
138-140: LGTM!The padding change is correct and aligns with UI spacing improvements.
core/src/trezor/enums/BackupType.py (1)
8-10: LGTM!The new backup type constants follow proper enumeration patterns and naming conventions.
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-shamir.h (4)
46-46: LGTM!Proper use of MP_ERROR_TEXT macro for error messages.
61-63: LGTM!Proper use of MP_ERROR_TEXT macro for error messages.
66-68: LGTM!Proper use of MP_ERROR_TEXT macro for error messages.
76-78: LGTM!Proper use of MP_ERROR_TEXT macro for error messages.
crypto/slip39.c (4)
34-38: LGTM!Proper renaming to SLIP39-specific constants improves code clarity.
47-58: LGTM!Consistent use of SLIP39_WORD_COUNT and SLIP39_WORDLIST constants.
67-76: LGTM!Consistent use of SLIP39_WORD_COUNT constant.
96-111: LGTM!Consistent use of SLIP39_WORDLIST and SLIP39_WORD_COUNT constants.
core/src/trezor/utils.py (1)
440-444: LGTM!The addr_chunkify function is correctly implemented with proper use of the existing chunks utility.
core/embed/trezorhal/se_thd89.h (1)
90-92: Function declaration looks correct.The new
se_import_slip39function follows the established pattern for secure element operations.crypto/slip39.h (2)
28-28: Macro definition is clear and appropriate.The
SLIP39_WORD_COUNTvalue of 1024 is reasonable for the SLIP-39 wordlist.
41-41: Wordlist declaration follows proper C conventions.The external declaration uses the defined constant correctly.
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-bip39.h (2)
38-38: Parameter addition is correct.The
falseparameter correctly indicates BIP39 wordlist usage.
57-57: Parameter addition is correct.The
falseparameter correctly indicates BIP39 wordlist usage.core/embed/trezorhal/se_thd89.c (1)
1347-1360: Function implementation is well-structured.The parameter packing and secure element transmission follow the established patterns in the codebase.
core/src/trezor/lvglui/scrs/components/radio.py (2)
104-104: Attribute initialization is correct.The
changedflag is properly initialized toFalse.
122-122: State tracking is implemented correctly.The
changedflag is set toTruewhen selection changes.core/src/apps/ethereum/tokens.py (1)
30-30: Good change - eliminates null returns.core/src/apps/ethereum/sign_tx_eip1559.py (3)
87-87: Clean refactoring - eliminates redundant calculations.
98-98: Good - passes pre-calculated flag.
122-122: Consistent usage of the flag.core/src/all_modules.py (1)
564-567: LGTM!Import additions look correct for the backup functionality reorganization.
Also applies to: 688-689
core/src/apps/ethereum/sign_tx.py (1)
64-64: LGTM!Good optimization moving
has_raw_datacalculation earlier and removing duplication.Also applies to: 75-75
common/protob/messages-management.proto (1)
19-21: LGTM!Clean enum additions with proper numbering and clear descriptions.
core/src/apps/ethereum/tokens.py.mako (1)
39-39: LGTM!Type annotation now matches actual function behavior - never returns None.
core/embed/rust/src/trezorhal/bip39.rs (1)
44-44: LGTM!Parameter addition correctly aligns with updated C function signature.
core/src/trezor/lvglui/i18n/locales/ko.py (3)
956-957: LGTM! Clean translation updates.Simplified backup type descriptions by removing technical terms.
1008-1008: LGTM! Better error messaging.Updated recovery phrase share validation message for clarity.
1017-1020: LGTM! New PIN attachment feature strings.Added appropriate Korean translations for the PIN attachment feature.
crypto/bip39.h (1)
56-56: LGTM! Clean API extension.Added
is_slip39parameter to support both BIP39 and SLIP39 wordlists.Also applies to: 58-58
core/src/trezor/lvglui/i18n/locales/de.py (3)
956-957: LGTM! Consistent translation updates.Simplified backup type descriptions matching other locales.
1008-1008: LGTM! Improved error messaging.Updated recovery phrase share validation message for clarity.
1017-1020: LGTM! New PIN attachment feature strings.Added appropriate German translations for the PIN attachment feature.
core/src/trezor/ui/layouts/lvgl/altcoin.py (2)
27-32: LGTM! Smart conditional title logic.Uses generic confirmation title for zero-value transactions with raw data.
Also applies to: 164-169
34-34: LGTM! Clean screen creation update.Updated to use the dynamically determined title variable.
Also applies to: 171-171
core/src/trezor/lvglui/i18n/locales/zh_hk.py (3)
956-957: Terminology change from technical to user-friendlyGood simplification from "原始備份類型(BIP39)" to "傳統備份類型" and technical SLIP39 reference to "20 位單詞的備份類型".
1008-1008: Error message improvedChanged from technical "invalid mnemonic shards" to user-friendly "shard mismatch" - clearer for users.
1017-1020: Four new translations addedNew strings for PIN attachment feature and recovery phrase creation flow.
core/src/trezor/lvglui/i18n/locales/en.py (2)
956-957: Consistent terminology simplificationRemoving technical BIP39/SLIP39 references for "Legacy Backup Types" and "20-word backup types".
1008-1008: Clearer error message"You have entered a share from a different backup" is clearer than technical jargon.
core/src/trezor/lvglui/i18n/locales/ja.py (3)
956-957: Consistent terminology updateRemoving technical BIP39/SLIP39 references in Japanese translations.
958-959: New backup type labels addedAdded "単一共有バックアップ" and "複数バックアップ" labels.
1008-1008: Error message improvedChanged to user-friendly "別のバックアップからの共有を入力しました" message.
core/src/trezor/lvglui/i18n/locales/zh_cn.py (4)
933-933: Translation update looks good.The updated wording for PIN-passphrase association is clearer.
956-957: Backup type terminology updated appropriately.Changes from "Original/Advanced" to "Traditional/20-word" align with the new SLIP-39 backup types.
1008-1008: Error message improvement.The softened error message for mnemonic shard mismatch is more user-friendly.
1017-1020: New translation entries added.Added strings for app updates, confirmation prompts, and mnemonic creation flows.
core/src/apps/common/mnemonic.py (5)
1-1: Import alias change is consistent.Using
storage_devicealias improves code readability.
5-6: New backup_types import added.Import is needed for the new
is_extendable_backup_typefunction.
47-50: SLIP-39 parameter retrieval logic updated.The reordered parameter retrieval and simplified error checking look correct for extendable SLIP-39 support.
58-58: Extendable parameter added to decrypt call.The new parameter enables extendable SLIP-39 functionality.
66-67: THD89 error handling simplified.Removing the BIP39 check and always validating the result is more robust.
core/src/trezor/motor.py (4)
1-11: Type annotations and constants added.Well-structured type definitions and vibration style constants.
12-19: Vibration style constants defined.Good range of vibration styles from WHISPER to ERROR.
24-47: Enhanced vibrate function implementation.The new function properly checks haptic settings, handles multiple styles, and includes good error handling for unknown styles.
51-54: Emulator stub updated.The stub function matches the new signature correctly.
core/embed/extmod/modtrezorconfig/modtrezorconfig.c (2)
599-626: New SLIP-39 import function implemented correctly.The function properly validates buffers, converts parameters, and handles errors appropriately.
813-814: Function registration added.The new function is properly registered in the module globals.
crypto/slip39_wordlist.h (3)
29-29: Include directive updated.Using centralized slip39.h header instead of local definitions.
31-31: Array renamed and size updated.The SLIP39_WORDLIST naming is more consistent and uses centralized SLIP39_WORD_COUNT.
218-218: Button sequence array size updated.Updated to use SLIP39_WORD_COUNT consistently.
core/src/trezor/lvglui/i18n/locales/ru.py (4)
956-959: LGTM!The simplified Russian translations are clear and concise.
968-968: LGTM!The translation "Создать мульти-копию" accurately conveys the multi-share backup creation concept.
1008-1008: LGTM!The error message clearly explains the share mismatch issue.
1017-1020: LGTM!The new UI strings for PIN-attach feature and share recording are well-translated.
core/src/storage/recovery_shares.py (1)
6-6: In-memory recovery storage is consistent and intentional.core/src/trezor/lvglui/scrs/components/slider.py (4)
74-74: LGTM!Added PRESSED event handler enhances slider interaction feedback.
127-129: LGTM!Appropriate whisper vibration on initial press provides good user feedback.
136-136: LGTM!ERROR vibration pattern clearly indicates incomplete slider action.
156-156: LGTM!SUCCESS vibration confirms slider completion effectively.
core/src/apps/debug/load_device.py (5)
9-9: LGTM!Import moved to reflect backup types relocation.
21-22: LGTM!Proper initialization of variables before conditional use.
27-29: LGTM!Updated to handle extendable SLIP-39 backup types correctly.
33-36: LGTM!Conditional identifier storage based on extendable flag is correct.
43-44: LGTM!Added parameters match the updated storage function signature.
core/src/apps/ethereum/onekey/sign_safe_tx.py (4)
43-45: LGTM!Separated hash computation improves clarity and reduces redundancy.
59-61: LGTM!Passing separate hashes to confirmation provides better context.
66-66: LGTM!Direct use of
safe_tx_hasheliminates redundant computation.
83-83: LGTM!Function name better reflects its purpose.
core/src/trezor/lvglui/i18n/locales/es.py (2)
956-960: LGTM! Clearer user-facing terminology.Simplified backup type labels improve usability.
1017-1020: LGTM! New translation strings added.Translations appear contextually appropriate.
core/src/trezor/lvglui/scrs/components/navigation.py (1)
6-12: LGTM! Good parameterization.Makes Navigation component more flexible while maintaining defaults.
core/src/storage/recovery.py (1)
137-165: LGTM! Clean state management.Well-structured functions for extend share handling.
core/src/storage/device.py (2)
889-891: LGTM! Proper backup type validation.Correctly includes new extendable SLIP-39 types.
935-956: LGTM! Clean function signature update.Proper handling of new parameters for extendable backups.
core/src/trezor/lvglui/i18n/keys.py (3)
2094-2097: Comment updates look good.
2211-2213: Message is clearer now.
2232-2238: New keys added correctly.core/src/apps/management/recovery_device/create_mul_shares.py (1)
1-163: New multi-share backup module looks good.core/src/trezor/uart.py (4)
90-168: Fingerprint handling improvements look solid.
198-198: Motor vibration change is fine.
428-428: Wireless charging vibration added.
464-474: BLE pairing feedback added.core/src/trezor/lvglui/scrs/components/listitem.py (3)
120-133: LGTM!The flexible padding parameters enhance component reusability.
477-593: LGTM!The new raw data overview component properly handles long messages with expandable display.
595-640: LGTM!The flexible column panel component follows the established pattern.
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-slip39.h (2)
27-46: LGTM!The string-based prefix approach is more intuitive than integer prefixes.
47-60: LGTM!The refactored word completion mask properly handles string prefixes.
core/src/apps/management/recovery_device/recover.py (5)
3-4: Import aliasing improves code clarity.Good refactoring to make storage module usage clearer throughout the file.
20-21: Moving imports inside function is good practice.This avoids potential circular import issues and only imports when needed.
35-35: Local variable improves readability.Extracting group_index makes the code more readable.
50-50: SLIP-39 recovery calls updated correctly.The function now unpacks 4 values to handle the new extendable flag, discarding the unused values appropriately.
Also applies to: 88-88
97-97: Local import follows established pattern.Consistent with the BIP-39 imports moved inside functions.
core/src/trezor/ui/layouts/lvgl/__init__.py (5)
91-92: Export list updated correctly.New functions properly added to all.
1256-1259: PIN error vibration improves UX.Good enhancement to provide haptic feedback when PIN attempts are remaining.
2579-2581: Safe transaction parameters added correctly.New hash parameters properly integrated into function signature and passed to screen.
Also applies to: 2600-2602
2609-2644: Safe approve hash function implemented correctly.Function follows established patterns with appropriate parameter handling and error handling.
2647-2700: Safe exec transaction function implemented correctly.Comprehensive parameter handling for Safe transaction execution with proper error handling.
core/src/trezor/lvglui/scrs/homescreen.py (7)
6-6: Import looks good.
28-28: Import update is consistent.
801-808: Navigation import and usage updated correctly.
831-831: Chain info refactoring looks correct.The change from dictionary to tuple unpacking is clean.
Also applies to: 902-920
998-998: Good defensive check.
1991-2009: Backup type handling is correct.
2203-2208: Multi-share backup feature addition looks good.core/src/apps/management/reset_device/layout.py (3)
3-10: LGTM!Import changes properly add the required utilities for chunked word confirmation.
32-40: LGTM!Clean refactoring using dynamic chunking instead of hardcoded splits.
142-203: LGTM!Well-implemented flow control with early exit support and proper memory management.
core/src/trezor/lvglui/scrs/common.py (3)
417-525: LGTM!Vibration feedback properly implemented with appropriate patterns for each icon type.
535-559: LGTM!Flexible nav back button positioning with proper content area adjustments.
580-583: LGTM!Proper default handling for nav back button clicks.
core/src/trezor/lvglui/scrs/address.py (4)
36-38: LGTM!Memory-efficient iterator pattern for chain configurations.
Also applies to: 409-414
29-29: LGTM!Clear naming with consistent logic updates throughout.
Also applies to: 76-82, 91-99, 271-271, 404-404
260-273: LGTM!Kaspa blockchain support properly integrated.
Also applies to: 312-313
341-344: LGTM!Helpful debugging enhancement for development.
core/src/apps/management/recovery_device/homescreen.py (4)
2-3: LGTM!Clear module aliasing improves readability.
110-149: LGTM!Proper memory management and cancellation handling.
196-221: LGTM!Comprehensive SLIP39 validation with extendable backup type support.
303-327: LGTM!Better user feedback with progress tracking.
Also applies to: 349-379
core/src/trezor/lvglui/scrs/reset_device.py (4)
32-102: LGTM!Well-designed mnemonic display with flexible layout options.
318-422: LGTM!Comprehensive backup type selector with clear UI.
505-616: LGTM!Well-designed reusable number selection component.
618-686: LGTM!Clear user education flow for multi-share backups.
core/src/apps/management/recovery_device/layout.py (1)
68-98: Good error handling improvement.The while loop with explicit index management handles cancellation and errors better.
core/src/trezor/lvglui/scrs/components/keyboard.py (1)
236-236: Good haptic feedback unification.Moving vibration to PRESSED events across all keyboards improves responsiveness.
Also applies to: 260-260, 309-320, 522-522, 572-580, 745-745, 806-816, 1127-1127, 1139-1149
core/src/apps/ethereum/layout.py (1)
78-91: Clear title logic improvement.The has_raw_data parameter properly distinguishes between different transaction types.
core/src/trezor/lvglui/scrs/template.py (2)
419-419: Missing f-string prefix.- raise ValueError(f"Unsupported network: {self.network}") + raise ValueError(f"Unsupported network: {self.network}")
462-462: Missing f-string prefix.- raise ValueError(f"Unsupported network: {self.network}") + raise ValueError(f"Unsupported network: {self.network}")python/src/trezorlib/messages.py (1)
645-648: Compatibility riskOld firmware may not handle new enum values.
core/src/trezor/lvglui/i18n/locales/fr.py (1)
956-1020: All French translations look correct.core/src/trezor/lvglui/scrs/fingerprints.py (1)
234-569: Code changes look good.crypto/bip39.c (1)
34-333: C code modifications are clean.core/src/trezor/crypto/slip39.py (1)
37-714: SLIP39 implementation updates are solid.core/src/apps/management/recovery_device/word_validity.py (5)
1-4: LGTM: Proper TYPE_CHECKING patternClean import optimization.
23-29: LGTM: Delayed importsGood practice to delay runtime imports.
42-46: LGTM: Utility function usageCleaner than direct enum comparisons.
52-53: LGTM: Function made privateCorrect encapsulation.
71-75: LGTM: Function made private with local importConsistent with the pattern.
core/src/trezor/lvglui/i18n/locales/it.py (3)
956-959: LGTM: Simplified backup terminologyClearer user-facing labels.
1008-1008: LGTM: Improved error messageMore specific guidance for users.
1017-1020: LGTM: New feature stringsClear prompts for new functionality.
core/src/trezor/lvglui/i18n/locales/pt_br.py (4)
956-959: LGTM: Simplified backup terminologyConsistent with Italian version.
968-968: LGTM: Consistent terminologyMatches the simplified naming.
1008-1008: LGTM: Improved error messageBetter user guidance.
1017-1020: LGTM: New feature stringsClear prompts for new functionality.
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (2)
core/src/trezor/lvglui/scrs/template.py (2)
5462-5462: Fix spelling error.
opeartionshould beoperation.- opeartion: int, + operation: int,
5485-5485: Fix spelling error.
opeartionshould beoperation.- is_delegate_call = opeartion == 1 + is_delegate_call = operation == 1
♻️ Duplicate comments (4)
core/src/trezor/lvglui/scrs/template.py (4)
1098-1098: Hard-coded string needs i18n."Data" should use i18n key.
1121-1121: Hard-coded string needs i18n."Data" should use i18n key.
1128-1128: Hard-coded strings need i18n."SafeTxGas", "BaseGas", "GasPrice", "GasToken", "RefundReceiver", "Signatures" should use i18n keys.
Also applies to: 1133-1133, 1139-1139, 1144-1144, 1149-1149, 1153-1153
1222-1222: Hard-coded string needs i18n."Nonce" should use i18n key.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
core/embed/firmware/version.h(1 hunks)core/src/trezor/lvglui/scrs/address.py(9 hunks)core/src/trezor/lvglui/scrs/template.py(16 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- core/embed/firmware/version.h
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Defs check
- GitHub Check: Gen check
- GitHub Check: Style check
🔇 Additional comments (12)
core/src/trezor/lvglui/scrs/address.py (12)
1-1: Import looks correct.
29-29: Logic inversion handled correctly.
36-36: Iterator approach is memory efficient.
76-82: Derivation logic updated consistently.
91-99: Solana derivation logic matches Ethereum pattern.
260-274: Kaspa support follows existing patterns.
313-314: Kaspa chain handling integrated properly.
342-346: Debug exception handling improved.
376-387: User interaction handling updated for new return types.
405-405: Cleanup method updated correctly.
410-411: Brief info function is clear and concise.
414-791: Generator function is comprehensive and well-structured.
* feat(core): add Kaspa address format toggle for Address Book * feat(core): add support for safe execTransaction/approveHash support * feat(core): optimize display of ETH zero-value transfers with non-null data * fix(core): fix the delegate resource issue with tron * fix(core): optimize vibrate * feat(core): add support for slip-39 backup * fix(core): fix gen/style check issue * fix(Kaspa): add i18n keys * chore(core): bump version to 4.15.0
* feat(core): add Kaspa address format toggle for Address Book * feat(core): add support for safe execTransaction/approveHash support * feat(core): optimize display of ETH zero-value transfers with non-null data * fix(core): fix the delegate resource issue with tron * fix(core): optimize vibrate * feat(core): add support for slip-39 backup * fix(core): fix gen/style check issue * fix(Kaspa): add i18n keys * chore(core): bump version to 4.15.0
Summary by CodeRabbit
New Features
lock_period.Improvements
Bug Fixes
Refactor
Documentation
Chores