refactor: migrate from custom bitmask to EnumerableSet architecture#218
Conversation
| @@ -0,0 +1,84 @@ | |||
| ClusterTest:test_AbortMigration_BumpsVersion() (gas: 288212) | |||
There was a problem hiding this comment.
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-report in my PR
There was a problem hiding this comment.
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.
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.
I checked the gas cost, looks good. However this file is not representative, can we remove it?
… maintenance + update getView
xDarksome
left a comment
There was a problem hiding this comment.
Looks good overall, gas cost seems to be reasonable as well, thanks!
Couple of final logic tweaks left.
|
Addressed feedback, thanks again @xDarksome |
|
👍 merging |
Description
This is a follow-up PR on top of @xDarksome #212. My goal was to keep Rust/WCN integration almost unchanged while modernising the Solidity internals.
What changed (one-liner each)
Integration side of things
@xDarksome : please confirm events + getters still fit alloy bindings. No single getView() now, so you might have to join with multiCall on the alloy side: https://alloy.rs/guides/multicall#multicall-with-alloy
All forge tests green; ready for merge once you’re happy.