metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

Refactor(storage): Refactor extension storage classes

Open brad-decker opened this issue 10 months ago • 4 comments

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.

brad-decker avatar Apr 12 '24 20:04 brad-decker

Builds ready [9837883]
Page Load Metrics (1288 ± 593 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint813471416632
domContentLoaded159931199
load68318812881235593
domInteractive159931199
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%)

metamaskbot avatar Apr 15 '24 15:04 metamaskbot

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).

Files Patch % Lines
shared/modules/Storage/ReadOnlyNetworkStore.ts 0.00% 43 Missing :warning:
shared/modules/Storage/ExtensionStore.ts 70.77% 19 Missing :warning:
app/scripts/lib/setup-initial-state-hooks.js 0.00% 3 Missing :warning:
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.

codecov[bot] avatar Apr 25 '24 17:04 codecov[bot]

Builds ready [be80104]
Page Load Metrics (882 ± 603 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint57152902713
domContentLoaded9371473
load4530498821256603
domInteractive9371473
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%)

metamaskbot avatar Apr 25 '24 17:04 metamaskbot

Builds ready [8e43959]
Page Load Metrics (648 ± 569 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint54151822713
domContentLoaded75515115
load4333276481185569
domInteractive75515115
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%)

metamaskbot avatar May 06 '24 15:05 metamaskbot

TODO (discussed during refinement):

gauthierpetetin avatar Jun 18 '24 16:06 gauthierpetetin

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.

github-actions[bot] avatar Jun 18 '24 16:06 github-actions[bot]

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.

github-actions[bot] avatar Aug 17 '24 18:08 github-actions[bot]

This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.

github-actions[bot] avatar Aug 31 '24 20:08 github-actions[bot]