fix(core): adaptation related to Polkadot updates#403
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. |
WalkthroughThis PR adds support for three new Polkadot networks (hydration, bifrost, bifrost-ksm) with corresponding UI assets and deserialization logic. Updates include firmware version bump, USB/BLE state management refactoring across storage and utility modules, Polkadot prefix field additions to proto and message definitions, UI button enhancements, homescreen conditional rendering, and artifact naming changes in CI workflows. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
core/src/storage/device.py (1)
1649-1730: Missing cache clears.Add
_USB_ENABLED_VALUEand_BLE_ENABLED_BACKUP_VALUEto this function. You clear_BLE_ENABLED_VALUEbut not the new ones.global _TREZOR_COMPATIBLE_VALUE global _DEVICE_NAME_DISPLAY_ENABLED_VALUE + global _USB_ENABLED_VALUE + global _BLE_ENABLED_BACKUP_VALUE _LANGUAGE_VALUE = None_SERIAL_NUMBER_VALUE = None _TREZOR_COMPATIBLE_VALUE = None _DEVICE_NAME_DISPLAY_ENABLED_VALUE = None + _USB_ENABLED_VALUE = None + _BLE_ENABLED_BACKUP_VALUE = None
♻️ Duplicate comments (1)
core/src/apps/ur_registry/chains/hardware_requests/get_multi_accounts.py (1)
38-39: Paths logged in debug mode.Same issue. Remove path data from debug output.
🧹 Nitpick comments (1)
core/src/apps/ur_registry/chains/ethereum/typed_data_transacion.py (1)
261-263: Use tuple form for readability.Replace with
chain_id_origin.startswith(("0x", "0X")).- if chain_id_origin.startswith( - "0x" - ) or chain_id_origin.startswith("0X"): + if chain_id_origin.startswith(("0x", "0X")):
📜 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 (5)
core/src/trezor/lvglui/res/chain-bifrost-ksm.pngis excluded by!**/*.pngcore/src/trezor/lvglui/res/chain-bifrost.pngis excluded by!**/*.pngcore/src/trezor/lvglui/res/chain-dot.pngis excluded by!**/*.pngcore/src/trezor/lvglui/res/chain-hydration.pngis excluded by!**/*.pngcore/src/trezor/lvglui/res/chain-kusama.pngis excluded by!**/*.png
📒 Files selected for processing (20)
.github/workflows/build-pro.yml(2 hunks)common/protob/messages-polkadot.proto(1 hunks)core/embed/firmware/version.h(1 hunks)core/src/apps/polkadot/__init__.py(1 hunks)core/src/apps/polkadot/helper.py(5 hunks)core/src/apps/polkadot/sign_tx.py(1 hunks)core/src/apps/polkadot/transaction.py(6 hunks)core/src/apps/ur_registry/chains/base_sign_request.py(1 hunks)core/src/apps/ur_registry/chains/ethereum/typed_data_transacion.py(2 hunks)core/src/apps/ur_registry/chains/hardware_requests/get_multi_accounts.py(1 hunks)core/src/apps/ur_registry/crypto_multi_accounts.py(1 hunks)core/src/apps/ur_registry/helpers.py(2 hunks)core/src/storage/device.py(6 hunks)core/src/trezor/lvglui/scrs/components/button.py(1 hunks)core/src/trezor/lvglui/scrs/homescreen.py(14 hunks)core/src/trezor/messages.py(1 hunks)core/src/trezor/uart.py(14 hunks)core/src/trezor/utils.py(5 hunks)python/src/trezorlib/messages.py(2 hunks)tools/i18n.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (8)
core/src/apps/polkadot/sign_tx.py (1)
core/src/apps/polkadot/helper.py (1)
get_address_type(164-170)
core/src/storage/device.py (1)
core/src/storage/common.py (2)
get(24-25)set_bool(45-49)
core/src/apps/ur_registry/chains/base_sign_request.py (2)
core/src/apps/ur_registry/chains/base_signature.py (2)
get_tag(19-20)decode(68-81)core/src/apps/ur_registry/crypto_key_path.py (1)
CryptoKeyPath(49-192)
core/src/trezor/uart.py (1)
core/mocks/generated/trezorio/__init__.pyi (3)
state(538-541)ctrl(15-18)ctrl(379-382)
python/src/trezorlib/messages.py (1)
python/src/trezorlib/protobuf.py (1)
Field(148-179)
core/src/trezor/lvglui/scrs/components/button.py (4)
core/src/trezor/lvglui/scrs/widgets/style.py (4)
StyleWrapper(4-211)bg_color(44-46)text_color(16-18)bg_opa(48-50)core/src/trezor/lvglui/lv_colors.py (1)
lv_colors(9-69)core/src/trezor/lvglui/scrs/address.py (1)
STATE(16-22)core/src/trezor/lvglui/scrs/components/slider.py (1)
enable(79-107)
core/src/apps/polkadot/transaction.py (3)
core/src/apps/polkadot/codec/base.py (4)
ScaleBytes(5-64)get_next_bytes(22-25)get_next_bytes(145-147)decode(165-192)core/src/apps/polkadot/helper.py (1)
ss58_encode(57-95)core/src/apps/polkadot/codec/types.py (1)
Compact(4-42)
core/src/trezor/lvglui/scrs/homescreen.py (8)
core/src/storage/device.py (6)
ble_enabled(487-495)is_usb_enabled(624-632)is_passphrase_enabled(1031-1035)is_passphrase_pin_enabled(1594-1602)is_airgap_mode(1408-1412)enable_airgap_mode(1415-1423)core/src/trezor/utils.py (2)
is_usb_enabled(236-243)enable_airgap_mode(300-310)core/src/trezor/lvglui/scrs/components/button.py (5)
disable(72-76)disable(210-218)disable(295-312)enable(78-82)enable(314-331)core/src/trezor/qr.py (1)
retrieval_encoder(284-285)core/src/trezor/lvglui/scrs/template.py (5)
ConnectWalletTutorial(5530-5617)destroy(4402-4403)destroy(5435-5436)destroy(5464-5465)destroy(5526-5527)core/src/trezor/lvglui/scrs/initscreen.py (1)
destroy(193-197)core/src/trezor/lvglui/scrs/components/container.py (1)
ContainerFlexCol(8-48)core/src/trezor/lvglui/scrs/widgets/style.py (4)
align(12-14)StyleWrapper(4-211)bg_color(44-46)bg_opa(48-50)
🪛 Ruff (0.14.8)
core/src/apps/ur_registry/chains/base_sign_request.py
150-150: Create your own exception
(TRY002)
150-150: Avoid specifying long messages outside the exception class
(TRY003)
157-157: Create your own exception
(TRY002)
157-157: Avoid specifying long messages outside the exception class
(TRY003)
core/src/trezor/lvglui/scrs/homescreen.py
2720-2720: Avoid specifying long messages outside the exception class
(TRY003)
⏰ 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: Style check
- GitHub Check: Defs check
- GitHub Check: Gen check
🔇 Additional comments (8)
core/embed/firmware/version.h (1)
12-13: Clean version bump..github/workflows/build-pro.yml (1)
30-31: LGTM!Naming is clearer and consistent.
Also applies to: 42-43
python/src/trezorlib/messages.py (1)
9910-9931: No action needed. Optional fields are the standard protobuf mechanism for cross-version compatibility. Theprefixfield is correctly marked as optional and will be safely ignored by older firmware versions.core/src/apps/polkadot/helper.py (2)
132-155: LGTM.New network branches follow the existing pattern.
164-169: LGTM.The
preset_prefixparameter and earlybreakare clean additions.core/src/apps/polkadot/transaction.py (3)
26-50: LGTM.The
skip_type_lookupparameter cleanly handles networks without type-lookup bytes.
230-266: Verify hydration callPrivIdx values.Ensure 1792, 1794, 1795, 1796 match the Hydration chain's actual pallet indices.
286-293: LGTM.Routing logic is clear. Bifrost networks reuse manta deserialization with correct address types.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.