@@ -1955,91 +1955,91 @@ contract RegistryCoordinatorUnitTests_RegisterOperatorWithChurn is RegistryCoord
1955
1955
}
1956
1956
1957
1957
contract RegistryCoordinatorUnitTests_UpdateOperators is RegistryCoordinatorUnitTests {
1958
- // function test_updateOperators_revert_paused() public {
1959
- // cheats.prank(pauser);
1960
- // registryCoordinator.pause(2 ** PAUSED_UPDATE_OPERATOR);
1961
-
1962
- // address[] memory operatorsToUpdate = new address[](1);
1963
- // operatorsToUpdate[0] = defaultOperator;
1964
-
1965
- // cheats.expectRevert(bytes4(keccak256("CurrentlyPaused()")));
1966
- // registryCoordinator.updateOperators(operatorsToUpdate);
1967
- // }
1968
-
1969
- // // @notice tests the `updateOperators` function with a single registered operator as input
1970
- // function test_updateOperators_singleOperator() public {
1971
- // // register the default operator
1972
- // ISignatureUtils.SignatureWithSaltAndExpiry memory emptySig;
1973
- // uint32 registrationBlockNumber = 100;
1974
- // bytes memory quorumNumbers = new bytes(1);
1975
- // quorumNumbers[0] = bytes1(defaultQuorumNumber);
1976
- // _setOperatorWeight(defaultOperator, uint8(quorumNumbers[0]), defaultStake);
1977
- // cheats.startPrank(defaultOperator);
1978
- // cheats.roll(registrationBlockNumber);
1979
- // registryCoordinator.registerOperator(
1980
- // quorumNumbers, defaultSocket, pubkeyRegistrationParams, emptySig
1981
- // );
1982
-
1983
- // address[] memory operatorsToUpdate = new address[](1);
1984
- // operatorsToUpdate[0] = defaultOperator;
1985
-
1986
- // registryCoordinator.updateOperators(operatorsToUpdate);
1987
- // }
1988
-
1989
- // // @notice tests the `updateOperators` function with a single registered operator as input
1990
- // // @dev also sets up return data from the StakeRegistry
1991
- // function testFuzz_updateOperators_singleOperator(
1992
- // uint192 registrationBitmap,
1993
- // uint192 mockReturnData
1994
- // ) public {
1995
- // // filter fuzzed inputs to only valid inputs
1996
- // cheats.assume(registrationBitmap != 0);
1997
- // mockReturnData = (mockReturnData & registrationBitmap);
1998
- // emit log_named_uint("mockReturnData", mockReturnData);
1999
-
2000
- // // register the default operator
2001
- // ISignatureUtils.SignatureWithSaltAndExpiry memory emptySig;
2002
- // uint32 registrationBlockNumber = 100;
2003
- // bytes memory quorumNumbers = BitmapUtils.bitmapToBytesArray(registrationBitmap);
2004
- // for (uint256 i = 0; i < quorumNumbers.length; ++i) {
2005
- // _setOperatorWeight(defaultOperator, uint8(quorumNumbers[i]), defaultStake);
2006
- // }
2007
- // cheats.startPrank(defaultOperator);
2008
- // cheats.roll(registrationBlockNumber);
2009
- // registryCoordinator.registerOperator(
2010
- // quorumNumbers, defaultSocket, pubkeyRegistrationParams, emptySig
2011
- // );
2012
-
2013
- // address[] memory operatorsToUpdate = new address[](1);
2014
- // operatorsToUpdate[0] = defaultOperator;
2015
-
2016
- // uint192 quorumBitmapBefore = registryCoordinator.getCurrentQuorumBitmap(defaultOperatorId);
2017
- // assertEq(quorumBitmapBefore, registrationBitmap, "operator bitmap somehow incorrect");
2018
-
2019
- // // make the stake registry return info that the operator should be removed from quorums
2020
- // uint192 quorumBitmapToRemove = mockReturnData;
2021
- // bytes memory quorumNumbersToRemove = BitmapUtils.bitmapToBytesArray(quorumBitmapToRemove);
2022
- // for (uint256 i = 0; i < quorumNumbersToRemove.length; ++i) {
2023
- // _setOperatorWeight(defaultOperator, uint8(quorumNumbersToRemove[i]), 0);
2024
- // }
2025
- // uint256 expectedQuorumBitmap = BitmapUtils.minus(quorumBitmapBefore, quorumBitmapToRemove);
2026
-
2027
- // registryCoordinator.updateOperators(operatorsToUpdate);
2028
- // uint192 quorumBitmapAfter = registryCoordinator.getCurrentQuorumBitmap(defaultOperatorId);
2029
- // assertEq(expectedQuorumBitmap, quorumBitmapAfter, "quorum bitmap did not update correctly");
2030
- // }
2031
-
2032
- // // @notice tests the `updateOperators` function with a single *un*registered operator as input
2033
- // function test_updateOperators_unregisteredOperator() public view {
2034
- // address[] memory operatorsToUpdate = new address[](1);
2035
- // operatorsToUpdate[0] = defaultOperator;
2036
-
2037
- // // force a staticcall to the `updateOperators` function -- this should *pass* because the call should be a strict no-op!
2038
- // (bool success,) = address(registryCoordinator).staticcall(
2039
- // abi.encodeWithSignature("updateOperators(address[])", operatorsToUpdate)
2040
- // );
2041
- // require(success, "staticcall failed!");
2042
- // }
1958
+ function test_updateOperators_revert_paused () public {
1959
+ cheats.prank (pauser);
1960
+ registryCoordinator.pause (2 ** PAUSED_UPDATE_OPERATOR);
1961
+
1962
+ address [] memory operatorsToUpdate = new address [](1 );
1963
+ operatorsToUpdate[0 ] = defaultOperator;
1964
+
1965
+ cheats.expectRevert (bytes4 (keccak256 ("CurrentlyPaused() " )));
1966
+ registryCoordinator.updateOperators (operatorsToUpdate);
1967
+ }
1968
+
1969
+ // @notice tests the `updateOperators` function with a single registered operator as input
1970
+ function test_updateOperators_singleOperator () public {
1971
+ // register the default operator
1972
+ ISignatureUtils.SignatureWithSaltAndExpiry memory emptySig;
1973
+ uint32 registrationBlockNumber = 100 ;
1974
+ bytes memory quorumNumbers = new bytes (1 );
1975
+ quorumNumbers[0 ] = bytes1 (defaultQuorumNumber);
1976
+ _setOperatorWeight (defaultOperator, uint8 (quorumNumbers[0 ]), defaultStake);
1977
+ cheats.startPrank (defaultOperator);
1978
+ cheats.roll (registrationBlockNumber);
1979
+ registryCoordinator.registerOperator (
1980
+ quorumNumbers, defaultSocket, pubkeyRegistrationParams, emptySig
1981
+ );
1982
+
1983
+ address [] memory operatorsToUpdate = new address [](1 );
1984
+ operatorsToUpdate[0 ] = defaultOperator;
1985
+
1986
+ registryCoordinator.updateOperators (operatorsToUpdate);
1987
+ }
1988
+
1989
+ // @notice tests the `updateOperators` function with a single registered operator as input
1990
+ // @dev also sets up return data from the StakeRegistry
1991
+ function testFuzz_updateOperators_singleOperator (
1992
+ uint192 registrationBitmap ,
1993
+ uint192 mockReturnData
1994
+ ) public {
1995
+ // filter fuzzed inputs to only valid inputs
1996
+ cheats.assume (registrationBitmap != 0 );
1997
+ mockReturnData = (mockReturnData & registrationBitmap);
1998
+ emit log_named_uint ("mockReturnData " , mockReturnData);
1999
+
2000
+ // register the default operator
2001
+ ISignatureUtils.SignatureWithSaltAndExpiry memory emptySig;
2002
+ uint32 registrationBlockNumber = 100 ;
2003
+ bytes memory quorumNumbers = BitmapUtils.bitmapToBytesArray (registrationBitmap);
2004
+ for (uint256 i = 0 ; i < quorumNumbers.length ; ++ i) {
2005
+ _setOperatorWeight (defaultOperator, uint8 (quorumNumbers[i]), defaultStake);
2006
+ }
2007
+ cheats.startPrank (defaultOperator);
2008
+ cheats.roll (registrationBlockNumber);
2009
+ registryCoordinator.registerOperator (
2010
+ quorumNumbers, defaultSocket, pubkeyRegistrationParams, emptySig
2011
+ );
2012
+
2013
+ address [] memory operatorsToUpdate = new address [](1 );
2014
+ operatorsToUpdate[0 ] = defaultOperator;
2015
+
2016
+ uint192 quorumBitmapBefore = registryCoordinator.getCurrentQuorumBitmap (defaultOperatorId);
2017
+ assertEq (quorumBitmapBefore, registrationBitmap, "operator bitmap somehow incorrect " );
2018
+
2019
+ // make the stake registry return info that the operator should be removed from quorums
2020
+ uint192 quorumBitmapToRemove = mockReturnData;
2021
+ bytes memory quorumNumbersToRemove = BitmapUtils.bitmapToBytesArray (quorumBitmapToRemove);
2022
+ for (uint256 i = 0 ; i < quorumNumbersToRemove.length ; ++ i) {
2023
+ _setOperatorWeight (defaultOperator, uint8 (quorumNumbersToRemove[i]), 0 );
2024
+ }
2025
+ uint256 expectedQuorumBitmap = BitmapUtils.minus (quorumBitmapBefore, quorumBitmapToRemove);
2026
+
2027
+ registryCoordinator.updateOperators (operatorsToUpdate);
2028
+ uint192 quorumBitmapAfter = registryCoordinator.getCurrentQuorumBitmap (defaultOperatorId);
2029
+ assertEq (expectedQuorumBitmap, quorumBitmapAfter, "quorum bitmap did not update correctly " );
2030
+ }
2031
+
2032
+ // @notice tests the `updateOperators` function with a single *un*registered operator as input
2033
+ function test_updateOperators_unregisteredOperator () public view {
2034
+ address [] memory operatorsToUpdate = new address [](1 );
2035
+ operatorsToUpdate[0 ] = defaultOperator;
2036
+
2037
+ // force a staticcall to the `updateOperators` function -- this should *pass* because the call should be a strict no-op!
2038
+ (bool success ,) = address (registryCoordinator).staticcall (
2039
+ abi.encodeWithSignature ("updateOperators(address[]) " , operatorsToUpdate)
2040
+ );
2041
+ require (success, "staticcall failed! " );
2042
+ }
2043
2043
2044
2044
function test_updateOperatorsForQuorum_revert_paused () public {
2045
2045
cheats.prank (pauser);
0 commit comments