From fa6094837bfeab56e35d74d81f3ca15adc9221d1 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 19 Jan 2021 21:41:34 +0800 Subject: [PATCH] Update lightclient patch and phase1 specs --- specs/lightclient/beacon-chain.md | 26 +++++++++++++++++++------- specs/phase1/beacon-chain.md | 10 +++++++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/specs/lightclient/beacon-chain.md b/specs/lightclient/beacon-chain.md index 2fbe190e4..60526d8c0 100644 --- a/specs/lightclient/beacon-chain.md +++ b/specs/lightclient/beacon-chain.md @@ -29,7 +29,7 @@ - [Sync committee processing](#sync-committee-processing) - [Epoch processing](#epoch-processing) - [Components of attestation deltas](#components-of-attestation-deltas) - - [Final updates](#final-updates) + - [Sync committee updates](#sync-committee-updates) @@ -209,6 +209,22 @@ def process_sync_committee(state: BeaconState, body: BeaconBlockBody) -> None: ### Epoch processing +```python +def process_epoch(state: BeaconState) -> None: + process_justification_and_finalization(state) + process_rewards_and_penalties(state) + process_registry_updates(state) + process_slashings(state) + process_eth1_data_votes_updates(state) + process_effective_balances_updates(state) + process_slashings_updates(state) + process_randao_mixes_updates(state) + process_historical_roots_updates(state) + process_participation_record_updates(state) + # Light client patch + process_sync_committee_updates(state) +``` + #### Components of attestation deltas *Note*: The function `get_inactivity_penalty_deltas` is modified with `BASE_REWARDS_PER_EPOCH` replaced by `BASE_REWARDS_PER_EPOCH - 1`. @@ -235,14 +251,10 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S return rewards, penalties ``` -#### Final updates - -*Note*: The function `process_final_updates` is modified to handle sync committee updates. +#### Sync committee updates ```python -def process_final_updates(state: BeaconState) -> None: - # FIXME: unfold the full `process_final_updates` to avoid side effects. - phase0.process_final_updates(state) +def process_sync_committee_updates(state: BeaconState) -> None: next_epoch = get_current_epoch(state) + Epoch(1) if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0: state.current_sync_committee = state.next_sync_committee diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index c8f93cc7f..2b8e460ed 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -1054,10 +1054,14 @@ def process_epoch(state: BeaconState) -> None: process_justification_and_finalization(state) process_rewards_and_penalties(state) process_registry_updates(state) - process_reveal_deadlines(state) - process_challenge_deadlines(state) process_slashings(state) - process_final_updates(state) # phase 0 final updates + process_eth1_data_votes_updates(state) + process_effective_balances_updates(state) + process_slashings_updates(state) + process_randao_mixes_updates(state) + process_historical_roots_updates(state) + process_participation_record_updates(state) + # Phase 1 process_phase_1_final_updates(state) ```