Skip to content

Fix BITCOIN_ONLY version issue.#136

Merged
lihuanhuan merged 1 commit intoOneKeyHQ:masterfrom
lihuanhuan:classic1s
Apr 3, 2025
Merged

Fix BITCOIN_ONLY version issue.#136
lihuanhuan merged 1 commit intoOneKeyHQ:masterfrom
lihuanhuan:classic1s

Conversation

@lihuanhuan
Copy link
Contributor

@lihuanhuan lihuanhuan commented Apr 1, 2025

Summary by CodeRabbit

  • New Features

    • Firmware builds now offer configurable options—including a dedicated bitcoin-only mode that adjusts firmware naming and available functionalities.
    • Full-mode builds now feature an enhanced security menu option for FIDO keys, improving user authentication access.
    • New message types for Solana and Benfen protocols have been introduced, expanding the functionality for off-chain message handling.
  • Chores

    • The build process has been updated with a flexible configuration strategy and improved automation, including streamlined notifications and versioning for smoother release management.

@coderabbitai
Copy link

coderabbitai bot commented Apr 1, 2025

Walkthrough

This pull request updates the build workflow and firmware configuration to support multiple build configurations using a matrix. It adds new jobs and outputs for firmware building and Slack notifications. The changes implement conditional logic throughout the firmware source and Makefiles based on the BITCOIN_ONLY flag, affecting file naming, object file inclusion, and feature availability. Additionally, minor script modifications include commenting out certain build commands and updating the cpp invocation in the version script.

Changes

File(s) Summary of Changes
.github/workflows/build-classic1s.yml Updated build workflow: changed runs-on from ubuntu-20.04 to ubuntu-latest, added a matrix strategy, new job "Build Classic1S", introduced multiple output variables, and added the notify-slack job for sending Slack notifications.
legacy/firmware/Makefile,
legacy/firmware/protob/Makefile
Modified build configuration based on BITCOIN_ONLY: updated NAME with conditional assignments; adjusted object files inclusion in the Makefile; expanded SKIPPED_MESSAGES list with additional entries when BITCOIN_ONLY is set.
legacy/firmware/menu_list.c,
legacy/firmware/protect.c,
legacy/firmware/usb.c
Introduced conditional compilation blocks using #if !BITCOIN_ONLY to control inclusion of resident credential functionality, modify protectWaitKey logic, and conditionally compile USB U2F functions and I2C handling.
legacy/script/cibuild Commented out the make commands for the intermediate_fw directory, thereby disabling the execution of these commands under certain conditions.
tools/version.sh Updated the cpp invocation to use the full path /usr/bin/cpp instead of relying on the system PATH.

Sequence Diagram(s)

sequenceDiagram
    participant B as Build Job (build-classic1s)
    participant N as Notification Job (notify-slack)
    participant S as Slack API

    B->>N: Complete build with output variables
    N->>S: Send Slack notification with build details
    S-->>N: Acknowledge notification
Loading

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or 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

Documentation and Community

  • 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.

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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b3cbd7 and 4d8d2d8.

📒 Files selected for processing (8)
  • .github/workflows/build-classic1s.yml (3 hunks)
  • legacy/firmware/Makefile (2 hunks)
  • legacy/firmware/menu_list.c (3 hunks)
  • legacy/firmware/protect.c (1 hunks)
  • legacy/firmware/protob/Makefile (1 hunks)
  • legacy/firmware/usb.c (3 hunks)
  • legacy/script/cibuild (1 hunks)
  • tools/version.sh (1 hunks)
🧰 Additional context used
🧬 Code Definitions (3)
legacy/firmware/menu_list.c (2)
legacy/firmware/menu_para.c (2)
  • menu_para_passphrase (50-54)
  • menu_para_passphrase_index (108-112)
legacy/firmware/menu_para.h (2)
  • menu_para_passphrase (10-10)
  • menu_para_passphrase_index (20-20)
legacy/firmware/usb.c (3)
legacy/firmware/fido2/ctap_trans.c (3)
  • get_ble_fido_data_ptr (1312-1312)
  • set_ble_fido_data_len (1310-1310)
  • ctap_ble_cmd (1694-1733)
legacy/firmware/fido2/ctap_trans.h (3)
  • get_ble_fido_data_ptr (74-74)
  • set_ble_fido_data_len (75-75)
  • ctap_ble_cmd (72-72)
legacy/trans_fifo.c (1)
  • fifo_read_lock (66-82)
