Skip to content

feat(stats): swap REST /sentrix_status_extended → pure gRPC v0.4#1

Merged
satyakwok merged 2 commits intomainfrom
feat/pure-grpc-stats
May 5, 2026
Merged

feat(stats): swap REST /sentrix_status_extended → pure gRPC v0.4#1
satyakwok merged 2 commits intomainfrom
feat/pure-grpc-stats

Conversation

@satyakwok
Copy link
Copy Markdown
Contributor

Summary

Drops the REST /sentrix_status_extended bridge from StatsDashboard + SupplyBar. After chain v2.1.72 ships (sentrix-labs/sentrix#472), the explorer's stats hot path is pure gRPC:

  • GetValidatorSet → active/total validator counts
  • GetMempool → pending-tx size
  • GetSupply → minted_sentri (drives the Minted/Cap progress bar)

Block height + avg block time still ride EVM JSON-RPC. They're swap-able to gRPC GetBlock(latest) in a follow-up commit; this PR keeps the diff scoped to the previously-REST fields.

Why DON'T merge yet

Chain v2.1.72 isn't live in prod (grpc.sentrixchain.com:443) until sentrix-labs/sentrix#472 is merged + deployed. Merging this explorer PR before that would 502 the stats cards — the new gRPC methods would respond unimplemented.

Order of operations:

  1. Merge feat(grpc): v0.4 read-only — GetValidatorSet, GetSupply, GetMempool sentrix-labs/sentrix#472 → fast-deploy testnet → bake → mainnet ship
  2. Verify grpcurl grpc.sentrixchain.com:443 sentrix.v1.Sentrix/GetValidatorSet returns real data
  3. Merge this PR → cargo-leptos build --release → rsync to vps6 → restart

Test plan

  • cargo check --features ssr — green
  • cargo check --features hydrate --target wasm32-unknown-unknown — green
  • Once chain v2.1.72 live: grpcurl smoke test all three methods
  • cargo leptos build --release for mainnet + testnet
  • Browser smoke: hero block ticks, validator count populates, mempool size reflects /mempool, Minted/Cap bar grows

satyakwok added 2 commits May 5, 2026 12:52
The README's "zero JSON-RPC, zero JS glue" claim was aspirational —
StatsDashboard's validator/mempool fields and SupplyBar's minted total
were both bridged through REST `/sentrix_status_extended` because proto
v0.1 didn't ship the corresponding RPCs.

Chain v2.1.72 (sentrix-labs/sentrix#472) lands `GetValidatorSet`,
`GetSupply`, `GetMempool` as pure-read gRPC methods. This commit swaps
the explorer's stats hot path onto them — no more REST in StatsDashboard
or StatsPanel.

Block height + avg block time still ride EVM `eth_blockNumber` /
`eth_getBlockByNumber`. Both are 100% in proto territory via
`GetBlock(latest)` but the existing JSON-RPC path works and the
follow-up to swap them is a separate commit (would touch
`compute_avg_block_time_ms` + the EvmProvider trait).

Proto in `proto/sentrix.proto` synced from chain. tonic-build
regenerates `pb::{GetValidatorSet, GetSupply, GetMempool, ValidatorSet,
Supply, Mempool, ValidatorEntry, MempoolEntry, ...}` — see grpc/client.rs
for the new wrappers. Bundle size impact: marginal — same tonic
infra, three more proto types.

**Stays on a feature branch** until chain v2.1.72 ships to prod
(grpc.sentrixchain.com:443). Merging earlier would 502 the stats cards
because the gRPC endpoint would respond `unimplemented`.
CI flagged six `manual_is_multiple_of` lints in `format_unix_ts`'s
hand-rolled leap-year calculation — `% N == 0` → `.is_multiple_of(N)`
across the year/century/quad-century guards. Plus `cargo fmt` over the
new MobileNavLink component signature wraps the args one per line.
@satyakwok satyakwok merged commit 8283f34 into main May 5, 2026
3 checks passed
satyakwok added a commit that referenced this pull request May 5, 2026
…blur, mobile clean

Operator audit caught real UX bugs that needed fixing in one pass:

1. **REST regression revert.** PR #1 (pure-gRPC stats) merged before
   chain v2.1.72 shipped to prod, so the dashboard's gRPC calls 502'd
   the validator + mempool + supply cards (showed 0/0/0 instead of
   4/4 + 64M minted). Reverted stats_dashboard's `fetch_sentrix_status`
   + the inline SupplyBar to REST `/sentrix_status_extended` until
   chain v2.1.72 lands. Will flip back to gRPC in a follow-up PR
   once the chain endpoints exist in prod.

2. **Color: amber → emerald (#10B981).** Brand primary is emerald per
   operator confirmation; gold was over-applied and reading "amber/
   bronze" instead of editorial-luxury. Replaced `sentrix-gold` /
   `sentrix-bronze` token usage across navbar, footer, stats_dashboard,
   live_feed, block_detail. Tailwind's default `emerald-500` palette
   is canonical now (we removed the broken @theme override that was
   tinting `--color-emerald-500` with the gold value). Amber stays
   reserved for testnet badge + warnings.

3. **Trim dashboard 12 metrics → 4 + supply.** Dropped the entire
   StatsPanel (Tip Height was a Latest-Block dupe, Avg Finality
   stuck at 0.00s, two TPS variants of the same data, two empty
   spark-charts that read as broken). New layout = the 4-card hero
   (Latest Block / Avg Block Time / Active Validators / Pending Tx)
   + Minted/Cap progress bar inline. SupplyBar polling moved into
   stats_dashboard.rs; stats.rs deleted.

4. **Header overlap.** Sticky header was painting on a partial bg
   so content scrolled visibly behind it. Added `backdrop-blur-md`
   + `bg-zinc-950/85` (with `supports-[backdrop-filter]:bg-zinc-950/70`
   fallback) so the surface reads opaque while preserving subtle
   depth.

5. **Mobile cluttered → hamburger eats the right-side actions.**
   The desktop nav (Faucet/Wallet/CoinBlast + theme + EN +
   Switch-to-Testnet + MetaMask + ConnectionStatus + MAINNET pill)
   was 9 elements jammed onto a 375px viewport. Now: lg+ keeps the
   inline row; below lg only the brand mark + hamburger render. The
   menu drops down with the route links AND the external products
   AND the Switch-to-Testnet button. The standalone MAINNET pill
   was redundant with the toggle button copy — dropped entirely.

6. **Block tile reformat.** Random-color identicons that doubled as
   noise are gone; replaced with a small hex-block-number badge in
   emerald. Hash truncation: `0x3a93…874f` (4-4 with prefix). Raw
   unix `1777977194` swapped for relative "5 min ago" computed
   client-side from `js_sys::Date::now()`.
satyakwok added a commit that referenced this pull request May 5, 2026
…identicon

Three changes per operator brief:

- **Network switcher.** Static "Mainnet · chain · 7119" badge becomes
  a clickable dropdown (◤ chevron) listing both networks with a
  ✓ next to the active one. Selecting a row navigates cross-subdomain
  to the matching bundle (`scan.sentriscloud.com` ↔ `scan-testnet.
  sentriscloud.com`). Each network ships its own bundle so a runtime
  signal flip isn't enough — full page nav is the right primitive
  here. `Network::explorer_url()` carries the destination.

- **Network-aware accent.** Mainnet keeps emerald (#10B981); testnet
  picks up amber (#F59E0B) so the user feels which network they're
  on without having to read labels. New helpers on `Network`:
  `accent_text()` / `accent_bg()` / `accent_pill()`. Applied to the
  hero pulse + "LATEST BLOCKS" live pill + Minted/Cap progress bar.
  Components stay structurally identical; just the colour swaps.

- **Hero strips its leading identicon.** Operator wanted the hero
  visually distinct from the row tiles — list rows keep the per-block
  Identicon as their anchor visual, but the hero cleans up to:
    LATEST BLOCK ● [▢]
    #1,577,898
    0x07ac…dd29
    0 txs · Validator · just now
  Same metadata as before (hash + proposer-label + tx_count + relative
  timestamp), no identicon competing with the height for attention.
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