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: 7862 invalid address error #7881

Merged
merged 5 commits into from
Nov 20, 2023
Merged

Conversation

dawnseeker8
Copy link
Contributor

@dawnseeker8 dawnseeker8 commented Nov 20, 2023

Description

This PR was created to fix the issue [#7862], following code change has been done:

  1. Change the getKeyringByAddress() method to return undefined when address is not valid hex address (e.g. ENS domain name)
  2. Fix the existing unit tests to reflect above changes in address/index.test.ts file
  3. add extra unit tests to make sure function will return undefined when address is not valid hex address (e.g. ENS domain)

Related issues

Fixes: [#7862]

Manual testing steps

Please refer to following videos for detail how to test.

Screenshots/Recordings

Before

before.mp4

After

Screen_Recording_20231120_224005_MetaMask.mp4
  • 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.

change getKeyringByAddress() method to return null if isValidHexAddress
Also fix the unit tests for that method.
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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 20, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4e01d6e) 37.42% compared to head (eb47326) 37.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7881      +/-   ##
==========================================
- Coverage   37.42%   37.38%   -0.04%     
==========================================
  Files        1052     1052              
  Lines       28177    28177              
  Branches     2516     2516              
==========================================
- Hits        10544    10534      -10     
- Misses      17034    17044      +10     
  Partials      599      599              

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

@dawnseeker8 dawnseeker8 marked this pull request as ready for review November 20, 2023 15:32
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner November 20, 2023 15:32
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f1bdb212-c238-4106-9754-7496f5231bef
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@sethkfman sethkfman added the release-7.12.0 Issue or pull request that will be included in release 7.12.0 label Nov 20, 2023
@dawnseeker8 dawnseeker8 removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 20, 2023
gantunesr
gantunesr previously approved these changes Nov 20, 2023
@gantunesr gantunesr added the needs-qa Any New Features that needs a full manual QA prior to being added to a release. label Nov 20, 2023
Copy link
Contributor

@cryptotavares cryptotavares left a comment

Choose a reason for hiding this comment

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

@dawnseeker8 can you please also add a unit test to the AddressInput component where the toSelectedAddress is not a valid hex address?
AddressTo Component
Existing unit tests - as you can see there are only tests with valid hex addresses.

@seaona
Copy link
Contributor

seaona commented Nov 20, 2023

The PR looks good from QA cc @dawnseeker8 . I see the issue fixed. I can enter any char, and both hex and ENS address seem to work as expected

recipietn-to-char.mp4

@seaona seaona added QA Passed A successful QA run through has been done and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Nov 20, 2023
sethkfman and others added 2 commits November 20, 2023 12:11
updated comment

Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com>
Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@sethkfman sethkfman merged commit f63c1dd into main Nov 20, 2023
26 checks passed
@sethkfman sethkfman deleted the fix/7862-fix-invalid-address-error branch November 20, 2023 19:35
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2023
@metamaskbot metamaskbot added the release-7.13.0 Issue or pull request that will be included in release 7.13.0 label Nov 20, 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.12.0 Issue or pull request that will be included in release 7.12.0 release-7.13.0 Issue or pull request that will be included in release 7.13.0 team-accounts
Projects
None yet
7 participants