Skip to content

feat(crown): note that round-bounded panels refresh every ~2h#103

Merged
entrius merged 5 commits into
testfrom
feat/crown-round-fill-note
May 27, 2026
Merged

feat(crown): note that round-bounded panels refresh every ~2h#103
entrius merged 5 commits into
testfrom
feat/crown-round-fill-note

Conversation

@anderdc
Copy link
Copy Markdown
Collaborator

@anderdc anderdc commented May 27, 2026

Summary

Three dashboard panels read from the per-round `crown_holders` / `rate_history` tables and will visibly stale-then-snap-in once we retire the alw-utils `sync-validator-state` daemon (which today silently re-derives the rows every 12s and writes them incrementally). This PR surfaces that behavior inline so users don't think the dashboard is broken between flushes.

Companion PRs (the rest of the live-crown rollout):

What's added

New `CrownRoundFillNote` component renders:

"{subject} refreshes at end of each ~2h scoring round · last refresh #L · next ~M blocks"

Used in:

  • `CrownHistoryGrid` — subject "crown grid", below the existing as-of footnote
  • `CrownRateChart` — subject "rate history", below the legend
  • `MinerLeaderboard` — subject "crown share", below the table

What's NOT touched

  • `StickyNetworkHeader` (top-bar current-crown widget) — stays unnoted. After the validator+schema PRs land it reads from `current_crown_holders`, which the validator upserts every ~12s. Already live, no caveat needed.
  • Score Factors Window panel (miner detail `← earlier / latest →`) — already labeled "scoring window" with explicit round navigation. No UX change.
  • "CROWN SHARE · PREVIOUS ROUND" mini-cards — label literally says PREVIOUS ROUND. Honest as-is.

Test plan

  • `npm run build` clean
  • `npm run lint` clean
  • `npx prettier --check` clean
  • Visual: `headBlock=0` (e.g. before halt loads) renders the note without the L/M figures — text wraps gracefully
  • Visual: dark + light themes — `color: 'text.disabled'` reads correctly in both
  • Visual: confirm the note appears in all three panels and the math is sensible (last refresh = floor(head/600)*600, next ~ ceil(head/600)*600 - head)

anderdc added 5 commits May 27, 2026 15:42
Three dashboard surfaces — Crown History grid, Crown rate chart, and
the Miner Leaderboard's crown_share column — read from the per-round
crown_holders / rate_history tables. Today the alw-utils
sync-validator-state daemon hides this by re-deriving crown rows every
12s and writing them incrementally; once that daemon retires (in
favor of the validator owning these writes directly), the same panels
will visibly stale between flushes and snap in at end of each
SCORING_WINDOW_BLOCKS round (~2h).

The behavior isn't a regression — it's the validator becoming the
single source of truth — but it changes user expectation, so we
surface it inline. New small CrownRoundFillNote component renders
"{subject} refreshes at end of each ~2h scoring round · last refresh
#L · next ~M blocks" using the current chain head to compute the
window boundaries.

Distinct from the top-bar current-crown widget, which keeps the live
~12s cadence via the new current_crown_holders table — that one
needs no note. See companion validator + schema + das-allways PRs.
StickyNetworkHeader carries a 6px dot + tiny "halted" label that's
easy to miss. During a halt no miner earns crown and the full
emission pool recycles — significant enough to warrant something
unmissable. Mounts in AppLayout right under TopNav so it sits above
every routed page, including miner detail.

Renders nothing when halt.halted is false. Uses the existing
useHaltState() hook (already polling in StickyNetworkHeader and
elsewhere) so no new network traffic. Shows "as of block #N" detail
when asOfBlock is set, so users can see freshness.

Part of the same dashboard-truthiness rollout that adds the live
current_crown_holders writer + round-fill notes; pairs with the
validator-side halt fixes (validator now clears current_crown_holders
during halt so the live header doesn't contradict the recycle).
The previous per-panel CrownRoundFillNote (added on Crown History
grid, Crown rate chart, Miner Leaderboard) said the same thing three
times in three places. Replaces it with a single status line on the
right side of StickyNetworkHeader where "healthy"/"halted" already
lives — one source of truth for system state.

Behavior:
- not halted, head known:  "last refresh #L · next ~M blocks"
- not halted, head unknown (halt query loading): "healthy" (existing
  fallback so the indicator never disappears mid-load)
- halted:                  "paused" in error.main, bold

Refresh math (last/next) is the same formula as the deleted note:
floor(head / 600) and (last + 600 - head). One module-level constant
mirrors allways/constants.py SCORING_WINDOW_BLOCKS so a future scoring
window change updates here in one place.

Removes CrownRoundFillNote.tsx entirely (no remaining callers).
Removes the now-unused useHaltState import + headBlock plumbing from
MinerLeaderboard.

Full HaltBanner stays — top-right is for ongoing/quieter signal; the
banner is for "everything is recycling, you need to notice this."
"SWAP CONTRACT HALTED — emissions are recycling, no miner is
currently earning. Rate posts still accepted; scoring resumes on
unhalt." reads as an alert about something broken. Halt is almost
always a planned admin action (upgrade window, parameter change),
so user-facing copy frames it as scheduled rather than emergency:

  "System is paused for maintenance. Swaps are not being initiated.
   Emissions are recycling. Scoring will resume when the system is
   unpaused. (as of block #N)"

Same banner styling, same /halt data source, same gating.
Red signals critical-failure semantics; halt is a planned admin
action ("paused for maintenance"). Amber/warning palette communicates
"heads up, things are different" without the alarm bell.

Switches both the full-width HaltBanner background and the top-right
"paused" dot+text from error.main/error.contrastText to
warning.main/warning.contrastText. Same MUI palette path, same
contrast guarantees (warning.contrastText auto-resolves).
@entrius entrius merged commit 4df71a0 into test May 27, 2026
2 checks passed
@entrius entrius deleted the feat/crown-round-fill-note branch May 27, 2026 23:04
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.

2 participants