Skip to content

Fix/kaspa version limit - #477

Merged
wabicai merged 2 commits into
onekeyfrom
fix/kaspaVersionLimit
May 26, 2025
Merged

Fix/kaspa version limit#477
wabicai merged 2 commits into
onekeyfrom
fix/kaspaVersionLimit

Conversation

@ByteZhang1024

@ByteZhang1024 ByteZhang1024 commented May 26, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Enforced stricter device support checks for Kaspa address and transaction signing features, improving firmware compatibility validation.
  • Bug Fixes
    • Updated device model naming and minimum firmware version requirements for Kaspa-related features.
  • Chores
    • Bumped package versions and synchronized dependency versions across multiple packages for improved consistency.

@coderabbitai

coderabbitai Bot commented May 26, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update bumps package versions from 1.0.29 to 1.0.30 across several projects and dependencies. It also tweaks firmware version checks and device model identifiers in Kaspa-related methods, adding stricter compatibility enforcement for certain features.

Changes

File(s) Change Summary
.../electron-example/package.json, .../expo-example/package.json, .../core/package.json, .../hd-ble-sdk/package.json, .../hd-common-connect-sdk/package.json, .../hd-transport-http/package.json, .../hd-transport-lowlevel/package.json, .../hd-transport-react-native/package.json, .../hd-transport-webusb/package.json, .../hd-transport/package.json, .../hd-web-sdk/package.json, .../shared/package.json Bumped version from 1.0.29 to 1.0.30. Updated related dependencies to 1.0.30 where applicable.
core/src/api/BaseMethod.ts Expanded imports. Updated checkFeatureVersionLimit to accept an options argument for strict device support.
core/src/api/kaspa/KaspaGetAddress.ts, core/src/api/kaspa/KaspaSignTransaction.ts Changed device model key from model_classic to model_classic1s. Lowered minimum firmware version. Enforced strict device support in version checks.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant KaspaGetAddress
    participant BaseMethod

    App->>KaspaGetAddress: run()
    KaspaGetAddress->>BaseMethod: checkFeatureVersionLimit(..., { strictCheckDeviceSupport: true })
    BaseMethod-->>KaspaGetAddress: Throws error if device unsupported
    KaspaGetAddress-->>App: Returns address or error
Loading
sequenceDiagram
    participant App
    participant KaspaSignTransaction
    participant BaseMethod

    App->>KaspaSignTransaction: run()
    KaspaSignTransaction->>BaseMethod: checkFeatureVersionLimit(..., { strictCheckDeviceSupport: true })
    BaseMethod-->>KaspaSignTransaction: Throws error if device unsupported
    KaspaSignTransaction-->>App: Returns result or error
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

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

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert (click for details)
Warn Critical
parse-url@6.0.2 has a Critical CVE.

CVE: GHSA-j9fq-vwqv-2fm2 Server-Side Request Forgery (SSRF) in GitHub repository ionicabizau/parse-url (CRITICAL)

Affected versions: < 8.1.0

Patched version: 8.1.0

From: yarn.locknpm/parse-url@6.0.2

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/parse-url@6.0.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between a2cf72c and ecbb291.

📒 Files selected for processing (15)
  • packages/connect-examples/electron-example/package.json (1 hunks)
  • packages/connect-examples/expo-example/package.json (2 hunks)
  • packages/core/package.json (2 hunks)
  • packages/core/src/api/BaseMethod.ts (3 hunks)
  • packages/core/src/api/kaspa/KaspaGetAddress.ts (2 hunks)
  • packages/core/src/api/kaspa/KaspaSignTransaction.ts (2 hunks)
  • packages/hd-ble-sdk/package.json (2 hunks)
  • packages/hd-common-connect-sdk/package.json (2 hunks)
  • packages/hd-transport-http/package.json (2 hunks)
  • packages/hd-transport-lowlevel/package.json (2 hunks)
  • packages/hd-transport-react-native/package.json (2 hunks)
  • packages/hd-transport-webusb/package.json (2 hunks)
  • packages/hd-transport/package.json (1 hunks)
  • packages/hd-web-sdk/package.json (2 hunks)
  • packages/shared/package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/core/src/api/BaseMethod.ts (2)
packages/core/src/types/device.ts (1)
  • DeviceFirmwareRange (132-134)
packages/shared/src/HardwareError.ts (1)
  • HardwareErrorCode (46-410)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint (18.x)
  • GitHub Check: build (18.x)
🔇 Additional comments (23)
packages/hd-transport/package.json (1)

3-3: Version bump looks good.

Clean increment to 1.0.30 aligns with the coordinated release.

packages/core/src/api/BaseMethod.ts (3)

2-6: Import additions support the new error handling.

Added imports for ERRORS and HardwareErrorCode enable the stricter device support checking.


157-163: Good API design for backward compatibility.

Optional options parameter maintains existing behavior while enabling stricter checking when needed.


175-180: Stricter device support checking implemented correctly.

