Skip to content

Conversation

@fabiobozzo
Copy link
Contributor

@fabiobozzo fabiobozzo commented Nov 6, 2025

Description

Fixes a critical bug where the extension crashes on startup due to invalid semver version comparison.

See: https://consensys.slack.com/archives/CTQAGKY5V/p1762443107241399

Problem

Extension versions can be non-standard formats like 13.9.0.150 (4-part versions), which causes semver.lt() to throw:

TypeError: Invalid Version: 13.9.0.150

This crashes the extension on startup for users upgrading from these version formats.

Solution

  • Use semver.coerce() to normalize versions before comparison (e.g., 13.9.0.15013.9.0)
  • Add try/catch error handling for graceful fallback
  • Add test cases for 4-part version formats

Test Coverage

  • ✅ Handles 13.9.0.150 → coerces to 13.9.0 → compares safely
  • ✅ Handles 13.4.0.100 → coerces to 13.4.0 → compares safely
  • ✅ Graceful fallback on unparseable versions

Changelog

CHANGELOG entry: null

Related issues

Follow-up: https://github.com/MetaMask/metamask-extension/pull/37324/files

Manual testing steps

N/A

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

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.

Note

Coerces extension version strings before semver comparison to avoid crashes and ensure correct BIP-44 intro modal behavior, with new tests for 4-part versions.

  • Hook (ui/hooks/useMultichainAccountsIntroModal.ts):
    • Use semver.coerce with try/catch to normalize lastUpdatedFromVersion before semverLt for isUpgradeFromLowerThanBip44Version.
    • Keeps modal gating logic unchanged; only improves version parsing robustness.
  • Tests (ui/hooks/useMultichainAccountsIntroModal.test.ts):
    • Mirror hook logic using semver.coerce.
    • Add cases for non-standard versions like 13.9.0.150 (no banner) and 13.4.0.100 (shows banner).

Written by Cursor Bugbot for commit f28f155. This will update automatically on new commits. Configure here.

- Use semver.coerce() to normalize extension versions before comparison
- Add try/catch to handle invalid version formats gracefully
- Add test coverage for 4-part versions like 13.9.0.150
@fabiobozzo fabiobozzo marked this pull request as draft November 6, 2025 15:45
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

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 team-accounts-framework Accounts Framework team label Nov 6, 2025
@fabiobozzo fabiobozzo changed the title hotfix: handle non-standard semver formats in BIP-44 banner check fix: handle non-standard semver formats in BIP-44 banner check Nov 6, 2025
@github-actions github-actions bot added the size-S label Nov 6, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [8c10bf5]
UI Startup Metrics (1218 ± 85 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1218107314258512631388
load105092212828011101189
domContentLoaded104391912768011031179
domInteractive211486131859
firstPaint57889123040510381169
backgroundConnect23121934813233241
firstReactRender25184762835
getState22662102644
initialActions001001
loadScripts819693104879877957
setupStore1042831116
numNetworkReqs1367419671
BrowserifyPower User HomeuiStartup19921747258626721802586
load1047903145319613371453
domContentLoaded1040896142719313281427
domInteractive281569184769
firstPaint6139414724909671472
backgroundConnect24622738838250388
firstReactRender30255983259
getState18216322016193220
initialActions001011
loadScripts803671112917410761129
setupStore1493281432
numNetworkReqs1207324860164248
WebpackStandard HomeuiStartup8677321213958771113
load62857699185622885
domContentLoaded62157197381614859
domInteractive171271111549
firstPaint19861976202175850
backgroundConnect261274142857
firstReactRender3319228223655
getState1162431315
initialActions001001
loadScripts61856996379612848
setupStore1363751424
numNetworkReqs1367119869
WebpackPower User HomeuiStartup11531068157314512911573
load56851477177659771
domContentLoaded55150474170622741
domInteractive221278183878
firstPaint20465626146250626
backgroundConnect701624076173240
firstReactRender25232712627
getState1318614620142146
initialActions001001
loadScripts54850273367615733
setupStore952461024
numNetworkReqs1076716641162166
FirefoxBrowserifyStandard HomeuiStartup15271324209914116041827
load12921129158410213621490
domContentLoaded12921129158410213621490
domInteractive1193434751130208
firstPaint------
backgroundConnect52241983155115
firstReactRender27226062740
getState84355722
initialActions002011
loadScripts1260109915569913241460
setupStore147115131439
numNetworkReqs1367416761
BrowserifyPower User HomeuiStartup24012113300628625913006
load13511109169220916221692
domContentLoaded13501109169220916221692
domInteractive21152594178458594
firstPaint------
backgroundConnect962925073190250
firstReactRender35295073750
getState1427626943156269
initialActions102112
loadScripts13211092167220415821672
setupStore3061333642133
numNetworkReqs1336923164214231
WebpackStandard HomeuiStartup21501828269818022252587
load18301487223714619062160
domContentLoaded18291487223614619052159
domInteractive1304268691129285
firstPaint------
backgroundConnect78303495479200
firstReactRender41271281939111
getState136242241229
initialActions001011
loadScripts17791395218915418662117
setupStore199107141943
numNetworkReqs1366617765
WebpackPower User HomeuiStartup25562218321830327893218
load15251290193423118101934
domContentLoaded15241289193323118091933
domInteractive20437626180378626
firstPaint------
backgroundConnect983821563192215
firstReactRender412959105659
getState1547235666183356
initialActions105115
loadScripts14931269190322617491903
setupStore29990263690
numNetworkReqs1315724766196247
📊 Page Load Benchmark Results

Current Commit: 8c10bf5 | Date: 11/6/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±37ms) 🟢 | historical mean value: 733ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±11ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.02s 1.33s 1.06s 1.33s
domContentLoaded 724ms 37ms 703ms 995ms 737ms 995ms
firstPaint 76ms 11ms 60ms 172ms 84ms 172ms
firstContentfulPaint 76ms 11ms 60ms 172ms 84ms 172ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 64 Bytes (0%)
  • common: 20 Bytes (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-S team-accounts-framework Accounts Framework team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants