Skip to content

Commit

Permalink
fix for review
Browse files Browse the repository at this point in the history
  • Loading branch information
skhomuti committed Jan 11, 2024
1 parent 090ff97 commit 2aa0c1e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/CSModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ contract CSModuleBase {
bool isTargetLimitActive,
uint256 targetValidatorsCount
);
event WithdrawalSubmitted(uint256 indexed validatorId, uint256 exitBalance);
event WithdrawalSubmitted(
uint256 indexed validatorId,
uint256 withdrawalBalance
);

event BatchEnqueued(
uint256 indexed nodeOperatorId,
Expand Down Expand Up @@ -960,7 +963,6 @@ contract CSModule is ICSModule, CSModuleBase {

if (
no.isTargetLimitActive &&
// TODO: totalExited or totalWithdrawn?
vetKeysPointer > (no.totalExitedKeys + no.targetLimit)
) revert TargetLimitExceeded();
if (no.stuckValidatorsCount > 0) revert StuckKeysPresent();
Expand Down Expand Up @@ -1109,20 +1111,23 @@ contract CSModule is ICSModule, CSModuleBase {
bytes32 /*withdrawalProof*/,
uint256 nodeOperatorId,
uint256 validatorId,
uint256 exitBalance
uint256 withdrawalBalance
) external onlyExistingNodeOperator(nodeOperatorId) {
// TODO: check for withdrawal proof
// TODO: consider asserting that withdrawn keys count is not higher than exited keys count
NodeOperator storage no = _nodeOperators[nodeOperatorId];

no.totalWithdrawnKeys += 1;

if (exitBalance < DEPOSIT_SIZE) {
accounting.penalize(nodeOperatorId, DEPOSIT_SIZE - exitBalance);
if (withdrawalBalance < DEPOSIT_SIZE) {
accounting.penalize(
nodeOperatorId,
DEPOSIT_SIZE - withdrawalBalance
);
_checkForOutOfBond(nodeOperatorId);
}

emit WithdrawalSubmitted(validatorId, exitBalance);
emit WithdrawalSubmitted(validatorId, withdrawalBalance);
}

/// @notice Called when withdrawal credentials changed by DAO
Expand Down

0 comments on commit 2aa0c1e

Please sign in to comment.