Merge pull request #751 from ethereum/JustinDrake-patch-8
Disallow duplicate voluntary exits
This commit is contained in:
commit
2c7c48a4e0
|
@ -2453,14 +2453,16 @@ Verify that `len(block.body.voluntary_exits) <= MAX_VOLUNTARY_EXITS`.
|
|||
For each `exit` in `block.body.voluntary_exits`, run the following function:
|
||||
|
||||
```python
|
||||
def process_exit(state: BeaconState, exit: VoluntaryExit) -> None:
|
||||
def process_voluntary_exit(state: BeaconState, exit: VoluntaryExit) -> None:
|
||||
"""
|
||||
Process ``VoluntaryExit`` transaction.
|
||||
Note that this function mutates ``state``.
|
||||
"""
|
||||
validator = state.validator_registry[exit.validator_index]
|
||||
# Verify the validator has not yet exited
|
||||
assert validator.exit_epoch > get_delayed_activation_exit_epoch(get_current_epoch(state))
|
||||
assert validator.exit_epoch == FAR_FUTURE_EPOCH
|
||||
# Verify the validator has not initiated an exit
|
||||
assert validator.initiated_exit is False
|
||||
# Exits must specify an epoch when they become valid; they are not valid before then
|
||||
assert get_current_epoch(state) >= exit.epoch
|
||||
# Verify signature
|
||||
|
|
Loading…
Reference in New Issue