legacy/firmware/protect.c (2)
legacy/firmware/layout2.c (1)
  • layoutScreensaver (289-298)
legacy/firmware/layout2.h (1)
  • layoutScreensaver (57-57)
🪛 Shellcheck (0.10.0)
tools/version.sh

[info] 7-7: Double quote to prevent globbing and word splitting.

(SC2086)

🪛 actionlint (1.7.4)
.github/workflows/build-classic1s.yml

61-61: shellcheck reported issue in this script: SC2086:info:2:3: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 YAMLlint (1.35.1)
.github/workflows/build-classic1s.yml

[error] 64-64: trailing spaces

(trailing-spaces)


[error] 67-67: trailing spaces

(trailing-spaces)


[error] 101-101: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)


[error] 105-105: trailing spaces

(trailing-spaces)


[error] 132-132: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Gen check
  • GitHub Check: Defs check
🔇 Additional comments (13)
legacy/firmware/protob/Makefile (1)

17-18: Correctly adds new cryptocurrencies to BITCOIN_ONLY skip list

This change properly extends the list of skipped messages for BITCOIN_ONLY mode to include Cardano, Scdo, Nostr, Tron, Ripple, and Lnurl. This ensures these non-Bitcoin cryptocurrencies are excluded when BITCOIN_ONLY=1.

legacy/firmware/Makefile (1)

10-14: Correct conditional naming for BITCOIN_ONLY builds

The firmware name now correctly indicates "bc-only" when BITCOIN_ONLY=1, making Bitcoin-only builds easily identifiable.

legacy/firmware/protect.c (1)

810-817: Correctly conditioned U2F functionality for non-Bitcoin builds

Added appropriate conditional compilation directive to exclude U2F handler code from Bitcoin-only builds. This ensures U2F functionality is only included when needed.

legacy/firmware/usb.c (2)

452-460: Appropriate conditional compilation for FIDO functionality

Good addition of #if !BITCOIN_ONLY conditional to exclude FIDO-specific code when building the Bitcoin-only version. This helps reduce binary size and remove unused functionality.


570-584: Proper conditional compilation of U2F data sending function

Wrapping the usb_u2f_data_send function in #if !BITCOIN_ONLY correctly excludes this function from Bitcoin-only builds where U2F functionality isn't needed.

🧰 Tools
🪛 Cppcheck (2.10-2)

[style] 571-571: The function 'usb_u2f_data_send' is never used.

(unusedFunction)

legacy/firmware/menu_list.c (3)

20-23: Good conditional inclusion of FIDO credentials

Properly wrapped the FIDO2 header inclusion and resident_credential_refresh variable in #if !BITCOIN_ONLY condition to exclude from Bitcoin-only builds.


374-505: Appropriate conditional compilation of FIDO2 resident credential functions

Correctly wrapped the entire FIDO2 resident credential implementation in #if !BITCOIN_ONLY conditional. This eliminates unnecessary code from Bitcoin-only firmware builds.


512-515: Proper conditional inclusion of FIDO menu item

Good job conditionally including the "FIDO Keys" menu item only when not in Bitcoin-only mode. This ensures the menu structure remains consistent with available functionality.

.github/workflows/build-classic1s.yml (5)

10-33: Well-structured build matrix setup

Good implementation of build matrix to generate different firmware variants (prod/qa and with/without Bitcoin-only support). The naming scheme with descriptive artifact suffixes will help distinguish the builds.


42-58: Improved variable population and outputs

Simplified firmware version extraction with awk and properly set up output variables that can be used by dependent jobs.


68-80: Good conditional build configuration

Well-structured conditional build configuration based on matrix values. The approach makes it clear which environment variables are set for each build type.


85-104: Well-implemented build artifact handling

Good conditional logic for handling different artifact types based on build configuration. The approach ensures correct file naming and hash generation.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 101-101: trailing spaces

(trailing-spaces)


[error] 103-103: trailing spaces

(trailing-spaces)


[error] 104-104: trailing spaces

(trailing-spaces)


112-131: Well-structured Slack notification job

Good addition of a notification job that reuses outputs from the build job. This keeps the notification logic separate from the build logic.

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: 9

🔭 Outside diff range comments (1)
core/src/trezor/enums/__init__.py (1)

731-736: ⚠️ Potential issue

Move Ton-specific enums inside the BITCOIN_ONLY check

These Ton-specific enum classes should be conditionally included based on the BITCOIN_ONLY flag.

