Skip to content

feat(sequencer): redistribute checkpoint budget evenly across remaining blocks#21378

Merged
PhilWindle merged 1 commit intomerge-train/spartanfrom
palla/redistribute-checkpoint-budget
Mar 12, 2026
Merged

feat(sequencer): redistribute checkpoint budget evenly across remaining blocks#21378
PhilWindle merged 1 commit intomerge-train/spartanfrom
palla/redistribute-checkpoint-budget

Conversation

@spalladino
Copy link
Contributor

@spalladino spalladino commented Mar 11, 2026

Update the per-block budgets so that, on every block, the limits are further adjusted to remainingCheckpointBudget / remainingBlocks * multiplier. This prevents the last blocks from starvation. Also adjusts the multiplier from 2x to 1.2x.

Visualization

Using the https://github.com/AztecProtocol/explorations/tree/main/block-distribution-simulator

Before this PR

No redistribution, 2x multiplier

Screenshot From 2026-03-11 15-50-38

After this PR

Redistribution enabled, 1.2x multiplier

Screenshot From 2026-03-11 15-50-49

With no multiplier

For comparison purposes only, note the lower gas utilization

Screenshot From 2026-03-11 15-50-59

Summary

  • Adds SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET (default: true) to distribute remaining checkpoint budget evenly across remaining blocks instead of letting one block consume it all. Fair share per block is ceil(remainingBudget / remainingBlocks * multiplier), applied to all four dimensions (L2 gas, DA gas, blob fields, tx count).
  • Changes default perBlockAllocationMultiplier from 2 to 1.2 for smoother distribution.
  • Wires maxBlocksPerCheckpoint from the timetable through to the checkpoint builder config.

Test plan

  • Existing capLimitsByCheckpointBudgets tests pass with redistributeCheckpointBudget: false (old behavior)
  • New tests cover: even split with multiplier=1, fair share with multiplier=1.2, last block gets all remaining, disabled flag falls back to old behavior, DA gas and tx count redistribution
  • computeBlockLimits tests updated for new default multiplier and maxBlocksPerCheckpoint return value

🤖 Generated with Claude Code

…ng blocks

Instead of allowing a single block to consume the entire remaining checkpoint budget,
redistribute it evenly across remaining blocks scaled by a multiplier. This produces
smoother distribution (e.g., with multiplier=1.2 and 5 blocks: 240k/216k/180k/...
instead of all-or-nothing). Also changes the default perBlockAllocationMultiplier
from 2 to 1.2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@spalladino spalladino added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure backport-to-v4-next labels Mar 11, 2026
@PhilWindle PhilWindle merged commit 7255d1d into merge-train/spartan Mar 12, 2026
38 of 46 checks passed
@PhilWindle PhilWindle deleted the palla/redistribute-checkpoint-budget branch March 12, 2026 10:07
AztecBot pushed a commit that referenced this pull request Mar 12, 2026
…ng blocks (#21378)

Update the per-block budgets so that, on every block, the limits are further adjusted to `remainingCheckpointBudget / remainingBlocks * multiplier`. This prevents the last blocks from starvation. Also adjusts the multiplier from 2x to 1.2x.

## Visualization

Using the https://github.com/AztecProtocol/explorations/tree/main/block-distribution-simulator

### Before this PR

No redistribution, 2x multiplier

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-38" src="https://github.com/user-attachments/assets/fda36d04-5d9e-456a-9ced-4649fa58d724" />

### After this PR

Redistribution enabled, 1.2x multiplier

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-49" src="https://github.com/user-attachments/assets/2bc196f3-77fa-47bf-9294-4eb4199f8f93" />

### With no multiplier

For comparison purposes only, note the lower gas utilization

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-59" src="https://github.com/user-attachments/assets/0facbc36-65e3-446e-abaf-eb7f637b87c9" />

## Summary

- Adds `SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET` (default: true) to distribute remaining checkpoint budget evenly across remaining blocks instead of letting one block consume it all. Fair share per block is `ceil(remainingBudget / remainingBlocks * multiplier)`, applied to all four dimensions (L2 gas, DA gas, blob fields, tx count).
- Changes default `perBlockAllocationMultiplier` from 2 to 1.2 for smoother distribution.
- Wires `maxBlocksPerCheckpoint` from the timetable through to the checkpoint builder config.

## Test plan

- Existing `capLimitsByCheckpointBudgets` tests pass with `redistributeCheckpointBudget: false` (old behavior)
- New tests cover: even split with multiplier=1, fair share with multiplier=1.2, last block gets all remaining, disabled flag falls back to old behavior, DA gas and tx count redistribution
- `computeBlockLimits` tests updated for new default multiplier and `maxBlocksPerCheckpoint` return value

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@AztecBot
Copy link
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #21370.

ludamad pushed a commit that referenced this pull request Mar 12, 2026
…ng blocks (#21378)

Update the per-block budgets so that, on every block, the limits are further adjusted to `remainingCheckpointBudget / remainingBlocks * multiplier`. This prevents the last blocks from starvation. Also adjusts the multiplier from 2x to 1.2x.

## Visualization

Using the https://github.com/AztecProtocol/explorations/tree/main/block-distribution-simulator

### Before this PR

No redistribution, 2x multiplier

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-38" src="https://github.com/user-attachments/assets/fda36d04-5d9e-456a-9ced-4649fa58d724" />

### After this PR

Redistribution enabled, 1.2x multiplier

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-49" src="https://github.com/user-attachments/assets/2bc196f3-77fa-47bf-9294-4eb4199f8f93" />

### With no multiplier

For comparison purposes only, note the lower gas utilization

<img width="1544" height="737" alt="Screenshot From 2026-03-11 15-50-59" src="https://github.com/user-attachments/assets/0facbc36-65e3-446e-abaf-eb7f637b87c9" />

## Summary

- Adds `SEQ_REDISTRIBUTE_CHECKPOINT_BUDGET` (default: true) to distribute remaining checkpoint budget evenly across remaining blocks instead of letting one block consume it all. Fair share per block is `ceil(remainingBudget / remainingBlocks * multiplier)`, applied to all four dimensions (L2 gas, DA gas, blob fields, tx count).
- Changes default `perBlockAllocationMultiplier` from 2 to 1.2 for smoother distribution.
- Wires `maxBlocksPerCheckpoint` from the timetable through to the checkpoint builder config.

## Test plan

- Existing `capLimitsByCheckpointBudgets` tests pass with `redistributeCheckpointBudget: false` (old behavior)
- New tests cover: even split with multiplier=1, fair share with multiplier=1.2, last block gets all remaining, disabled flag falls back to old behavior, DA gas and tx count redistribution
- `computeBlockLimits` tests updated for new default multiplier and `maxBlocksPerCheckpoint` return value

🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-merge-queue bot pushed a commit that referenced this pull request Mar 16, 2026
BEGIN_COMMIT_OVERRIDE
feat: add ETHEREUM_HTTP_TIMEOUT_MS env var for viem HTTP transport
(#20919)
fix(archiver): filter tagged log queries by block number (#21388)
fix(node): handle slot zero in getL2ToL1Messages (#21386)
feat(sequencer): redistribute checkpoint budget evenly across remaining
blocks (#21378)
fix: fall back to package.json for CLI version detection (#21382)
chore: Removed multiplier config (#21412)
chore: Removed default snapshot url config (#21413)
chore: Read tx filestores from network config (#21416)
fix(node): check world state against requested block hash (#21385)
feat(p2p): use l2 priority fee only for tx priority (#21420)
feat(p2p): reject and evict txs with insufficient max fee per gas
(#21281)
revert "feat(p2p): reject and evict txs with insufficient max fee per
gas (#21281)" (#21432)
chore: Reduce log spam (#21436)
fix(tx): reject txs with invalid setup when unprotecting (#21224)
fix: orchestrator enqueue yield (#21286)
chore(builder): check archive tree next leaf index during block building
(#21457)
fix: scenario deployment (#21428)
chore: add claude skill to read network-logs (#21495)
chore: update claude network-logs skill (#21523)
feat(rpc): add package version to RPC response headers (#21526)
chore(prover): silence "epoch to prove" debug logs (#21527)
chore(sequencer): do not log blob data (#21530)
fix: dependabot alerts (#21531)
docs(p2p): nicer READMEs (#21456)
fix(archiver): guard getL1ToL2Messages against incomplete message sync
(#21494)
fix(sequencer): await syncing proposed block to archiver (#21554)
feat(ethereum): check VK tree root and protocol contracts hash in rollup
compatibility (#21537)
fix: marking peer as dumb on failed responses (#21316)
fix(kv-store): make LMDB clear and drop operations atomic across
sub-databases (#21539)
feat(world-state): add blockHash verification to syncImmediate (#21556)
chore(monitor): print out l2 fees components (#21559)
chore: rm faucet (#21538)
chore: remove old merkle trees (#21577)
feat: Implement commit all and revert all for world state checkpoints
(#21532)
chore: skip flaky browser acir tests in CI (#21596)
fix: Better detection for epoch prune (#21478)
chore: logging (#21604)
fix: Don't update state if we failed to execute sufficient transactions
(#21443)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4-next ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants