Repository navigation
fix(provider-rewards): use actual reward pool for estimated amounts - #30
Merged
Merged
Conversation
…amounts estimatedRewardsUsd was computing share × lavaPrice which is dimensionally wrong (fraction × USD/token = nonsense). Now uses the provider-side reward pools (distribution + allocation + iprpc) so the formula is: share × providerPoolLava × lavaUsdPrice. Adds estimatedRewardsLava field and providerPoolLava in response meta. Gracefully degrades to null when pool or price fetch fails.
Queries the chain's estimated_provider_rewards/{address} RPC for every
active provider, groups rewards by spec (collapsing Boost/Pools/Subscription
sources), converts multi-denom amounts to USD via CoinGecko, and returns
per-provider actual reward data sorted by total USD.
This replaces the gen_provider_rewards.py → push to jsinfo flow that
lava-ops Job 2 performed monthly. Consumers can now call this endpoint
on demand instead of depending on static JSON files.
Exports fetchRewardsBySpec, fetchProvidersWithSpecs, prewarmPriceCache,
and RewardsBySpecEntry from rpc/lava.ts for reuse.
…te docs - Import BASE_SPECS from @info/shared instead of duplicating locally - Extract shared fetchRewardPools() so both fetchRewardPoolsAmount and fetchProviderRewardPoolsAmount share one RPC call via request coalescing - Document new /provider-estimated-rewards endpoint in CLAUDE.md - Update /provider-rewards docs with new estimatedRewardsLava field - Add no-co-author rule to git-workflow.md - Add safe-range comment on Number(ulava) conversion
nimrod-teich
force-pushed
the
fix/provider-rewards-estimated-usd
branch
from
April 16, 2026 13:13
fa05928 to
976b4a1
Compare
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
estimatedRewardsUsdwas broken: computedshare × lavaPrice(fraction × USD/token = nonsense). A provider with 10% share at LAVA=$2 would get $0.20.share × providerPoolLava × lavaUsdPriceestimatedRewardsLavafield per provider andproviderPoolLavain responsemetaso consumers know the total pool being distributedChanges
rpc/lava.ts— newfetchProviderRewardPoolsAmount()(provider pools only, excludes validator pools)routes/provider-rewards.ts— pool fetch in parallel, fixed USD calc, added LAVA estimate field__tests__/routes-provider-rewards.test.ts— pool mock, USD/LAVA assertions, pool-failure degradation testTest plan
pnpm typecheckpassespnpm test— all 72 tests passGET /provider-rewards?from=2026-03-17&to=2026-04-17estimatedRewardsUsdvalues are sane (order of magnitude check against known pool size)