From da6f3a5e2650749dada6d66204e79db8e9c1833b Mon Sep 17 00:00:00 2001 From: ChaoticWalrus <93558947+ChaoticWalrus@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:27:39 -0800 Subject: [PATCH] fix: address stack-too-deep issue in RegistryCoordinator --- src/RegistryCoordinator.sol | 7 +++---- test/unit/RegistryCoordinatorUnit.t.sol | 3 --- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/RegistryCoordinator.sol b/src/RegistryCoordinator.sol index 68b5d4bd..5fc49713 100644 --- a/src/RegistryCoordinator.sol +++ b/src/RegistryCoordinator.sol @@ -233,9 +233,8 @@ 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 @@ -243,7 +242,7 @@ contract RegistryCoordinator is EIP712, Initializable, IRegistryCoordinator, ISo */ if (results.numOperatorsPerQuorum[i] > operatorSetParams.maxOperatorCount) { _validateChurn({ - quorumNumber: quorumNumber, + quorumNumber: uint8(quorumNumbers[i]), totalQuorumStake: results.totalStakes[i], newOperator: msg.sender, newOperatorStake: results.operatorStakes[i], diff --git a/test/unit/RegistryCoordinatorUnit.t.sol b/test/unit/RegistryCoordinatorUnit.t.sol index 2e88a222..90179d74 100644 --- a/test/unit/RegistryCoordinatorUnit.t.sol +++ b/test/unit/RegistryCoordinatorUnit.t.sol @@ -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();