Skip to content

Conversation

@somebodyLi
Copy link
Contributor

@somebodyLi somebodyLi commented Dec 29, 2025

  1. fix the tron memory related issue
  2. fix the issue when the client first connect to hardware after creating a new wallet

Summary by CodeRabbit

  • New Features

    • Added support for Pharos network (PROS token, chain ID 1672) for transactions and interactions on this Ethereum-compatible blockchain
    • Enhanced Tron transaction support to handle more complex smart contract operations
  • Improvements

    • Refined internal transaction processing with improved flag handling
  • Chores

    • Version updated to 3.17.0

✏️ Tip: You can customize this high-level summary in your review settings.

1. fix the tron memory related issue
2. fix the issue when the client first connect to hardware after creating a new wallet
@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

Walkthrough

This release adds Pharos (PROS) network support with chain ID 1672, increases Tron message buffer capacity, removes mnemonic storage logic from reset flow, and bumps the version to 3.17.0.

Changes

Cohort / File(s) Summary
Pharos Network Support
legacy/firmware/ethereum_networks.c, legacy/firmware/ethereum_networks_onekey.h.mako, legacy/firmware/ethereum_onekey.h
Added Pharos (PROS) as new Ethereum-compatible network with chain_id 1672 and slip44 1672. Includes network registry entry, chain-name mapping, suffix handling (" PROS"), and slip44 validation across three files. Network count incremented from 11 to 12.
Tron Buffer Expansion
legacy/firmware/messages-tron.options, legacy/firmware/tron.c
Increased cmessage buffer from 1024 to 2560 bytes and TronSignedTx.serialized_tx max size from 2048 to 2946 bytes. Changed serialized TX flag assignment from integer (1) to boolean (true).
Mnemonic Storage Removal
legacy/firmware/reset.c
Removed platform-specific mnemonic storage calls (config_setMnemonic on emulator, se_set_mnemonic on device) from writedown_mnemonic function end. Function now returns after verification and PIN handling without persisting mnemonic.
Version Bump
legacy/firmware/version.h
Updated ONEKEY_VER_MINOR from 16 to 17 and ONEKEY_VERSION string from "3.16.0" to "3.17.0".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change—adding PHAROS EVM chain support—but omits secondary fixes (TRON memory issue, wallet connection issue) mentioned in PR objectives.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 3.17.0

Comment @coderabbitai help to get the list of available commands and usage tips.

@revan-zhang
Copy link
Contributor

revan-zhang commented Dec 29, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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

📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

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.

📥 Commits

Reviewing files that changed from the base of the PR and between e5f0b4d and 292fe5f.

📒 Files selected for processing (7)
  • legacy/firmware/ethereum_networks.c
  • legacy/firmware/ethereum_networks_onekey.h.mako
  • legacy/firmware/ethereum_onekey.h
  • legacy/firmware/protob/messages-tron.options
  • legacy/firmware/reset.c
  • legacy/firmware/tron.c
  • legacy/firmware/version.h
💤 Files with no reviewable changes (1)
  • legacy/firmware/reset.c
🧰 Additional context used
🪛 Clang (14.0.6)
legacy/firmware/ethereum_onekey.h

[warning] 100-100: macro argument should be enclosed in parentheses

(bugprone-macro-parentheses)

🪛 Cppcheck (2.19.0)
legacy/firmware/tron.c

[style] 176-176: The function 'is_mode_unprivileged' is never used.

(unusedFunction)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Defs check
  • GitHub Check: Style check
  • GitHub Check: Gen check
🔇 Additional comments (8)
legacy/firmware/version.h (1)

10-13: LGTM!

Version bump to 3.17.0 is consistent and properly applied to both macro and string.

legacy/firmware/ethereum_onekey.h (1)

99-101: LGTM!

Pharos chain (1672) mapping added correctly and consistently with the existing pattern. The placement maintains numerical order.

Note: Static analysis flags missing parentheses around the chain_name macro parameter (line 100), but this is a pre-existing pattern throughout the macro definition, not introduced by this change.

legacy/firmware/ethereum_networks.c (1)

7-7: LGTM!

Network count correctly incremented to 12 to reflect the new Pharos entry.

legacy/firmware/ethereum_networks_onekey.h.mako (3)

38-39: LGTM!

Pharos (1672) suffix mapping added correctly. The " PROS" suffix matches the symbol defined in ethereum_networks.c.

Note: This change also adds DTT (9798) suffix, which isn't mentioned in the PR objectives. Confirm this is intentional or if it should be a separate change.


48-50: LGTM!

Pharos slip44 (1672) correctly recognized as valid Ethereum-compatible chain.


61-62: LGTM!

Chain-to-slip44 mapping for Pharos (1672 → 1672) is consistent with the network definition.

legacy/firmware/protob/messages-tron.options (1)

25-25: Document the serialized_tx buffer size calculation.

The max_size increased from 2048 to 2946 bytes. Add a comment explaining the breakdown: cmessage buffer (2560 bytes) + capi buffer (64 bytes) + signature (65 bytes) + protobuf field overhead. This clarifies why 2946 was chosen and connects it to the cmessage buffer in tron.c.

legacy/firmware/tron.c (1)

176-176: Stack capacity is adequate for the 2560-byte buffer.

The cmessage buffer allocation of 2560 bytes represents only ~2% of the available 127K stack (128K SRAM minus the 1024-byte safety margin already enforced by the firmware). The firmware's stack limit is set with a 1024-byte safety cushion, and similar large allocations (e.g., unsignedEvent_bytes[2048] in nostr.c) exist elsewhere in the codebase without issues. No further action needed.

Likely an incorrect or invalid review comment.

@somebodyLi somebodyLi merged commit 6a40a9e into master Dec 29, 2025
5 of 8 checks passed
@somebodyLi somebodyLi deleted the 3.17.0 branch December 29, 2025 07:29
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.

5 participants