-
Notifications
You must be signed in to change notification settings - Fork 100
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
Anvil testing updateOperatorsForQuorum #66
Conversation
Additionally - renamed updateOperatorsPerQuorum to updateOperatorsForQuorum - sort by operator addresses instead of operatorIds
- sorted by ascending address instead of operatorId - sanitization checks on quorumNumbers, added quorumsAllExist modifier - performing `OperatorStatus.REGISTERED` checks now - Removed uneccesary bitmapToBytes calls and doing bytes slicing for quorumNumbers - using internal function and scoping to fix stack-too-deep
small off by 1 error, for example of quorumCount = 1,3 1 << 1 = 2, bit rep is 10 1 << 1 - 1 = 1, bit rep is 01 1 << 3 = 8, bit rep is 1000 1 << 3 - 1 = 7, bit rep is 0111 We should be subtracting by 1 instead of 2 here to get the bitmap
May change this in the future to be configurable
} | ||
} | ||
|
||
quorumUpdateTimestamp[quorumNumber] = block.timestamp; |
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.
comment
); | ||
|
||
{ | ||
uint192 currentBitmap = _currentOperatorBitmap(operatorId); |
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.
any way to reduce duplication between this and the other update stakes method?
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.
Let me try to create another PR for this
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.
#68
Take a look here
src/BLSSignatureChecker.sol
Outdated
@@ -73,6 +73,10 @@ contract BLSSignatureChecker is IBLSSignatureChecker { | |||
// loop through every quorumNumber and keep track of the apk | |||
BN254.G1Point memory apk = BN254.G1Point(0, 0); | |||
for (uint i = 0; i < quorumNumbers.length; i++) { | |||
require( | |||
registryCoordinator.quorumUpdateTimestamp(uint8(quorumNumbers[i])) + 1 weeks <= block.timestamp, |
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.
should we set a minimum withdrawalDelayBlocks in delegation manager and set this to that?
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.
what if we just read the current DelegationManager.withdrawalDelayBlocks
value instead?
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.
oh yup! that'l work
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.
Added this in the feature PR e4f39f6 as well as the interface change to read off of the DM Layr-Labs/eigenlayer-contracts#344
f836cf2
to
9d9c328
Compare
Additionally - renamed updateOperatorsPerQuorum to updateOperatorsForQuorum - sort by operator addresses instead of operatorIds
- sorted by ascending address instead of operatorId - sanitization checks on quorumNumbers, added quorumsAllExist modifier - performing `OperatorStatus.REGISTERED` checks now - Removed uneccesary bitmapToBytes calls and doing bytes slicing for quorumNumbers - using internal function and scoping to fix stack-too-deep
small off by 1 error, for example of quorumCount = 1,3 1 << 1 = 2, bit rep is 10 1 << 1 - 1 = 1, bit rep is 01 1 << 3 = 8, bit rep is 1000 1 << 3 - 1 = 7, bit rep is 0111 We should be subtracting by 1 instead of 2 here to get the bitmap
May change this in the future to be configurable
…-updates-per-quorum
Update all operators quorum0: ~13.9M gas Update all operators quorums1-9: ~8M gas
Ran tests with anvil node running the following commands
Assumptions:
Running updates for Quorum0 with 200 operators costs ~11.4M gas, updates for Quorums1-9 with 50 operators each costs ~6.4M gas. If using 30 operator cap instead of 50 then its ~4M.
Only mocked the
BLSPubkeyRegistry
contract in tests as generating BLS pubkeys for all 200 operators would have been much more of a chore. This affects gas estimations in the event that the operator stake is below the minimum requirement for the quorum and we have to rederegister them from all other registries.In this scenario, for Quorum0 and de-registering ALL 200 operators, it would cost approximately 2-3M more gas to perform the transaction. For updating all Quorums1-9 and all operators de-registering, it would cost approximately 3-5M more gas.
TL;DR In the worst case scenario where all operators deregister/have below minimum quorum stake, we can still update operators for Quorum0 and Quorums1-9 in two separate tx's.