Skip to content

[Low Priority] Upgrade price.proto float → double for future fiat currency precision #283

@islandbitcoin

Description

@islandbitcoin

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

  • float in 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

  1. Change field type from float to double in price.proto
  2. Regenerate protobuf stubs (price service + Flash backend consumer)
  3. Deploy price service first, then backend (wire format change)
  4. Verify no downstream consumers depend on the float wire format

Scope

  • src/services/price/protos/price.proto
  • src/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions