From d17ecbc58eac31365f1cf288ba88a448abfc3feb Mon Sep 17 00:00:00 2001 From: skhomuti Date: Fri, 1 Dec 2023 12:07:21 +0500 Subject: [PATCH] fix disable limit cause unvet --- src/CSModule.sol | 2 +- test/CSModule.t.sol | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/CSModule.sol b/src/CSModule.sol index 6808dfd4..541211a2 100644 --- a/src/CSModule.sol +++ b/src/CSModule.sol @@ -694,7 +694,7 @@ contract CSModule is IStakingModule, CSModuleBase { ) return; if ( - no.isTargetLimitActive != isTargetLimitActive || + (!no.isTargetLimitActive && isTargetLimitActive) || targetLimit < no.targetLimit ) { _unvetKeys(nodeOperatorId); diff --git a/test/CSModule.t.sol b/test/CSModule.t.sol index 1bf438df..73d6d093 100644 --- a/test/CSModule.t.sol +++ b/test/CSModule.t.sol @@ -1133,6 +1133,19 @@ contract CsmUpdateTargetValidatorsLimits is CSMCommon { assertEq(no.totalVettedValidators, 1); } + function test_updateTargetValidatorsLimits_NoUnvetKeysWhenLimitDisabled() + public + { + uint256 noId = createNodeOperator(2); + csm.updateTargetValidatorsLimits(noId, true, 1); + + csm.vetKeys(noId, 1); + + csm.updateTargetValidatorsLimits(noId, false, 1); + NodeOperatorInfo memory no = csm.getNodeOperator(noId); + assertEq(no.totalVettedValidators, 1); + } + function test_updateTargetValidatorsLimits_RevertWhenNoNodeOperator() public {