Skip to content

fix: For batch transactions sum total of gas needed for all transactions in the batched should be check to show insufficient funds error #31555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2025

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Apr 3, 2025

Description

For batch transactions sum total of gas needed for all transactions in the batched should be check to show insufficient funds error

Related issues

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

Manual testing steps

  1. Submit a batched transaction with a simple send whose value is more than your balance
  2. You should see insufficient fund alert

Screenshots/Recordings

TODO

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.

…n the batched should be check to show insufficient funds error
@jpuri jpuri added the team-confirmations Push issues to confirmations team label Apr 3, 2025
@jpuri jpuri requested a review from a team as a code owner April 3, 2025 09:50
Copy link
Contributor

github-actions bot commented Apr 3, 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

✨ Files requiring CODEOWNER review ✨

✅ @MetaMask/confirmations

  • ui/pages/confirmations/hooks/alerts/transactions/useInsufficientBalanceAlerts.test.ts
  • ui/pages/confirmations/hooks/alerts/transactions/useInsufficientBalanceAlerts.ts
  • ui/pages/confirmations/send/send.utils.js

@metamaskbot
Copy link
Collaborator

Builds ready [c4bdea2]
UI Startup Metrics (1218 ± 62 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1218111614416212561334
load10649641217561145989
domContentLoaded10589601209551179985
domInteractive16136261628
firstPaint748831218415245990
backgroundConnect106567910
firstReactRender18153231923
getState10429668
initialActions001001
loadScripts80971495754846908
setupStore7515278
WebpackHomeuiStartup21041652260720221892522
load16281307201915717181943
domContentLoaded16221303199515417141917
domInteractive171267111449
firstPaint193654115924276
backgroundConnect261480152769
firstReactRender213563671197791
getState1132742789
initialActions316134
loadScripts16141300196915017111892
setupStore24628649249
FirefoxBrowserifyHomeuiStartup13841204199116014191819
load12441054184615112921652
domContentLoaded12441054184615112921651
domInteractive10138247308897
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2516169162539
firstReactRender23194842431
getState7339478
initialActions001001
loadScripts12211037182014612621581
setupStore6432367
WebpackHomeuiStartup15721346204814616351938
load13581169182314314241697
domContentLoaded13571168182214314231696
domInteractive10243177239197
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25186272743
firstReactRender362810893846
getState8332579
initialActions102111
loadScripts13351149180014214031675
setupStore8527389
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0%)
  • ui: 4.25 KiB (0.06%)
  • common: 290 Bytes (0%)

amount: totalValue,
gasTotal: multiplyHexes(
hexMaximumTransactionFee as Hex,
decimalToHex(batchTransactionCount + 1) as Hex,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As these are EIP-7702 batches, there is only one transaction so one gas fee, so no need to multiply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, let me fix this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is updated

@metamaskbot
Copy link
Collaborator

Builds ready [3f667b1]
UI Startup Metrics (1261 ± 65 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1261114614776513091372
load110598813316311491292
domContentLoaded109998113266311431326
domInteractive17133851629
firstPaint868751336403172287
backgroundConnect107656910
firstReactRender19154352035
getState12432769
initialActions001001
loadScripts844730105962875928
setupStore8523378
WebpackHomeuiStartup20541675257523021942481
load15981303198317717191917
domContentLoaded15931300197017517161911
domInteractive171269121452
firstPaint20575171916625077
backgroundConnect261295172870
firstReactRender165543511108795
getState1132382389
initialActions512832834
loadScripts15851297194417117101885
setupStore29729859239
FirefoxBrowserifyHomeuiStartup13751192205418013811906
load12411078188617212511703
domContentLoaded12401078188517212511703
domInteractive10945180258898
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2516150182433
firstReactRender21192922126
getState6417278
initialActions002001
loadScripts12171061186616912311672
setupStore6420267
WebpackHomeuiStartup15261309203816215621949
load13211133180814913711711
domContentLoaded13201132180814913711711
domInteractive9738329338994
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect25174652737
firstReactRender35276063947
getState8437679
initialActions004111
loadScripts12981114178514913481684
setupStore8528379
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -472 Bytes (-0.01%)
  • ui: -1.92 KiB (-0.03%)
  • common: -580 Bytes (-0.01%)

@jpuri jpuri added this pull request to the merge queue Apr 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2025
Copy link

@mustafacryptolife mustafacryptolife left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2+

@jpuri jpuri added this pull request to the merge queue Apr 3, 2025
Merged via the queue into main with commit 996034d Apr 3, 2025
164 checks passed
@jpuri jpuri deleted the fnds_alert_fix branch April 3, 2025 15:22
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.17.0 Issue or pull request that will be included in release 12.17.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants