Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): Adds confirmation screen for 'increaseAllowance' #23560

Merged
merged 11 commits into from
Mar 28, 2024

Conversation

pedronfigueiredo
Copy link
Contributor

@pedronfigueiredo pedronfigueiredo commented Mar 18, 2024

NOTE: This PR is blocked by changes to core repo as well as to the test dApp first.

Description

Reuses the token approve confirmation screen for 'increaseAllowance'. It also includes an e2e test for the complete flow.

Open in GitHub Codespaces

Related issues

Fixes: #2224

Manual testing steps

  1. Go to the test dApp
  2. Create a token
  3. Approve token for a small amount
  4. Try to transfer a higher amount of tokens from another account. (it should fail)
  5. Go back to the first account and increase the allowance.
  6. Try to transfer again from the second account. (it should succeed)

Screenshots/Recordings

Before

Screenshot 2024-03-18 at 17 54 12

After

Screenshot 2024-03-18 at 17 54 38

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.

@pedronfigueiredo pedronfigueiredo added team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead team-confirmations-secure-ux-PR PRs from the confirmations team labels Mar 18, 2024
@pedronfigueiredo pedronfigueiredo self-assigned this Mar 18, 2024
Copy link
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.

@pedronfigueiredo pedronfigueiredo changed the title Adds confirmation screen for 'increaseAllowance' feat(): Adds confirmation screen for 'increaseAllowance' Mar 26, 2024
@pedronfigueiredo pedronfigueiredo marked this pull request as ready for review March 26, 2024 10:26
@pedronfigueiredo pedronfigueiredo requested a review from a team as a code owner March 26, 2024 10:26
jpuri
jpuri previously approved these changes Mar 26, 2024
Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

great work 🚀

@pedronfigueiredo
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated

@pedronfigueiredo pedronfigueiredo requested review from a team as code owners March 26, 2024 14:00
digiwand
digiwand previously approved these changes Mar 26, 2024
app/scripts/lib/transaction/metrics.ts Outdated Show resolved Hide resolved
digiwand
digiwand previously approved these changes Mar 27, 2024
jpuri
jpuri previously approved these changes Mar 27, 2024
segun
segun previously approved these changes Mar 27, 2024
Copy link
Contributor

@seaona seaona left a comment

Choose a reason for hiding this comment

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

Explanation on gas changes required in the e2e: in this PR we are updating the test-dapp to the latest version. In the new version, we removed the suggested gas from the test dapp, to fix a non-related issue with network congestion, meaning that from now on, the gas for the approve and transfer is calculated differently

https://github.com/MetaMask/test-dapp/commit/a3a2ea834b8739005325901d48f19b551b02a609#diff-bfe9874d239014961b1ae4e8[…]34a410aaaa2ebe3cf89820556L1757

so we need to update both the transfer and approve occurrences where we check the gas, to the new gas values --> those will always be the same (bc ganache setup and mocks are the same) but they are not the same as the ones we currently have with the previous dapp version

extra note: not sure why FF is passing, but this might indicate that we are not properly validating in that browser - maybe in that browser something else is going on that misses it, but I think that could be out of scope of this PR and could be investigated separately

@pedronfigueiredo pedronfigueiredo dismissed stale reviews from segun and jpuri via 17c1222 March 27, 2024 18:55
@pedronfigueiredo pedronfigueiredo added the release-blocker This bug is blocking the next release label Mar 27, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [da4c4e8]
Page Load Metrics (799 ± 466 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint702571154120
domContentLoaded106626147
load542314799970466
domInteractive106626147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 47 Bytes (0.00%)
  • ui: 1.2 KiB (0.02%)
  • common: 26.64 KiB (0.53%)

jpuri
jpuri previously approved these changes Mar 28, 2024
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 52.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 69.11%. Comparing base (b2d843f) to head (704b115).

Files Patch % Lines
ui/hooks/useTransactionDisplayData.js 16.67% 5 Missing ⚠️
...ion-switch/confirm-transaction-switch.component.js 0.00% 3 Missing ⚠️
ui/helpers/utils/transactions.util.js 0.00% 2 Missing ⚠️
...firmations/confirm-approve/confirm-approve.util.js 66.67% 1 Missing ⚠️
...rm-transaction/confirm-token-transaction-switch.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23560      +/-   ##
===========================================
- Coverage    69.13%   69.11%   -0.01%     
===========================================
  Files         1160     1160              
  Lines        44275    44296      +21     
  Branches     11844    11850       +6     
===========================================
+ Hits         30606    30615       +9     
- Misses       13669    13681      +12     

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

@metamaskbot
Copy link
Collaborator

Builds ready [ef4caab]
Page Load Metrics (1272 ± 461 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint793771557134
domContentLoaded116232168
load6522211272960461
domInteractive116232168
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 47 Bytes (0.00%)
  • ui: 1.2 KiB (0.02%)
  • common: 26.64 KiB (0.53%)

@metamaskbot
Copy link
Collaborator

Builds ready [1b917dd]
Page Load Metrics (1147 ± 530 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7162317613766
domContentLoaded10264435426
load59312911471104530
domInteractive10192394019
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 47 Bytes (0.00%)
  • ui: 1.2 KiB (0.02%)
  • common: 26.64 KiB (0.53%)

@metamaskbot
Copy link
Collaborator

Builds ready [704b115]
Page Load Metrics (1230 ± 501 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint712821274723
domContentLoaded983302110
load58249212301044501
domInteractive983302110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 47 Bytes (0.00%)
  • ui: 1.2 KiB (0.02%)
  • common: 497 Bytes (0.01%)

@pedronfigueiredo pedronfigueiredo merged commit 860c03f into develop Mar 28, 2024
66 checks passed
@pedronfigueiredo pedronfigueiredo deleted the pnf/2224 branch March 28, 2024 13:06
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
@metamaskbot metamaskbot added the release-11.15.0 Issue or pull request that will be included in release 11.15.0 label Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.15.0 Issue or pull request that will be included in release 11.15.0 release-blocker This bug is blocking the next release team-confirmations-secure-ux DEPRECATED: please use "team-confirmations" label instead team-confirmations-secure-ux-PR PRs from the confirmations team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants