Skip to content

Rewards tests use genesis epoch #3593

@michaelsproul

Description

@michaelsproul

The rewards tests use a BeaconState in epoch 0, which isn't compatible with implementations that avoid processing rewards in the genesis epoch.

The process_rewards_and_penalties function does not compute rewards in epoch 0:

def process_rewards_and_penalties(state: BeaconState) -> None:
    # No rewards are applied at the end of `GENESIS_EPOCH` because rewards are for work done in the previous epoch
    if get_current_epoch(state) == GENESIS_EPOCH:
        return
    ...

https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.6/specs/altair/beacon-chain.md#rewards-and-penalties

In Lighthouse, while moving to single-pass epoch processing we no longer have code for computing individual deltas, and extract the deltas (actually the sum of all deltas) from our single-pass implementation. Single-pass epoch processing (correctly) skips rewards calculations in epoch 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions