Skip to content

Commit 8563eab

Browse files
committed
feat: report unexited validator to staking router
1 parent 50cee98 commit 8563eab

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

contracts/0.4.24/nos/NodeOperatorsRegistry.sol

+17
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,23 @@ contract NodeOperatorsRegistry is AragonApp, Versioned {
866866
_increaseValidatorsKeysNonce();
867867
}
868868

869+
/// @notice Reports the duration a validator has remained eligible for exit after exit request.
870+
/// @dev Notify how many seconds have passed since a validator first became eligible
871+
/// to exit following an exit request but has not yet exited.
872+
/// @param nodeOperatorId The identifier of the node operator.
873+
/// @param publicKey The public key of the validator being reported.
874+
/// @param secondsSinceEligibleExitRequest Seconds since the validator first
875+
/// became eligible to exit following an exit request but has not yet exited.
876+
function reportUnexitedValidator(
877+
uint256 nodeOperatorId,
878+
bytes publicKey,
879+
uint256 secondsSinceEligibleExitRequest
880+
) external {
881+
_auth(STAKING_ROUTER_ROLE);
882+
883+
// ToDo: implement...
884+
}
885+
869886
function _getNodeOperator(uint256 _nodeOperatorId)
870887
internal
871888
view

contracts/0.8.9/StakingRouter.sol

+24
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ contract StakingRouter is AccessControlEnumerable, BeaconChainDepositor, Version
133133
bytes32 public constant STAKING_MODULE_MANAGE_ROLE = keccak256("STAKING_MODULE_MANAGE_ROLE");
134134
bytes32 public constant STAKING_MODULE_UNVETTING_ROLE = keccak256("STAKING_MODULE_UNVETTING_ROLE");
135135
bytes32 public constant REPORT_EXITED_VALIDATORS_ROLE = keccak256("REPORT_EXITED_VALIDATORS_ROLE");
136+
bytes32 public constant REPORT_UNEXITED_VALIDATORS_ROLE = keccak256("REPORT_UNEXITED_VALIDATORS_ROLE");
136137
bytes32 public constant UNSAFE_SET_EXITED_VALIDATORS_ROLE = keccak256("UNSAFE_SET_EXITED_VALIDATORS_ROLE");
137138
bytes32 public constant REPORT_REWARDS_MINTED_ROLE = keccak256("REPORT_REWARDS_MINTED_ROLE");
138139

@@ -1321,6 +1322,29 @@ contract StakingRouter is AccessControlEnumerable, BeaconChainDepositor, Version
13211322
emit WithdrawalCredentialsSet(_withdrawalCredentials, msg.sender);
13221323
}
13231324

1325+
/// @notice Reports the duration a validator has remained eligible for exit after exit request.
1326+
/// @dev Notify staking module how many seconds have passed since a validator first became eligible
1327+
/// to exit following an exit request but has not yet exited.
1328+
/// @param stakingModuleId The identifier of the staking module.
1329+
/// @param nodeOperatorId The identifier of the node operator.
1330+
/// @param publicKey The public key of the validator being reported.
1331+
/// @param secondsSinceEligibleExitRequest Seconds since the validator first
1332+
/// became eligible to exit following an exit request but has not yet exited.
1333+
function reportUnexitedValidator(
1334+
uint256 stakingModuleId,
1335+
uint256 nodeOperatorId,
1336+
bytes calldata publicKey,
1337+
uint256 secondsSinceEligibleExitRequest
1338+
) external onlyRole(REPORT_UNEXITED_VALIDATORS_ROLE) {
1339+
StakingModule storage stakingModule = _getStakingModuleById(stakingModuleId);
1340+
1341+
IStakingModule(stakingModule.stakingModuleAddress).reportUnexitedValidator(
1342+
nodeOperatorId,
1343+
publicKey,
1344+
secondsSinceEligibleExitRequest
1345+
);
1346+
}
1347+
13241348
/// @notice Returns current credentials to withdraw ETH on Consensus Layer side.
13251349
/// @return Withdrawal credentials.
13261350
function getWithdrawalCredentials() public view returns (bytes32) {

contracts/0.8.9/interfaces/IStakingModule.sol

+13
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ interface IStakingModule {
169169
/// Details about error data: https://docs.soliditylang.org/en/v0.8.9/control-structures.html#error-handling-assert-require-revert-and-exceptions
170170
function onWithdrawalCredentialsChanged() external;
171171

172+
/// @notice Reports the duration a validator has remained unexited after becoming eligible for exit.
173+
/// @dev Notify staking module how many seconds have passed since a validator first became eligible
174+
/// to exit following an exit request but has not yet exited.
175+
/// @param nodeOperatorId Id of the node operator.
176+
/// @param publicKey The public key of the validator being reported.
177+
/// @param secondsSinceEligibleExitRequest Seconds since the validator first
178+
/// became eligible to exit following an exit request but has not yet exited.
179+
function reportUnexitedValidator(
180+
uint256 nodeOperatorId,
181+
bytes calldata publicKey,
182+
uint256 secondsSinceEligibleExitRequest
183+
) external;
184+
172185
/// @dev Event to be emitted on StakingModule's nonce change
173186
event NonceChanged(uint256 nonce);
174187

test/0.8.9/contracts/StakingModule__MockForStakingRouter.sol

+14
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,20 @@ contract StakingModule__MockForStakingRouter is IStakingModule {
216216

217217
event Mock__onExitedAndStuckValidatorsCountsUpdated();
218218

219+
function reportUnexitedValidator(
220+
uint256 nodeOperatorId,
221+
bytes calldata publicKey,
222+
uint256 secondsSinceEligibleExitRequest
223+
) external {
224+
emit Mock__UnexitedValidatorReported(nodeOperatorId, publicKey, secondsSinceEligibleExitRequest);
225+
}
226+
227+
event Mock__UnexitedValidatorReported(
228+
uint256 nodeOperatorId,
229+
bytes publicKey,
230+
uint256 secondsSinceEligibleExitRequest
231+
);
232+
219233
bool private onExitedAndStuckValidatorsCountsUpdatedShouldRevert = false;
220234
bool private onExitedAndStuckValidatorsCountsUpdatedShouldRunOutGas = false;
221235

0 commit comments

Comments
 (0)