if TYPE_CHECKING:
-    class TonWalletVersion(IntEnum):
-        V4R2 = 3
-
-    class TonWorkChain(IntEnum):
-        BASECHAIN = 0
-        MASTERCHAIN = 1

Suggested implementation:

if TYPE_CHECKING:
    if not utils.BITCOIN_ONLY:
        class TonWalletVersion(IntEnum):
            V4R2 = 3

        class TonWorkChain(IntEnum):
            BASECHAIN = 0
            MASTERCHAIN = 1
♻️ Duplicate comments (3)
tools/version.sh (1)

7-7: 🧹 Nitpick (assertive)

Good change to use absolute path for cpp

Using the full path /usr/bin/cpp ensures consistent behavior across environments, eliminating potential PATH-related issues.

You should also add double quotes around the variable reference to prevent word splitting:

-echo "VERSION_MAJOR.VERSION_MINOR.VERSION_PATCH" | /usr/bin/cpp -include $1 -nostdinc -P | tr -d " "
+echo "VERSION_MAJOR.VERSION_MINOR.VERSION_PATCH" | /usr/bin/cpp -include "$1" -nostdinc -P | tr -d " "
🧰 Tools
🪛 Shellcheck (0.10.0)

[info] 7-7: Double quote to prevent globbing and word splitting.

(SC2086)

legacy/script/cibuild (1)

35-36: 🧹 Nitpick (assertive)

Add comment explaining why these steps are disabled

The intermediate firmware build steps have been commented out, but there's no explanation why. Add a brief comment to help future developers understand the reason.

-    # make -C intermediate_fw
-    # make -C intermediate_fw sign
+    # Disabled intermediate firmware build for BITCOIN_ONLY compatibility
+    # make -C intermediate_fw
+    # make -C intermediate_fw sign
legacy/firmware/Makefile (1)

90-91: ⚠️ Potential issue

Move Bitcoin-specific objects into conditional block

These Bitcoin-specific object files should be conditionally included based on BITCOIN_ONLY like other crypto-specific objects.

Apply this fix:

-OBJS += psbt/psbt.o
-OBJS += bip322_simple/bip322_simple.o
+ifdef BITCOIN_ONLY
+OBJS += psbt/psbt.o
+OBJS += bip322_simple/bip322_simple.o
+endif
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 4d8d2d8 and c2e1e2e.

📒 Files selected for processing (20)
  • .github/workflows/build-classic1s.yml (3 hunks)
  • core/src/all_modules.py (2 hunks)
  • core/src/apps/ethereum/networks.py (19 hunks)
  • core/src/trezor/enums/CardanoCertificateType.py (1 hunks)
  • core/src/trezor/enums/CardanoDRepType.py (1 hunks)
  • core/src/trezor/enums/CardanoTxAuxiliaryDataSupplementType.py (1 hunks)
  • core/src/trezor/enums/MessageType.py (2 hunks)
  • core/src/trezor/enums/SolanaOffChainMessageFormat.py (1 hunks)
  • core/src/trezor/enums/SolanaOffChainMessageVersion.py (1 hunks)
  • core/src/trezor/enums/__init__.py (5 hunks)
  • core/src/trezor/messages.py (16 hunks)
  • legacy/firmware/Makefile (2 hunks)
  • legacy/firmware/menu_list.c (3 hunks)
  • legacy/firmware/protect.c (1 hunks)
  • legacy/firmware/protob/Makefile (1 hunks)
  • legacy/firmware/usb.c (3 hunks)
  • legacy/script/cibuild (1 hunks)
  • python/src/trezorlib/cli/sol.py (1 hunks)
  • python/src/trezorlib/messages.py (21 hunks)
  • tools/version.sh (1 hunks)
🧰 Additional context used
🧬 Code Definitions (8)
legacy/firmware/menu_list.c (2)
legacy/firmware/menu_para.c (2)
  • menu_para_passphrase (50-54)
  • menu_para_passphrase_index (108-112)
legacy/firmware/menu_para.h (2)
  • menu_para_passphrase (10-10)
  • menu_para_passphrase_index (20-20)
legacy/firmware/protect.c (2)
legacy/firmware/layout2.c (1)
  • layoutScreensaver (289-298)
legacy/firmware/layout2.h (1)
  • layoutScreensaver (57-57)
