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

fix: Warning when rejecting an approval request with id XYZ not found #7077

Merged
merged 7 commits into from
Sep 13, 2023

Conversation

vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Aug 30, 2023

Development & PR Process

  1. Follow MetaMask Mobile Coding Standards
  2. Add release-xx label to identify the PR slated for a upcoming release (will be used in release discussion)
  3. Add needs-dev-review label when work is completed
  4. Add the appropiate QA label when dev review is completed
    • needs-qa: PR requires manual QA.
    • No QA/E2E only: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.
    • Spot check on release build: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.
  5. Add QA Passed label when QA has signed off (Only required if the PR was labeled with needs-qa)
  6. Add your team's label, i.e. label starting with team- (or external-contributor label if your not a MetaMask employee)

Description

Whenever you deploy an ERC 20, create an approval request, move the app to the background and get it back active again.
Basically, the issue is that handleAppStateChange and componentWillUnmount are calling reject approval twice without checking if the approval exists.

Changes:

  • Includes a check if an approval request exists before trying to reject.

Screenshots/Recordings

bug-warning-approval-id-not-found.webm

If applicable, add screenshots and/or recordings to visualize the before and after of your change

To Reproduce
Steps to reproduce the behaviour

  • Go to test dapp
  • Deploy an ERC20 token
  • Click Approve
  • Go in the background and get the app back "active"
  • See warning

The expected behaviour is the transaction being rejected but no warning or error is shown.

E2E
https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8c4f9cff-ec1b-43ed-8c6f-776cfb46d06f

Issue

fixes #6860

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

@vinistevam vinistevam added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Aug 30, 2023
@github-actions
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.

@vinistevam vinistevam marked this pull request as ready for review August 31, 2023 09:35
@vinistevam vinistevam requested a review from a team as a code owner August 31, 2023 09:35
@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.01% ⚠️

Comparison is base (2fbafdf) 33.15% compared to head (cb558a3) 33.15%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7077      +/-   ##
==========================================
- Coverage   33.15%   33.15%   -0.01%     
==========================================
  Files        1005     1005              
  Lines       32655    32656       +1     
  Branches     8399     8398       -1     
==========================================
  Hits        10827    10827              
- Misses      21828    21829       +1     
Files Changed Coverage Δ
app/components/Views/Approval/index.js 4.49% <0.00%> (+0.09%) ⬆️
app/components/Views/ApproveView/Approve/index.js 2.85% <0.00%> (+0.01%) ⬆️
app/core/Engine.ts 53.78% <0.00%> (-1.26%) ⬇️

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

@vinistevam vinistevam force-pushed the fix/6860-approval-request-id-not-found branch from 1ccd624 to f0810ca Compare September 5, 2023 11:56
app/core/Engine.ts Outdated Show resolved Hide resolved
app/core/Engine.ts Outdated Show resolved Hide resolved
@sleepytanya
Copy link
Contributor

The 'Approve token' transaction is rejected after moving to background, no error/wa
rning is shown.
iOS build:

Screen.Recording.2023-09-12.at.10.18.47.AM.mov

Android build:

Screen.Recording.2023-09-12.at.11.21.56.AM.mov

@vinistevam vinistevam added the QA Passed A successful QA run through has been done label Sep 13, 2023
@sonarcloud
Copy link

sonarcloud bot commented Sep 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@vinistevam vinistevam merged commit b23a5f4 into main Sep 13, 2023
46 checks passed
@vinistevam vinistevam deleted the fix/6860-approval-request-id-not-found branch September 13, 2023 07:45
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2023
@metamaskbot metamaskbot added the release-7.8.0 Issue or pull request that will be included in release 7.8.0 label Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.8.0 Issue or pull request that will be included in release 7.8.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Warning when Rejecting an Approve tx Approval request with id XYZ not found
6 participants