Skip to content

[Phase 1] Upgrade price.proto float → double (blocker for multi-currency price-server) #283

Description

@islandbitcoin

Status: Phase 1 blocker (per ENG-315 currency-precision roadmap 5.A)

Reclassified 2026-04-19 from "deferred / low priority." JMD's yaml.ts workaround only covers JMD. Phase 1.C extends price-server into a multi-source aggregator for every currency Flash adds (TTD, HTG, NGN, etc.) — float32 reintroduces silent rounding errors the moment a second fiat goes through gRPC. Must land before Phase 1.C starts.

The Problem

float in protobuf = 32-bit IEEE 754 = ~7 significant digits. Rates like 157.xx (JMD) or 392.xx (NGN) × 8-decimal sat precision exceed that. Result: silent rounding errors on every conversion through the gRPC price service.

The Fix

// src/services/price/protos/price.proto

  • float price = 1;
  • double price = 1;

Apply to every numeric rate field. Regen stubs. Deploy price-server → backend → mobile in that order, in the same release window, with mobile min-supported-version bumped.

Files

src/services/price/protos/price.proto

src/services/price/index.ts

Regenerated stubs + any gRPC consumer importing them (audit before merge)

Verification

Unit test: encode rate > 7 sig digits, decode, bit-equal compare

Integration test: full gRPC round-trip preserves precision

All gRPC consumers audited and listed in PR description

24h dev burn-in before staging promotion

Out of scope

Migrating JMD off yaml.ts (Phase 1.C). RoundingPolicy module (Phase 1.B). New currencies (their own issues post-Phase-1.C).

Activity

  1. linear commented on Feb 23, 2026

    @linear
  2. changed the title [-][Low Priority] Upgrade price.proto float → double for future fiat currency precision[/-] [+][Phase 1] Upgrade price.proto float → double (blocker for multi-currency price-server)[/+] on Apr 19, 2026
  3. islandbitcoin commented on Oct 10, 2026

    @islandbitcoin
    ContributorAuthor

    Priority pass 2026-10-10: rank 10 of 13. Latent until a second fiat goes through gRPC. Schedule immediately before TTD or HTG rates are added, not before.

  4. nul-quill commented on Oct 11, 2026

    @nul-quill

    Handle: nul-quill. Payout wallets: Solana USDC BdznDjc4xwt5Y6WJT5UnrFQzDptka8YnC9oqmmkKpwkd, TRC20 TNEHCVwR2aPMrj5AKfWCQ2rFL3bEDQmsg7. Shipped in PR #523: PriceResponse.price and Tick.price widened from float to double, so rates with more than 7 significant digits survive the gRPC round trip instead of being rounded inside the wire layer. Stubs load at runtime from the .proto files in src/services/price/grpc.ts, so no regen step is needed; the only consumers are src/services/price/index.ts and the price queries in src/app/prices. New spec test/flash/unit/services/price/price-proto-double.spec.ts covers the encode/decode bit-equality cases plus a float32 contrast. 118 suites / 1431 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions