Skip to content

ticker: defensive ceiling on live-number values - #1258

Merged
Flotapponnier merged 1 commit into
mainfrom
fix/ticker-sanity-clamp
Jul 17, 2026
Merged

ticker: defensive ceiling on live-number values#1258
Flotapponnier merged 1 commit into
mainfrom
fix/ticker-sanity-clamp

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Ships direct to main since it fixes a visible bug on openchainbench.com right now ($8.26e79 stuck on the Onchain volume 24h stat). Client-side defence against upstream relay data corruption. See commit body for detail.

An upstream corruption on the relay's vol24h feed (observed
8.26e79 today) latched into the LiveNumber snapshot pair and, in
monotonic mode, stuck as the displayed value forever because every
subsequent healthy tick was smaller and got rejected as a 'down
tick'. Add a maxValue prop that rejects any incoming value above
a plausible ceiling before it can pollute the snapshot pair, and
flushes a previously-poisoned lastRef so a healthy value can seed
the ticker on the next push.

Ceilings sit 20 to 100x above the real world ATH so plausible
growth stays uncapped: vol24h 1e13 (real ATH ~5e11), trades24h
1e10 (real ATH ~5e7), mcap 1e14 (real ATH ~4e12).
@Flotapponnier
Flotapponnier merged commit 62f930e into main Jul 17, 2026
1 check failed
Flotapponnier pushed a commit that referenced this pull request Jul 17, 2026
Follow-up to #1258. The initial fix rejected future ticks above the
ceiling but left two paths for the garbage to stick:

1. useState was seeded with the raw value on mount, so the very first
   render painted 8.26e79 before any effect ran. The monotonic guard
   then rejected every healthy value that followed as a down tick.
2. Even after flushing lastRef, the display state still held the
   garbage, and the raf tick was returning early on lastRef=null so
   setDisplay was never called with a smaller-but-healthy value.

Fix: guard the useState seed too, and reset display to undefined when
an above-ceiling value arrives. A subsequent healthy push then seeds
both lastRef and display fresh.
Flotapponnier pushed a commit that referenced this pull request Jul 17, 2026
Follow-up to #1258. The initial fix rejected future ticks above the
ceiling but left two paths for the garbage to stick:

1. useState was seeded with the raw value on mount, so the very first
   render painted 8.26e79 before any effect ran. The monotonic guard
   then rejected every healthy value that followed as a down tick.
2. Even after flushing lastRef, the display state still held the
   garbage, and the raf tick was returning early on lastRef=null so
   setDisplay was never called with a smaller-but-healthy value.

Fix: guard the useState seed too, and reset display to undefined when
an above-ceiling value arrives. A subsequent healthy push then seeds
both lastRef and display fresh.
Flotapponnier added a commit that referenced this pull request Jul 17, 2026
…ng (#1259)

Follow-up to #1258. The initial fix rejected future ticks above the
ceiling but left two paths for the garbage to stick:

1. useState was seeded with the raw value on mount, so the very first
   render painted 8.26e79 before any effect ran. The monotonic guard
   then rejected every healthy value that followed as a down tick.
2. Even after flushing lastRef, the display state still held the
   garbage, and the raf tick was returning early on lastRef=null so
   setDisplay was never called with a smaller-but-healthy value.

Fix: guard the useState seed too, and reset display to undefined when
an above-ceiling value arrives. A subsequent healthy push then seeds
both lastRef and display fresh.

Co-authored-by: Florent Tapponnier <contact@mobula.io>
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