ethereum / consensus-specs

Ethereum Proof-of-Stake Consensus Specifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rewards tests use genesis epoch

michaelsproul opened this issue · comments

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.

It seems there's actually only 1 rewards test with the genesis epoch, the empty case:

Test Result
Title: altair/rewards/basic
11 tests, 0 failed, 1 skipped (known failure), 0 skipped (bls), 10 passed. (See below for errors)

-------
case () from /home/michael/Programming/lighthouse3/testing/ef_tests/consensus-spec-tests/tests/mainnet/altair/rewards/basic/pyspec_tests/empty skipped because it's a known failure