AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 33 Monero

fix: crypto amount calculation logic with max decimals (#2697)

Public commit record

What the developer wrote

Authored by Konstantin Ullrich

93/100 · Strong
fix: crypto amount calculation logic with max decimals (#2697)

* fix: crypto amount calculation logic with max decimals

* refactor: remove `_setCryptoNumMaximumFractionDigits` and `_cryptoNumberFormat` to simplify `OutputBase` logic
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit changes how Cake Wallet converts a fiat amount into a crypto amount when a user is sending funds. Previously, the app used a shared number formatter whose decimal precision was set per wallet type. Now it uses the currency's own configured decimal count. The change also adds helper methods for converting between whole-coin and smallest-unit amounts elsewhere in the code. The main risk is that a wrong number of decimal places could cause displayed or calculated amounts to be rounded, potentially leading users to send slightly more or less than they intended, or to misread the value.

Recommended action

Review the new decimal handling against each supported currency's actual chain precision, especially currencies whose decimals differ from the old switch values. Verify that toStringAsFixed does not introduce rounding that affects the subsequently parsed send amount. Test edge cases such as very small fiat amounts, low-priced tokens, and send-all flows. Consider adding unit tests for _updateCryptoAmount and the new CryptoCurrency amount helpers.

Security signals we found

01

Amount formatting/precision change in wallet send flow

02

Removal of per-wallet-type hard-coded maximum fraction digits

03

Use of currency-specific decimals for fiat-to-crypto conversion display

04

Addition of raw amount parsing/formatting helpers using fixed-point conversion

Risk score

Why this scored 33/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 6/15
Affected reach 7/15
Confidence 5/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.