The conditional error throwing uses the appropriate error code and message. Logic is well-guarded and maintains backward compatibility.

packages/shared/package.json (1)

3-3: Version bump consistent with release.

Clean increment aligns with the coordinated package updates.

packages/connect-examples/electron-example/package.json (1)

5-5: Version bump completes coordinated release.

Consistent increment to 1.0.30 matches other packages.

packages/core/package.json (2)

3-3: Sync package version. Bumped "version" to 1.0.30 to match the coordinated release.


28-29: Align dependency versions. Updated @onekeyfe/hd-shared and @onekeyfe/hd-transport to ^1.0.30 for consistency across packages.

packages/hd-transport-webusb/package.json (2)

3-3: Sync package version. Bumped "version" to 1.0.30 to keep in line with the monorepo.


23-24: Align dependency versions. Updated @onekeyfe/hd-shared and @onekeyfe/hd-transport to ^1.0.30 for compatibility.

packages/hd-transport-lowlevel/package.json (2)

3-3: Sync package version. Bumped "version" to 1.0.30 to match other transports.


22-23: Align dependency versions. Raised @onekeyfe/hd-shared and @onekeyfe/hd-transport to ^1.0.30 for consistency.

packages/hd-transport-react-native/package.json (2)

3-3: Sync package version. Updated "version" to 1.0.30 in step with the release.


22-23: Align dependency versions. Upgraded @onekeyfe/hd-shared and @onekeyfe/hd-transport to ^1.0.30 for uniformity.

packages/hd-transport-http/package.json (2)

3-3: Sync package version. Bumped "version" to 1.0.30 to maintain parity.


27-28: Align dependency versions. Updated @onekeyfe/hd-shared and @onekeyfe/hd-transport to ^1.0.30 to stay in sync.

packages/hd-web-sdk/package.json (1)

3-3: LGTM! Clean coordinated version bump.

The package version and all related dependencies are updated consistently from 1.0.29 to 1.0.30.

Also applies to: 24-27

packages/connect-examples/expo-example/package.json (1)

3-3: LGTM! Consistent version bump across dependencies.

All @onekeyfe package dependencies are updated in sync with the main version bump.

Also applies to: 22-25

packages/hd-common-connect-sdk/package.json (1)

3-3: LGTM! Coordinated version update maintained.

Version consistency across the monorepo is properly maintained.

Also applies to: 23-27

packages/hd-ble-sdk/package.json (1)

3-3: LGTM! Final package version bump is consistent.

All dependency versions are properly aligned with the main version update.

Also applies to: 23-25

packages/core/src/api/kaspa/KaspaSignTransaction.ts (2)

100-102: Device model key corrected and firmware requirement relaxed.

The device model key change from model_classic to model_classic1s appears to be a naming correction. The firmware version requirement was lowered from '3.13.0' to '3.12.0'.

Please verify that firmware version '3.12.0' properly supports the tweak functionality to avoid compatibility issues.


150-157: Good addition of strict device support checking.

Adding strictCheckDeviceSupport: true improves error handling by enforcing stricter compatibility checks when tweak functionality is disabled.

packages/core/src/api/kaspa/KaspaGetAddress.ts (1)

72-76:

Details

✅ Verification successful

Verify BaseMethod supports the new strictCheckDeviceSupport option.

The addition of strictCheckDeviceSupport: true enforces stricter device compatibility checks. This looks correct but needs verification that BaseMethod.checkFeatureVersionLimit accepts this option.


🏁 Script executed:

#!/bin/bash
# Verify BaseMethod.checkFeatureVersionLimit supports the strictCheckDeviceSupport option
ast-grep --pattern 'checkFeatureVersionLimit($$$) {
  $$$
}'

# Also check for the options parameter definition
rg -A 10 "checkFeatureVersionLimit.*options" --type ts

Length of output: 119


🏁 Script executed:

#!/bin/bash
# Locate the BaseMethod class definition
rg -n "class BaseMethod" --type ts

# Find where checkFeatureVersionLimit is declared or defined
rg -n "checkFeatureVersionLimit" --type ts

Length of output: 772


🏁 Script executed:

#!/bin/bash
# Show the checkFeatureVersionLimit method signature and parameter list
rg -n "protected checkFeatureVersionLimit" -A 8 -B 2 packages/core/src/api/BaseMethod.ts

Length of output: 373


Approve strictCheckDeviceSupport usage

The checkFeatureVersionLimit method in BaseMethod already declares an optional strictCheckDeviceSupport?: boolean parameter:

• packages/core/src/api/BaseMethod.ts (lines 159–163)

No further changes needed.

Comment thread packages/core/src/api/kaspa/KaspaGetAddress.ts
@wabicai
wabicai self-requested a review May 26, 2025 03:29
@wabicai
wabicai merged commit e7d0b54 into onekey May 26, 2025
@wabicai
wabicai deleted the fix/kaspaVersionLimit branch May 26, 2025 03:31
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.

2 participants