You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/StakeRegistry.sol
+22-10Lines changed: 22 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -24,20 +24,17 @@ contract StakeRegistry is StakeRegistryStorage {
24
24
using BitmapUtilsfor*;
25
25
26
26
modifier onlyRegistryCoordinator() {
27
-
require(
28
-
msg.sender==address(registryCoordinator),
29
-
"StakeRegistry.onlyRegistryCoordinator: caller is not the RegistryCoordinator"
30
-
);
27
+
_checkRegistryCoordinator();
31
28
_;
32
29
}
33
30
34
31
modifier onlyCoordinatorOwner() {
35
-
require(msg.sender==IRegistryCoordinator(registryCoordinator).owner(), "StakeRegistry.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator");
32
+
_checkRegistryCoordinatorOwner();
36
33
_;
37
34
}
38
35
39
36
modifier quorumExists(uint8quorumNumber) {
40
-
require(_quorumExists(quorumNumber), "StakeRegistry.quorumExists: quorum does not exist");
37
+
_checkQuorumExists(quorumNumber);
41
38
_;
42
39
}
43
40
@@ -74,7 +71,7 @@ contract StakeRegistry is StakeRegistryStorage {
74
71
for (uint256 i =0; i < quorumNumbers.length; i++) {
75
72
76
73
uint8 quorumNumber =uint8(quorumNumbers[i]);
77
-
require(_quorumExists(quorumNumber), "StakeRegistry.registerOperator: quorum does not exist");
74
+
_checkQuorumExists(quorumNumber);
78
75
79
76
// Retrieve the operator's current weighted stake for the quorum, reverting if they have not met
80
77
// the minimum.
@@ -121,7 +118,7 @@ contract StakeRegistry is StakeRegistryStorage {
121
118
*/
122
119
for (uint256 i =0; i < quorumNumbers.length; i++) {
123
120
uint8 quorumNumber =uint8(quorumNumbers[i]);
124
-
require(_quorumExists(quorumNumber), "StakeRegistry.deregisterOperator: quorum does not exist");
121
+
_checkQuorumExists(quorumNumber);
125
122
126
123
// Update the operator's stake for the quorum and retrieve the shares removed
127
124
int256 stakeDelta =_recordOperatorStakeUpdate({
@@ -161,7 +158,7 @@ contract StakeRegistry is StakeRegistryStorage {
161
158
*/
162
159
for (uint256 i =0; i < quorumNumbers.length; i++) {
163
160
uint8 quorumNumber =uint8(quorumNumbers[i]);
164
-
require(_quorumExists(quorumNumber), "StakeRegistry.updateOperatorStake: quorum does not exist");
161
+
_checkQuorumExists(quorumNumber);
165
162
166
163
// Fetch the operator's current stake, applying weighting parameters and checking
167
164
// against the minimum stake requirements for the quorum.
@@ -697,7 +694,7 @@ contract StakeRegistry is StakeRegistryStorage {
697
694
uint32[] memory indices =newuint32[](quorumNumbers.length);
698
695
for (uint256 i =0; i < quorumNumbers.length; i++) {
699
696
uint8 quorumNumber =uint8(quorumNumbers[i]);
700
-
require(_quorumExists(quorumNumber), "StakeRegistry.getTotalStakeIndicesAtBlockNumber: quorum does not exist");
"StakeRegistry.getTotalStakeIndicesAtBlockNumber: quorum has no stake history at blockNumber"
@@ -712,4 +709,19 @@ contract StakeRegistry is StakeRegistryStorage {
712
709
}
713
710
return indices;
714
711
}
712
+
713
+
function _checkRegistryCoordinator() internalview {
714
+
require(
715
+
msg.sender==address(registryCoordinator),
716
+
"StakeRegistry.onlyRegistryCoordinator: caller is not the RegistryCoordinator"
717
+
);
718
+
}
719
+
720
+
function _checkRegistryCoordinatorOwner() internalview {
721
+
require(msg.sender==IRegistryCoordinator(registryCoordinator).owner(), "StakeRegistry.onlyCoordinatorOwner: caller is not the owner of the registryCoordinator");
722
+
}
723
+
724
+
function _checkQuorumExists(uint8quorumNumber) internalview {
725
+
require(_quorumExists(quorumNumber), "StakeRegistry.quorumExists: quorum does not exist");
0 commit comments