Skip to content

Commit

Permalink
Add limit churn feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Jul 11, 2023
1 parent 2cd967e commit 81c729b
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions specs/_features/limit_churn/beacon_chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Limit churn -- The Beacon Chain

## 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)
- [Preset](#preset)
- [Time parameters](#time-parameters)
- [Helper functions](#helper-functions)
- [Predicates](#predicates)
- [`is_reusable_validator`](#is_reusable_validator)
- [Beacon chain state transition function](#beacon-chain-state-transition-function)
- [Block processing](#block-processing)
- [Modified `get_index_for_new_validator`](#modified-get_index_for_new_validator)

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

## Introduction

This is the beacon chain specification to limit the max churn value, motivated to limit the validator active set growth rate.

*Note:* This specification is built upon [Capella](../../capella/beacon_chain.md) and is under active development.

## Configuration

### Validator cycle

| Name | Value |
| - | - |
| `MAX_PER_EPOCH_CHURN_LIMIT` | `uint64(12)` (= 12) |

## Helper functions

### Beacon state accessors

#### modified `get_validator_churn_limit`

```python
def get_validator_churn_limit(state: BeaconState) -> uint64:
"""
Return the validator churn limit for the current epoch.
"""
active_validator_indices = get_active_validator_indices(state, get_current_epoch(state))
return min(
MAX_PER_EPOCH_CHURN_LIMIT,
max(
MIN_PER_EPOCH_CHURN_LIMIT,
uint64(len(active_validator_indices)) // CHURN_LIMIT_QUOTIENT
)
)
```

0 comments on commit 81c729b

Please sign in to comment.