Skip to content

feat(priority-fees): rebuild the burn series the upstream stopped publishing - #18

Merged
Yaugourt merged 1 commit into
mainfrom
feat/priority-fees-series
Jul 30, 2026
Merged

feat(priority-fees): rebuild the burn series the upstream stopped publishing#18
Yaugourt merged 1 commit into
mainfrom
feat/priority-fees-series

Conversation

@Yaugourt

Copy link
Copy Markdown
Owner

Why

/analytics/priority-fees/chart/daily still answers 200, but its rows stopped advancing on 2026-07-11. Anything charting priority gas from it has been serving frozen data since, silently.

The cumulative rollup next to it (/analytics/priority-fees/stats?hours=N) is alive and fresh. It always reports [now-N, now], so differencing consecutive N reconstructs a disjoint bucket series without needing the dead aggregation.

What

New GET /market/priority-fees/series?window=24h|7d.

  • priorityFees.series.ts holds the arithmetic and nothing else: the hour ladder and computeBuckets, which differences the sorted rollups. Pure, so the edge cases are unit-testable.
  • priorityFees.service.ts fans the ladder out (concurrency 6), caches per window (300 s / 900 s), and reads the HYPE price off the existing perp:markets cache.
  • Window-wide aggregates come from the widest rollup, never summed across buckets: payers, average, min and max are not additive.
  • Buckets carry the span they really cover. The upstream occasionally clamps a lookback short (hours=30 came back as 28.7 h); inheriting that keeps the totals exact instead of shifting every later bucket onto the wrong hour.
  • A rollup that fails is left out and counted in meta.missingBuckets, so a consumer can say how much of the window really answered.

Scope

Order priority only, and the response says so by omission. The gossip auction feed (read-path priority) is frozen at 2026-07-11T17:55:26, so that burn cannot be sized from our sources. Documented in the types header rather than left for the next reader to rediscover.

Verification

  • 24h: 24 buckets, 0 missing, sum(buckets.gas) == totals.gas to 6 decimals. 2.4 s cold, 0.010 s cached.
  • 7d: 28 buckets, same exactness.
  • Invalid window: 400 INVALID_WINDOW.
  • 21 new tests (13 unit on the differencing, 8 integration on the route). Full suite 132/132. type-check and lint clean.

Verified against live upstream data, not fixtures.

🤖 Generated with Claude Code

https://claude.ai/code/session_013zGKQKm432ZKEw1GjVWPZG

…lishing

The pre-aggregated daily priority-fee chart stopped advancing on 2026-07-11
and has answered 200 with a frozen payload every day since, so nothing that
reads it can draw a current line. Its `stats` rollup is computed on the fly
and is still accurate to the minute, but it only ever reports one cumulative
window ending now.

Asking that rollup for every lookback across the window and differencing
neighbouring answers reconstructs the series: the narrowest window is a bucket
on its own, and each wider one contributes the slice it adds. Buckets carry
the span they really cover rather than the nominal width, because the upstream
occasionally clamps a window short, and inheriting that as a wider bucket is
honest where silently shifting every later bucket onto the wrong hour is not.

Windows stop at 7d since 168 h is the widest lookback the rollup accepts.
Aggregates that differencing destroys — unique payers, avg, min, max — come
from the single widest rollup instead of from summing buckets, and venue-wide
fill counts ride along so a client can say what share of activity pays for
priority rather than only what priority costs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013zGKQKm432ZKEw1GjVWPZG
@Yaugourt
Yaugourt merged commit 258a056 into main Jul 30, 2026
2 checks passed
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