-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: migrate from custom bitmask to EnumerableSet architecture #218
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 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6739307
refactor: migrate from custom bitmask to EnumerableSet architecture
rplusq a33e0e6
fix: remove different max migration operators and use max operators i…
rplusq 7a9aa7e
chore: events also include NodeOperator data
rplusq fe71060
chore: remove double address from indexed events
rplusq 0486de3
feat(cluster): slot-map operator registry + getView + test suite upgrade
rplusq 2e9ef02
chore: update remappings + tests folder + foundry.toml for less fuzzi…
rplusq cfcf58b
fix: change max operators to 256
rplusq b25bbdd
chore: removed initialized modifier and the node operator struct with…
rplusq baff687
fix: include minOperators check in startMigration
rplusq d9a3ddf
refactor: return truncated operator slot buffer from getView
rplusq 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 |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| ClusterTest:test_AbortMigration_BumpsVersion() (gas: 288212) | ||
| ClusterTest:test_AbortMigration_EmitsEvent() (gas: 287753) | ||
| ClusterTest:test_AbortMigration_RevertsKeyspaceVersion() (gas: 295857) | ||
| ClusterTest:test_AbortMigration_Success() (gas: 290197) | ||
| ClusterTest:test_AddNodeOperator_BumpsVersion() (gas: 155341) | ||
| ClusterTest:test_AddNodeOperator_DoesNotBumpKeyspaceVersion() (gas: 156748) | ||
| ClusterTest:test_AddNodeOperator_EmitsEvent() (gas: 153010) | ||
| ClusterTest:test_AddNodeOperator_Success() (gas: 162096) | ||
| ClusterTest:test_CompleteMigration_BumpsVersion() (gas: 345814) | ||
| ClusterTest:test_CompleteMigration_EmitsCompletedEvent() (gas: 216627) | ||
| ClusterTest:test_CompleteMigration_EmitsDataPullEvent() (gas: 345290) | ||
| ClusterTest:test_CompleteMigration_Success() (gas: 347634) | ||
| ClusterTest:test_Constructor_ContainsInitialNodeOperators() (gas: 155679) | ||
| ClusterTest:test_Constructor_EmitsInitializedEvent() (gas: 3819912) | ||
| ClusterTest:test_Constructor_EmptyClusterNotInitialized() (gas: 3404846) | ||
| ClusterTest:test_Constructor_InitialKeyspace() (gas: 52465) | ||
| ClusterTest:test_Constructor_MaxNumberOfOperators() (gas: 35654137) | ||
| ClusterTest:test_GetAllOperators() (gas: 46122) | ||
| ClusterTest:test_GetMaintenanceOperators() (gas: 137530) | ||
| ClusterTest:test_GetMigrationStatus() (gas: 264767) | ||
| ClusterTest:test_RemoveNodeOperator_BumpsVersion() (gas: 147485) | ||
| ClusterTest:test_RemoveNodeOperator_DoesNotBumpKeyspaceVersion() (gas: 146807) | ||
| ClusterTest:test_RemoveNodeOperator_EmitsEvent() (gas: 145396) | ||
| ClusterTest:test_RemoveNodeOperator_Success() (gas: 147675) | ||
| ClusterTest:test_RemoveNodeOperator_UpdatesCount() (gas: 158232) | ||
| ClusterTest:test_RevertWhen_AbortNonExistentMigration() (gas: 18531) | ||
| ClusterTest:test_RevertWhen_AddingDuplicateOperator() (gas: 30869) | ||
| ClusterTest:test_RevertWhen_CompleteMigrationOnUninitializedCluster() (gas: 3408747) | ||
| ClusterTest:test_RevertWhen_CompleteMigrationTwice() (gas: 348054) | ||
| ClusterTest:test_RevertWhen_CompleteNonExistentMigration() (gas: 20508) | ||
| ClusterTest:test_RevertWhen_DuplicateOperators() (gas: 29139) | ||
| ClusterTest:test_RevertWhen_InvalidOperatorInMigration() (gas: 58609) | ||
| ClusterTest:test_RevertWhen_MigrationInProgress() (gas: 351390) | ||
| ClusterTest:test_RevertWhen_MigrationWithTooManyOperators() (gas: 598905) | ||
| ClusterTest:test_RevertWhen_NonAuthorizedSetsMaintenance() (gas: 22999) | ||
| ClusterTest:test_RevertWhen_NonOperatorCompletesMigration() (gas: 359208) | ||
| ClusterTest:test_RevertWhen_NonOwnerAbortsMigration() (gas: 354096) | ||
| ClusterTest:test_RevertWhen_NonOwnerAddsOperator() (gas: 23696) | ||
| ClusterTest:test_RevertWhen_NonOwnerRemovesOperator() (gas: 18077) | ||
| ClusterTest:test_RevertWhen_NonOwnerStartsMigration() (gas: 28514) | ||
| ClusterTest:test_RevertWhen_NonOwnerTransfersOwnership() (gas: 18702) | ||
| ClusterTest:test_RevertWhen_NonOwnerUpdatesOperator() (gas: 20646) | ||
| ClusterTest:test_RevertWhen_NonOwnerUpdatesSettings() (gas: 18840) | ||
| ClusterTest:test_RevertWhen_OperatorAbortsMigration() (gas: 356794) | ||
| ClusterTest:test_RevertWhen_OperatorAddsAnotherOperator() (gas: 26768) | ||
| ClusterTest:test_RevertWhen_OperatorRemovesAnother() (gas: 22555) | ||
| ClusterTest:test_RevertWhen_OperatorRemovesSelf() (gas: 20753) | ||
| ClusterTest:test_RevertWhen_OperatorStartsMigration() (gas: 31234) | ||
| ClusterTest:test_RevertWhen_OperatorTransfersOwnership() (gas: 20330) | ||
| ClusterTest:test_RevertWhen_OperatorUpdatesAnother() (gas: 22896) | ||
| ClusterTest:test_RevertWhen_OperatorUpdatesSettings() (gas: 19998) | ||
| ClusterTest:test_RevertWhen_OwnerCompletesMigration() (gas: 353516) | ||
| ClusterTest:test_RevertWhen_RemoveOperatorInKeyspace() (gas: 59729) | ||
| ClusterTest:test_RevertWhen_SameMigration() (gas: 214415) | ||
| ClusterTest:test_RevertWhen_SetMaintenanceOnUninitializedCluster() (gas: 3406853) | ||
| ClusterTest:test_RevertWhen_StartMigrationOnUninitializedCluster() (gas: 3407184) | ||
| ClusterTest:test_RevertWhen_TooManyOperators() (gas: 1680475) | ||
| ClusterTest:test_RevertWhen_UnsortedOperators() (gas: 29345) | ||
| ClusterTest:test_RevertWhen_UpdateOnUninitializedCluster() (gas: 3411665) | ||
| ClusterTest:test_SetMaintenance_BumpsVersion() (gas: 48053) | ||
| ClusterTest:test_SetMaintenance_DoesNotBumpKeyspaceVersion() (gas: 50120) | ||
| ClusterTest:test_SetMaintenance_EmitsEvent() (gas: 45359) | ||
| ClusterTest:test_SetMaintenance_OperatorCanSet() (gas: 81923) | ||
| ClusterTest:test_SetMaintenance_OwnerCanSet() (gas: 62130) | ||
| ClusterTest:test_SetMaintenance_SingleOperatorMigration() (gas: 199402) | ||
| ClusterTest:test_SetMaintenance_UpdatesFlag() (gas: 75268) | ||
| ClusterTest:test_SetUpState() (gas: 32395) | ||
| ClusterTest:test_StartMigration_BumpsKeyspaceVersion() (gas: 350582) | ||
| ClusterTest:test_StartMigration_BumpsVersion() (gas: 349391) | ||
| ClusterTest:test_StartMigration_EmitsEvent() (gas: 352270) | ||
| ClusterTest:test_StartMigration_Success() (gas: 357125) | ||
| ClusterTest:test_TransferOwnership_RequiresAcceptance() (gas: 45092) | ||
| ClusterTest:test_TransferOwnership_Success() (gas: 40520) | ||
| ClusterTest:test_UpdateNodeOperator_BumpsVersion() (gas: 68352) | ||
| ClusterTest:test_UpdateNodeOperator_DoesNotBumpKeyspaceVersion() (gas: 71850) | ||
| ClusterTest:test_UpdateNodeOperator_EmitsEvent() (gas: 66923) | ||
| ClusterTest:test_UpdateNodeOperator_OperatorCanUpdateSelf() (gas: 72452) | ||
| ClusterTest:test_UpdateNodeOperator_OwnerCanUpdate() (gas: 73837) | ||
| ClusterTest:test_UpdateNodeOperator_UpdatesData() (gas: 78064) | ||
| ClusterTest:test_UpdateSettings_BumpsVersion() (gas: 50912) | ||
| ClusterTest:test_UpdateSettings_DoesNotBumpKeyspaceVersion() (gas: 52187) | ||
| ClusterTest:test_UpdateSettings_EmitsEvent() (gas: 49679) | ||
| ClusterTest:test_UpdateSettings_EnforcesMaxDataBytes() (gas: 54004) | ||
| ClusterTest:test_UpdateSettings_Success() (gas: 52260) | ||
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 was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @openzeppelin-contracts/=dependencies/@openzeppelin-contracts-5.3.0/ | ||
| forge-std/=dependencies/forge-std-1.9.7/src/ | ||
| solady/=dependencies/solady-0.1.19/src/ |
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.
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.
This gas cost is for test functions, can we somehow get the cost of the actual SC calls here? I did manage to get it by
forge test --via-ir -vvv --gas-reportin my PRUh 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.
this is just the snapshot, runing what you said gives:
╭----------------------------------+-----------------+--------+--------+----------+---------╮
| src/Cluster.sol:Cluster Contract | | | | | |
+===========================================================================================+
| Deployment Cost | Deployment Size | | | | |
|----------------------------------+-----------------+--------+--------+----------+---------|
| 4462765 | 22888 | | | | |
|----------------------------------+-----------------+--------+--------+----------+---------|
| | | | | | |
|----------------------------------+-----------------+--------+--------+----------+---------|
| Function Name | Min | Avg | Median | Max | # Calls |
|----------------------------------+-----------------+--------+--------+----------+---------|
| abortMigration | 24957 | 48135 | 64963 | 64963 | 7 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| acceptOwnership | 30573 | 30573 | 30573 | 30573 | 2 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| addNodeOperator | 25846 | 120157 | 156915 | 156915 | 14 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| completeMigration | 24514 | 38973 | 43472 | 45878 | 12 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getAllOperators | 4035 | 287480 | 18550 | 839856 | 3 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getCurrentKeyspace | 8584 | 296314 | 22354 | 714140 | 5 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getMaintenanceOperators | 34185 | 34185 | 34185 | 34185 | 1 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getMigrationStatus | 5955 | 5955 | 5955 | 5955 | 7 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getOperatorAt | 3387 | 5399 | 6405 | 6405 | 3 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getOperatorCount | 2772 | 2772 | 2772 | 2772 | 6 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| getPullingOperators | 4018 | 20160 | 27818 | 28645 | 3 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| info | 8419 | 8427 | 8428 | 8428 | 12 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| isInitialized | 2946 | 2946 | 2946 | 2946 | 2 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| isOperator | 3999 | 3999 | 3999 | 3999 | 11 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| keyspaceVersion | 2984 | 2984 | 2984 | 2984 | 10 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| owner | 3073 | 3073 | 3073 | 3073 | 3 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| removeNodeOperator | 25095 | 54586 | 68064 | 80895 | 11 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| setMaintenance | 24294 | 53814 | 51632 | 77455 | 11 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| settings | 3170 | 3170 | 3170 | 3170 | 1 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| startMigration | 26402 | 636068 | 345575 | 13587430 | 35 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| transferOwnership | 25033 | 37408 | 37462 | 49675 | 4 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| updateNodeOperator | 25553 | 57678 | 73738 | 73738 | 9 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| updateSettings | 24527 | 46209 | 54882 | 54882 | 7 |
|----------------------------------+-----------------+--------+--------+----------+---------|
| version | 2786 | 2786 | 2786 | 2786 | 10 |
╰----------------------------------+-----------------+--------+--------+----------+---------╯
Ran 1 test suite in 33.14ms (24.17ms CPU time): 95 tests passed, 0 failed, 0 skipped (95 total tests)
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.
I mean, I think we should either have the actual gas cost in this file or just remove it.
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.
I checked the gas cost, looks good. However this file is not representative, can we remove it?