Update lightclient patch and phase1 specs

This commit is contained in:
Hsiao-Wei Wang 2021-01-19 21:41:34 +08:00
parent daa4798704
commit fa6094837b
No known key found for this signature in database
GPG Key ID: 1111A8A81778319E
2 changed files with 26 additions and 10 deletions

View File

@ -29,7 +29,7 @@
- [Sync committee processing](#sync-committee-processing) - [Sync committee processing](#sync-committee-processing)
- [Epoch processing](#epoch-processing) - [Epoch processing](#epoch-processing)
- [Components of attestation deltas](#components-of-attestation-deltas) - [Components of attestation deltas](#components-of-attestation-deltas)
- [Final updates](#final-updates) - [Sync committee updates](#sync-committee-updates)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC --> <!-- /TOC -->
@ -209,6 +209,22 @@ def process_sync_committee(state: BeaconState, body: BeaconBlockBody) -> None:
### Epoch processing ### 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 #### 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`. *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 return rewards, penalties
``` ```
#### Final updates #### Sync committee updates
*Note*: The function `process_final_updates` is modified to handle sync committee updates.
```python ```python
def process_final_updates(state: BeaconState) -> None: def process_sync_committee_updates(state: BeaconState) -> None:
# FIXME: unfold the full `process_final_updates` to avoid side effects.
phase0.process_final_updates(state)
next_epoch = get_current_epoch(state) + Epoch(1) next_epoch = get_current_epoch(state) + Epoch(1)
if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0: if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0:
state.current_sync_committee = state.next_sync_committee state.current_sync_committee = state.next_sync_committee

View File

@ -1054,10 +1054,14 @@ def process_epoch(state: BeaconState) -> None:
process_justification_and_finalization(state) process_justification_and_finalization(state)
process_rewards_and_penalties(state) process_rewards_and_penalties(state)
process_registry_updates(state) process_registry_updates(state)
process_reveal_deadlines(state)
process_challenge_deadlines(state)
process_slashings(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) process_phase_1_final_updates(state)
``` ```