Skip to content

ENG-317: price wire float→double (Phase A, server)#7

Draft
islandbitcoin wants to merge 1 commit into
mainfrom
feat/eng-317-price-proto-double
Draft

ENG-317: price wire float→double (Phase A, server)#7
islandbitcoin wants to merge 1 commit into
mainfrom
feat/eng-317-price-proto-double

Conversation

@islandbitcoin

Copy link
Copy Markdown

ENG-317 — float→double on the price wire (Phase A, server side)

Pairs with lnflash/flash#333. Server should land first.

What changes

  • realtime/src/servers/protos/price.proto: add double price_v2 = 3
    alongside float price = 1 [deprecated = true] on PriceResponse.
  • history/src/servers/protos/price_history.proto: same pattern on
    Tick (float price = 2 [deprecated = true]; double price_v2 = 3;).
  • realtime/src/servers/realtime/run.ts: getPrice callback now
    returns { price, price_v2: price } so both fields carry the same
    source value. The float wire encoding still quantises price;
    price_v2 carries the full float64.
  • history/src/servers/history/run.ts: listPrices maps each tick to
    { ...t, price_v2: t.price } for the same reason.

Why dual-field instead of in-place float→double

Protobuf wire types for float and double are not interchangeable
(types 5 vs 1) — swapping the type in place would silently corrupt
every reader. The additive deprecate-then-remove pattern is the only
safe rollout. Phase B (follow-up PR after one full release cycle in
prod) drops float price entirely from both protos and stops
populating it on the server.

Acceptance

  • Server populates both price and price_v2 from the same source
  • No change to upstream price-source code or domain layer
  • Wire-compatible with pre-ENG-317 clients (they keep reading
    price and ignore the unknown price_v2 tag)
  • Client PR (ENG-317: price wire float→double (Phase A, client) flash#333) prefers price_v2

Adds `double price_v2 = 3` alongside the existing `float price = 1` (now
deprecated) on PriceResponse and the equivalent on Tick. Servers populate
both fields; clients prefer `price_v2` and fall back to `price` so the
two repos can roll out independently.

Float32 quantises non-USD/non-BTC rates (notably JMD-class rates) by
~6e-8 relative drift, which compounds to ~J$19 of uncertainty on a
1-BTC quote — the wire-level baseline behind ENG-316.

Phase B (separate PR, after one prod release cycle on Phase A) removes
`float price` entirely.
@linear

linear Bot commented Apr 21, 2026

Copy link
Copy Markdown

@islandbitcoin islandbitcoin marked this pull request as draft June 23, 2026 16:38
@islandbitcoin

Copy link
Copy Markdown
Author

Paused → converted to draft (not closed)

Re-evaluated against the currency-precision initiative state in Linear (ENG-315/317/319) and the move to IBEX ETH-USDT wallets.

This is the orphaned server half of ENG-317's rollout: the paired client PR (lnflash/flash#333) was closed as a draft back in April, the epic (ENG-315) never started, and every downstream Phase-1 consumer (ENG-319 multi-source aggregator, Phase-4 quote/treasury) is in Backlog. The epic's premise — dust through a coarse USD-cent intermediate — is undercut now that balances are USDT-denominated (micro-unit precision).

ENG-317 moved to Backlog; this PR converted to draft rather than closed, because the change is small, clean, and still mergeable if the re-scope confirms the price-wire float32 is a real precision issue for some pair post-USDT.

To revive: confirm float→double is still needed under USDT wallets, rebase to trigger CI (the repo has workflows but none ran on this branch), and re-open the client side. Context + decision criteria are on ENG-315.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant