feat(proto): upgrade price.proto float to double (#283)#364
Closed
onchito-walks wants to merge 2 commits into
Closed
feat(proto): upgrade price.proto float to double (#283)#364onchito-walks wants to merge 2 commits into
onchito-walks wants to merge 2 commits into
Conversation
… static rate Backend fixes for lnflash#282: - Math.round() instead of Math.floor() for exchange rates - Correct offset (12 BTC, 6 USD) instead of 0n - displayCurrency parameter instead of hardcoded "USD" - JMD conversion via ExchangeRates.jmd.sell static rate - Price service uses static JMD rate instead of BTC triangulation 15 new tests covering all fix areas. 48/48 tests pass.
…recision (lnflash#283) Changes PriceResponse.price from float (32-bit, ~7 sig figs) to double (64-bit, ~15 sig figs). Float32 silently truncates JMD and other fiat exchange rates that need more than 7 significant digits of precision. This is a wire-compatible change: protobuf handles float→double conversion automatically on the client side, and the price server can be updated independently. Phase 1 blocker for multi-currency price-server (ENG-315, lnflash#283).
This was referenced May 22, 2026
Author
|
Replaced by clean PR #?? with only the proto fix. This PR had unrelated JMD commits mixed in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change:
PriceResponse.price→float→doubleinprice.protoWhy: 32-bit float (~7 significant digits) silently truncates exchange rates for JMD and other non-USD fiat currencies that need more precision. For example, JMD pricing at ~160 per USD requires 8+ digits to represent with sub-cent accuracy — float32 cannot do this.
Impact: Protobuf handles float→double conversion transparently. Existing price servers that send float values are decoded as double with zero precision loss (float32 values are a subset of float64). The price server can be updated independently.
Blocked by: This is Phase 1 of the currency precision roadmap (ENG-315). Needs to land before Phase 1.C (multi-source price aggregator for TTD, HTG, NGN, etc.) where float32 would reintroduce silent rounding errors.
Verification:
yarn tsc-check— protobuf wire format change only, no TypeScript changes needed (proto is loaded dynamically at runtime via protoLoader.loadSync).1 file changed, 1 insertion, 1 deletion. Wire-compatible.