Skip to content

fix(backend): widen TPS window to ~3.33 blocks for 300ms block time#111

Merged
Camillebzd merged 1 commit into
mainfrom
fix/tps-window-300ms-blocks
Jul 24, 2026
Merged

fix(backend): widen TPS window to ~3.33 blocks for 300ms block time#111
Camillebzd merged 1 commit into
mainfrom
fix/tps-window-300ms-blocks

Conversation

@dak-agent

@dak-agent dak-agent Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Motivation

The backend TPS metric (TPSTracker::get_tps in backend/src/lib/server.rs) hardcoded an assumption that average block time is ~400ms. It approximated one second of throughput by summing 2.5 blocks of transaction counts (2.5 × 400ms = 1s).

With the block time change from 400ms → 300ms, a 2.5-block window now covers only ~750ms, so reported TPS is ~25% too low (750ms / 1000ms).

Modifications

  • Added a fourth tracked block (block_4_txs) to TPSTracker.
  • get_tps() now sums the three most recent full blocks plus one third of the block before them — an effective window of ~3.33 blocks (3.33 × 300ms ≈ 1s).
  • Updated the doc comment to reflect the 300ms assumption.

Result

TPS again approximates one second of throughput at the new 300ms block time. No other part of the app needed changes — the frontend (block execution times, timeline, block-state tracker, transaction-volume chart) is derived entirely from live execution-event data and normalizes dynamically.

Greptile Summary

This PR adjusts the backend TPS estimate for a 300 ms block cadence. The main changes are:

  • Adds a fourth completed-block counter to TPSTracker.
  • Uses three full blocks plus one third of the preceding block.
  • Updates the TPS documentation to describe the new window.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
backend/src/lib/server.rs Extends TPS history and updates its rotation and weighting for the shorter block cadence.

Reviews (1): Last reviewed commit: "fix(backend): widen TPS window to ~3.33 ..." | Re-trigger Greptile

The TPS metric summed 2.5 blocks of transaction counts to approximate
one second, on the assumption that average block time is ~400ms
(2.5 * 400ms = 1s). With block time now ~300ms, a 2.5-block window
covers only ~750ms, causing TPS to be under-reported by ~25%.

Track a fourth block and sum ~3.33 blocks (3.33 * 300ms = 1s) so the
metric again approximates one second of throughput.

Co-authored-by: Vukašin Manojlović <8989109+iamvukasin@users.noreply.github.com>
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
monode Ready Ready Preview, Comment Jul 23, 2026 4:30pm

Request Review

@Camillebzd
Camillebzd merged commit 7f7f4cb into main Jul 24, 2026
10 checks passed
@Camillebzd
Camillebzd deleted the fix/tps-window-300ms-blocks branch July 24, 2026 08:24
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