@@ -13,7 +13,7 @@ import { ILidoLocator } from "./interfaces/ILidoLocator.sol";
13
13
import { IStETH } from "./interfaces/IStETH.sol " ;
14
14
import { ICSParametersRegistry } from "./interfaces/ICSParametersRegistry.sol " ;
15
15
import { ICSAccounting } from "./interfaces/ICSAccounting.sol " ;
16
- import { ICSModule, NodeOperator, NodeOperatorManagementProperties } from "./interfaces/ICSModule.sol " ;
16
+ import { ICSModule, NodeOperator, NodeOperatorManagementProperties, ValidatorWithdrawalInfo } from "./interfaces/ICSModule.sol " ;
17
17
18
18
import { QueueLib, Batch } from "./lib/QueueLib.sol " ;
19
19
import { ValidatorCountsReport } from "./lib/ValidatorCountsReport.sol " ;
@@ -677,45 +677,65 @@ contract CSModule is
677
677
}
678
678
679
679
/// @inheritdoc ICSModule
680
- function submitWithdrawal (
681
- uint256 nodeOperatorId ,
682
- uint256 keyIndex ,
683
- uint256 amount ,
684
- bool isSlashed
680
+ function submitWithdrawals (
681
+ ValidatorWithdrawalInfo[] calldata withdrawalsInfo
685
682
) external onlyRole (VERIFIER_ROLE) {
686
- _onlyExistingNodeOperator (nodeOperatorId);
687
- NodeOperator storage no = _nodeOperators[nodeOperatorId];
688
- if (keyIndex >= no.totalDepositedKeys) {
689
- revert SigningKeysInvalidOffset ();
690
- }
691
-
692
- uint256 pointer = _keyPointer (nodeOperatorId, keyIndex);
693
- if (_isValidatorWithdrawn[pointer]) revert AlreadyWithdrawn ();
683
+ for (uint256 i; i < withdrawalsInfo.length ; ++ i) {
684
+ ValidatorWithdrawalInfo memory withdrawalInfo = withdrawalsInfo[i];
694
685
695
- _isValidatorWithdrawn[pointer] = true ;
696
- unchecked {
697
- ++ no.totalWithdrawnKeys;
698
- }
686
+ _onlyExistingNodeOperator (withdrawalInfo.nodeOperatorId) ;
687
+ NodeOperator storage no = _nodeOperators[
688
+ withdrawalInfo.nodeOperatorId
689
+ ];
699
690
700
- bytes memory pubkey = SigningKeys.loadKeys (nodeOperatorId, keyIndex, 1 );
701
- emit WithdrawalSubmitted (nodeOperatorId, keyIndex, amount, pubkey);
691
+ if (withdrawalInfo.keyIndex >= no.totalDepositedKeys) {
692
+ revert SigningKeysInvalidOffset ();
693
+ }
702
694
703
- if (isSlashed) {
704
- // Bond curve should be reset to default in case of slashing. See https://hackmd.io/@lido/SygBLW5ja
705
- accounting.resetBondCurve (nodeOperatorId);
706
- }
695
+ uint256 pointer = _keyPointer (
696
+ withdrawalInfo.nodeOperatorId,
697
+ withdrawalInfo.keyIndex
698
+ );
699
+ if (_isValidatorWithdrawn[pointer]) revert AlreadyWithdrawn ();
707
700
708
- if (DEPOSIT_SIZE > amount) {
701
+ _isValidatorWithdrawn[pointer] = true ;
709
702
unchecked {
710
- accounting. penalize (nodeOperatorId, DEPOSIT_SIZE - amount) ;
703
+ ++ no.totalWithdrawnKeys ;
711
704
}
712
- }
713
705
714
- // Nonce should be updated if depositableValidators change
715
- _updateDepositableValidatorsCount ({
716
- nodeOperatorId: nodeOperatorId,
717
- incrementNonceIfUpdated: true
718
- });
706
+ bytes memory pubkey = SigningKeys.loadKeys (
707
+ withdrawalInfo.nodeOperatorId,
708
+ withdrawalInfo.keyIndex,
709
+ 1
710
+ );
711
+
712
+ emit WithdrawalSubmitted (
713
+ withdrawalInfo.nodeOperatorId,
714
+ withdrawalInfo.keyIndex,
715
+ withdrawalInfo.amount,
716
+ pubkey
717
+ );
718
+
719
+ if (withdrawalInfo.isSlashed) {
720
+ // Bond curve should be reset to default in case of slashing. See https://hackmd.io/@lido/SygBLW5ja
721
+ accounting.resetBondCurve (withdrawalInfo.nodeOperatorId);
722
+ }
723
+
724
+ if (DEPOSIT_SIZE > withdrawalInfo.amount) {
725
+ unchecked {
726
+ accounting.penalize (
727
+ withdrawalInfo.nodeOperatorId,
728
+ DEPOSIT_SIZE - withdrawalInfo.amount
729
+ );
730
+ }
731
+ }
732
+
733
+ // Nonce should be updated if depositableValidators change
734
+ _updateDepositableValidatorsCount ({
735
+ nodeOperatorId: withdrawalInfo.nodeOperatorId,
736
+ incrementNonceIfUpdated: true
737
+ });
738
+ }
719
739
}
720
740
721
741
/// @inheritdoc IStakingModule
0 commit comments