Skip to content

chore: add logs to identify root cause of issue reported in #1507#8414

Merged
gantunesr merged 10 commits into
mainfrom
chore/add-guard-logic-patch
Feb 16, 2024
Merged

chore: add logs to identify root cause of issue reported in #1507#8414
gantunesr merged 10 commits into
mainfrom
chore/add-guard-logic-patch

Conversation

@gantunesr

@gantunesr gantunesr commented Jan 26, 2024

Copy link
Copy Markdown
Member

Description

This PR add logs help to collect more metrics in Sentry and provide more insights regarding the root cause of the issue described in https://github.com/MetaMask/mobile-planning/issues/1507.

Related issues

Relates to https://github.com/MetaMask/mobile-planning/issues/1507

Manual testing steps

There should not be any impact in the UI/UX. The goal of this PR is to detect possible edge cases in the app where the selectedAddress is not set.

Screenshots/Recordings

There should not be any impact in the UI/UX

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.

@gantunesr gantunesr added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-accounts-framework Accounts team labels Jan 26, 2024
@gantunesr gantunesr marked this pull request as ready for review January 26, 2024 16:25
@gantunesr gantunesr requested a review from a team as a code owner January 26, 2024 16:25
@github-actions

Copy link
Copy Markdown
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/15387c84-0c0e-4bf5-aaa7-5ce939e16650
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@tommasini

tommasini commented Jan 26, 2024

Copy link
Copy Markdown
Contributor

I believe yes, but I just want to check with you!
When this error is thrown we are sure that it will be caught by the error boundary component?

@Gudahtt

Gudahtt commented Jan 26, 2024

Copy link
Copy Markdown
Member

I think we'll need to patch the keyring controller as well, since it calls syncIdentities with an empty array. That would result in this error being thrown.

@gantunesr

Copy link
Copy Markdown
Member Author

Thanks @Gudahtt!

I think it's safe to just comment out the line, I'll run some test on my end to verify it. Let me know what you think

@codecov-commenter

codecov-commenter commented Jan 27, 2024

Copy link
Copy Markdown

Codecov Report

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

Comparison is base (23dc52b) 41.06% compared to head (c6cd716) 41.04%.

Files Patch % Lines
app/components/Views/Login/index.js 0.00% 6 Missing ⚠️
app/components/Views/LockScreen/index.js 0.00% 3 Missing ⚠️
.../components/Views/RestoreWallet/WalletRestored.tsx 0.00% 2 Missing ⚠️
app/components/Views/ManualBackupStep1/index.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8414      +/-   ##
==========================================
- Coverage   41.06%   41.04%   -0.02%     
==========================================
  Files        1247     1247              
  Lines       30351    30363      +12     
  Branches     2963     2964       +1     
==========================================
  Hits        12464    12464              
- Misses      17142    17154      +12     
  Partials      745      745              

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

@gantunesr gantunesr changed the title chore: add @metamask/preferences-controller patch chore: add logs to identify root cause of issue reported in #1507 Jan 29, 2024
@gantunesr

Copy link
Copy Markdown
Member Author

@tommasini I believe that too but I have not checked it yet. I'm still researching the issue and have not tested the current code of this PR.

@Gudahtt

Gudahtt commented Jan 29, 2024

Copy link
Copy Markdown
Member

I think it's safe to just comment out the line, I'll run some test on my end to verify it. Let me know what you think

I think you're right, I'll try and verify this as best I can later though

@Gudahtt

Gudahtt commented Feb 15, 2024

Copy link
Copy Markdown
Member

@gantunesr I've taken another look, and I definitely think that updateIdentities([]) call is not useful and safe to comment out.

Could you update this PR again when you get the chance, and I can review it again?

@gantunesr

gantunesr commented Feb 15, 2024

Copy link
Copy Markdown
Member Author

Sure @Gudahtt, I just now returned to work on this code, but why is that? The next 2 lines updates the identities array to the accounts fetched from eth-keyring-controller

@Gudahtt

Gudahtt commented Feb 15, 2024

Copy link
Copy Markdown
Member

That method is replacing the existing vault with a new one, so it is supposed to replace all identities as well, as part of that process.

Not sure if that answers the question; could you clarify which part seems confusing if not?

@gantunesr

Copy link
Copy Markdown
Member Author

Right, I was under the impression that it would replace a repeated identity with a new one, but in reality it keeps the old one so it's right to clean identities before providing a new array of addresses

@gantunesr

gantunesr commented Feb 16, 2024

Copy link
Copy Markdown
Member Author

@Gudahtt I decided to revert the patches because I was unsure of the impact. The preferences-controller patch would cause a crash under certain edge cases and I want to take a deeper look at the keyring-controller method. I have just kept the logs to monitor them in Sentry

owencraston
owencraston previously approved these changes Feb 16, 2024
Comment thread app/components/Views/ManualBackupStep1/index.js Outdated
@sonarqubecloud

Copy link
Copy Markdown

@gantunesr gantunesr removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 16, 2024
@gantunesr gantunesr merged commit 2a194b8 into main Feb 16, 2024
@gantunesr gantunesr deleted the chore/add-guard-logic-patch branch February 16, 2024 12:49
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 16, 2024
@metamaskbot metamaskbot added the release-7.17.0 Issue or pull request that will be included in release 7.17.0 label Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.17.0 Issue or pull request that will be included in release 7.17.0 team-accounts-framework Accounts team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants