ENG-317: price wire float→double (Phase A, server)#7
Conversation
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.
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 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. |
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: adddouble price_v2 = 3alongside
float price = 1 [deprecated = true]onPriceResponse.history/src/servers/protos/price_history.proto: same pattern onTick(float price = 2 [deprecated = true]; double price_v2 = 3;).realtime/src/servers/realtime/run.ts:getPricecallback nowreturns
{ price, price_v2: price }so both fields carry the samesource value. The float wire encoding still quantises
price;price_v2carries the full float64.history/src/servers/history/run.ts:listPricesmaps 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
floatanddoubleare 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 priceentirely from both protos and stopspopulating it on the server.
Acceptance
priceandprice_v2from the same sourcepriceand ignore the unknownprice_v2tag)price_v2