Skip to content

Conversation

@vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Dec 9, 2025

Description

This PR fixes a issue raised by cursor to 0x0 is a numeric literal (the number zero) rather than the hex string '0x0'

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/6408

Manual testing steps

  1. Send flow with insufficient balance
  2. should display the insufficient alert

Screenshots/Recordings

alert.webm

Before

After

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

Standardizes zero-hex fallback via a shared ZERO_HEX_FALLBACK in useHasInsufficientBalance for tx value, batch values, and balance lookups.

  • Hooks
    • ui/pages/confirmations/hooks/useHasInsufficientBalance.ts:
      • Introduces ZERO_HEX_FALLBACK = '0x0'.
      • Replaces inline zero-hex defaults with ZERO_HEX_FALLBACK for txParams.value, nested transaction values, and balance fallback.

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

@vinistevam vinistevam added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Dec 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 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
Copy link
Collaborator

metamaskbot commented Dec 9, 2025

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (1 files, +5 -3)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 hooks/
          • 📄 useHasInsufficientBalance.ts +5 -3

@metamaskbot
Copy link
Collaborator

Builds ready [94996cb]
UI Startup Metrics (1235 ± 78 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1235105315647812821364
load101485812726210501096
domContentLoaded100885312666210431091
domInteractive21156582136
firstPaint4628211333739571048
backgroundConnect21519524611222237
firstReactRender453085125073
getState3216104123753
initialActions104111
loadScripts800652105461834880
setupStore1173551218
numNetworkReqs86317630
BrowserifyPower User HomeuiStartup19191688251515319902150
load108891413059611611239
domContentLoaded107790712969511431224
domInteractive2817102112948
firstPaint559107125641610441224
backgroundConnect263205706109242601
firstReactRender49406855158
getState20414632538226288
initialActions102112
loadScripts8606951059949301012
setupStore18115891638
numNetworkReqs67581101266104
WebpackStandard HomeuiStartup83071599354858936
load63957474846679714
domContentLoaded63456774446674710
domInteractive21164262238
firstPaint20987725137200665
backgroundConnect1253681331
firstReactRender57342314062151
getState241471102845
initialActions104112
loadScripts63156474146672707
setupStore1064051119
numNetworkReqs86306629
WebpackPower User HomeuiStartup14671189216818015741796
load722596100192781912
domContentLoaded71658899491774902
domInteractive2515102122648
firstPaint27192864202252750
backgroundConnect67757113255527
firstReactRender48396854957
getState18414032635194267
initialActions104111
loadScripts71358699290770900
setupStore1464381336
numNetworkReqs67571081265101
FirefoxBrowserifyStandard HomeuiStartup12881088176113913691596
load104693014498910911202
domContentLoaded104593014488910901202
domInteractive56301853281135
firstPaint------
backgroundConnect3821153233995
firstReactRender3930133133863
getState1073141019
initialActions103122
loadScripts102191614027910611153
setupStore1055151012
numNetworkReqs86265724
BrowserifyPower User HomeuiStartup26041579350458631043367
load1606966248554421182388
domContentLoaded1605966248554421172388
domInteractive170311211307921031
firstPaint------
backgroundConnect152231237190193370
firstReactRender543797125782
getState1377627742164220
initialActions207123
loadScripts1535951232451620472311
setupStore3354396226159
numNetworkReqs70581231468106
WebpackStandard HomeuiStartup15161325190712415851821
load1228110015007812871338
domContentLoaded1228110015007812871338
domInteractive51272283167104
firstPaint------
backgroundConnect46211762745119
firstReactRender403391104152
getState157161201424
initialActions102122
loadScripts1205108714737712641314
setupStore146164181329
numNetworkReqs86265724
WebpackPower User HomeuiStartup30141880563770134273866
load19671202450164424542751
domContentLoaded19661201450164424542750
domInteractive2342823514081001070
firstPaint------
backgroundConnect1702312242431901034
firstReactRender6142122146697
getState1537755669186271
initialActions3138623
loadScripts18751182447462124032664
setupStore4454808133266
numNetworkReqs71581201668118
📊 Page Load Benchmark Results

Current Commit: 94996cb | Date: 12/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.02s (±38ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 713ms (±36ms) 🟢 | historical mean value: 734ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±13ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.02s 38ms 1.00s 1.32s 1.04s 1.32s
domContentLoaded 713ms 36ms 696ms 986ms 728ms 986ms
firstPaint 75ms 13ms 56ms 196ms 84ms 196ms
firstContentfulPaint 75ms 13ms 56ms 196ms 84ms 196ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 6 Bytes (0%)
  • common: 20 Bytes (0%)

@vinistevam vinistevam marked this pull request as ready for review December 9, 2025 08:29
@vinistevam vinistevam requested a review from a team as a code owner December 9, 2025 08:29
jpuri
jpuri previously approved these changes Dec 9, 2025
OGPoyraz
OGPoyraz previously approved these changes Dec 9, 2025
@vinistevam vinistevam dismissed stale reviews from OGPoyraz and jpuri via 3d24dbb December 9, 2025 16:08
@vinistevam vinistevam requested review from OGPoyraz and jpuri December 9, 2025 16:08
@metamaskbot
Copy link
Collaborator

Builds ready [3d24dbb]
UI Startup Metrics (1279 ± 98 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1279105214969813471434
load104486812418110861177
domContentLoaded103786312328010821169
domInteractive2615101202284
firstPaint54985122841010251156
backgroundConnect21819326914226244
firstReactRender493290155983
getState4218121205085
initialActions106113
loadScripts826665101476867963
setupStore1373761626
numNetworkReqs1367619671
BrowserifyPower User HomeuiStartup19351569256216820212239
load1100894156212911881332
domContentLoaded1090890155312811791324
domInteractive3117125232798
firstPaint4719713753909561281
backgroundConnect25419865188244536
firstReactRender48396955059
getState19914673160218255
initialActions102112
loadScripts87169312851259541102
setupStore1573961434
numNetworkReqs73592242468133
WebpackStandard HomeuiStartup868726104272911992
load66457685268715790
domContentLoaded65857084568711783
domInteractive261595182379
firstPaint24880849181230714
backgroundConnect1163361229
firstReactRender56332103757155
getState301563123953
initialActions102111
loadScripts65556884367707771
setupStore1163351319
numNetworkReqs1468020671
WebpackPower User HomeuiStartup15541141220819616711881
load7516211235112827965
domContentLoaded7436151228111816956
domInteractive37172273829135
firstPaint27394915196252763
backgroundConnect89867117146568
firstReactRender52409285468
getState18914334635201260
initialActions102012
loadScripts7406131217110813947
setupStore1575671534
numNetworkReqs74592322867136
FirefoxBrowserifyStandard HomeuiStartup14231176214318714991847
load1135971141810911941368
domContentLoaded1134971141810911931368
domInteractive71322224087147
firstPaint------
backgroundConnect67244286877209
firstReactRender42338094365
getState137103121125
initialActions103122
loadScripts109895513079211561252
setupStore166196231250
numNetworkReqs1567721874
BrowserifyPower User HomeuiStartup25791587374555630653329
load1601966243649920452339
domContentLoaded1600960243549920452339
domInteractive16832126228390968
firstPaint------
backgroundConnect168271138192194394
firstReactRender5533113126080
getState1317341652158239
initialActions3037523
loadScripts1517949240147519372291
setupStore4144076743199
numNetworkReqs76551332174123
WebpackStandard HomeuiStartup17131417329524617942114
load13901195296119614451595
domContentLoaded13891195296119614451595
domInteractive96301483146113174
firstPaint------
backgroundConnect61241913872145
firstReactRender44359284759
getState2291862918107
initialActions103122
loadScripts13581172293619214081561
setupStore196185261654
numNetworkReqs1668721876
WebpackPower User HomeuiStartup27931769400957532073623
load18801151279051523352559
domContentLoaded18791151279051523342558
domInteractive2063011193221781014
firstPaint------
backgroundConnect157221137201184402
firstReactRender5336101126067
getState1278137347148221
initialActions3144627
loadScripts18041135268749322642501
setupStore3343615924151
numNetworkReqs75521302268125
📊 Page Load Benchmark Results

Current Commit: 3d24dbb | Date: 12/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±63ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 733ms (±81ms) 🟢 | historical mean value: 736ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 91ms (±141ms) 🟢 | historical mean value: 84ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 63ms 1.02s 1.49s 1.08s 1.49s
domContentLoaded 733ms 81ms 703ms 1.42s 761ms 1.42s
firstPaint 91ms 141ms 60ms 1.49s 88ms 1.49s
firstContentfulPaint 91ms 141ms 60ms 1.49s 88ms 1.49s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 6 Bytes (0%)
  • common: 20 Bytes (0%)

@vinistevam vinistevam added this pull request to the merge queue Dec 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 10, 2025
@vinistevam vinistevam added this pull request to the merge queue Dec 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR fixes a [issue raised by
cursor](#38306 (comment))
to 0x0 is a numeric literal (the number zero) rather than the hex string
'0x0'

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38649?quickstart=1)

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#6408

## **Manual testing steps**

1. Send flow with insufficient  balance
2. should display the insufficient alert 

## **Screenshots/Recordings**


[alert.webm](https://github.com/user-attachments/assets/5cf66e88-8256-4995-9b2d-4cb30f2f5198)


<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [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](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Standardizes zero-hex fallback via a shared `ZERO_HEX_FALLBACK` in
`useHasInsufficientBalance` for tx value, batch values, and balance
lookups.
> 
> - **Hooks**
>   - `ui/pages/confirmations/hooks/useHasInsufficientBalance.ts`:
>     - Introduces `ZERO_HEX_FALLBACK = '0x0'`.
> - Replaces inline zero-hex defaults with `ZERO_HEX_FALLBACK` for
`txParams.value`, nested transaction values, and balance fallback.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3d24dbb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Merged via the queue into main with commit 02d62fa Dec 10, 2025
176 checks passed
@vinistevam vinistevam deleted the fix/zero-hex-fallback branch December 10, 2025 17:47
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
@metamaskbot metamaskbot added the release-13.14.0 Issue or pull request that will be included in release 13.14.0 label Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.14.0 Issue or pull request that will be included in release 13.14.0 size-XS team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants