Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
53abe87
feat(rollup): seed snapshots
Maddiaa0 Apr 15, 2025
5a6fe8a
chore: document
Maddiaa0 Apr 15, 2025
6bbadd4
chore: add setupEpoch test suite
Maddiaa0 Apr 15, 2025
9724ef2
fmt
Maddiaa0 Apr 16, 2025
b212389
fmt: function order
Maddiaa0 Apr 16, 2025
de29295
Merge branch 'master' into md/seed-snapshots
Maddiaa0 Apr 28, 2025
40967d9
post merge fix
Maddiaa0 Apr 28, 2025
4321429
Merge branch 'master' into md/seed-snapshots
Maddiaa0 Apr 28, 2025
1ecec4f
fmt
Maddiaa0 Apr 28, 2025
08d1132
update getseed
Maddiaa0 Apr 28, 2025
091c43e
chore: genesis state changes
Maddiaa0 Apr 29, 2025
7b18dbe
feat: remove committee, swap signatures to attestations
Maddiaa0 Apr 21, 2025
4500d32
tmp
Maddiaa0 Apr 21, 2025
4163ff5
chore: update sol tests
Maddiaa0 Apr 22, 2025
3183d05
chore: yp changes
Maddiaa0 Apr 22, 2025
dceeecc
fix
Maddiaa0 Apr 22, 2025
d5c6f18
chore: update can propose at time to recreate content commitments
Maddiaa0 Apr 22, 2025
ba5e341
merge fixes
Maddiaa0 Apr 28, 2025
b23058d
chore: apply ontop of master changes
Maddiaa0 Apr 28, 2025
8090796
fix: tests
Maddiaa0 Apr 28, 2025
edec30d
fmt
Maddiaa0 Apr 29, 2025
fcabbb1
fmt
Maddiaa0 Apr 29, 2025
b94eebf
Merge branch 'master' into md/commit-comittee
Maddiaa0 May 12, 2025
eeeabf3
post merge fixes
Maddiaa0 May 12, 2025
aeeb6cc
fixes
Maddiaa0 May 13, 2025
dc6617f
fix: some comments
Maddiaa0 May 13, 2025
8eb31c4
cleanup
Maddiaa0 May 13, 2025
15f3365
chore: update scream and shout
Maddiaa0 May 13, 2025
95c95cd
chore: add reverts if no proposer addr provided test
Maddiaa0 May 13, 2025
63187e2
invert dependency
Maddiaa0 May 13, 2025
3bbfe3d
Merge branch 'master' into md/commit-comittee
Maddiaa0 May 13, 2025
1f55a69
Merge branch 'master' into md/commit-comittee
LHerskind May 16, 2025
31b5b8c
fix: build + rollup getter test
Maddiaa0 May 19, 2025
e12cc4e
Merge remote-tracking branch 'origin/next' into md/commit-comittee
Maddiaa0 May 21, 2025
ffac3a2
fix
Maddiaa0 May 21, 2025
1a58661
update gas report after next merge
Maddiaa0 May 21, 2025
27101ba
chore: post merge formatting
Maddiaa0 May 21, 2025
b3e2188
fmt
Maddiaa0 May 21, 2025
64ddb43
fmt
Maddiaa0 May 21, 2025
95097f7
Merge branch 'next' into md/commit-comittee
Maddiaa0 May 21, 2025
4a7f21c
Merge branch 'next' into md/commit-comittee
just-mitch May 24, 2025
12afb4b
run benchmark
just-mitch May 24, 2025
5a04980
Merge branch 'next' into md/commit-comittee
just-mitch May 24, 2025
3bf4893
use test date provider in snapshot manager
just-mitch May 24, 2025
7dd7b04
fix: sync date provider if behind.
just-mitch May 25, 2025
d91d06d
fix: anvil watcher compensates for stuck L1
just-mitch May 25, 2025
96ac393
fix: more generous timeout waiting for l2 block
just-mitch May 25, 2025
30b73a2
fix: date provider in sandbox
just-mitch May 25, 2025
1c6942d
fix: sequencer tests
just-mitch May 25, 2025
d3c1044
fix: sequencer-ppublisher test
just-mitch May 25, 2025
ba034ac
fix: epoch proof fails tests
just-mitch May 25, 2025
0b6c3b6
fix: epoch tests
just-mitch May 25, 2025
7894927
fix: e2e empty blocks looser assertion
just-mitch May 25, 2025
81aa988
fix: keep anvil test watcher in tighter sync. shorter l1 time in empt…
just-mitch May 25, 2025
a2f4514
fix linter
just-mitch May 25, 2025
4489286
fix: fewer epochs
just-mitch May 25, 2025
e1246ef
chore: remove optimization of getting slot/proposer from epoch cache
just-mitch May 26, 2025
0153bf4
revert changes in empty epoch test
just-mitch May 26, 2025
f1f9d6a
Merge branch 'next' into md/commit-comittee
just-mitch May 26, 2025
5b96aa6
Revert "revert changes in empty epoch test"
just-mitch May 26, 2025
b15710d
Revert "chore: remove optimization of getting slot/proposer from epoc…
just-mitch May 26, 2025
45f9c54
Revert "fix: fewer epochs"
just-mitch May 26, 2025
f2a5916
undo some timing changes
just-mitch May 26, 2025
ad52667
Merge branch 'next' into md/commit-comittee
just-mitch May 27, 2025
ad0ff2f
reorder tests
just-mitch May 27, 2025
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
26 changes: 13 additions & 13 deletions l1-contracts/gas_benchmark.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Function | Metric | No Validators (gas/tx) | 100 Validators (gas/tx) | Δ Gas (gas/tx) | % Overhead
Function | Metric | No Validators (gas/tx) | 100 Validators (gas/tx) | Δ Gas (gas/tx) | % Overhead
-------------------------+---------+------------------------+-------------------------+------------------------+-----------------
forward | Min | 308660 (857.39) | 308660 (857.39) | 0 (0.00) | 0.00%
forward | Avg | 320436 (890.10) | 543109 (1508.64) | 222673 (618.54) | 69.49%
forward | Median | 320645 (890.68) | 642954 (1785.98) | 322309 (895.30) | 100.52%
forward | Max | 332545 (923.74) | 655258 (1820.16) | 322713 (896.42) | 97.04%
forward | Min | 298181 (828.28) | 576397 (1601.10) | 278216 (772.82) | 93.30%
forward | Avg | 310056 (861.27) | 588480 (1634.67) | 278424 (773.40) | 89.80%
forward | Median | 308932 (858.14) | 587490 (1631.92) | 278558 (773.77) | 90.17%
forward | Max | 321646 (893.46) | 600346 (1667.63) | 278700 (774.17) | 86.65%
forward | # Calls | 100 | 100 | 0 | 0.00%
-------------------------+---------+------------------------+-------------------------+------------------------+-----------------
setupEpoch | Min | 52590 (4.57) | 39767 (3.45) | -12823 (-1.11) | -24.38%
setupEpoch | Avg | 57031 (4.95) | 92551 (8.03) | 35520 (3.08) | 62.28%
setupEpoch | Median | 57360 (4.98) | 40222 (3.49) | -17138 (-1.49) | -29.88%
setupEpoch | Max | 84128 (7.30) | 1655176 (143.68) | 1571048 (136.38) | 1867.45%
setupEpoch | Min | 37724 (3.27) | 37724 (3.27) | 0 (0.00) | 0.00%
setupEpoch | Avg | 42099 (3.65) | 61483 (5.34) | 19384 (1.68) | 46.04%
setupEpoch | Median | 39724 (3.45) | 39724 (3.45) | 0 (0.00) | 0.00%
setupEpoch | Max | 112629 (9.78) | 597218 (51.84) | 484589 (42.07) | 430.25%
setupEpoch | # Calls | 100 | 100 | 0 | 0.00%
-------------------------+---------+------------------------+-------------------------+------------------------+-----------------
submitEpochRootProof | Min | 868811 (75.42) | 868811 (75.42) | 0 (0.00) | 0.00%
submitEpochRootProof | Avg | 886463 (76.95) | 886463 (76.95) | 0 (0.00) | 0.00%
submitEpochRootProof | Median | 868823 (75.42) | 868823 (75.42) | 0 (0.00) | 0.00%
submitEpochRootProof | Max | 921756 (80.01) | 921756 (80.01) | 0 (0.00) | 0.00%
submitEpochRootProof | Min | 867316 (75.29) | 867316 (75.29) | 0 (0.00) | 0.00%
submitEpochRootProof | Avg | 885016 (76.82) | 885016 (76.82) | 0 (0.00) | 0.00%
submitEpochRootProof | Median | 867400 (75.30) | 867400 (75.30) | 0 (0.00) | 0.00%
submitEpochRootProof | Max | 920334 (79.89) | 920334 (79.89) | 0 (0.00) | 0.00%
submitEpochRootProof | # Calls | 3 | 3 | 0 | 0.00%
-------------------------+---------+------------------------+-------------------------+------------------------+-----------------
94 changes: 47 additions & 47 deletions l1-contracts/gas_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"contract": "src/core/Rollup.sol:Rollup",
"deployment": {
"gas": 0,
"size": 43024
"size": 43935
},
"functions": {
"archive()": {
Expand All @@ -14,7 +14,7 @@
"max": 4583
},
"getBlock(uint256)": {
"calls": 886,
"calls": 847,
"min": 9208,
"mean": 9208,
"median": 9208,
Expand Down Expand Up @@ -50,17 +50,17 @@
},
"getFeeAssetPortal()": {
"calls": 3104,
"min": 497,
"mean": 1497,
"median": 1497,
"max": 2497
"min": 453,
"mean": 1453,
"median": 1453,
"max": 2453
},
"getInbox()": {
"calls": 6198,
"min": 2476,
"mean": 2476,
"median": 2476,
"max": 2476
"min": 2498,
"mean": 2498,
"median": 2498,
"max": 2498
},
"getL1FeesAt(uint256)": {
"calls": 2,
Expand All @@ -71,10 +71,10 @@
},
"getManaBaseFeeAt(uint256,bool)": {
"calls": 2325,
"min": 30582,
"mean": 32494,
"median": 30582,
"max": 36337
"min": 30538,
"mean": 32450,
"median": 30538,
"max": 36293
},
"getManaTarget()": {
"calls": 2,
Expand All @@ -85,10 +85,10 @@
},
"getOutbox()": {
"calls": 3875,
"min": 2474,
"mean": 2474,
"median": 2474,
"max": 2474
"min": 2452,
"mean": 2452,
"median": 2452,
"max": 2452
},
"getPendingBlockNumber()": {
"calls": 1545,
Expand All @@ -99,10 +99,10 @@
},
"getProofSubmissionWindow()": {
"calls": 4,
"min": 2493,
"mean": 2493,
"median": 2493,
"max": 2493
"min": 2404,
"mean": 2404,
"median": 2404,
"max": 2404
},
"getProvenBlockNumber()": {
"calls": 6196,
Expand All @@ -127,10 +127,10 @@
},
"getSequencerRewards(address)": {
"calls": 2,
"min": 2649,
"mean": 2649,
"median": 2649,
"max": 2649
"min": 2716,
"mean": 2716,
"median": 2716,
"max": 2716
},
"getTimestampForSlot(uint256)": {
"calls": 2432,
Expand All @@ -148,17 +148,17 @@
},
"owner()": {
"calls": 1552,
"min": 464,
"mean": 464,
"median": 464,
"max": 464
"min": 420,
"mean": 420,
"median": 420,
"max": 420
},
"propose((bytes32,bytes,(int256),bytes,bytes32[]),(bool,uint8,bytes32,bytes32)[],bytes)": {
"propose((bytes32,bytes,(int256),bytes,bytes32[]),(address,(uint8,bytes32,bytes32))[],bytes)": {
"calls": 2327,
"min": 152057,
"mean": 334744,
"median": 330093,
"max": 360753
"min": 180367,
"mean": 343443,
"median": 348542,
"max": 380636
},
"prune()": {
"calls": 6,
Expand All @@ -169,17 +169,17 @@
},
"setProvingCostPerMana(uint256)": {
"calls": 2,
"min": 28669,
"mean": 28669,
"median": 28669,
"max": 28669
"min": 28780,
"mean": 28780,
"median": 28780,
"max": 28780
},
"submitEpochRootProof((uint256,uint256,(bytes32,bytes32,uint256,bytes32,address),bytes32[],bytes,bytes))": {
"calls": 885,
"min": 59252,
"mean": 419060,
"median": 415459,
"max": 449558
"submitEpochRootProof((uint256,uint256,(bytes32,bytes32,address),bytes32[],bytes,bytes))": {
"calls": 846,
"min": 58871,
"mean": 417467,
"median": 414067,
"max": 448154
}
}
},
Expand Down Expand Up @@ -244,7 +244,7 @@
},
"functions": {
"getCanonicalRollup()": {
"calls": 2643,
"calls": 2526,
"min": 1016,
"mean": 3016,
"median": 1016,
Expand Down Expand Up @@ -281,7 +281,7 @@
"max": 238
},
"canonicalRollup()": {
"calls": 881,
"calls": 842,
"min": 10158,
"mean": 10158,
"median": 10158,
Expand Down
36 changes: 24 additions & 12 deletions l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
Epoch,
Timestamp,
Errors,
Signature,
CommitteeAttestation,
ExtRollupLib,
EthValue,
STFLib,
Expand Down Expand Up @@ -94,15 +94,15 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
* without having to deal with viem or anvil for simulating timestamps in the future.
*
* @param _header - The header to validate
* @param _signatures - The signatures to validate
* @param _attestations - The attestations to validate
* @param _digest - The digest to validate
* @param _currentTime - The current time
* @param _blobsHash - The blobs hash for this block
* @param _flags - The flags to validate
*/
function validateHeader(
bytes calldata _header,
Signature[] memory _signatures,
CommitteeAttestation[] memory _attestations,
bytes32 _digest,
Timestamp _currentTime,
bytes32 _blobsHash,
Expand All @@ -111,7 +111,7 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
ProposeLib.validateHeader(
ValidateHeaderArgs({
header: HeaderLib.decode(_header),
attestations: _signatures,
attestations: _attestations,
digest: _digest,
currentTime: _currentTime,
manaBaseFee: getManaBaseFeeAt(_currentTime, true),
Expand Down Expand Up @@ -148,6 +148,22 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
return getEpochCommittee(getEpochAt(_ts));
}

/**
* @notice Get the committee commitment a the given timestamp
*
* @param _ts - The timestamp to get the committee for
*
* @return The committee commitment for the given timestamp
* @return The committee size for the given timestamp
*/
function getCommitteeCommitmentAt(Timestamp _ts)
external
Copy link
Member Author

@Maddiaa0 Maddiaa0 May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another candidate for external that is setting state, will update post your pr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My pr is in, so feel free to add the test in the new file from there. I think it should be solved as part of the getCommittee that was altered lower down the stack.

override(IValidatorSelection)
returns (bytes32, uint256)
{
return ValidatorSelectionLib.getCommitteeCommitmentAt(getEpochAt(_ts));
}

/**
* @notice Get the proposer for the current slot
*
Expand Down Expand Up @@ -186,14 +202,10 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
bytes32 tipArchive = rollupStore.blocks[pendingBlockNumber].archive;
require(tipArchive == _archive, Errors.Rollup__InvalidArchive(tipArchive, _archive));

Signature[] memory sigs = new Signature[](0);

ValidatorSelectionLib.verify(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty.

slot,
slot.epochFromSlot(),
sigs,
_archive,
BlockHeaderValidationFlags({ignoreDA: true, ignoreSignatures: true})
Epoch epochNumber = slot.epochFromSlot();
address proposer = ValidatorSelectionLib.getProposerAt(slot, epochNumber);
require(
proposer == msg.sender, Errors.ValidatorSelection__InvalidProposer(proposer, msg.sender)
);

return (slot, pendingBlockNumber + 1);
Expand Down
6 changes: 3 additions & 3 deletions l1-contracts/src/core/RollupCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {IValidatorSelectionCore} from "@aztec/core/interfaces/IValidatorSelectio
import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol";
import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol";
import {Constants} from "@aztec/core/libraries/ConstantsGen.sol";
import {Signature} from "@aztec/core/libraries/crypto/SignatureLib.sol";
import {CommitteeAttestation} from "@aztec/core/libraries/crypto/SignatureLib.sol";
import {Errors} from "@aztec/core/libraries/Errors.sol";
import {CheatLib} from "@aztec/core/libraries/rollup/CheatLib.sol";
import {ExtRollupLib} from "@aztec/core/libraries/rollup/ExtRollupLib.sol";
Expand Down Expand Up @@ -215,10 +215,10 @@ contract RollupCore is

function propose(
ProposeArgs calldata _args,
Signature[] memory _signatures,
CommitteeAttestation[] memory _attestations,
bytes calldata _blobInput
) external override(IRollupCore) {
ExtRollupLib.propose(_args, _signatures, _blobInput, checkBlob);
ExtRollupLib.propose(_args, _attestations, _blobInput, checkBlob);
}

function setupEpoch() public override(IValidatorSelectionCore) {
Expand Down
6 changes: 3 additions & 3 deletions l1-contracts/src/core/interfaces/IRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {IFeeJuicePortal} from "@aztec/core/interfaces/IFeeJuicePortal.sol";
import {IVerifier} from "@aztec/core/interfaces/IVerifier.sol";
import {IInbox} from "@aztec/core/interfaces/messagebridge/IInbox.sol";
import {IOutbox} from "@aztec/core/interfaces/messagebridge/IOutbox.sol";
import {Signature} from "@aztec/core/libraries/crypto/SignatureLib.sol";
import {CommitteeAttestation} from "@aztec/core/libraries/crypto/SignatureLib.sol";
import {
FeeHeader, L1FeeData, ManaBaseFeeComponents
} from "@aztec/core/libraries/rollup/FeeLib.sol";
Expand Down Expand Up @@ -137,7 +137,7 @@ interface IRollupCore {

function propose(
ProposeArgs calldata _args,
Signature[] memory _signatures,
CommitteeAttestation[] memory _attestations,
bytes calldata _blobInput
) external;

Expand All @@ -150,7 +150,7 @@ interface IRollupCore {
interface IRollup is IRollupCore {
function validateHeader(
bytes calldata _header,
Signature[] memory _signatures,
CommitteeAttestation[] memory _attestations,
bytes32 _digest,
Timestamp _currentTime,
bytes32 _blobsHash,
Expand Down
14 changes: 2 additions & 12 deletions l1-contracts/src/core/interfaces/IValidatorSelection.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,10 @@ pragma solidity >=0.8.27;

import {Timestamp, Slot, Epoch} from "@aztec/core/libraries/TimeLib.sol";
import {Checkpoints} from "@oz/utils/structs/Checkpoints.sol";
/**
* @notice The data structure for an epoch
* @param committee - The attesters for the epoch
* @param sampleSeed - The seed used to sample the attesters of the epoch
* @param nextSeed - The seed used to influence the NEXT epoch
*/

struct EpochData {
// TODO: remove in favor of commitment to comittee
address[] committee;
}

struct ValidatorSelectionStorage {
// A mapping to snapshots of the validator set
mapping(Epoch => EpochData) epochs;
mapping(Epoch => bytes32 committeeCommitment) committeeCommitments;
// Checkpointed map of epoch -> sample seed
Checkpoints.Trace224 seeds;
uint256 targetCommitteeSize;
Expand All @@ -37,6 +26,7 @@ interface IValidatorSelection is IValidatorSelectionCore {
// Non view as uses transient storage
function getCurrentEpochCommittee() external returns (address[] memory);
function getCommitteeAt(Timestamp _ts) external returns (address[] memory);
function getCommitteeCommitmentAt(Timestamp _ts) external returns (bytes32, uint256);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The probability that we are going to misspel this word is so insanely high 😆

function getEpochCommittee(Epoch _epoch) external returns (address[] memory);

// Stable
Expand Down
5 changes: 2 additions & 3 deletions l1-contracts/src/core/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ library Errors {
error ValidatorSelection__InvalidProposer(address expected, address actual); // 0xa8843a68
error ValidatorSelection__InvalidDeposit(address attester, address proposer); // 0x533169bd
error ValidatorSelection__InsufficientAttestations(uint256 minimumNeeded, uint256 provided); // 0xaf47297f
error ValidatorSelection__InsufficientAttestationsProvided(
uint256 minimumNeeded, uint256 provided
); // 0x4d4f66ac
error ValidatorSelection__InvalidCommitteeCommitment(bytes32 reconstructed, bytes32 expected); // 0x10816cae
error ValidatorSelection__InvalidAttestationsLength(uint256 expected, uint256 actual);

// Staking
error Staking__AlreadyActive(address attester); // 0x5e206fa4
Expand Down
Loading