Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions app/scaling/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const area = async (id: string) => renderToStaticMarkup(await ScalingAreaPage({
it('ends the first screen with the DA link, and no guardrails or benchmark links', async () => {
const html = renderToStaticMarkup(await ScalingPage());
expect(html).toContain('<a class="underline" href="/scaling/da">DA by workload</a>');
expect(html).toContain('Block Gas Limit: 40 Mgas');
expect(html, 'configured rate and per-block budget use the requested units').toContain('200 Mgas / s (40 Mgas / block)');
// The guardrails page stays, unlinked, while the first screen leaves guardrails out.
expect(html).not.toMatch(/href="\/scaling\/guardrails"|Guardrails<\/h2>|SLOs/);
expect(html).not.toMatch(/href="\/benchmark|href="\/scaling\/networking"/);
Expand All @@ -34,11 +34,26 @@ it('ends the first screen with the DA link, and no guardrails or benchmark links

it('orders the first screen: freshness, headline, ladder, ranked limits, subsystems by workload, work, links', async () => {
const html = renderToStaticMarkup(await ScalingPage());
const order = ['Block Gas Limit: 40 Mgas', 'Usage to 2026-01-02', 'Proven capacity', 'How close are we, and to what?', 'What breaks first', 'Subsystems by workload', 'Glamsterdam', 'Work log', 'DA by workload'].map((h) => html.indexOf(h));
const order = ['200 Mgas / s (40 Mgas / block)', 'Usage to 2026-01-02', 'Proven capacity', 'How close are we, and to what?', 'What breaks first', 'Subsystems by workload', 'Glamsterdam', 'Work log', 'DA by workload'].map((h) => html.indexOf(h));
expect(order.every((i, k) => i > (order[k - 1] ?? -1))).toBe(true);
expect(html).not.toMatch(/Subsystem detail|>Progress<|Ceilings by bottleneck|Usage data as of/);
});

/** Verifies the dual-unit header uses configured data and preserves unknown values. */
it.each([
[1234.5, '1,234.5 Mgas / s (246.9 Mgas / block)'],
[0, '0 Mgas / s (0 Mgas / block)'],
[null, '— Mgas / s (— Mgas / block)'],
])('renders configured gas rate %s in both units', async (value, expected) => {
const path = join(tmpdir(), `scaling-header-${value}.json`);
writeFileSync(path, JSON.stringify({ ...fixture, ladder: { ...fixture.ladder, configuredLimit: { ...fixture.ladder.configuredLimit, value, tag: value === null ? 'not-established' : fixture.ladder.configuredLimit.tag } } }));
vi.stubEnv('SCALING_SNAPSHOT_PATH', path);
const html = renderToStaticMarkup(await ScalingPage());
expect(html, 'both units reflect the configured limit without substituting sample data').toContain(expected);
expect(html, 'the editorial explanation labels this as a block gas limit').toContain('Block gas limit');
if (value === null) expect(html, 'missing configuration is explicitly unavailable').toContain('Configured gas limit unavailable.');
});

it('dates snapshot data without a stale banner', async () => {
// The fixture is far older than any staleness window.
expect(renderToStaticMarkup(await ScalingGuardrailsPage())).toContain('Usage data as of 2026-01-02');
Expand Down
19 changes: 14 additions & 5 deletions app/scaling/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ export default async function ScalingPage() {

const snapshot = withArchiveSize(loaded.snapshot, await loadArchiveSize());
const dashboardUrl = process.env.SCALING_DATADOG_DASHBOARD_URL;
const gasRate = snapshot.ladder.configuredLimit.value;
return (
<div className="flex flex-col gap-10 pb-8">
<div className="flex flex-col gap-1.5">
<Header title={`${snapshot.network} capacity`} />
<Text variant="label.regular" tone="muted">
Block Gas Limit: {snapshot.ladder.configuredLimit.value === null ? '—' : `${(snapshot.ladder.configuredLimit.value * BASE_BLOCK_TIME_SECONDS).toLocaleString('en-US', { maximumFractionDigits: 1 })} Mgas`}
</Text>
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 md:items-center md:gap-10">
<div className="flex min-w-0 flex-col gap-4">
<Header title={`${snapshot.network} capacity`} />
<Text variant="label.regular" className="text-[22px] leading-snug tabular-nums text-brand-blue md:text-[26px]">
{gasRate === null ? '— Mgas / s (— Mgas / block)' : `${gasRate.toLocaleString('en-US', { maximumFractionDigits: 1 })} Mgas / s (${(gasRate * BASE_BLOCK_TIME_SECONDS).toLocaleString('en-US', { maximumFractionDigits: 1 })} Mgas / block)`}
</Text>
</div>
<div className="flex flex-col gap-2">
<Text as="h2" variant="label">Block gas limit</Text>
<Text variant="label.regular" tone="muted">
{gasRate === null ? 'Configured gas limit unavailable.' : 'Configured gas ceiling, shown per second and per 200ms block. This is a setting, not measured throughput.'}
</Text>
</div>
</div>
<Scorecard snapshot={snapshot} benchUrl={process.env.SCALING_BENCH_BASE_URL} />
<Text variant="label.regular" tone="muted">
Expand Down
Loading