You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to prevent validators from exiting voluntarily if any of these conditions are fulfilled:
Open chunk/bit challenges
Custody keys not revealed
This was originally implemented by the function below, but the function and its attachment point was lost over some refactoring of the exit queue:
defeligible(state: BeaconState, index: ValidatorIndex) ->bool:
validator=state.validator_registry[index]
# Cannot exit if there are still open chunk challengesiflen([recordforrecordinstate.custody_chunk_challenge_recordsifrecord.responder_index==index]) >0:
returnFalse# Cannot exit if there are still open bit challengesiflen([recordforrecordinstate.custody_bit_challenge_recordsifrecord.responder_index==index]) >0:
returnFalse# Cannot exit if you have not revealed all of your custody keyselifvalidator.next_custody_reveal_period<=get_validators_custody_reveal_period(state, index, validator.exit_epoch):
returnFalse# Cannot exit if you already haveelifvalidator.withdrawable_epoch<FAR_FUTURE_EPOCH:
returnFalse# Return minimum timeelse:
returncurrent_epoch>=validator.exit_epoch+MIN_VALIDATOR_WITHDRAWAL_EPOCHS
The text was updated successfully, but these errors were encountered:
Case 1: the validator initiated exit at epoch N, and then got slashed at epoch N+k
In initiate_validator_exit, validator.withdrawable_epoch is set to Epoch(validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY)
In process_chunk_challenge and process_bit_challenge, responder.withdrawable_epoch is set to FAR_FUTURE_EPOCH.
Case 2: the validator got challenged at epoch N, and then initiated exit at epoch N+k
In process_chunk_challenge and process_bit_challenge, responder.withdrawable_epoch is set to FAR_FUTURE_EPOCH.
In initiate_validator_exit, validator.withdrawable_epoch is set to Epoch(validator.exit_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY) <--- oh no!! 🤯
Proposing solutions
Solution 1: update after_process_final_updates to delay withdrawable_epoch
forindex, validatorinenumerate(state.validators):
ifindexinvalidator_indices_in_records:
# Delay withdrawable epochs if challenge records are not emptyvalidator.withdrawable_epoch=Epoch(current_epoch+MIN_VALIDATOR_WITHDRAWABILITY_DELAY)
else:
# Reset withdrawable epochs if challenge records are emptyifvalidator.exit_epoch!=FAR_FUTURE_EPOCHandvalidator.withdrawable_epoch==FAR_FUTURE_EPOCH:
validator.withdrawable_epoch=Epoch(validator.exit_epoch+MIN_VALIDATOR_WITHDRAWABILITY_DELAY)
Solution 2: Extract checks into initiate_validator_withdrawable:
#1066 was the patch before #1035 was merged… and somehow I was convinced that #1035 already fixed everything. 🙈
We need to prevent validators from exiting voluntarily if any of these conditions are fulfilled:
This was originally implemented by the function below, but the function and its attachment point was lost over some refactoring of the exit queue:
The text was updated successfully, but these errors were encountered: