Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Update validate_voluntary_exit #421

Merged
merged 5 commits into from
Mar 19, 2019
Merged

Update validate_voluntary_exit #421

merged 5 commits into from
Mar 19, 2019

Conversation

hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Mar 17, 2019

What was wrong?

Fix #412 and #413

How was it fixed?

Add and edit the validation rules of voluntary exit.

    # Verify the validator has not yet exited
    assert validator.exit_epoch == FAR_FUTURE_EPOCH

    # Verify the validator has not initiated an exit
    assert validator.initiated_exit is False

    # Must have been in the validator set long enough
    assert get_current_epoch(state) - validator.activation_epoch >= PERSISTENT_COMMITTEE_PERIOD

Cute Animal Picture

moose-931640_640

@hwwhww hwwhww added the eth2.0 label Mar 17, 2019
@hwwhww hwwhww requested a review from NIC619 March 17, 2019 05:11
Copy link
Contributor

@NIC619 NIC619 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

"""
if current_epoch - validator.activation_epoch < persistent_committee_period:
raise ValidationError(
"current_epoch - validator.activation_epoch "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"current_epoch - validator.activation_epoch "
f"current_epoch - validator.activation_epoch "

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems fine either way.

@@ -25,26 +30,41 @@
'slots_per_epoch',
'target_committee_size',
'activation_exit_delay',
'persistent_committee_period',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the activation_exit_delay above.

)
state = state.update_validator_registry(validator_index, validator)

validator_index = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated validator_index = 0.

@hwwhww hwwhww merged commit 61c1e55 into ethereum:master Mar 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disallow duplicate voluntary exits
2 participants