-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Summary
Change the float field type to double in src/services/price/protos/price.proto to eliminate 32-bit IEEE 754 precision limits on exchange rates.
Current Status: Deferred
This was originally Wave 3, Task 1 of the JMD currency precision fix plan (#282). It has been dropped from that plan because the JMD/USD rate source is moving to config yaml.ts, which is read as a JS number (64-bit double) — bypassing the protobuf wire format entirely.
Why It Still Exists as an Issue
If Flash ever adds another display currency that pulls rates from the gRPC price service (e.g., TTD, HTG), the float (32-bit, ~7 significant digits) proto field would reintroduce the same class of silent rounding errors. A double (64-bit, ~15 significant digits) eliminates this.
The Problem
floatin protobuf = 32-bit IEEE 754 = ~7 significant digits- Exchange rates like 157.xx multiplied by BTC amounts with 8 decimal places push against that ceiling
- Result: silent rounding errors in every price conversion flowing through gRPC
The Fix
- Change field type from
floattodoubleinprice.proto - Regenerate protobuf stubs (price service + Flash backend consumer)
- Deploy price service first, then backend (wire format change)
- Verify no downstream consumers depend on the
floatwire format
Scope
src/services/price/protos/price.protosrc/services/price/index.ts- Coordinated deployment required (price service → backend)
Priority
Low — not on the critical path for JMD fixes. Only becomes relevant if a new fiat currency is added that uses the gRPC price service.
Related
- Parent issue: [Bug] JMD Currency Precision — Backend #282 (JMD currency precision failures)
- Mobile companion: [Bug] Systemic JMD currency precision failures — float amounts, wrong tx history, 100× inflation, hardcoded USD flash-mobile#555