Skip to content

fix: endless loop after hw tentative sign#28163

Merged
mathieuartu merged 1 commit intomainfrom
fix/hw-loop-signing
Apr 1, 2026
Merged

fix: endless loop after hw tentative sign#28163
mathieuartu merged 1 commit intomainfrom
fix/hw-loop-signing

Conversation

@mathieuartu
Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu commented Mar 31, 2026

Description

Changelog

CHANGELOG entry: Hardware wallet no longer enters infinite loop when Ledger device disconnects or Ethereum app is closed during transaction signing

Related issues

Fixes:

Manual testing steps

Feature: fix HW endless loop

  Scenario: user triggers a sign request (e.g swap)
    Given Ledger is fully ready 

    When user is shown the awaiting confirmation sheet, and disconnects the device / closes the eth app
    Then the transaction fails, and no infinite retry mechanism triggers

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 hardware-wallet connection retry behavior based on internal operation state; risk is moderate because it alters error/retry UX and could affect recovery paths for some error scenarios.

Overview
Fixes an endless retry loop by changing the bottom-sheet retryEnsureDeviceReady action to close the hardware-wallet flow after a post-signing error (tracked via operationTypeRef) instead of attempting to reconnect/ensure readiness again.

Resets operationTypeRef at flow start and on close, and adds/updates provider tests to cover both retrying a connection error and closing on a signing error.

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

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

@metamaskbot metamaskbot added the team-accounts-framework Accounts team label Mar 31, 2026
@github-actions github-actions bot added size-S risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are a targeted bug fix in HardwareWalletProvider.tsx that corrects the retry behavior after a signing error in the hardware wallet flow. Previously, after a signing operation failed (post-showAwaitingConfirmation), the retry button would incorrectly attempt to reconnect the device. The fix introduces handleRetryOrClose which detects if a signing operation was in progress (via operationTypeRef.current) and closes the flow instead of retrying. The HardwareWalletProvider is a top-level provider in Root/index.tsx wrapping the entire app, but the actual behavioral change is isolated to the hardware wallet signing error recovery path. SmokeAccounts is the appropriate tag as it covers QR-based hardware wallet account flows. No multi-SRP, identity sync, or other cross-cutting concerns are involved. The test file adds a new unit test for the new behavior and renames an existing test for clarity.

Performance Test Selection:
This change is a logic fix in the hardware wallet error recovery path (retry vs close after signing error). It does not affect rendering performance, data loading, state management at scale, or any performance-sensitive code paths. No performance tests are warranted.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

@mathieuartu mathieuartu enabled auto-merge March 31, 2026 13:52
Copy link
Copy Markdown
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

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

Looks good. Did not test

@mathieuartu mathieuartu added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit 1c43aef Apr 1, 2026
113 of 120 checks passed
@mathieuartu mathieuartu deleted the fix/hw-loop-signing branch April 1, 2026 14:01
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2026
@weitingsun weitingsun added release-7.73.0 Issue or pull request that will be included in release 7.73.0 and removed release-101.2.0 labels Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-S team-accounts team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants