Skip to content

feat(core): add support for EIP-7702 transaction signing#383

Merged
somebodyLi merged 5 commits intomainfrom
feat/eip7702
Aug 26, 2025
Merged

feat(core): add support for EIP-7702 transaction signing#383
somebodyLi merged 5 commits intomainfrom
feat/eip7702

Conversation

@somebodyLi
Copy link
Contributor

@somebodyLi somebodyLi commented Aug 26, 2025

Summary by CodeRabbit

  • New Features

    • Ethereum: EIP‑7702 delegated signing (upgrade/revoke) with UI and CLI support.
    • TRON: message V2 support, UR QR request/response flows, transaction parsing, multi‑account/address verify.
    • Aptos: SIWA (Sign‑In With Aptos) message signing.
    • UI: new transaction detail cards, “Show more” flow, Certifications screen, button alignment option.
  • Improvements

    • Air Gap reworded to “Air Gap Only”; translations and help links updated.
  • Bug Fixes

    • TRON freeze label corrected; CBOR encoded-bytes prefix handling fixed.
  • Chores

    • Firmware version bumped to 4.16.0.

1. add support for tron sign message V2 by usb/QR
2. add support for create tron account and verify tron address by QR
3. add support for tron transaction signing by QR
@somebodyLi somebodyLi requested a review from a team as a code owner August 26, 2025 06:52
@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds EIP-7702 (Ethereum) signing flow, TRON message/transaction support (incl. UR), and Aptos SIWA message. Updates protobufs, enums, host libs, UI (LVGL templates/components, i18n), and routing. Introduces UR base classes and Solana refactor. Bumps firmware minor version, adjusts wire behavior, and updates requirements.

Changes

Cohort / File(s) Summary
Protobuf schemas
common/protob/messages-aptos.proto, common/protob/messages-ethereum-onekey.proto, common/protob/messages-tron.proto, common/protob/messages.proto
Add AptosSignSIWAMessage; add EIP-7702 messages, access/authorization types and signatures; add TronMessageType and message_type field; add new MessageType enum values.
Enums & core message wiring
core/src/trezor/enums/MessageType.py, core/src/trezor/enums/TronMessageType.py, core/src/trezor/enums/__init__.py, core/src/trezor/messages.py, python/src/trezorlib/messages.py
Expose new MessageType values; add TronMessageType; extend TronSignMessage; add Aptos SIWA message and Ethereum EIP-7702/authorization/access-list types in runtime/message declarations.
Ethereum EIP-7702 host + CLI
core/src/apps/ethereum/onekey/*, core/src/apps/ethereum/layout.py, core/src/apps/ethereum/onekey/sign_tx_eip7702.py, python/src/trezorlib/ethereum_onekey.py, python/src/trezorlib/cli/ethereum_onekey.py
New EIP-7702 signing logic (keychain typing, delegator registry, sign_tx_eip7702, RLP/authorization handling), CLI parsing/option for authorization list; note: duplicate sign_tx_eip7702 def in host CLI.
UR registry base & Solana refactor
core/src/apps/ur_registry/chains/base_sign_request.py, core/src/apps/ur_registry/chains/base_signature.py, core/src/apps/ur_registry/chains/solana/*, core/src/apps/ur_registry/registry_types.py, core/src/apps/ur_registry/ur_py/ur/cbor_lite.py
Introduce BaseSignRequest/BaseSignature, refactor Solana sign/signature to inherit base, add TRON registry types, fix CBOR encode prefix behavior.
TRON support & UR flows
core/src/apps/tron/*, core/src/apps/ur_registry/chains/tron/*, core/src/apps/ur_registry/helpers.py, core/src/apps/ur_registry/crypto_coin_info.py, core/src/apps/ur_registry/crypto_multi_accounts.py, core/src/apps/ur_registry/chains/requests_handler.py, core/src/trezor/qr.py
Add TRON coin type/path, (de)serialization, message versioning (V1/V2), sign-message branching, UR message/transaction/signature classes and handlers, routing for TRON registry types and QR finish handling.
UR request handlers (other chains)
core/src/apps/ur_registry/chains/*, core/src/apps/ur_registry/chains/hardware_requests/*
Add Tron support to hardware requests and verify_address; refactor SolSignRequest to use BaseSignRequest and introduce type-dispatch gen_request flow.
UI components & templates (LVGL)
core/src/trezor/lvglui/scrs/components/composite.py, core/src/trezor/lvglui/scrs/components/button.py, core/src/trezor/lvglui/scrs/template.py, core/src/trezor/lvglui/scrs/homescreen.py, core/src/trezor/lvglui/scrs/initscreen.py
New composite card groups, raw-data viewer, show-more; NormalButton label_align param; TransactionOverview/Details rewritten to data-driven CardGroup; CertificationInfo moved to template; homescreen help link and certifications button updates.
LVGL layout APIs
core/src/trezor/ui/layouts/lvgl/__init__.py, core/src/trezor/ui/layouts/lvgl/altcoin.py
Add CONFIRM_ACTION_TYPE, expand confirm_action/show_warning signatures, add should_show_details_eip7702 and confirm_total_eip7702 integration.
i18n keys & locales
core/src/trezor/lvglui/i18n/keys.py, core/src/trezor/lvglui/i18n/locales/*
Large reindexing/addition of i18n keys; rename/reword Air Gap to “Air Gap Only” (and localized equivalents); add wallpaper/touch/change strings; update translations across languages and help text references.
Workflow handlers & module registry
core/src/all_modules.py, core/src/apps/workflow_handlers.py
Export new modules (TRON, Aptos SIWA, UR chains, EIP-7702 modules) and map new message handlers to modules.
Management recovery flow
core/src/apps/management/recovery_device/create_mul_shares.py
Privatize backup/show helpers, wrap calls with dynamic unimport_begin/unimport_end, adjust control flow.
Tron serialization & sign message changes
core/src/apps/tron/serialize.py, core/src/apps/tron/sign_message.py
Replace ad-hoc encoding with protobuf-like field tags, add varint/field readers, expose deserialize/unpack_contract; sign_message now branches on TronMessageType V1/V2 and renames digest helper.
Aptos SIWA signer
core/src/apps/aptos/sign_siwa_message.py
Add domain-separated SIWA signer: key derivation, UI confirm, ed25519 sign, return AptosMessageSignature.
Messages / runtime message classes
core/src/trezor/messages.py, python/src/trezorlib/messages.py
Add AptosSignSIWAMessage; add Ethereum authorization/access-list/signature types; extend Tron message fields and enums; update message constructors/wiring.
Wire behavior & exports
core/src/trezor/wire/__init__.py
Remove io re-export; Context.signal always emits TASK_CLOSED failure (previous conditional removed).
Version bump
core/embed/firmware/version.h
ONEKEY_VERSION_MINOR: 15 → 16.
Requirements / packaging
python/requirements.txt, python/requirements-optional.txt
Swap/simple-rlp ↔ rlp conditional changes (adjust version and gating).
Minor fixes
core/src/apps/common/request_pin.py, core/src/trezor/lvglui/__init__.py
Make request_pin_on_device import unconditional in verify_user_pin; change StatusBar text “Air Gap Mode” → “Air Gap Only”.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120+ minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/eip7702

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@revan-zhang
Copy link
Contributor

revan-zhang commented Aug 26, 2025

🎉 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)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 37

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (12)
core/src/trezor/lvglui/i18n/locales/de.py (1)

602-602: Fix stray apostrophe in string

Trailing apostrophe at end of sentence.

core/src/apps/common/request_pin.py (4)

123-128: Wrong identity check on pin_use_type
Uses 'is' after casting to int; condition unreliable.


130-136: ticks wrap-around bug in cache check
ticks_ms subtraction is unsafe; wrap-around breaks the cache gate.


154-154: Typos in error messages
"cancle" and "cal cale .." are user-facing.

Also applies to: 162-162, 178-178, 194-194, 221-221, 230-230


268-268: Forgot to call _set_last_unlock_time
Missing parentheses; timestamp never updates.

core/src/apps/management/recovery_device/create_mul_shares.py (1)

133-165: Unbalanced unimport scope on cancel; cleanup not guaranteed on exceptions.

core/src/apps/ur_registry/chains/solana/sol_sign_request.py (1)

47-47: Use more specific exception type.

Generic Exception is too broad here.

-            raise Exception(f"Unexpected Request Type {req.get_request_type()}")
+            raise ValueError(f"Unexpected Request Type {req.get_request_type()}")
core/src/trezor/ui/layouts/lvgl/__init__.py (4)

463-481: Confirm button text color ignored without bg color

Passing only btn_yes_text_color has no effect due to the guard.

-    if btn_yes_bg_color:
-        screen.btn_yes.enable(
-            bg_color=btn_yes_bg_color or lv_colors.ONEKEY_GREEN,
-            text_color=btn_yes_text_color or lv_colors.WHITE,
-        )
+    if btn_yes_bg_color is not None or btn_yes_text_color is not None:
+        screen.btn_yes.enable(
+            bg_color=btn_yes_bg_color or lv_colors.ONEKEY_GREEN,
+            text_color=btn_yes_text_color or lv_colors.WHITE,
+        )

1437-1455: Missing await on should_show_details (Sol transfer)

Coroutine not awaited; flow is wrong.

-    if should_show_details(ctx, to_addr, title):
+    if await should_show_details(ctx, to_addr, title):

1509-1527: Missing await on should_show_details (Sol token transfer)

Coroutine not awaited; flow is wrong.

-    if should_show_details(ctx, to_addr, title):
+    if await should_show_details(ctx, to_addr, title):

142-145: confirm_screen.slider may be undefined when hold=False

  • core/src/trezor/ui/layouts/lvgl/init.py:143

Category:

core/src/apps/ur_registry/chains/hardware_requests/verify_address.py (1)

47-48: Wrong coin_name branch for BTC. Picks Testnet for 'btc'.

🧹 Nitpick comments (47)
core/src/trezor/lvglui/i18n/locales/de.py (4)

714-714: Inconsistent Air Gap naming

“Luftspalt” vs “Air Gap”.

Also applies to: 784-784


743-743: Awkward German phrasing

“Kann das Gerät sich … verbinden” reads clunky.


1030-1030: Formality mismatch

“du” vs consistent “Sie”.


1027-1029: UI term inconsistency

“Berührung/Ändern” vs prior “Tippen/Ändern”.

core/src/trezor/lvglui/i18n/locales/es.py (5)

714-716: Awkward Spanish and term inconsistency

“Solo separación de aire” suena antinatural y es inconsistente con “Air Gap” usado en otras cadenas.


718-718: Terminology mismatch

“monederos” vs “billetera” en el mismo locale.


870-870: Inconsistent networks list

No coincide con “Redes BTC, ETH y EVM” en Line 789.


1020-1020: Person inconsistency

Usa “Está” (3ª persona) mientras el resto usa “Estás” (2ª persona).


1027-1030: UI phrasing issues

“Tocar” inconsistente con “Toca” en el archivo. “cambiarlo como tu fondo de pantalla” es gramaticalmente incorrecto.

core/src/trezor/lvglui/i18n/locales/it.py (4)

714-714: Terminologia incoerente: “Air Gap” vs “traferro”.


718-718: Grammatica: preposizione errata in “a wallet software”.


784-784: Coerenza: manca “NFC” rispetto alle altre stringhe Air Gap.


1030-1030: Concordanza di genere: “impostarla” non concorda con “sfondo” (masch.).

core/src/trezor/lvglui/i18n/locales/pt_br.py (3)

715-718: Inconsistent wording: “desabilita” vs “desativa”.
Line 715 usa “desabilita”; Line 718 usa “desativa”. Mantenha consistente.


1027-1027: Verb mood mismatch: “Tocar”.
UI usa “Toque” em outros lugares.


1028-1028: Awkward noun: “Mudança”.
Soa errado para ação/botão.

core/src/trezor/lvglui/i18n/locales/ru.py (2)

718-718: Несогласованное использование «ё»: «всё равно»
В остальных строках используется «е».


784-784: Несогласованное использование «ё»: «Включён»
Стилистика с «е» преобладает в файле.

core/src/trezor/lvglui/i18n/locales/zh_hk.py (2)

870-870: 用詞不一致:「網絡/網路」
與行 745 不一致。


1027-1031: 異體字不一致:「爲/為」
與行 425 不一致。另:用語不一致「觸控/輕觸」。

core/src/trezor/lvglui/i18n/locales/ko.py (4)

714-719: Inconsistent terms: '에어 갭' vs '에어갭' and '블루투스' vs 'Bluetooth'.


785-785: NFC omitted; conflicts with earlier Air Gap text.


118-118: '여기로' is ambiguous as a label.


635-635: '방향' may confuse in this context.

core/src/apps/ur_registry/chains/base_sign_request.py (2)

74-76: Unused setter 'set_data_type'; value is never encoded or read.


143-166: Misleading variable name 'sol_sign_req' in a generic base class.

core/src/apps/ur_registry/chains/base_signature.py (1)

74-77: Misleading error message and generic exception

Message is unclear and uses Exception.

core/src/trezor/lvglui/i18n/keys.py (1)

1723-1723: Grammar in key name

“HAS_DISABLED” reads wrong.

core/src/trezor/lvglui/scrs/components/button.py (1)

20-20: Function call in default argument

text=_(...) in defaults violates best practices.

core/src/trezor/lvglui/scrs/components/composite.py (1)

23-25: Typo in attribute name

“pannel” is misspelled.

core/src/trezor/qr.py (1)

206-206: Typo: camear_scan

Spelling error in function name.

core/src/trezor/lvglui/i18n/locales/zh_cn.py (2)

719-719: 术语不统一(Air Gap)

仍使用 “Air Gap”,与“隔空签名模式”不一致。


785-785: 模块禁用描述不一致

此处缺少 “NFC”,与 716 行不一致。

core/src/apps/ur_registry/chains/tron/tron_transaction.py (1)

11-11: Unused attribute: encoder

core/src/trezor/lvglui/i18n/locales/fr.py (1)

714-714: Inconsistent term: “Entrefer” vs “Air Gap”

Also applies to: 784-784

core/src/apps/ur_registry/chains/tron/tron_message.py (1)

11-11: Unused attribute: encoder

core/src/trezor/lvglui/i18n/locales/ja.py (1)

714-716: Inconsistent spacing: エアギャップ vs エア ギャップ

Also applies to: 784-784

core/src/apps/tron/serialize.py (2)

253-253: Consider using a more descriptive error message.

The error message "Unsupported contract type" could be more helpful by including the actual type value.

-        raise ValueError("Unsupported contract type")
+        raise ValueError(f"Unsupported contract type: {contract.WhichOneof('contract')}")

349-349: Simplify dictionary get() call.

The None default is implicit for dict.get().

-    if (contract_info := contract_parsers.get(contract_type, None)) is not None:
+    if (contract_info := contract_parsers.get(contract_type)) is not None:
core/src/trezor/lvglui/i18n/locales/en.py (4)

714-719: Terminology inconsistent: “Air Gap Only” vs existing “Air Gap/Airgap”.

Also applies to: 784-785


716-716: Comma usage inconsistent (“USB and NFC” vs “USB, and NFC”).

Also applies to: 743-743


784-784: Missing NFC in status text.


1030-1030: Awkward phrasing: “change it as your wallpaper”.

core/src/trezor/messages.py (1)

387-402: Ambiguous SIWA name and payload type.
“SIWA” commonly means Sign in with Apple. Using str for payload creates encoding ambiguity.

core/src/apps/ur_registry/chains/tron/tron_sign_request.py (2)

4-6: Constant names break Python style.


40-40: Generic Exception used.

common/protob/messages-aptos.proto (1)

68-76: Grammar: missing articles in comment.

📜 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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fdd458e and 57d21be.

📒 Files selected for processing (63)
  • common/protob/messages-aptos.proto (1 hunks)
  • common/protob/messages-ethereum-onekey.proto (3 hunks)
  • common/protob/messages-tron.proto (2 hunks)
  • common/protob/messages.proto (2 hunks)
  • core/embed/firmware/version.h (1 hunks)
  • core/src/all_modules.py (7 hunks)
  • core/src/apps/common/request_pin.py (2 hunks)
  • core/src/apps/ethereum/layout.py (1 hunks)
  • core/src/apps/ethereum/onekey/eip7702_delegators.py (1 hunks)
  • core/src/apps/ethereum/onekey/keychain.py (2 hunks)
  • core/src/apps/ethereum/onekey/sign_tx_eip7702.py (1 hunks)
  • core/src/apps/management/recovery_device/create_mul_shares.py (2 hunks)
  • core/src/apps/tron/layout.py (1 hunks)
  • core/src/apps/tron/serialize.py (5 hunks)
  • core/src/apps/tron/sign_message.py (3 hunks)
  • core/src/apps/ur_registry/chains/base_sign_request.py (1 hunks)
  • core/src/apps/ur_registry/chains/base_signature.py (1 hunks)
  • core/src/apps/ur_registry/chains/hardware_requests/get_multi_accounts.py (1 hunks)
  • core/src/apps/ur_registry/chains/hardware_requests/verify_address.py (1 hunks)
  • core/src/apps/ur_registry/chains/requests_handler.py (2 hunks)
  • core/src/apps/ur_registry/chains/solana/sol_sign_request.py (1 hunks)
  • core/src/apps/ur_registry/chains/solana/sol_signature.py (1 hunks)
  • core/src/apps/ur_registry/chains/tron/tron_message.py (1 hunks)
  • core/src/apps/ur_registry/chains/tron/tron_sign_request.py (1 hunks)
  • core/src/apps/ur_registry/chains/tron/tron_signature.py (1 hunks)
  • core/src/apps/ur_registry/chains/tron/tron_transaction.py (1 hunks)
  • core/src/apps/ur_registry/crypto_coin_info.py (1 hunks)
  • core/src/apps/ur_registry/crypto_multi_accounts.py (2 hunks)
  • core/src/apps/ur_registry/helpers.py (3 hunks)
  • core/src/apps/ur_registry/registry_types.py (1 hunks)
  • core/src/apps/ur_registry/ur_py/ur/cbor_lite.py (1 hunks)
  • core/src/apps/workflow_handlers.py (2 hunks)
  • core/src/trezor/enums/MessageType.py (2 hunks)
  • core/src/trezor/enums/TronMessageType.py (1 hunks)
  • core/src/trezor/enums/__init__.py (3 hunks)
  • core/src/trezor/lvglui/__init__.py (1 hunks)
  • core/src/trezor/lvglui/i18n/keys.py (3 hunks)
  • core/src/trezor/lvglui/i18n/locales/de.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/en.py (6 hunks)
  • core/src/trezor/lvglui/i18n/locales/es.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/fr.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/it.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/ja.py (6 hunks)
  • core/src/trezor/lvglui/i18n/locales/ko.py (8 hunks)
  • core/src/trezor/lvglui/i18n/locales/pt_br.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/ru.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/zh_cn.py (8 hunks)
  • core/src/trezor/lvglui/i18n/locales/zh_hk.py (8 hunks)
  • core/src/trezor/lvglui/scrs/components/button.py (3 hunks)
  • core/src/trezor/lvglui/scrs/components/composite.py (1 hunks)
  • core/src/trezor/lvglui/scrs/homescreen.py (6 hunks)
  • core/src/trezor/lvglui/scrs/initscreen.py (1 hunks)
  • core/src/trezor/lvglui/scrs/template.py (4 hunks)
  • core/src/trezor/messages.py (6 hunks)
  • core/src/trezor/qr.py (2 hunks)
  • core/src/trezor/ui/layouts/lvgl/__init__.py (11 hunks)
  • core/src/trezor/ui/layouts/lvgl/altcoin.py (1 hunks)
  • core/src/trezor/wire/__init__.py (2 hunks)
  • python/requirements-optional.txt (0 hunks)
  • python/requirements.txt (1 hunks)
  • python/src/trezorlib/cli/ethereum_onekey.py (7 hunks)
  • python/src/trezorlib/ethereum_onekey.py (1 hunks)
  • python/src/trezorlib/messages.py (8 hunks)
💤 Files with no reviewable changes (1)
  • python/requirements-optional.txt
👮 Files not reviewed due to content moderation or server errors (12)
  • core/embed/firmware/version.h
  • core/src/trezor/enums/MessageType.py
  • core/src/trezor/enums/TronMessageType.py
  • core/src/apps/ur_registry/chains/solana/sol_signature.py
  • core/src/apps/workflow_handlers.py
  • core/src/trezor/enums/init.py
  • core/src/apps/ur_registry/chains/requests_handler.py
  • core/src/apps/ur_registry/chains/tron/tron_signature.py
  • common/protob/messages.proto
  • core/src/apps/ur_registry/helpers.py
  • core/src/apps/ethereum/onekey/keychain.py
  • core/src/all_modules.py
🧰 Additional context used
🪛 Ruff (0.12.2)
core/src/trezor/lvglui/scrs/components/button.py

19-19: Do not perform function call _ in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

core/src/apps/tron/serialize.py

349-349: Use contract_parsers.get(contract_type) instead of contract_parsers.get(contract_type, None)

Replace contract_parsers.get(contract_type, None) with contract_parsers.get(contract_type)

(SIM910)

core/src/trezor/lvglui/scrs/components/composite.py

118-119: Use a single if statement instead of nested if statements

Combine if statements using and

(SIM102)

python/src/trezorlib/cli/ethereum_onekey.py

125-125: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


145-145: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

core/src/trezor/lvglui/scrs/template.py

656-657: Use a single if statement instead of nested if statements

Combine if statements using and

(SIM102)


971-971: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


989-989: Use kwargs.get(section_name) instead of kwargs.get(section_name, None)

Replace kwargs.get(section_name, None) with kwargs.get(section_name)

(SIM910)

core/src/trezor/ui/layouts/lvgl/__init__.py

667-670: Return the condition directly

Inline condition

(SIM103)


698-701: Return the condition directly

Inline condition

(SIM103)


789-792: Return the condition directly

Inline condition

(SIM103)


2149-2152: Return the condition directly

Inline condition

(SIM103)

⏰ 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: Defs check
  • GitHub Check: Style check
🔇 Additional comments (35)
core/src/apps/common/request_pin.py (3)

28-28: Spelling: standy_wall_only
Likely a typo. Confirm API compatibility.

Also applies to: 39-40, 78-78, 88-88, 119-119, 149-149, 217-217


138-138: Import placement: check for cycles
Unconditional in-function import may introduce a cycle.


208-218: Type-check the request_pin_on_device call
Ignore removed; confirm signature matches.

core/src/trezor/lvglui/i18n/locales/pt_br.py (2)

784-784: NFC missing in Air Gap notice.
Outras mensagens do Air Gap citam Bluetooth, USB e NFC.


1030-1030: Ambiguous pronoun gender.
“defini-la” tem antecedente implícito.

core/src/trezor/lvglui/i18n/locales/ru.py (1)

714-718: Несогласованная терминология: «Air Gap» vs «Airgap»
В этом файле также встречается «Airgap». Проверьте единообразие.

core/src/trezor/lvglui/__init__.py (2)

190-190: Untranslated UI text; i18n regression


257-259: AirGap check missing; BLE may unhide in AirGap

core/src/apps/ur_registry/ur_py/ur/cbor_lite.py (1)

152-155: Potential type misuse in encodeEncodedBytesPrefix

encodeTagAndValue expects an int length; bytes will break.

core/src/apps/tron/layout.py (1)

138-138: Unlocalized UI label

New labels are not i18n keys.

common/protob/messages-tron.proto (1)

160-160: Default points to deprecated enum value

message_type default is V1, marked deprecated.

core/src/apps/ur_registry/chains/base_signature.py (1)

18-21: No action needed — get_tag is used in subclasses (TronSignature, SolSignature).

core/src/trezor/qr.py (1)

91-105: Missing encoder fallback for TRON sign responses

If TRON uses encoder (multi‑part), no UI output is shown.

core/src/apps/ur_registry/crypto_multi_accounts.py (1)

167-170: BITCOIN_ONLY risk

TRON is added without BITCOIN_ONLY gating here.

Also applies to: 193-195

core/src/apps/ur_registry/registry_types.py (1)

18-20: UR tag allocation check

Verify 5201/5202 don’t collide with existing registry tags.

core/src/apps/ethereum/onekey/eip7702_delegators.py (1)

34-45: Parameter chain_id is ignored in _delegator_iterator.

Misleading API. Readers expect chain filtering.

Also applies to: 46-55

core/src/apps/ethereum/layout.py (1)

154-166: Typo in parameter name: authorty_adrr.

Inconsistent with authority_addr elsewhere.

python/src/trezorlib/cli/ethereum_onekey.py (1)

180-187: Type mismatch in _format_authorization_list.

Annotation says Tuple[...] and nonce bytes, but returns list and nonce int.

common/protob/messages-ethereum-onekey.proto (1)

113-113: Fix typo in comment.

"i" should be capitalized.

- message EthereumSignTxEIP7702OneKey {
+ message EthereumSignTxEIP7702OneKey {

Likely an incorrect or invalid review comment.

core/src/trezor/lvglui/scrs/homescreen.py (1)

1784-1786: Remove leading space in URL.

URL has an unnecessary leading space.

-                    " https://help.onekey.so/articles/11461103"
+                    "https://help.onekey.so/articles/11461103"

Likely an incorrect or invalid review comment.

core/src/trezor/lvglui/scrs/template.py (1)

1071-1077: None values may render as “None” in fee section.

core/src/trezor/ui/layouts/lvgl/__init__.py (3)

726-733: Possible 'None' rendered for delegate address

Delegate may be None and display as "None".


642-671: Confirmed TransactionOverviewSend publishes 2, matching SHOW_MORE = 2 and CONFIRM_ACTION_TYPE.CONFIRM_ACTION_SHOW_MORE. No changes needed.


714-752: Couldn't locate CONFIRM_ACTION_TYPE in the repo. Verify that res codes from TransactionOverview align with CANCEL=0, SHOW_MORE=2, and default CONFIRM=1.

core/src/trezor/messages.py (3)

5530-5536: authorization_signatures ordering unclear.
Confirm 1:1 alignment with authorization_list.


5651-5671: Duplicate signature fields across types.
Same signature data here and in EthereumTxRequestOneKey. Risk of divergence.


9434-9442: Back-compat risk for Tron message_type.
Older hosts may omit message_type. Ensure safe default behavior.

python/src/trezorlib/messages.py (5)

845-848: Enum lacks 0 value; omitted field may decode to invalid 0.

Also applies to: 11693-11706


1188-1203: Aptos SIWA payload uses string; other sign APIs use bytes.


7439-7463: Duplicate signature channels: Authorization.signature vs TxRequest.authorization_signatures.

Also applies to: 7306-7319, 7232-7250


184-184: Confirm 20120 is unique across all message registries.


335-335: Confirm 10606 is unused and correctly routed in core.

core/src/apps/ur_registry/chains/hardware_requests/verify_address.py (1)

15-16: 'address' param is required but unused.

core/src/apps/ur_registry/chains/hardware_requests/get_multi_accounts.py (1)

39-46: Tron HDKey builder mismatch

Using generate_HDKey for Tron may produce wrong UR output.

Also applies to: 102-114

core/src/trezor/lvglui/scrs/initscreen.py (1)

69-73: Screen not loaded

Click does not load the screen. No lv.scr_load call.

@somebodyLi somebodyLi merged commit 9f23c6d into main Aug 26, 2025
8 of 9 checks passed
@somebodyLi somebodyLi deleted the feat/eip7702 branch August 26, 2025 07:37
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
core/src/apps/management/recovery_device/create_mul_shares.py (1)

133-164: UI import scope leak; unimport_end not guaranteed on early exits.

core/src/trezor/lvglui/scrs/template.py (2)

3969-3974: Bug: invalid attribute “self.lv”

Use lv, not self.lv.

-            self.banner.align(self.lv.ALIGN.TOP_MID, 0, 40)
+            self.banner.align(lv.ALIGN.TOP_MID, 0, 40)

2814-2831: Typo: parameter “doamin”

Rename to “domain” and update usage.

-        doamin,
+        domain,
@@
-            self.container, _(i18n_keys.LIST_KEY__DOMAIN__COLON), doamin
+            self.container, _(i18n_keys.LIST_KEY__DOMAIN__COLON), domain
♻️ Duplicate comments (15)
core/src/trezor/lvglui/i18n/keys.py (8)

1569-1569: Typo: NFC/NFT mismatch

NFT used; NFC expected.


1579-1579: Grammar: MEANS

MEANS used; MEAN expected.


1608-1608: Typo: RETUNRN

RETUNRN misspelled.


1829-1829: Typo: VEIRIFY

VEIRIFY misspelled.


1925-1933: Prefix typo: GNOSIS_SAGE

“SAGE” instead of “SAFE”.


2159-2161: Typo: TLTLE__

TLTLE__ misspelled.


2205-2205: Naming: missing double underscore

BUTTON_ONEKEY_EXTENDED lacks BUTTON__.


2231-2231: Naming: missing double underscore

TITLE_UPGRADE_SMART_ACCOUNT, TITLE_REVOKE_SMART_ACCOUNT_DELEGATION, TITLE_SMART_ACCOUNT_DELEGATION_BLOCKED, BUTTON_UNDERSTAND.

Also applies to: 2240-2240, 2245-2245, 2252-2252

core/src/trezor/lvglui/i18n/locales/de.py (1)

784-784: Inconsistent disable list

NFC missing.

core/src/trezor/lvglui/scrs/template.py (3)

647-651: Typo: attribute “pannel”

Rename to the correct attribute.

-            self.show_more = ShowMore(self.content_area, self.card_group.pannel)
+            self.show_more = ShowMore(self.content_area, self.card_group.panel)

1037-1079: Typo: parameter “authorty_adrr”

Fix the name and its usage.

-        authorty_adrr: str,
+        authority_addr: str,
@@
-                (_(i18n_keys.FIELDS_ACCOUNT), authorty_adrr),
+                (_(i18n_keys.FIELDS_ACCOUNT), authority_addr),

6049-6055: Separator won’t render

lv.line without points; switch to a styled object.

-                self.line = lv.line(self.container)
-                self.line.set_size(408, 1)
-                self.line.add_style(
-                    StyleWrapper().bg_color(lv_colors.ONEKEY_GRAY_2).bg_opa(), 0
-                )
+                self.separator = lv.obj(self.container)
+                self.separator.remove_style_all()
+                self.separator.set_size(408, 1)
+                self.separator.add_style(
+                    StyleWrapper().bg_color(lv_colors.ONEKEY_GRAY_2).bg_opa().border_width(0), 0
+                )
python/src/trezorlib/messages.py (2)

7255-7261: 'to' marked required prevents contract creation.


7276-7294: init makes 'to' mandatory, blocking contract creation.

core/src/trezor/messages.py (1)

5489-5524: 'to' required blocks contract creation (EIP-7702).

🧹 Nitpick comments (9)
core/src/apps/management/recovery_device/create_mul_shares.py (3)

64-64: Overbroad exception catch (BaseException).


83-84: Inconsistent variable name (src vs scr).


134-134: Brittle tokenization; split(" ") breaks on multiple spaces.

core/src/trezor/lvglui/i18n/keys.py (4)

1594-1596: Grammar: NOT SUPPORT

“NOT SUPPORT” in key names.


1723-1723: Grammar: HAS vs HAVE

Plural subject with HAS.


1725-1732: Naming: missing double underscore

TITLE_… keys use single underscore.


1780-1780: Naming: triple underscore

MSG___ prefix inconsistent.

core/src/trezor/lvglui/scrs/components/button.py (1)

19-23: Default arg calls function (B008)

Function call in default value for text.

core/src/trezor/lvglui/i18n/locales/zh_cn.py (1)

714-714: 用语不自然。

📜 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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 57d21be and 084d997.

📒 Files selected for processing (32)
  • common/protob/messages-aptos.proto (1 hunks)
  • common/protob/messages-ethereum-onekey.proto (3 hunks)
  • common/protob/messages.proto (2 hunks)
  • core/embed/firmware/version.h (1 hunks)
  • core/src/all_modules.py (7 hunks)
  • core/src/apps/aptos/sign_siwa_message.py (1 hunks)
  • core/src/apps/ethereum/onekey/eip7702_delegators.py (1 hunks)
  • core/src/apps/management/recovery_device/create_mul_shares.py (2 hunks)
  • core/src/apps/workflow_handlers.py (2 hunks)
  • core/src/trezor/enums/MessageType.py (2 hunks)
  • core/src/trezor/enums/TronMessageType.py (1 hunks)
  • core/src/trezor/enums/__init__.py (3 hunks)
  • core/src/trezor/lvglui/__init__.py (1 hunks)
  • core/src/trezor/lvglui/i18n/keys.py (3 hunks)
  • core/src/trezor/lvglui/i18n/locales/de.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/en.py (6 hunks)
  • core/src/trezor/lvglui/i18n/locales/es.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/fr.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/it.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/ja.py (6 hunks)
  • core/src/trezor/lvglui/i18n/locales/ko.py (8 hunks)
  • core/src/trezor/lvglui/i18n/locales/pt_br.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/ru.py (5 hunks)
  • core/src/trezor/lvglui/i18n/locales/zh_cn.py (8 hunks)
  • core/src/trezor/lvglui/i18n/locales/zh_hk.py (8 hunks)
  • core/src/trezor/lvglui/scrs/components/button.py (3 hunks)
  • core/src/trezor/lvglui/scrs/homescreen.py (6 hunks)
  • core/src/trezor/lvglui/scrs/initscreen.py (1 hunks)
  • core/src/trezor/lvglui/scrs/template.py (4 hunks)
  • core/src/trezor/messages.py (6 hunks)
  • core/src/trezor/wire/__init__.py (2 hunks)
  • python/src/trezorlib/messages.py (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (20)
  • core/src/trezor/lvglui/init.py
  • core/embed/firmware/version.h
  • core/src/trezor/enums/init.py
  • common/protob/messages-aptos.proto
  • core/src/apps/workflow_handlers.py
  • common/protob/messages.proto
  • core/src/all_modules.py
  • core/src/apps/ethereum/onekey/eip7702_delegators.py
  • core/src/trezor/wire/init.py
  • core/src/trezor/lvglui/i18n/locales/pt_br.py
  • core/src/trezor/lvglui/i18n/locales/ja.py
  • common/protob/messages-ethereum-onekey.proto
  • core/src/trezor/lvglui/i18n/locales/ru.py
  • core/src/trezor/lvglui/i18n/locales/fr.py
  • core/src/trezor/lvglui/i18n/locales/es.py
  • core/src/trezor/lvglui/i18n/locales/zh_hk.py
  • core/src/trezor/lvglui/i18n/locales/ko.py
  • core/src/trezor/lvglui/scrs/homescreen.py
  • core/src/trezor/lvglui/i18n/locales/it.py
  • core/src/trezor/lvglui/i18n/locales/en.py
👮 Files not reviewed due to content moderation or server errors (3)
  • core/src/trezor/enums/MessageType.py
  • core/src/apps/aptos/sign_siwa_message.py
  • core/src/trezor/lvglui/scrs/initscreen.py
🧰 Additional context used
🪛 Ruff (0.12.2)
core/src/trezor/lvglui/scrs/template.py

656-657: Use a single if statement instead of nested if statements

Combine if statements using and

(SIM102)


971-971: Use key in dict instead of key in dict.keys()

Remove .keys()

(SIM118)


989-989: Use kwargs.get(section_name) instead of kwargs.get(section_name, None)

Replace kwargs.get(section_name, None) with kwargs.get(section_name)

(SIM910)

core/src/trezor/lvglui/scrs/components/button.py

19-19: Do not perform function call _ in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

⏰ 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 (4)
core/src/apps/management/recovery_device/create_mul_shares.py (2)

85-86: Missing validation for threshold <= count.


112-112: Unchecked shape; mnemonics[0] may not be list[str].

core/src/trezor/enums/TronMessageType.py (1)

5-5: 缺少 V1 常量。

core/src/trezor/lvglui/i18n/locales/zh_cn.py (1)

784-784: 与前文不一致(缺少 NFC)。

Comment on lines +62 to +63
mods = utils.unimport_begin()
await _backup_multi_share(storage_recovery.get_slip39_checked_secret())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

mods may be undefined; unimport_end in finally can crash.

Also applies to: 71-71

🤖 Prompt for AI Agents
In core/src/apps/management/recovery_device/create_mul_shares.py around lines
62-63 (and also line 71), mods returned from utils.unimport_begin() may be
undefined and calling utils.unimport_end(mods) in the finally block can crash;
fix by initializing mods = None before the try, assign mods =
utils.unimport_begin() inside the try, and in the finally only call
utils.unimport_end(mods) if mods is not None (or truthy); apply the same pattern
to the other occurrence at line 71 so unimport_end is always guarded against an
undefined mods value.

Comment on lines +9434 to 9442
message_type: "TronMessageType"

def __init__(
self,
*,
message: "bytes",
address_n: "list[int] | None" = None,
message_type: "TronMessageType | None" = None,
) -> None:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Type mismatch: message_type optional in init, non-optional in field.

🤖 Prompt for AI Agents
In core/src/trezor/messages.py around lines 9434-9442, the class-level
annotation declares message_type as non-optional while the __init__ parameter
makes it optional; change the field to be optional to match the constructor
(e.g., annotate message_type as "TronMessageType | None" or use
Optional[TronMessageType]) and ensure any default value is None so the type
signatures are consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments