metamask-extension
metamask-extension copied to clipboard
fix: handle low numbers when saving default advanced gas fees
Description
This PR aims to fix a bug when a user saves very low default values, in the example 0.000000001
number was turned into 1e-9
string and thrown when converting it down the line in the next transaction.
Related issues
Fixes: https://github.com/MetaMask/metamask-extension/issues/22605
Manual testing steps
- Go to send flow
- Edit gas fee > Advanced
- Change
Max Base Fee
1
andPriority Fee
to0.000000001
- Check
Save these values as my default for the <chain name> network.
I was able to reproduce the issue using Ganache with default gas zero.
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've clearly explained what problem this PR is solving and how it is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [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.
- [x] I’ve properly set the pull request status:
- [x] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to "non-draft".
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.
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.
Builds ready [38d63f8]
- 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 (830 ± 48 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 95 | 178 | 124 | 28 | 13 |
domContentLoaded | 9 | 56 | 23 | 16 | 8 | ||
load | 688 | 1012 | 830 | 100 | 48 | ||
domInteractive | 9 | 56 | 23 | 16 | 8 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 418 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
8ab0637
) 68.53% compared to head (bdaca06
) 68.53%.
Additional details and impacted files
@@ Coverage Diff @@
## develop #22790 +/- ##
===========================================
- Coverage 68.53% 68.53% -0.00%
===========================================
Files 1089 1089
Lines 42966 42972 +6
Branches 11440 11440
===========================================
+ Hits 29446 29448 +2
- Misses 13520 13524 +4
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
LGTM!
@vinistevam Build from https://github.com/MetaMask/metamask-extension/commit/38d63f8a9cf05be24c39d1495a0236b0b7e71b96] - it won't let me type 0 after decimal point:
https://github.com/MetaMask/metamask-extension/assets/104780023/bf32a906-91f2-4b00-8574-6b5cb9a7d052
I can cut and paste 0.000000001 but it results in failed
transaction.
Builds ready [dabd239]
- 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 (861 ± 25 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 94 | 161 | 122 | 19 | 9 |
domContentLoaded | 9 | 47 | 16 | 9 | 4 | ||
load | 750 | 963 | 861 | 53 | 25 | ||
domInteractive | 9 | 47 | 16 | 9 | 4 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 241 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [9e0a0ae]
- 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 (783 ± 19 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 88 | 140 | 109 | 15 | 7 |
domContentLoaded | 9 | 42 | 17 | 8 | 4 | ||
load | 707 | 859 | 783 | 39 | 19 | ||
domInteractive | 9 | 42 | 17 | 8 | 4 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 346 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [49435c8]
- 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 (770 ± 19 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 86 | 137 | 107 | 13 | 6 |
domContentLoaded | 9 | 46 | 17 | 8 | 4 | ||
load | 709 | 871 | 770 | 40 | 19 | ||
domInteractive | 9 | 46 | 17 | 8 | 4 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 346 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Builds ready [01352bb]
- 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 (794 ± 27 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 92 | 165 | 118 | 17 | 8 |
domContentLoaded | 10 | 58 | 21 | 11 | 5 | ||
load | 710 | 917 | 794 | 55 | 27 | ||
domInteractive | 10 | 58 | 21 | 11 | 5 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 375 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Low values can be entered and saved correctly. Chrome 121.0.6167.139
https://github.com/MetaMask/metamask-extension/assets/104780023/5556ff20-02b5-4c6e-bd98-49d39d1f14c7
Firefox 122.0
https://github.com/MetaMask/metamask-extension/assets/104780023/10c4f4da-6a60-4b00-b1ac-edd34e8e2509
Builds ready [4491d22]
- 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 (1235 ± 168 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 144 | 400 | 217 | 65 | 31 |
domContentLoaded | 12 | 96 | 37 | 25 | 12 | ||
load | 809 | 2070 | 1235 | 350 | 168 | ||
domInteractive | 12 | 96 | 37 | 25 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 381 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Builds ready [728b59c]
- 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 (936 ± 76 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 125 | 271 | 180 | 31 | 15 |
domContentLoaded | 9 | 70 | 32 | 23 | 11 | ||
load | 818 | 1475 | 936 | 159 | 76 | ||
domInteractive | 9 | 70 | 32 | 23 | 11 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 381 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Builds ready [bdaca06]
- 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 (1072 ± 86 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 102 | 429 | 211 | 62 | 30 |
domContentLoaded | 15 | 95 | 35 | 25 | 12 | ||
load | 890 | 1665 | 1072 | 178 | 86 | ||
domInteractive | 15 | 95 | 35 | 25 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 381 Bytes (0.01%)
- common: 0 Bytes (0.00%)