Skip to content

Commit

Permalink
fix: remove lock if locked only
Browse files Browse the repository at this point in the history
  • Loading branch information
madlabman authored and dgusakov committed Oct 1, 2024
1 parent 04c57a3 commit 9c7d014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/CSAccounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ contract CSAccounting is
uint256 lockedAmount = CSBondLock.getActualLockedBond(nodeOperatorId);
if (lockedAmount > 0) {
CSBondCore._burn(nodeOperatorId, lockedAmount);
// reduce all locked bond even if bond isn't covered lock fully
CSBondLock._remove(nodeOperatorId);
}
// reduce all locked bond even if bond isn't covered lock fully
CSBondLock._remove(nodeOperatorId);
}

/// @notice Penalize bond by burning stETH shares of the given Node Operator
Expand Down
12 changes: 4 additions & 8 deletions test/CSModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5780,9 +5780,7 @@ contract CsmSettleELRewardsStealingPenaltyAdvanced is CSMCommon {
);
csm.settleELRewardsStealingPenalty(idsToSettle);

CSBondLock.BondLock memory lock = accounting.getLockedBondInfo(noId);
assertEq(lock.amount, 0 ether);
assertEq(lock.retentionUntil, 0);
assertEq(accounting.getActualLockedBond(noId), 0);
}

function test_settleELRewardsStealingPenalty_multipleNOs_oneExpired()
Expand Down Expand Up @@ -5818,15 +5816,13 @@ contract CsmSettleELRewardsStealingPenaltyAdvanced is CSMCommon {
);
csm.settleELRewardsStealingPenalty(idsToSettle);

assertEq(accounting.getActualLockedBond(firstNoId), 0);

CSBondLock.BondLock memory lock = accounting.getLockedBondInfo(
firstNoId
secondNoId
);
assertEq(lock.amount, 0 ether);
assertEq(lock.retentionUntil, 0);

lock = accounting.getLockedBondInfo(secondNoId);
assertEq(lock.amount, 0 ether);
assertEq(lock.retentionUntil, 0);
}

function test_settleELRewardsStealingPenalty_CurveReset_NoNewUnbonded()
Expand Down

0 comments on commit 9c7d014

Please sign in to comment.