exit updates

This commit is contained in:
realbigsean
2024-05-07 15:32:07 -04:00
parent 31955c2e7f
commit 75ab913a3a
3 changed files with 31 additions and 10 deletions

View File

@@ -451,7 +451,10 @@ pub enum ExitInvalid {
/// The specified validator has already initiated exit.
AlreadyInitiatedExit(u64),
/// The exit is for a future epoch.
FutureEpoch { state: Epoch, exit: Epoch },
FutureEpoch {
state: Epoch,
exit: Epoch,
},
/// The validator has not been active for long enough.
TooYoungToExit {
current_epoch: Epoch,
@@ -462,6 +465,7 @@ pub enum ExitInvalid {
/// There was an error whilst attempting to get a set of signatures. The signatures may have
/// been invalid or an internal error occurred.
SignatureSetError(SignatureSetError),
PendingWithdrawalInQueue(u64),
}
#[derive(Debug, PartialEq, Clone)]

View File

@@ -79,5 +79,16 @@ pub fn verify_exit<E: EthSpec>(
);
}
// [New in Electra:EIP7251]
// Only exit validator if it has no pending withdrawals in the queue
if let Ok(pending_balance_to_withdraw) =
state.get_pending_balance_to_withdraw(exit.validator_index as usize)
{
verify!(
pending_balance_to_withdraw == 0,
ExitInvalid::PendingWithdrawalInQueue(exit.validator_index)
);
}
Ok(())
}