legacy/firmware/usb.c (3)
legacy/firmware/fido2/ctap_trans.c (3)
  • get_ble_fido_data_ptr (1312-1312)
  • set_ble_fido_data_len (1310-1310)
  • ctap_ble_cmd (1694-1733)
legacy/firmware/fido2/ctap_trans.h (3)
  • get_ble_fido_data_ptr (74-74)
  • set_ble_fido_data_len (75-75)
  • ctap_ble_cmd (72-72)
legacy/trans_fifo.c (1)
  • fifo_read_lock (66-82)
core/src/all_modules.py (2)
core/src/trezor/enums/__init__.py (7)
  • SolanaOffChainMessageFormat (701-703)
  • SolanaOffChainMessageVersion (698-699)
  • TonWalletVersion (731-732)
  • TonWorkChain (734-736)
  • CardanoCVoteRegistrationFormat (562-564)
  • CardanoCertificateType (538-545)
  • CardanoDRepType (547-551)
python/src/trezorlib/messages.py (7)
  • SolanaOffChainMessageFormat (751-753)
  • SolanaOffChainMessageVersion (747-748)
  • TonWalletVersion (787-788)
  • TonWorkChain (791-793)
  • CardanoCVoteRegistrationFormat (588-590)
  • CardanoCertificateType (560-567)
  • CardanoDRepType (570-574)
core/src/trezor/enums/MessageType.py (1)
core/src/trezor/messages.py (15)
  • SolanaSignOffChainMessage (7442-7462)
  • SolanaMessageSignature (7480-7494)
  • SolanaSignUnsafeMessage (7464-7478)
  • BenfenGetAddress (420-434)
  • BenfenAddress (436-448)
  • BenfenSignTx (450-470)
  • BenfenSignedTx (472-486)
  • BenfenSignMessage (520-534)
  • BenfenMessageSignature (536-550)
  • BenfenTxRequest (488-504)
  • BenfenTxAck (506-518)
  • NeoGetAddress (6674-6688)
  • NeoAddress (6690-6704)
  • NeoSignTx (6706-6722)
  • NeoSignedTx (6724-6738)
core/src/trezor/enums/__init__.py (1)
core/src/trezor/messages.py (15)
  • SolanaSignOffChainMessage (7442-7462)
  • SolanaMessageSignature (7480-7494)
  • SolanaSignUnsafeMessage (7464-7478)
  • BenfenGetAddress (420-434)
  • BenfenAddress (436-448)
  • BenfenSignTx (450-470)
  • BenfenSignedTx (472-486)
  • BenfenSignMessage (520-534)
  • BenfenMessageSignature (536-550)
  • BenfenTxRequest (488-504)
  • BenfenTxAck (506-518)
  • NeoGetAddress (6674-6688)
  • NeoAddress (6690-6704)
  • NeoSignTx (6706-6722)
  • NeoSignedTx (6724-6738)
python/src/trezorlib/messages.py (2)
core/src/trezor/messages.py (12)
  • SolanaSignOffChainMessage (7442-7462)
  • SolanaMessageSignature (7480-7494)
  • SolanaSignUnsafeMessage (7464-7478)
  • BenfenGetAddress (420-434)
  • BenfenAddress (436-448)
  • BenfenSignTx (450-470)
  • BenfenSignedTx (472-486)
  • BenfenSignMessage (520-534)
  • BenfenMessageSignature (536-550)
  • BenfenTxRequest (488-504)
  • BenfenTxAck (506-518)
  • CardanoDRep (2126-2142)
core/src/trezor/enums/__init__.py (5)
  • CardanoDRepType (547-551)
  • CardanoCVoteRegistrationFormat (562-564)
  • SolanaOffChainMessageVersion (698-699)
  • SolanaOffChainMessageFormat (701-703)
  • MessageType (23-415)
core/src/trezor/messages.py (2)
python/src/trezorlib/messages.py (14)
  • CardanoCVoteRegistrationFormat (588-590)
  • CardanoCertificateType (560-567)
  • CardanoDRepType (570-574)
  • SolanaOffChainMessageFormat (751-753)
  • SolanaOffChainMessageVersion (747-748)
  • BenfenGetAddress (1173-1187)
  • MessageType (31-423)
  • BenfenSignTx (1204-1227)
  • BenfenSignedTx (1230-1244)
  • CardanoDRep (3393-3410)
  • CardanoTxCertificate (3413-3445)
  • CardanoCVoteRegistrationDelegation (3471-3485)
  • CardanoCVoteRegistrationParametersType (3488-3520)
  • CardanoTxAuxiliaryData (3523-3537)
core/src/trezor/enums/__init__.py (6)
  • CardanoCVoteRegistrationFormat (562-564)
  • CardanoCertificateType (538-545)
  • CardanoDRepType (547-551)
  • SolanaOffChainMessageFormat (701-703)
  • SolanaOffChainMessageVersion (698-699)
  • MessageType (23-415)
🪛 Shellcheck (0.10.0)
tools/version.sh

[info] 7-7: Double quote to prevent globbing and word splitting.

(SC2086)

🪛 actionlint (1.7.4)
.github/workflows/build-classic1s.yml

61-61: shellcheck reported issue in this script: SC2086:info:2:3: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 Ruff (0.8.2)
python/src/trezorlib/messages.py

1175-1178: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1186-1186: Remove quotes from type annotation

Remove quotes

(UP037)


1192-1194: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1206-1212: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1223-1223: Remove quotes from type annotation

Remove quotes

(UP037)


1232-1235: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1249-1253: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1269-1271: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1283-1286: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


1294-1294: Remove quotes from type annotation

Remove quotes

(UP037)


1300-1303: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3395-3399: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3438-3438: Remove quotes from type annotation

Remove quotes

(UP037)


3473-3476: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3490-3499: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3513-3513: Remove quotes from type annotation

Remove quotes

(UP037)


3514-3514: Remove quotes from type annotation

Remove quotes

(UP037)


3525-3528: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3707-3707: Remove quotes from type annotation

Remove quotes

(UP037)


8485-8488: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


8496-8496: Remove quotes from type annotation

Remove quotes

(UP037)


8502-8505: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


8519-8523: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


8532-8532: Remove quotes from type annotation

Remove quotes

(UP037)


8539-8542: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


9315-9321: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


9332-9332: Remove quotes from type annotation

Remove quotes

(UP037)


9341-9344: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


9352-9352: Remove quotes from type annotation

Remove quotes

(UP037)


9358-9361: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)

core/src/trezor/messages.py

27-27: Unused noqa directive (unused: F401)

Remove unused noqa directive

(RUF100)


28-28: Unused noqa directive (unused: F401)

Remove unused noqa directive

(RUF100)


29-29: Unused noqa directive (unused: F401)

Remove unused noqa directive

(RUF100)


62-62: Unused noqa directive (unused: F401)

Remove unused noqa directive

(RUF100)


63-63: Unused noqa directive (unused: F401)

Remove unused noqa directive

(RUF100)


433-433: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


447-447: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


469-469: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


485-485: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


503-503: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


517-517: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


533-533: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


549-549: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


2141-2141: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


2205-2205: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


2233-2233: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6687-6687: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6703-6703: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6721-6721: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6737-6737: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7439-7439: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7461-7461: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7477-7477: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7493-7493: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Gen check
  • GitHub Check: Defs check
🔇 Additional comments (66)
legacy/firmware/protob/Makefile (1)

17-18: Updated BITCOIN_ONLY exclusion list

The list of skipped messages for BITCOIN_ONLY mode has been expanded to include additional cryptocurrency types. This matches the overall objective of creating a Bitcoin-only firmware version.

legacy/firmware/protect.c (1)

810-817: Appropriate BITCOIN_ONLY conditional check

Adding the conditional compilation directive ensures this U2F-related code is excluded from Bitcoin-only builds. This helps reduce firmware size and streamlines functionality for Bitcoin-only devices.

The change correctly guards the screen saver and U2F command handling logic that would be unnecessary in a Bitcoin-only firmware.

legacy/firmware/Makefile (1)

10-14: Good conditional naming for Bitcoin-only builds.

The conditional naming convention helps users identify Bitcoin-only firmware builds by adding the bc-only suffix. This clearly distinguishes between the two build types.

legacy/firmware/usb.c (2)

452-460: Appropriate conditional for FIDO functionality

Properly excluding FIDO-related code when in Bitcoin-only mode ensures a cleaner build and smaller firmware size.


570-584: Good separation of U2F functionality

Conditionally excluding the usb_u2f_data_send function in Bitcoin-only builds aligns with the design goal of limiting functionality to just Bitcoin features.

🧰 Tools
🪛 Cppcheck (2.10-2)

[style] 571-571: The function 'usb_u2f_data_send' is never used.

(unusedFunction)

legacy/firmware/menu_list.c (3)

20-23: Proper conditional inclusion of FIDO headers and variables

Correctly wrapping FIDO-related include and variables in the conditional block ensures they're only compiled when needed.


374-505: Appropriate conditional for FIDO resident credential functionality

The FIDO credential management code is properly excluded from Bitcoin-only builds, reducing code size and simplifying the firmware.


512-515: Correctly removed FIDO menu item in Bitcoin-only mode

The menu item is properly excluded when in Bitcoin-only mode, ensuring users don't see options that aren't available.

.github/workflows/build-classic1s.yml (8)

10-33: Well-structured matrix build strategy

The matrix approach efficiently handles multiple build configurations (regular/Bitcoin-only and prod/qa). The defined outputs will help downstream jobs access build information.


43-43: Improved version extraction

Using awk for version extraction simplifies the command and makes it more readable.


51-58: Good job exposing build variables as outputs

Setting build information as both environment variables and job outputs makes the data accessible to downstream jobs (like the notification job).


68-80: Clean conditional logic for build configuration

The script clearly sets the appropriate environment variables based on matrix configuration options.


85-96: Appropriate conditional signing process

The QA build signing process is properly conditioned and uses secrets securely.


98-104: Proper artifact handling based on build type

The conditional logic correctly handles bootloader artifacts only for non-Bitcoin-only builds.


112-131: Useful Slack notification integration

The notification job effectively uses the outputs from the build job to send contextual information to Slack.


132-133: 🧹 Nitpick (assertive)

Add newline at end of file

YAML files should end with a newline character.

Add a newline at the end of the file.

 change-log: 'firmware@${{ env.FIRMWARE_VERSION }} / boot@${{ env.BOOT_VERSION }}'
 custom-issue-url: ''
+
core/src/trezor/enums/CardanoDRepType.py (1)

1-8: Looks good: Clean enum implementation for Cardano DRep types.

The constants use clear, descriptive names and follow Python naming conventions for constants. The sequential numbering (0-3) provides a logical structure for the enum values.

core/src/apps/ethereum/networks.py (15)

118-118: Network name updated for clarity.

The rename from "Ethereum Classic Testnet Kotti" to "Kotti Testnet" is more concise.


181-181: Network name clarification.

Renaming "Flare Testnet Coston" to "Songbird Testnet Coston" better reflects the network's identity.


237-237: Simplified network name.

"Rootstock" is the preferred name for what was previously labeled "RSK".


244-244: Network name consistency update.

Changed from "RSK Testnet" to "Rootstock Testnet" for consistency with the main network name change.


363-363: Clearer testnet naming.

The rename from "Ethereum Classic Testnet Morden" to "Morden Testnet" removes redundancy.


370-370: More concise testnet name.

Similar to other changes, "Mordor Testnet" is clearer than "Ethereum Classic Testnet Mordor".


1166-1166: Updated slip44 value for testnet.

Changed slip44 value from 60 to 1 for Moonbase Alpha, which is the standard value for testnets.


1413-1413: Network name simplification.

Changing from "Kava EVM" to just "Kava" makes the name more straightforward.


1971-1971: Corrected slip44 value.

Updated slip44 from 60 to 1 for Atelier network, which appears to be a testnet.


2071-2071: More descriptive network name.

"Wireshape Floripa Testnet" provides better context than just "Floripa".


2127-2127: Network name enhancement.

Adding "Network" to "eSync" creates a more complete name.


2160-2160: Testnet slip44 value update.

Changed slip44 from 60 to 1 for Firenze test network.


2356-2356: Standardized testnet slip44.

Updated slip44 to 1 for Kekchain testnet, aligning with convention.


2524-2524: Fixed testnet slip44 value.

Set slip44 to 1 for maistestsubnet, following the standard for test networks.


2565-2590: Updated slip44 for Harmony networks.

Changed slip44 to 1023 for all Harmony network entries, reflecting the correct coin type.

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

1-5: Clean version constant for Solana off-chain messages.

Adds a clear version identifier constant for Solana off-chain message handling. The version starts at 0, allowing for future versioning.

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

1-6: Appropriate format constants for Solana messages.

Defines two message format options for version 0 of Solana off-chain messages:

  1. Restricted ASCII (value 0)
  2. Limited UTF8 (value 1)

These constants provide clear encoding options for message handling.

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

22-22: Good addition of explicit import

Adding the explicit base58 import is good. It's used in the sign_tx function (line 57), so this improves code clarity.

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

6-6:

Details

✅ Verification successful

Renamed constant for clarity

Renaming from GOVERNANCE_REGISTRATION_SIGNATURE to CVOTE_REGISTRATION_SIGNATURE matches other changes in the codebase. This improves consistency in Cardano-related terminology.


🏁 Script executed:

#!/bin/bash
# Check if this constant is properly handled in BITCOIN_ONLY configurations
rg -p "CVOTE_REGISTRATION_SIGNATURE" --type py
rg -p "BITCOIN_ONLY.*CardanoTxAuxiliaryDataSupplementType" --type py

Length of output: 369


Renamed constant verified for clarity and consistency.

  • The constant is correctly renamed to CVOTE_REGISTRATION_SIGNATURE across the codebase (found in core/src/trezor/enums/CardanoTxAuxiliaryDataSupplementType.py, python/src/trezorlib/messages.py, and core/src/trezor/enums/__init__.py).
  • The BITCOIN_ONLY configuration check returned no matches, which is expected for Cardano-specific logic.
core/src/trezor/enums/CardanoCertificateType.py (1)

9-11:

Details

❓ Verification inconclusive

Added new certificate types

Added three new certificate types for Cardano Conway features and vote delegation. This expands functionality for Cardano blockchain operations.


🏁 Script executed:

#!/bin/bash
# Verify these new constants are properly handled in BITCOIN_ONLY configurations
rg -p "STAKE_REGISTRATION_CONWAY|STAKE_DEREGISTRATION_CONWAY|VOTE_DELEGATION" --type py
rg -p "BITCOIN_ONLY.*CardanoCertificateType" --type py

Length of output: 577


Action: Verify BITCOIN_ONLY Handling for New Cardano Certificate Constants

The new constants for Cardano Conway and vote delegation appear in the expected files:

  • python/src/trezorlib/messages.py shows the new constants at lines 565–567.
  • core/src/trezor/enums/CardanoCertificateType.py and core/src/trezor/enums/__init__.py correctly list these constants.
  • The BITCOIN_ONLY search returned no hits, which suggests these Cardano-specific constants aren’t mistakenly active in Bitcoin-only contexts. Please confirm that this outcome is intentional.
python/src/trezorlib/messages.py (14)

283-285: New Solana message types added.

These message types enable off-chain message signing capabilities for Solana blockchain, including both safe and unsafe message handling.


411-422: Added support for Benfen and Neo blockchains.

Clean implementation of message types for two new blockchains.


565-574: Added Cardano Conway governance support.

New stake operations and DRep types support Cardano's governance features.


585-590: Enhanced Cardano transaction auxiliary data.

Added support for vote registration signatures, consistent with Conway governance features.


747-753: Added Solana message format enums.

These enums properly support the new Solana message signing capabilities.


3023-3023: Added chunkify option to Cardano address.

This field allows breaking large data into smaller chunks for processing.

Also applies to: 3034-3034, 3041-3041


3119-3120: Added chunkify and CBOR tagging options to Cardano transactions.

These options improve processing of large transactions and structure tagging.

Also applies to: 3147-3148, 3171-3172


3393-3411: Added Cardano DRep message type.

New message type supports Conway governance, matching the DRep enum added earlier.

🧰 Tools
🪛 Ruff (0.8.2)

3395-3399: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3422-3423: Added deposit and DRep fields to Cardano certificates.

These fields properly support Conway governance stake operations.

Also applies to: 3435-3436, 3444-3445


3471-3537: Enhanced Cardano vote registration.

Updated field names and added support for delegation parameters, format options, and payment addresses.

🧰 Tools
🪛 Ruff (0.8.2)

3473-3476: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3490-3499: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3513-3513: Remove quotes from type annotation

Remove quotes

(UP037)


3514-3514: Remove quotes from type annotation

Remove quotes

(UP037)


3525-3528: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


3614-3614: Added vote registration signature field.

This completes the Cardano governance implementation for transaction auxiliary data.

Also applies to: 3622-3622, 3626-3626


3695-3695: Added address type to Cardano message signing.

Provides additional context for the signing operation.

Also applies to: 3705-3705, 3711-3711


9271-9271: Updated Solana address and signature fields.

Made these fields required for better type safety.

Also applies to: 9277-9277, 9302-9302, 9308-9308


9313-9371: Implemented Solana message signing types.

Complete implementation of off-chain and unsafe message signing capabilities with proper format options.

