From 3ed0619951dd43b30ed69e96baf0aa9bbb5a1f5f Mon Sep 17 00:00:00 2001 From: Suphanat Chunhapanya Date: Tue, 11 Jul 2023 15:47:17 +0700 Subject: [PATCH 1/2] Update the equivocating indices in the store Since we sometimes reuse the slashed validator index, we need to remove it from the list of equivocating indices in the fork-choice store. --- specs/_features/eip6914/beacon-chain.md | 2 +- specs/_features/eip6914/fork-choice.md | 36 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 specs/_features/eip6914/fork-choice.md diff --git a/specs/_features/eip6914/beacon-chain.md b/specs/_features/eip6914/beacon-chain.md index 2c60c9bdb..1e0b20747 100644 --- a/specs/_features/eip6914/beacon-chain.md +++ b/specs/_features/eip6914/beacon-chain.md @@ -1,4 +1,4 @@ -EIP-6914 -- The Beacon Chain +# EIP-6914 -- The Beacon Chain ## Table of contents diff --git a/specs/_features/eip6914/fork-choice.md b/specs/_features/eip6914/fork-choice.md new file mode 100644 index 000000000..e422a8e37 --- /dev/null +++ b/specs/_features/eip6914/fork-choice.md @@ -0,0 +1,36 @@ +# EIP-6914 -- Fork Choice + +## Table of contents + + + + + +- [Introduction](#introduction) +- [Fork choice](#fork-choice) + - [Handlers](#handlers) + - [`on_reused_index`](#on_reused_index) + + + + +## Introduction + +This is the modification of the fork choice according to EIP-6914. + +## Fork choice + +A new handler is added with this upgrade: + +- `on_reused_index(store, index)` whenever a validator index `index: ValidatorIndex` is reused + +This new handler is used to update the list of equivocating indices to be synchronized with the canonical chain. + +### Handlers + +#### `on_reused_index` + +```python +def on_reused_index(store: Store, index: ValidatorIndex) -> None: + store.equivocating_indices.discard(index) +``` From d8b023c5d8099db2459aec15985a0ffd9e2a24c2 Mon Sep 17 00:00:00 2001 From: Suphanat Chunhapanya Date: Tue, 18 Jul 2023 19:55:18 +0700 Subject: [PATCH 2/2] Explain more on on_reused_index --- specs/_features/eip6914/fork-choice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/_features/eip6914/fork-choice.md b/specs/_features/eip6914/fork-choice.md index e422a8e37..25adc82d6 100644 --- a/specs/_features/eip6914/fork-choice.md +++ b/specs/_features/eip6914/fork-choice.md @@ -22,7 +22,7 @@ This is the modification of the fork choice according to EIP-6914. A new handler is added with this upgrade: -- `on_reused_index(store, index)` whenever a validator index `index: ValidatorIndex` is reused +- `on_reused_index(store, index)` whenever a validator index `index: ValidatorIndex` is reused. That is, [`get_index_for_new_validator()`](./beacon-chain.md#get_index_for_new_validator) provides an index due to a return value of `True` from [`is_reusable_validator()`](./beacon-chain.md#is_reusable_validator). This new handler is used to update the list of equivocating indices to be synchronized with the canonical chain.