fix: cost-summary propagates per-day btcPrice#64
Closed
mukama wants to merge 1 commit intotetherto:developfrom
Closed
fix: cost-summary propagates per-day btcPrice#64mukama wants to merge 1 commit intotetherto:developfrom
mukama wants to merge 1 commit intotetherto:developfrom
Conversation
Two compounding bugs in getCostSummary caused btcPrice=0 for every log
entry, leaving ProductionCostPriceChart's overlay line at 0:
1. Wrong RPC key. The handler queried mempool with key: 'prices', which
the worker doesn't recognize and so returns the live snapshot
({currentPrice, blockHeight, ...}). Switched to 'HISTORICAL_PRICES',
which returns [{ts, priceUSD}, ...].
2. processEbitdaPrices couldn't parse the production shape. Same class
as the processBlockData fix (Bug C): the mempool worker returns a flat
per-ORK array of records, not a wrapper. Detect when entry has
.ts/.timestamp/.time and process it as the item directly; also accept
priceUSD (the actual upstream field name) alongside price.
The processEbitdaPrices fix incidentally makes getRevenueSummary and
getHashRevenue use real per-day prices instead of falling back to
currentBtcPrice. getEbitda still uses the wrong key: 'prices' (line 344)
and is left for a follow-up.
Contributor
Author
|
Consolidated into #67. |
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.
Summary
Fixes Bug D from the FE refactor smoke test: cost-summary returned
btcPrice: 0for every log entry, leaving ProductionCostPriceChart's overlay at 0. Two compounding bugs — wrong RPC key ('prices'returns the live mempool snapshot; the right key is'HISTORICAL_PRICES') plus the same flat-array shape bug fixed in PR #63 (processEbitdaPricesonly handled wrapper shapes). Side effect:getRevenueSummary/getHashRevenuenow use real per-day prices instead of thecurrentBtcPricefallback.getEbitda(line 344) still has the wrong key — flagged as a follow-up.Asana: https://app.asana.com/1/45238840754660/project/1205537444723387/task/1214118048367154
Test plan
standardlint cleandev-moria.tether.to/auth/ext-data?type=mempool&key=HISTORICAL_PRICES— fixedprocessEbitdaPricesproduces 59 distinct daily prices (range $65,204–$78,658) from the real production response. Pre-fix produces{}.dev-moriaonce deployed:/auth/finance/cost-summaryreturns non-zerobtcPriceper entry; ProductionCostPriceChart overlay renders.