-
Notifications
You must be signed in to change notification settings - Fork 599
feat(sol): remove committee storage #13700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 5a6fe8a
chore: document
Maddiaa0 6bbadd4
chore: add setupEpoch test suite
Maddiaa0 9724ef2
fmt
Maddiaa0 b212389
fmt: function order
Maddiaa0 de29295
Merge branch 'master' into md/seed-snapshots
Maddiaa0 40967d9
post merge fix
Maddiaa0 4321429
Merge branch 'master' into md/seed-snapshots
Maddiaa0 1ecec4f
fmt
Maddiaa0 08d1132
update getseed
Maddiaa0 091c43e
chore: genesis state changes
Maddiaa0 7b18dbe
feat: remove committee, swap signatures to attestations
Maddiaa0 4500d32
tmp
Maddiaa0 4163ff5
chore: update sol tests
Maddiaa0 3183d05
chore: yp changes
Maddiaa0 dceeecc
fix
Maddiaa0 d5c6f18
chore: update can propose at time to recreate content commitments
Maddiaa0 ba5e341
merge fixes
Maddiaa0 b23058d
chore: apply ontop of master changes
Maddiaa0 8090796
fix: tests
Maddiaa0 edec30d
fmt
Maddiaa0 fcabbb1
fmt
Maddiaa0 b94eebf
Merge branch 'master' into md/commit-comittee
Maddiaa0 eeeabf3
post merge fixes
Maddiaa0 aeeb6cc
fixes
Maddiaa0 dc6617f
fix: some comments
Maddiaa0 8eb31c4
cleanup
Maddiaa0 15f3365
chore: update scream and shout
Maddiaa0 95c95cd
chore: add reverts if no proposer addr provided test
Maddiaa0 63187e2
invert dependency
Maddiaa0 3bbfe3d
Merge branch 'master' into md/commit-comittee
Maddiaa0 1f55a69
Merge branch 'master' into md/commit-comittee
LHerskind 31b5b8c
fix: build + rollup getter test
Maddiaa0 e12cc4e
Merge remote-tracking branch 'origin/next' into md/commit-comittee
Maddiaa0 ffac3a2
fix
Maddiaa0 1a58661
update gas report after next merge
Maddiaa0 27101ba
chore: post merge formatting
Maddiaa0 b3e2188
fmt
Maddiaa0 64ddb43
fmt
Maddiaa0 95097f7
Merge branch 'next' into md/commit-comittee
Maddiaa0 4a7f21c
Merge branch 'next' into md/commit-comittee
just-mitch 12afb4b
run benchmark
just-mitch 5a04980
Merge branch 'next' into md/commit-comittee
just-mitch 3bf4893
use test date provider in snapshot manager
just-mitch 7dd7b04
fix: sync date provider if behind.
just-mitch d91d06d
fix: anvil watcher compensates for stuck L1
just-mitch 96ac393
fix: more generous timeout waiting for l2 block
just-mitch 30b73a2
fix: date provider in sandbox
just-mitch 1c6942d
fix: sequencer tests
just-mitch d3c1044
fix: sequencer-ppublisher test
just-mitch ba034ac
fix: epoch proof fails tests
just-mitch 0b6c3b6
fix: epoch tests
just-mitch 7894927
fix: e2e empty blocks looser assertion
just-mitch 81aa988
fix: keep anvil test watcher in tighter sync. shorter l1 time in empt…
just-mitch a2f4514
fix linter
just-mitch 4489286
fix: fewer epochs
just-mitch e1246ef
chore: remove optimization of getting slot/proposer from epoch cache
just-mitch 0153bf4
revert changes in empty epoch test
just-mitch f1f9d6a
Merge branch 'next' into md/commit-comittee
just-mitch 5b96aa6
Revert "revert changes in empty epoch test"
just-mitch b15710d
Revert "chore: remove optimization of getting slot/proposer from epoc…
just-mitch 45f9c54
Revert "fix: fewer epochs"
just-mitch f2a5916
undo some timing changes
just-mitch ad52667
Merge branch 'next' into md/commit-comittee
just-mitch ad0ff2f
reorder tests
just-mitch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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% | ||
| -------------------------+---------+------------------------+-------------------------+------------------------+----------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,7 @@ import { | |
| Epoch, | ||
| Timestamp, | ||
| Errors, | ||
| Signature, | ||
| CommitteeAttestation, | ||
| ExtRollupLib, | ||
| EthValue, | ||
| STFLib, | ||
|
|
@@ -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, | ||
|
|
@@ -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), | ||
|
|
@@ -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 | ||
| override(IValidatorSelection) | ||
| returns (bytes32, uint256) | ||
| { | ||
| return ValidatorSelectionLib.getCommitteeCommitmentAt(getEpochAt(_ts)); | ||
| } | ||
|
|
||
| /** | ||
| * @notice Get the proposer for the current slot | ||
| * | ||
|
|
@@ -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( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
Maddiaa0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Checkpointed map of epoch -> sample seed | ||
| Checkpoints.Trace224 seeds; | ||
| uint256 targetCommitteeSize; | ||
|
|
@@ -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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
getCommitteethat was altered lower down the stack.