Conversation
|
|
|
|
There was a problem hiding this comment.
Bug: Comma Parsing Error in Validation Functions
The validateValueIsPositive and validateGasLimitValueIsGreaterThanMinimum functions exhibit inconsistent validation behavior for comma-separated numerical inputs. Unlike other validation functions, they directly use parseFloat(value) instead of first normalizing the input with normalizeGasInput(). This causes parseFloat to incorrectly parse values (e.g., "0,5" as 0, "21,000" as 21), leading to erroneous validation results and undermining the PR's intent to handle comma inputs.
app/components/Views/confirmations/utils/validations/gas.ts#L99-L124
Bug: Comma Replacement Bug in Gas Input Normalization
The normalizeGasInput function incorrectly uses replace(',', '.'), which only replaces the first occurrence of a comma. This leaves subsequent commas in the input (e.g., "1,234,56" becomes "1.234,56"), resulting in an invalid number format. It should use replace(/,/g, '.') or replaceAll(',', '.') to replace all commas.
app/components/Views/confirmations/utils/gas.ts#L168-L171
metamask-mobile/app/components/Views/confirmations/utils/gas.ts
Lines 168 to 171 in 515cb31
Was this report helpful? Give feedback by reacting with 👍 or 👎
|



Description
This PR aims to fix gas inputs to replace comma
,input to dot.Changelog
CHANGELOG entry: Fixed a bug on comma inputs on gas text boxes.
Related issues
Fixes: #17195
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist