From b836b30bff9154a0dd809344c45033fc677f4b47 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 26 Feb 2019 15:10:34 +0800 Subject: [PATCH 1/3] Fix "is_ready_to_exit" condition --- specs/core/0_beacon-chain.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index d73761af7..6d72c301c 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1964,7 +1964,7 @@ def update_validator_registry(state: BeaconState) -> None: # Exit validators within the allowable balance churn balance_churn = 0 for index, validator in enumerate(state.validator_registry): - if validator.activation_epoch == FAR_FUTURE_EPOCH and validator.initiated_exit: + if validator.exit_epoch == FAR_FUTURE_EPOCH and validator.initiated_exit: # Check the balance churn would be within the allowance balance_churn += get_effective_balance(state, index) if balance_churn > max_balance_churn: From bdd68687361531c7a4680d24a9e38a88d09d6691 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 26 Feb 2019 17:07:10 +0800 Subject: [PATCH 2/3] Fix ToC --- specs/core/0_beacon-chain.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 6d72c301c..1c71cf4cf 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -55,6 +55,7 @@ - [Helper functions](#helper-functions) - [`hash`](#hash) - [`hash_tree_root`](#hash_tree_root) + - [`signed_root`](#signed_root) - [`slot_to_epoch`](#slot_to_epoch) - [`get_previous_epoch`](#get_previous_epoch) - [`get_current_epoch`](#get_current_epoch) From bcb0b8bf874eb438327deda2894c0fb51da8f6b8 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 26 Feb 2019 17:07:59 +0800 Subject: [PATCH 3/3] Refactor `exit_validator` --- specs/core/0_beacon-chain.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 1c71cf4cf..e31ecf2ea 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1316,12 +1316,13 @@ def exit_validator(state: BeaconState, index: ValidatorIndex) -> None: Note that this function mutates ``state``. """ validator = state.validator_registry[index] + delayed_activation_exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state)) # The following updates only occur if not previous exited - if validator.exit_epoch <= get_delayed_activation_exit_epoch(get_current_epoch(state)): + if validator.exit_epoch <= delayed_activation_exit_epoch: return - - validator.exit_epoch = get_delayed_activation_exit_epoch(get_current_epoch(state)) + else: + validator.exit_epoch = delayed_activation_exit_epoch ``` #### `slash_validator`