metamask-extension
metamask-extension copied to clipboard
Refactor(storage): Refactor extension storage classes
Description
adds a new class that models the shared surface of the two storage solutions we utilize, and then creates two new classes designed to extend from that one. The goal of this Pull request is to consolidate some of the operations of state management that were previously being implemented in background.js (the process of creating a new state tree). We relied upon a bullish value being returned from the .get()
method to know to generate a new first time state object fro the user. This logic has been moved into the storage class so that determining whether to use a new state tree is handled within the storage system itself.
This is a step towards providing a fail safe for state corruption. The new class will be utilized for this additional functionality.
Related issues
Fixes:
Manual testing steps
No functional changes should have occurred. Test the extension and ensure it behaves as expected
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using JSDoc format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
- [x] 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.
Builds ready [9837883]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1288 ± 593 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 81 | 347 | 141 | 66 | 32 |
domContentLoaded | 15 | 99 | 31 | 19 | 9 | ||
load | 68 | 3188 | 1288 | 1235 | 593 | ||
domInteractive | 15 | 99 | 31 | 19 | 9 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: -1.85 KiB (-0.06%)
- ui: 587 Bytes (0.01%)
- common: 6.78 KiB (0.13%)
Codecov Report
Attention: Patch coverage is 44.44444%
with 65 lines
in your changes are missing coverage. Please review.
Project coverage is 67.46%. Comparing base (
cfcbd1e
) to head (91b92a6
).
Additional details and impacted files
@@ Coverage Diff @@
## develop #24016 +/- ##
===========================================
- Coverage 67.48% 67.46% -0.02%
===========================================
Files 1288 1289 +1
Lines 50153 50181 +28
Branches 13023 13027 +4
===========================================
+ Hits 33842 33852 +10
- Misses 16311 16329 +18
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [be80104]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (882 ± 603 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 57 | 152 | 90 | 27 | 13 |
domContentLoaded | 9 | 37 | 14 | 7 | 3 | ||
load | 45 | 3049 | 882 | 1256 | 603 | ||
domInteractive | 9 | 37 | 14 | 7 | 3 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: -1.85 KiB (-0.05%)
- ui: 0 Bytes (0.00%)
- common: 6.78 KiB (0.11%)
Builds ready [8e43959]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (648 ± 569 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 54 | 151 | 82 | 27 | 13 |
domContentLoaded | 7 | 55 | 15 | 11 | 5 | ||
load | 43 | 3327 | 648 | 1185 | 569 | ||
domInteractive | 7 | 55 | 15 | 11 | 5 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: -1.85 KiB (-0.05%)
- ui: 0 Bytes (0.00%)
- common: 6.57 KiB (0.11%)
TODO (discussed during refinement):
- Check if this PR includes a metric event to track users who appear to have corrupted state (like described in this issue)
- If so, confirm metric event has the same name as on Mobile: Vault Corruption Restore Wallet Screen Viewed
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.
This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.
This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.