🧰 Tools
🪛 Ruff (0.8.2)

9315-9321: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


9332-9332: Remove quotes from type annotation

Remove quotes

(UP037)


9341-9344: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)


9352-9352: Remove quotes from type annotation

Remove quotes

(UP037)


9358-9361: Mutable class attributes should be annotated with typing.ClassVar

(RUF012)

core/src/all_modules.py (1)

372-377: Cardano enums correctly placed in conditional block

These Cardano enum imports are correctly placed inside the if not utils.BITCOIN_ONLY: block, which aligns with the PR goal of fixing BITCOIN_ONLY version issues.

core/src/trezor/enums/__init__.py (3)

543-551: Cardano certificate types correctly placed in conditional structure

These Cardano enum additions are correctly placed inside the TYPE_CHECKING block where other Cardano-related types exist. Since they appear within the CardanoCertificateType and CardanoDRepType classes that would only be included when BITCOIN_ONLY is false, this implementation is correct.


560-560: Enum value rename is correctly implemented

Renaming GOVERNANCE_REGISTRATION_SIGNATURE to CVOTE_REGISTRATION_SIGNATURE maintains the same enum value while updating its name to better reflect its purpose. This change is correctly placed within the conditional structure.


562-564: Enum class rename is correctly implemented

Renaming CardanoGovernanceRegistrationFormat to CardanoCVoteRegistrationFormat maintains consistency with the previous enum value rename. This change is correctly placed inside the conditional structure.

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

420-551: Good addition of Benfen blockchain support.

The implementation follows the same pattern as other blockchain protocols in this file. Methods and class structures are consistent with the codebase.

🧰 Tools
🪛 Ruff (0.8.2)

433-433: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


447-447: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


469-469: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


485-485: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


503-503: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


517-517: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


533-533: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


549-549: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


1810-1810: Support for chunked address operations in Cardano.

Adding the chunkify parameter enables chunked operations for Cardano address handling, which helps with memory-constrained operations.

Also applies to: 1820-1820


1898-1899: Enhanced transaction processing in Cardano.

Adding chunkify and tag_cbor_sets parameters improves memory efficiency and CBOR set handling for Cardano transactions.

Also applies to: 1925-1926


2126-2143: New structure for Cardano DRep support.

The CardanoDRep class properly implements the necessary fields and types for Cardano delegation representatives.

🧰 Tools
🪛 Ruff (0.8.2)

2141-2141: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


2151-2152: Enhanced Cardano certificate functionality.

The addition of deposit and drep fields to CardanoTxCertificate enables stake delegation and voting capabilities.

Also applies to: 2164-2164


2192-2207: Renamed governance to CVote for Cardano.

Good refactoring to align with Cardano naming conventions. Updated class and field names maintain functionality while following standard Cardano terminology.

Also applies to: 2208-2234, 2237-2243, 2323-2330

🧰 Tools
🪛 Ruff (0.8.2)

2205-2205: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


2403-2412: Enhanced Cardano message signing.

Added optional address_type field to CardanoSignMessage for flexibility in address handling.


6674-6739: Added Neo blockchain support.

Complete implementation with address, signing, and transaction handling capabilities. Structure follows the established pattern used for other blockchains.

🧰 Tools
🪛 Ruff (0.8.2)

6687-6687: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6703-6703: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6721-6721: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


6737-6737: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7399-7400: Solana address and signed transaction updates.

Minor formatting changes maintain the functionality while improving code readability.

Also applies to: 7429-7430


7442-7495: Added Solana off-chain messaging support.

Comprehensive implementation of off-chain messaging capabilities with proper versioning and format handling.

🧰 Tools
🪛 Ruff (0.8.2)

7461-7461: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7477-7477: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


7493-7493: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


433-549: Dynamically typed expressions in method return types.

Static analysis flags dynamic typing with Any in several type guard methods. While not a functional issue, it's worth noting for future type safety improvements.

Consider using more specific return types when possible to improve type safety throughout the codebase.

Also applies to: 2141-2233, 6687-6737, 7439-7493

🧰 Tools
🪛 Ruff (0.8.2)

433-433: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


447-447: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


469-469: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


485-485: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


503-503: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


517-517: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


533-533: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)


549-549: Dynamically typed expressions (typing.Any) are disallowed in msg

(ANN401)

@lihuanhuan lihuanhuan merged commit 8811c10 into OneKeyHQ:master Apr 3, 2025
3 of 6 checks passed
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.

3 participants