eth2.0-specs/specs/_features/eip6914/beacon-chain.md

2.0 KiB

EIP-6914 -- The Beacon Chain

Table of contents

Introduction

This is the beacon chain specification to assign new deposits to existing validator records. Refers to EIP-6914.

Note: This specification is built upon Capella and is under active development.

Preset

Time parameters

Name Value Unit Duration
SAFE_EPOCHS_TO_REUSE_INDEX uint64(2**16) (= 65,536) epochs ~0.8 year

Helper functions

Predicates

is_reusable_validator

def is_reusable_validator(validator: Validator, balance: Gwei, epoch: Epoch) -> bool:
    """
    Check if ``validator`` index can be re-assigned to a new deposit.
    """
    return (
        epoch > validator.withdrawable_epoch + SAFE_EPOCHS_TO_REUSE_INDEX
        and balance == 0
    )

Beacon chain state transition function

Block processing

Modified get_index_for_new_validator

def get_index_for_new_validator(state: BeaconState) -> ValidatorIndex:
    for index, validator in enumerate(state.validators):
        if is_reusable_validator(validator, state.balances[index], get_current_epoch(state)):
            return ValidatorIndex(index)
    return ValidatorIndex(len(state.validators))