Skip to content

feat: merge-train/spartan#22457

Open
AztecBot wants to merge 12 commits intonextfrom
merge-train/spartan
Open

feat: merge-train/spartan#22457
AztecBot wants to merge 12 commits intonextfrom
merge-train/spartan

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Apr 10, 2026

BEGIN_COMMIT_OVERRIDE
fix(p2p): back off on repeated auth handshake failures (#22435)
chore(pipeline): add metrics for pipeling building timelines (#21591)
fix: no division by zero in sentinel (#22467)
chore(pipelining): update next net (#22466)
feat(claude): add skill to read gists (#22471)
feat(node): add fee prediction API for upcoming L2 slots (#22116)
fix: lower EXPECTED_BLOCKS_PER_CHECKPOINT for CI stability (#22480)
END_COMMIT_OVERRIDE

AztecBot and others added 11 commits April 10, 2026 13:32
## Overview

Metrics to keep an eye on checkpoint construction
Fixes A-772

Note that the original issue reads "when commitee size is zero". That
was not the case, not on the sentinel at least.
enable pipelining on next net
Prevents claude from going through webfetch to read a gist, when the gh
cli is much more efficient
## Motivation

Wallets currently use `getCurrentMinFees` to set `maxFeesPerGas`, but
this only reflects the fee at the current moment. If L1 fees change (via
the oracle's LAG-delayed transition) or congestion grows before the
transaction lands, the fee could be too low and the tx gets rejected. We
need a prediction API that accounts for upcoming L1 fee transitions and
congestion growth so wallets can set fees that guarantee inclusion.

Fixes A-648

## Approach

Ports the fee computation logic from `FeeLib.sol` into TypeScript
(`fee_math.ts`) so fees can be predicted locally without state
overrides. A new `FeePredictor` class queries the L1 rollup state once
per L1 block (cached), then computes per-slot fees for a `LAG + 1 = 3`
slot window. The window is LAG (not LIFETIME) because a new oracle
update could be enqueued at any time and activate after LAG slots,
making longer predictions unreliable. The wallet picks the max fee
across the window with a backwards-compatible fallback to
`getCurrentMinFees` for old nodes.

## Changes

- **stdlib/src/gas/fee_math.ts**: TypeScript port of FeeLib.sol fee
computation (fakeExponential, congestion multiplier, full fee
calculation) with `ManaUsageEstimate` enum (None/Target/Limit)
- **stdlib/src/gas/fee_math.test.ts**: Unit tests for all fee math
functions
- **stdlib/src/gas/README.md**: Documentation on L1 gas oracle
LAG/LIFETIME and the fee prediction window
- **sequencer-client/src/global_variable_builder/fee_predictor.ts**:
`FeePredictor` class that caches L1 state and computes per-slot
predictions with configurable mana usage assumptions
-
**sequencer-client/src/global_variable_builder/fee_predictor.test.ts**:
Integration tests against Anvil + deployed Rollup verifying exact match
with L1 `getManaMinFeeAt` across all mana usage estimates
- **ethereum/src/contracts/rollup.ts**: Added `compressFeeHeader`,
`packChainTips`, `chainTipsStorageSlot`,
`getTempCheckpointLogStorageSlot`, `TempCheckpointLogField` enum, and
`getFeeHeader` wrapper
- **ethereum/src/contracts/rollup.test.ts**: Unit tests for the new
RollupContract helpers
- **stdlib/src/interfaces/aztec-node.ts**: Added
`getPredictedMinFees(manaUsage?)` to AztecNode interface and schema
- **aztec-node/src/aztec-node/server.ts**: Delegates to
GlobalVariableBuilder
- **wallet-sdk/src/base-wallet/base_wallet.ts**: Uses
`getPredictedMinFees(Limit)` with fallback to `getCurrentMinFees`
- **wallet-sdk/src/base-wallet/base_wallet.test.ts**: Unit tests for
`getMinFees` (max selection, estimate forwarding, fallback paths)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## Summary

The `epochs_mbps.pipeline.parallel` test expects at least 12 blocks in a
single checkpoint, which requires near-ideal timing (72s slot / 5.5s per
block = 13 max blocks). On constrained CI runners (2 CPUs, 8GB RAM),
block building is slower and only 11 blocks were achieved, causing a
flaky failure unrelated to the PR that triggered it (#22116).

Lowered `EXPECTED_BLOCKS_PER_CHECKPOINT` from 12 to 8, which still
validates MBPS behavior while giving sufficient margin for CI.

## Details

Full analysis:
https://gist.github.com/AztecBot/7779b7de743711f18899ef57e2060c68

ClaudeBox log: https://claudebox.work/s/6228f03c1549fb57?run=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants