Skip to content

Commit

Permalink
fix: address stack-too-deep issue in RegistryCoordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoticWalrus committed Dec 12, 2023
1 parent 11c51e1 commit da6f3a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/RegistryCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,16 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo

uint256 kickIndex = 0;
for (uint256 i = 0; i < quorumNumbers.length; i++) {
uint8 quorumNumber = uint8(quorumNumbers[i]);

OperatorSetParam memory operatorSetParams = _quorumParams[quorumNumber];
// reference: uint8 quorumNumber = uint8(quorumNumbers[i]);
OperatorSetParam memory operatorSetParams = _quorumParams[uint8(quorumNumbers[i])];

/**
* If the new operator count for any quorum exceeds the maximum, validate
* that churn can be performed, then deregister the specified operator
*/
if (results.numOperatorsPerQuorum[i] > operatorSetParams.maxOperatorCount) {
_validateChurn({
quorumNumber: quorumNumber,
quorumNumber: uint8(quorumNumbers[i]),
totalQuorumStake: results.totalStakes[i],
newOperator: msg.sender,
newOperatorStake: results.operatorStakes[i],
Expand Down
3 changes: 0 additions & 3 deletions test/unit/RegistryCoordinatorUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,6 @@ contract RegistryCoordinatorUnit is MockAVSDeployer {
emit QuorumIndexUpdate(operatorToRegisterId, defaultQuorumNumber, numOperators - 1);

{
BN254.G1Point memory pubkeyRegistrationSignature;
BN254.G1Point memory pubkeyG1;
BN254.G2Point memory pubkeyG2;
ISignatureUtils.SignatureWithSaltAndExpiry memory signatureWithExpiry = _signOperatorChurnApproval(operatorToRegisterId, operatorKickParams, defaultSalt, block.timestamp + 10);
cheats.prank(operatorToRegister);
uint256 gasBefore = gasleft();
Expand Down

0 comments on commit da6f3a5

Please sign in to comment.