Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-6914: Update the equivocating indices in the fork-choice store #3446

Merged
merged 2 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion specs/_features/eip6914/beacon-chain.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EIP-6914 -- The Beacon Chain
# EIP-6914 -- The Beacon Chain

## Table of contents

Expand Down
36 changes: 36 additions & 0 deletions specs/_features/eip6914/fork-choice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# EIP-6914 -- Fork Choice

## Table of contents

<!-- TOC -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Introduction](#introduction)
- [Fork choice](#fork-choice)
- [Handlers](#handlers)
- [`on_reused_index`](#on_reused_index)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->

## 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. 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.

### Handlers

#### `on_reused_index`

```python
def on_reused_index(store: Store, index: ValidatorIndex) -> None:
store.equivocating_indices.discard(index)
```