feat: Add multiple entropy sources support for device reset.#398
feat: Add multiple entropy sources support for device reset.#398lihuanhuan merged 1 commit intoOneKeyHQ:mainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughAdds an optional entropy source parameter to the random bytes API, surfaces an "Advanced Options" UI checkbox to use multiple entropy sources during device reset, threads that state through onboarding/reset flows, and appends new localized strings (plus minor formatting) across many locale files. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
9917234 to
7a70d45
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
📜 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
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
core/mocks/generated/trezorcrypto/random.pyiis excluded by!**/generated/**
📒 Files selected for processing (16)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-random.h(1 hunks)core/src/apps/management/reset_device/__init__.py(2 hunks)core/src/trezor/lvglui/i18n/keys.py(2 hunks)core/src/trezor/lvglui/i18n/locales/de.py(1 hunks)core/src/trezor/lvglui/i18n/locales/en.py(1 hunks)core/src/trezor/lvglui/i18n/locales/es.py(1 hunks)core/src/trezor/lvglui/i18n/locales/fr.py(1 hunks)core/src/trezor/lvglui/i18n/locales/it.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ja.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ko.py(1 hunks)core/src/trezor/lvglui/i18n/locales/pt_br.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ru.py(1 hunks)core/src/trezor/lvglui/i18n/locales/zh_cn.py(1 hunks)core/src/trezor/lvglui/i18n/locales/zh_hk.py(1 hunks)core/src/trezor/lvglui/scrs/initscreen.py(5 hunks)core/src/trezor/lvglui/scrs/reset_device.py(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
core/src/apps/management/reset_device/__init__.py (3)
core/src/trezor/wire/__init__.py (5)
GenericContext(71-87)call(72-77)call(127-128)call(160-165)call(254-259)core/src/trezor/messages.py (2)
EntropyRequest(3503-3507)EntropyAck(3509-3521)core/mocks/generated/trezorcrypto/random.pyi (1)
bytes(13-17)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-random.h (2)
core/embed/extmod/trezorobj.h (1)
trezor_obj_get_uint(52-71)core/embed/trezorhal/se_thd89.c (1)
se_random_encrypted(293-302)
core/src/trezor/lvglui/scrs/reset_device.py (2)
core/src/trezor/lvglui/scrs/components/listitem.py (2)
ListItemWithLeadingCheckbox(15-108)enable_bg_color(94-108)core/src/trezor/enums/__init__.py (1)
BackupType(613-619)
core/src/trezor/lvglui/scrs/initscreen.py (2)
core/src/apps/management/reset_device/__init__.py (1)
reset_device(30-99)core/src/trezor/lvglui/scrs/reset_device.py (1)
BackupTypeSelector(283-482)
🪛 Ruff (0.14.6)
core/src/trezor/lvglui/i18n/locales/ru.py
1045-1045: String contains ambiguous о (CYRILLIC SMALL LETTER O). Did you mean o (LATIN SMALL LETTER O)?
(RUF001)
1045-1045: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1045-1045: String contains ambiguous Е (CYRILLIC CAPITAL LETTER IE). Did you mean E (LATIN CAPITAL LETTER E)?
(RUF001)
1045-1045: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1046-1046: String contains ambiguous о (CYRILLIC SMALL LETTER O). Did you mean o (LATIN SMALL LETTER O)?
(RUF001)
1046-1046: String contains ambiguous б (CYRILLIC SMALL LETTER BE). Did you mean 6 (DIGIT SIX)?
(RUF001)
1049-1049: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1053-1053: String contains ambiguous О (CYRILLIC CAPITAL LETTER O). Did you mean O (LATIN CAPITAL LETTER O)?
(RUF001)
1053-1053: String contains ambiguous б (CYRILLIC SMALL LETTER BE). Did you mean 6 (DIGIT SIX)?
(RUF001)
1053-1053: String contains ambiguous а (CYRILLIC SMALL LETTER A). Did you mean a (LATIN SMALL LETTER A)?
(RUF001)
core/src/trezor/lvglui/scrs/reset_device.py
452-452: Unused method argument: event_obj
(ARG002)
core/src/trezor/lvglui/i18n/locales/zh_hk.py
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1046-1046: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
core/src/trezor/lvglui/i18n/locales/zh_cn.py
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1046-1046: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
core/src/trezor/lvglui/i18n/locales/it.py
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
core/src/trezor/lvglui/i18n/keys.py (1)
417-421: Comment no longer matches code behaviorThe comment says READY is listened on both
selfandcontent_area, but onlyself.add_event_cbremains, which can confuse future readers.
♻️ Duplicate comments (2)
core/src/trezor/lvglui/scrs/reset_device.py (1)
377-385: Typo in label name and unused on_ready argument
use_ext_entoryis misspelled (“entory” vs “entropy”), andon_ready’sevent_objparameter remains unused (ARG002).Also applies to: 440-456
core/src/trezor/lvglui/i18n/locales/pt_br.py (1)
1053-1053: Subject-verb agreement issue persists."a entropia do MCU e do elemento seguro serão combinadas" still mixes singular/plural.
📜 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
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
core/mocks/generated/trezorcrypto/random.pyiis excluded by!**/generated/**
📒 Files selected for processing (16)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-random.h(1 hunks)core/src/apps/management/reset_device/__init__.py(2 hunks)core/src/trezor/lvglui/i18n/keys.py(2 hunks)core/src/trezor/lvglui/i18n/locales/de.py(1 hunks)core/src/trezor/lvglui/i18n/locales/en.py(1 hunks)core/src/trezor/lvglui/i18n/locales/es.py(1 hunks)core/src/trezor/lvglui/i18n/locales/fr.py(1 hunks)core/src/trezor/lvglui/i18n/locales/it.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ja.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ko.py(1 hunks)core/src/trezor/lvglui/i18n/locales/pt_br.py(1 hunks)core/src/trezor/lvglui/i18n/locales/ru.py(1 hunks)core/src/trezor/lvglui/i18n/locales/zh_cn.py(1 hunks)core/src/trezor/lvglui/i18n/locales/zh_hk.py(1 hunks)core/src/trezor/lvglui/scrs/initscreen.py(5 hunks)core/src/trezor/lvglui/scrs/reset_device.py(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- core/src/trezor/lvglui/i18n/locales/ja.py
- core/src/trezor/lvglui/i18n/locales/ko.py
- core/src/apps/management/reset_device/init.py
- core/src/trezor/lvglui/i18n/locales/en.py
- core/src/trezor/lvglui/i18n/locales/fr.py
- core/src/trezor/lvglui/i18n/locales/es.py
- core/src/trezor/lvglui/i18n/locales/de.py
🧰 Additional context used
🧬 Code graph analysis (3)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-random.h (3)
core/embed/extmod/modtrezorcrypto/modtrezorcrypto-se-thd89.h (16)
mp_obj_t(34-39)mp_obj_t(50-69)mp_obj_t(81-100)mp_obj_t(111-123)mp_obj_t(212-235)mp_obj_t(249-287)mp_obj_t(299-320)mp_obj_t(330-361)mp_obj_t(371-408)mp_obj_t(416-455)mp_obj_t(465-491)mp_obj_t(501-527)mp_obj_t(569-584)mp_obj_t(664-677)mp_obj_t(686-710)mp_obj_t(722-735)core/embed/extmod/trezorobj.h (1)
trezor_obj_get_uint(52-71)core/embed/trezorhal/se_thd89.c (1)
se_random_encrypted(293-302)
core/src/trezor/lvglui/scrs/reset_device.py (3)
core/src/trezor/lvglui/scrs/components/listitem.py (2)
ListItemWithLeadingCheckbox(15-108)enable_bg_color(94-108)core/src/trezor/lvglui/scrs/widgets/style.py (5)
radius(8-10)StyleWrapper(4-211)text_font(40-42)text_align_left(32-34)text_color(16-18)core/src/trezor/enums/__init__.py (1)
BackupType(613-619)
core/src/trezor/lvglui/scrs/initscreen.py (2)
core/src/apps/management/reset_device/__init__.py (1)
reset_device(30-99)core/src/trezor/lvglui/scrs/reset_device.py (1)
BackupTypeSelector(283-482)
🪛 Ruff (0.14.7)
core/src/trezor/lvglui/i18n/locales/zh_hk.py
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1046-1046: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
core/src/trezor/lvglui/scrs/reset_device.py
452-452: Unused method argument: event_obj
(ARG002)
core/src/trezor/lvglui/i18n/locales/it.py
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
1053-1053: String contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF001)
core/src/trezor/lvglui/i18n/locales/ru.py
1045-1045: String contains ambiguous о (CYRILLIC SMALL LETTER O). Did you mean o (LATIN SMALL LETTER O)?
(RUF001)
1045-1045: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1045-1045: String contains ambiguous Е (CYRILLIC CAPITAL LETTER IE). Did you mean E (LATIN CAPITAL LETTER E)?
(RUF001)
1045-1045: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1046-1046: String contains ambiguous о (CYRILLIC SMALL LETTER O). Did you mean o (LATIN SMALL LETTER O)?
(RUF001)
1046-1046: String contains ambiguous б (CYRILLIC SMALL LETTER BE). Did you mean 6 (DIGIT SIX)?
(RUF001)
1049-1049: String contains ambiguous с (CYRILLIC SMALL LETTER ES). Did you mean c (LATIN SMALL LETTER C)?
(RUF001)
1053-1053: String contains ambiguous О (CYRILLIC CAPITAL LETTER O). Did you mean O (LATIN CAPITAL LETTER O)?
(RUF001)
1053-1053: String contains ambiguous б (CYRILLIC SMALL LETTER BE). Did you mean 6 (DIGIT SIX)?
(RUF001)
1053-1053: String contains ambiguous а (CYRILLIC SMALL LETTER A). Did you mean a (LATIN SMALL LETTER A)?
(RUF001)
core/src/trezor/lvglui/i18n/locales/zh_cn.py
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1045-1045: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1046-1046: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
1053-1053: String contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF001)
⏰ 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: Gen check
- GitHub Check: Style check
- GitHub Check: Defs check
🔇 Additional comments (1)
core/src/trezor/lvglui/scrs/initscreen.py (1)
84-85: Entropy-state propagation logic looks consistentThe new
use_multiple_entropy_statewiring betweenSetupDevice,BackupTypeSelector, andreset_deviceis coherent; no functional issues stand out in this block.Also applies to: 110-116, 127-128, 157-164, 190-191
Summary by CodeRabbit
New Features
Behavior Changes
Localization
✏️ Tip: You can customize this high-level summary in your review settings.