From 77188726de0b71a89afe40e5e5c97c85a96a163c Mon Sep 17 00:00:00 2001 From: vbuterin Date: Sat, 27 Nov 2021 07:27:16 -0600 Subject: [PATCH] Fixed ToC and get_active_header positioninf --- specs/altair/sync-protocol.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/specs/altair/sync-protocol.md b/specs/altair/sync-protocol.md index f90469f98..ca7aa7451 100644 --- a/specs/altair/sync-protocol.md +++ b/specs/altair/sync-protocol.md @@ -17,11 +17,10 @@ - [`LightClientStore`](#lightclientstore) - [Helper functions](#helper-functions) - [`get_subtree_index`](#get_subtree_index) - - [`get_signed_header`](#get_signed_header) + - [`get_active_header`](#get_active_header) - [`get_safety_threshold`](#get_safety_threshold) - [Light client state updates](#light-client-state-updates) - [`process_slot`](#process_slot) - - [`get_active_header`](#get_active_header) - [`validate_light_client_update`](#validate_light_client_update) - [`apply_light_client_update`](#apply_light_client_update) - [`process_light_client_update`](#process_light_client_update) @@ -103,6 +102,17 @@ def get_subtree_index(generalized_index: GeneralizedIndex) -> uint64: return uint64(generalized_index % 2**(floorlog2(generalized_index))) ``` +### `get_active_header` + +```python +def get_active_header(update: LightClientUpdate) -> BeaconBlockHeader: + # Is the update trying to convince us of a finalized header or an optimistic header? + if update.finalized_header BeaconBlockHeader(): + return update.finalized_header + else: + return update.attested_header +``` + ### `get_safety_threshold` ```python @@ -126,17 +136,6 @@ def process_slot(store: LightClientStore, current_slot: Slot): store.current_period_max_attendance = 0 ``` -### `get_active_header` - -```python -def get_active_header(update: LightClientUpdate) -> BeaconBlockHeader: - # Is the update trying to convince us of a finalized header or an optimistic header? - if update.finalized_header BeaconBlockHeader(): - return update.finalized_header - else: - return update.attested_header -``` - #### `validate_light_client_update` ```python