Skip to content

chore: v6 l1 updates integration branch - #25401

Draft
alexghr wants to merge 12 commits into
nextfrom
project/v6-l1-updates
Draft

chore: v6 l1 updates integration branch#25401
alexghr wants to merge 12 commits into
nextfrom
project/v6-l1-updates

Conversation

@alexghr

@alexghr alexghr commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

.

aminsammara and others added 12 commits August 28, 2026 09:42
Adds a governance-set margin `mu` on the mana base fee. The fee becomes
`cost * (1 + mu) * congestionMultiplier`: operators still receive exactly
`cost` from the fee waterfall plus the unchanged block reward, and the markup
above cost goes to a governance-set `protocolFeeRecipient`, which defaults to
the current burn address.

- `mu` is a uint16 bps field packed into bits 224-239 of `CompressedFeeConfig`
  and deploys at 0, so the rollup is bit-identical to today.
- `setProtocolFeeMargin` is governance-only and rate-limited to x3/2 on the fee
  multiplier per 30-day window, matching `setProvingCostPerMana`. Decreases are
  immediate and unrestricted; setting the current value is a no-op.
- The `(1 + mu)` scaling is applied only to the `fakeExponential` factor in
  `congestionMultiplier`. The `mulDiv` divisor stays
  `MINIMUM_CONGESTION_MULTIPLIER` -- scaling both sites cancels the margin.
- The fee header's uint64 `congestionCost` field becomes `protocolFee` and
  carries `summedMinFee - sequencerCost - proverCost` as a single subtraction
  clamped at 0, so `fee - protocolFee = cost * manaUsed` holds to the wei.
- `RewardLib.BURN_ADDRESS` becomes the deploy-time default for a stored
  `protocolFeeRecipient`; `getBurnAddress()` is replaced by
  `getProtocolFeeRecipient()`.
- The TypeScript fee mirror is updated to match bit-exactly, with `mu` threaded
  through the L1 config read into the fee predictor.
## Summary

- reuse the current epoch already computed during proof acceptance
- cache the packed chain tips for full-proof detection and proven-tip
advancement
- read the known-existing next checkpoint slot directly instead of
repeating checkpoint-number validation
- update the gas benchmark results; this saves 1,053 gas per proof
submission versus the parent PR implementation, leaving roughly 3,729
gas of net overhead versus the pre-PR baseline

## Tests

- `forge fmt --check`
- `forge test --offline --match-contract MultiProofTest`
- `forge test --offline --match-contract HandleRewardsTest`
- `python3 scripts/gas_benchmarks.py`
## Context

There was no on-chain record of who proved a given checkpoint.
`L2ProofVerified` carries the prover, but there is nothing queryable,
and the reward accounting only tracks per-epoch submissions.

## Approach

Adds a `firstProvenBy` mapping to `RollupStore`, written in
`submitEpochRootProof` whenever a proof advances the proven tip. Only
the checkpoint the proof ended at gets an entry, so entries are sparse:
proofs of 1-10 and then 11-20 record entries at 10 and 20, with nothing
in between. Because a proof of an already proven range cannot advance
the tip, it never reaches the write and the original prover is
preserved.

`getFirstProvenBy(checkpointNumber)` resolves an arbitrary checkpoint by
walking forward to the next entry. The first entry at or after the
requested number belongs to the earliest proof that covered it, since
the proven tip only ever advances; the walk is bounded by the epoch
duration because a proof covers at most one epoch. The mapping stores
the address in its lower 160 bits and sets bit 160 as a presence flag,
so `address(0)` remains distinguishable from a sparse, unwritten entry.

The getter reverts with `Rollup__CheckpointNotProven` for checkpoint 0
or a checkpoint ahead of the proven tip.

The getter is routed through `RewardExtLib` (alongside the other STF
getters) rather than inlined in `Rollup.sol` — the Rollup deployed
bytecode is within 800 bytes of the size limit.

## API changes

New `IRollup.getFirstProvenBy(uint256) returns (address)` and
`Errors.Rollup__CheckpointNotProven(uint256 proven, uint256 requested)`.

Fixes A-1927
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.

4 participants