Skip to content

Cancel transaction signing from activity list#22676

Merged
matthewwalsh0 merged 9 commits intodevelopfrom
fix/1969-cancel-transaction-signing
Jan 31, 2024
Merged

Cancel transaction signing from activity list#22676
matthewwalsh0 merged 9 commits intodevelopfrom
fix/1969-cancel-transaction-signing

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

@matthewwalsh0 matthewwalsh0 commented Jan 26, 2024

Description

Currently, the TransactionController allows infinite time for a transaction to be signed.

In the case of a hardware wallet, where this is reliant on the user, this process can take a long time or never resolve if the user disconnects their device for example.

This situation results in a transaction that can never be submitted, and subsequent transactions are also blocked due to the TransactionController using locks to safely sign and submit transactions one at a time.

This can be avoided with additional and alternate UX flows however this provides a quick solution via the following:

  • Transactions that are being signed are displayed with the Signing status in the activity list for additional clarity.
  • The standard Cancel button in the activity list will now cancel the signing process for a transaction and mark it as failed.
  • While a transaction is being signed and submitted, subsequent transactions will display an error in the confirmation and the Confirm button will be disabled.

Temporarily using a patch for the TransactionController pending a new release.

Related issues

Fixes: #1969

Manual testing steps

  1. Use Ledger hardware wallet.
  2. Disconnect device while signing.
  3. Attempt to create a new transaction.
  4. Note error message and disabled button.
  5. Click Cancel in activity list.
  6. Ensure transaction is now failed with suitable error.

Screenshots/Recordings

Before

After

Screenshot 2024-01-26 at 17 41 29 Screenshot 2024-01-30 at 10 30 17 Screenshot 2024-01-26 at 17 42 51

Pre-merge author checklist

  • [] I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

Show signing status in activity list.
Prevent confirmation if previous transactions still signing or submitting.
@socket-security
Copy link
Copy Markdown

socket-security bot commented Jan 26, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@matthewwalsh0 matthewwalsh0 added the team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead label Jan 26, 2024
@plasmacorral
Copy link
Copy Markdown
Contributor

plasmacorral commented Jan 27, 2024

Conducted some preliminary tests against commit 76bc1cf using both hardware and account snaps, and LGTM pending further unit tests being added.

Note that previous transaction message can be observed appearing 2x in Flask builds, but could also be related to using Ganache with ChainId=1.
Screenshot 2024-01-26 at 3 57 23 PM

Rename container property.
Rename error key.
@socket-security
Copy link
Copy Markdown

socket-security bot commented Jan 29, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/jsonschema@1.4.1 None 0 81.8 kB acubed

🚮 Removed packages: npm/jsonschema@1.2.4

View full report↗︎

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review January 30, 2024 10:24
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners January 30, 2024 10:24
@sleepytanya
Copy link
Copy Markdown
Contributor

Tested with the commit 112db7c
Works as expected on Chrome 121.0.6167.85:
Transaction displayed as signing in the Activity list:
Screenshot 2024-01-30 at 12 48 01 PM
Confirm button is disabled and appropriate error message is shown:
Screenshot 2024-01-30 at 12 29 11 PM

Failed transaction notification:
Screenshot 2024-01-30 at 12 48 29 PM
Screenshot 2024-01-30 at 12 31 21 PM

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 31, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (862617d) 68.11% compared to head (950dcc8) 68.14%.
Report is 3 commits behind head on develop.

Files Patch % Lines
...ction-list-item/transaction-list-item.component.js 69.23% 4 Missing ⚠️
...saction-base/confirm-transaction-base.component.js 75.00% 1 Missing ⚠️
ui/store/actions.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #22676      +/-   ##
===========================================
+ Coverage    68.11%   68.14%   +0.02%     
===========================================
  Files         1087     1087              
  Lines        42794    42827      +33     
  Branches     11381    11398      +17     
===========================================
+ Hits         29148    29181      +33     
  Misses       13646    13646              

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

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [51412ae]
Page Load Metrics (855 ± 29 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint101155122147
domContentLoaded94820115
load7559378556129
domInteractive94820115
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -24.55 KiB (-0.73%)
  • ui: 1.33 KiB (0.02%)
  • common: 589 Bytes (0.01%)

@montelaidev
Copy link
Copy Markdown
Contributor

Tested as well with the SSK and Safeheron snap

Screen.Recording.2024-01-31.at.20.19.50.mov
Screen.Recording.2024-01-31.at.20.20.53.mov

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [950dcc8]
Page Load Metrics (935 ± 182 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint922551324923
domContentLoaded97822178
load6882056935378182
domInteractive97822178
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -24.55 KiB (-0.73%)
  • ui: 1.33 KiB (0.02%)
  • common: 589 Bytes (0.01%)

@matthewwalsh0 matthewwalsh0 merged commit 7a3d9e2 into develop Jan 31, 2024
@matthewwalsh0 matthewwalsh0 deleted the fix/1969-cancel-transaction-signing branch January 31, 2024 18:31
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
@metamaskbot metamaskbot added the release-11.11.0 Issue or pull request that will be included in release 11.11.0 label Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Priority - High QA Passed release-11.11.0 Issue or pull request that will be included in release 11.11.0 team-accounts-framework Accounts team team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.