fix(crown): anchor grid head on scoring watermark + 1h window#106
Merged
Conversation
The crown grid is drawn entirely from crown_holders, which the validator writes directly up through crown_holders_max_block (PR #390). It was anchoring the head — window snap, "as of" label, and the striped pending-cell marker — on halt.asOfBlock (the contract_events head) instead. The two advance on independent pipelines: on a quiet network the validator keeps scoring per block while the event head stalls, so the pending stripe stranded on an already-finalized interior block and went stale until the next event landed. Anchor head on useScoringState().lastScoredBlock (+1 = live tip) so the pending cell always sits one block past the last finalized data, never stranded. Also mirror the validator's SCORING_WINDOW_BLOCKS 600 -> 300 (~1h): rebase RANGE_BLOCKS, move the scoring-window snap/label/window-pan from the 2h chip to the 1h chip, default crown range 2h -> 1h, and update the 2h -> 1h copy.
entrius
approved these changes
May 28, 2026
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.
Problem
On the Crown History grid, the striped pending cell would sometimes strand on an interior block — sitting next to already-finalized blue cells — and stay stale across refreshes.
Root cause
The grid is drawn entirely from
crown_holders, which the validator now writes directly up throughcrown_holders_max_block(#390 in allways). But the grid anchored its head — window snap, the "AS OF #…" label, and the pending-cell marker — onhalt.asOfBlock, i.e.MAX(block_number) FROM contract_events(the event-indexer head).Those two heads advance on independent pipelines.
contract_eventsonly ticks on commitments/swaps, while the validator keeps scoring every block. On a quiet network the crown watermark runs ahead ofasOfBlock, soisCurrent = b === asOfBlocklands the stripe on a block that's already finalized (blue cells exist past it), and it doesn't move until a new on-chain event bumpsasOfBlock.Fix
Anchor the head on the crown data's own watermark via
useScoringState().lastScoredBlock(=crown_holders_max_block),+1for the live tip. The pending cell now always sits exactly one block past the last finalized data — it can never strand among finalized cells.Also: 1h scoring cadence (300 blocks)
The validator's
SCORING_WINDOW_BLOCKSis now 300 (~1h), not 600. Mirrored here:SCORING_WINDOW_BLOCKS600 → 300;RANGE_BLOCKSrebased on it (chips stay honest: 1h=300, 2h=600, 4h=1200)2hchip to the1hchip (one round = 300 blocks)2h→1h(both pages); detail-pagecrownPandefault 600 → 300ScoreFactorsStripcopy "2-hour" → "1-hour"Docs counterpart: entrius/allways-docs-ui#51.
Notes / to confirm
SCORING_WINDOW_BLOCKS, so the max custom window is now 300 blocks (was 600). Faithful to the prior "caps at one scoring window" intent — flag if it should be decoupled./crownwidget still updates every forward step.tsc -bandeslintpass.