Skip to content

fix: HWB197 (24544) fix ledger transaction speedup and cancel#24745

Merged
dawnseeker8 merged 17 commits into
mainfrom
fix/24544-fix-ledger-transaction-speedup-and-cancel
Feb 20, 2026
Merged

fix: HWB197 (24544) fix ledger transaction speedup and cancel#24745
dawnseeker8 merged 17 commits into
mainfrom
fix/24544-fix-ledger-transaction-speedup-and-cancel

Conversation

@dawnseeker8

@dawnseeker8 dawnseeker8 commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fix the ledger transaction speedup and cancel not able to run issue.
The root clause of this issue was caused by when we introduce the new unified transaction view and we forgot to check account is ledger devices or not, and didn't handle ledger differently because ledger require BLE approve to trigger the speed up and cancl transaction.

If you look at legacy behavior defined in Transaction/index.js file which has this code to handle ledger device check and then do speedup and cancel

const isLedgerAccount = isHardwareAccount(this.props.selectedAddress, [...]);
...
if (isLedgerAccount) {
  await this.signLedgerTransaction({...replacementParams...});
} else {
  await speedUpTransaction(...);
}

Changelog

CHANGELOG entry: Modify useUnifiedTxActions.ts to specially handle ledger transaction speed up and cancel transaction.

Related issues

Fixes: #24544

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes transaction replacement execution paths and fee parameter wiring for Ledger accounts, which can affect speed up/cancel behavior; coverage is improved with new unit tests but the flow is user-funds-adjacent.

Overview
Fixes unified transaction speed up and cancel for Ledger accounts by detecting Ledger keyring addresses and routing replacement transactions through LedgerTransactionModal (BLE confirmation) instead of calling speedUpTransaction/TransactionController.stopTransaction directly.

Extends Ledger replacement parameters to support legacy gasPrice as legacyGasFee (in addition to EIP-1559 fees), passes the appropriate fee shape through the modal, and ensures modal state is cleaned up even when the user rejects on the Ledger confirmation screen. Adds comprehensive unit tests covering Ledger vs non-Ledger paths and legacy vs EIP-1559 fee handling.

Written by Cursor Bugbot for commit fe13682. This will update automatically on new commits. Configure here.

@dawnseeker8 dawnseeker8 requested a review from a team as a code owner January 16, 2026 11:51
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts
Akaryatrh
Akaryatrh previously approved these changes Jan 16, 2026
Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts Outdated
Akaryatrh
Akaryatrh previously approved these changes Jan 16, 2026

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts Outdated
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.83%. Comparing base (44a8bc0) to head (130a8ec).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...ews/UnifiedTransactionsView/useUnifiedTxActions.ts 96.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #24745   +/-   ##
=======================================
  Coverage   79.82%   79.83%           
=======================================
  Files        4200     4200           
  Lines      107434   107454   +20     
  Branches    22402    22411    +9     
=======================================
+ Hits        85761    85786   +25     
+ Misses      15652    15648    -4     
+ Partials     6021     6020    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dawnseeker8 dawnseeker8 requested a review from Akaryatrh January 16, 2026 13:11
dawnseeker8 and others added 3 commits January 19, 2026 10:31
…fees. Update `useUnifiedTxActions` to conditionally use legacy gas price or EIP-1559 gas fee based on transaction type. Add tests to verify correct handling of legacy transactions for speed up and cancel actions.
- Implemented tests to ensure that the modal state is properly cleaned up when a user rejects a transaction on the Ledger modal for both speed up and cancel actions.
- Updated the `onConfirmation` function to clean up modal state regardless of user confirmation, preventing stale state issues.
- Enhanced test coverage for the `useUnifiedTxActions` hook to validate the expected behavior during rejection scenarios.
@github-actions github-actions Bot added size-L and removed size-M labels Jan 19, 2026
Akaryatrh
Akaryatrh previously approved these changes Jan 21, 2026
@vivek-consensys vivek-consensys added the QA Passed QA testing has been completed and passed label Jan 21, 2026
Comment thread app/components/UI/LedgerModals/LedgerTransactionModal.tsx
Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts
@dawnseeker8 dawnseeker8 requested a review from Akaryatrh February 4, 2026 01:39
Comment thread app/components/UI/LedgerModals/LedgerTransactionModal.tsx Outdated
Comment thread app/components/UI/LedgerModals/LedgerTransactionModal.tsx Outdated
Updated the gas fee parameter logic in the LedgerTransactionModal to prefer legacyGasFee for legacy transactions and fall back to eip1559GasFee for EIP-1559 transactions. This change simplifies the code and improves clarity. Additionally, updated test descriptions in useUnifiedTxActions.test.ts for better accuracy regarding legacy transaction handling.
Akaryatrh
Akaryatrh previously approved these changes Feb 12, 2026
Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts Outdated
Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts Outdated
Comment thread app/components/Views/UnifiedTransactionsView/useUnifiedTxActions.ts Outdated
…ions

Refactored the onSpeedUpCompleted and onCancelCompleted functions to use useCallback for better performance and to prevent unnecessary re-renders. Updated the signLedgerTransaction function to also utilize useCallback, ensuring it correctly references the new completion handlers. This change enhances the efficiency of the transaction handling logic in the UnifiedTransactionsView component.
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 75%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes modify Ledger hardware wallet transaction handling for speed up and cancel operations in the UnifiedTransactionsView. Key changes include:

  1. LedgerTransactionModal.tsx: Added legacyGasFee support to ReplacementTxParams interface, allowing the modal to handle both EIP-1559 and legacy gas fees for Ledger transactions.

  2. useUnifiedTxActions.ts:

    • Added Ledger account detection using isHardwareAccount
    • Modified speedUpTransaction and cancelTransaction to route through signLedgerTransaction for Ledger accounts
    • Fixed a bug where rejecting on Ledger modal left stale state (now cleans up regardless of confirmation result)
    • Added support for both EIP-1559 and legacy gas fee formats
  3. useUnifiedTxActions.test.ts: Added comprehensive unit tests for Ledger account transaction handling.

Tag Selection Rationale:

  • SmokeAccounts: Selected because changes involve hardware wallet (Ledger) account handling, which is part of account management functionality. The test suite covers QR-based hardware wallet accounts.
  • SmokeConfirmations: Selected because the changes directly affect transaction speed up and cancel flows, which are part of the transaction confirmation system.

Not Selected:

  • SmokeWalletPlatform: While UnifiedTransactionsView is used for transaction history, the changes are specific to Ledger transaction actions, not general transaction display.

The risk is medium because:

  • Changes are well-covered by unit tests
  • Changes are isolated to Ledger hardware wallet accounts (subset of users)
  • No direct E2E tests exist for Ledger speed up/cancel functionality
  • The changes fix a bug and add legacy gas fee support without affecting non-hardware wallet flows

Performance Test Selection:
The changes are specific to Ledger hardware wallet transaction handling (speed up and cancel operations). These changes do not affect UI rendering performance, data loading, or critical user flows that would impact app responsiveness. The modifications are in the transaction action logic for hardware wallets, which is a specialized flow that doesn't impact general app performance metrics like account list rendering, login, swaps, or app launch times.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@MarioAslau MarioAslau 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.

LGTM

@dawnseeker8 dawnseeker8 added this pull request to the merge queue Feb 20, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Feb 20, 2026
Merged via the queue into main with commit e5f677f Feb 20, 2026
107 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/24544-fix-ledger-transaction-speedup-and-cancel branch February 20, 2026 11:07
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 20, 2026
@metamaskbot metamaskbot added the release-7.68.0 Issue or pull request that will be included in release 7.68.0 label Feb 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed release-7.68.0 Issue or pull request that will be included in release 7.68.0 size-L team-accounts-framework Accounts team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug]: [Mobile] Ledger - The user can't speed up or cancel a transaction

8 participants