@@ -60,9 +60,9 @@ Additional documents describe how the light client sync protocol can be used:
6060
6161| Name | Value |
6262| - | - |
63- | ` FINALIZED_ROOT_INDEX ` | ` get_generalized_index(BeaconState, 'finalized_checkpoint', 'root') ` (= 105) |
64- | ` CURRENT_SYNC_COMMITTEE_INDEX ` | ` get_generalized_index(BeaconState, 'current_sync_committee') ` (= 54) |
65- | ` NEXT_SYNC_COMMITTEE_INDEX ` | ` get_generalized_index(BeaconState, 'next_sync_committee') ` (= 55) |
63+ | ` FINALIZED_ROOT_GINDEX ` | ` get_generalized_index(BeaconState, 'finalized_checkpoint', 'root') ` (= 105) |
64+ | ` CURRENT_SYNC_COMMITTEE_GINDEX ` | ` get_generalized_index(BeaconState, 'current_sync_committee') ` (= 54) |
65+ | ` NEXT_SYNC_COMMITTEE_GINDEX ` | ` get_generalized_index(BeaconState, 'next_sync_committee') ` (= 55) |
6666
6767## Preset
6868
@@ -93,7 +93,7 @@ class LightClientBootstrap(Container):
9393 header: LightClientHeader
9494 # Current sync committee corresponding to `header.beacon.state_root`
9595 current_sync_committee: SyncCommittee
96- current_sync_committee_branch: Vector[Bytes32, floorlog2(CURRENT_SYNC_COMMITTEE_INDEX )]
96+ current_sync_committee_branch: Vector[Bytes32, floorlog2(CURRENT_SYNC_COMMITTEE_GINDEX )]
9797```
9898
9999### ` LightClientUpdate `
@@ -104,10 +104,10 @@ class LightClientUpdate(Container):
104104 attested_header: LightClientHeader
105105 # Next sync committee corresponding to `attested_header.beacon.state_root`
106106 next_sync_committee: SyncCommittee
107- next_sync_committee_branch: Vector[Bytes32, floorlog2(NEXT_SYNC_COMMITTEE_INDEX )]
107+ next_sync_committee_branch: Vector[Bytes32, floorlog2(NEXT_SYNC_COMMITTEE_GINDEX )]
108108 # Finalized header corresponding to `attested_header.beacon.state_root`
109109 finalized_header: LightClientHeader
110- finality_branch: Vector[Bytes32, floorlog2(FINALIZED_ROOT_INDEX )]
110+ finality_branch: Vector[Bytes32, floorlog2(FINALIZED_ROOT_GINDEX )]
111111 # Sync committee aggregate signature
112112 sync_aggregate: SyncAggregate
113113 # Slot at which the aggregate signature was created (untrusted)
@@ -122,7 +122,7 @@ class LightClientFinalityUpdate(Container):
122122 attested_header: LightClientHeader
123123 # Finalized header corresponding to `attested_header.beacon.state_root`
124124 finalized_header: LightClientHeader
125- finality_branch: Vector[Bytes32, floorlog2(FINALIZED_ROOT_INDEX )]
125+ finality_branch: Vector[Bytes32, floorlog2(FINALIZED_ROOT_GINDEX )]
126126 # Sync committee aggregate signature
127127 sync_aggregate: SyncAggregate
128128 # Slot at which the aggregate signature was created (untrusted)
@@ -174,14 +174,14 @@ def is_valid_light_client_header(header: LightClientHeader) -> bool:
174174
175175``` python
176176def is_sync_committee_update (update : LightClientUpdate) -> bool :
177- return update.next_sync_committee_branch != [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_INDEX ))]
177+ return update.next_sync_committee_branch != [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_GINDEX ))]
178178```
179179
180180### ` is_finality_update `
181181
182182``` python
183183def is_finality_update (update : LightClientUpdate) -> bool :
184- return update.finality_branch != [Bytes32() for _ in range (floorlog2(FINALIZED_ROOT_INDEX ))]
184+ return update.finality_branch != [Bytes32() for _ in range (floorlog2(FINALIZED_ROOT_GINDEX ))]
185185```
186186
187187### ` is_better_update `
@@ -286,8 +286,8 @@ def initialize_light_client_store(trusted_block_root: Root,
286286 assert is_valid_merkle_branch(
287287 leaf = hash_tree_root(bootstrap.current_sync_committee),
288288 branch = bootstrap.current_sync_committee_branch,
289- depth = floorlog2(CURRENT_SYNC_COMMITTEE_INDEX ),
290- index = get_subtree_index(CURRENT_SYNC_COMMITTEE_INDEX ),
289+ depth = floorlog2(CURRENT_SYNC_COMMITTEE_GINDEX ),
290+ index = get_subtree_index(CURRENT_SYNC_COMMITTEE_GINDEX ),
291291 root = bootstrap.header.beacon.state_root,
292292 )
293293
@@ -358,8 +358,8 @@ def validate_light_client_update(store: LightClientStore,
358358 assert is_valid_merkle_branch(
359359 leaf = finalized_root,
360360 branch = update.finality_branch,
361- depth = floorlog2(FINALIZED_ROOT_INDEX ),
362- index = get_subtree_index(FINALIZED_ROOT_INDEX ),
361+ depth = floorlog2(FINALIZED_ROOT_GINDEX ),
362+ index = get_subtree_index(FINALIZED_ROOT_GINDEX ),
363363 root = update.attested_header.beacon.state_root,
364364 )
365365
@@ -373,8 +373,8 @@ def validate_light_client_update(store: LightClientStore,
373373 assert is_valid_merkle_branch(
374374 leaf = hash_tree_root(update.next_sync_committee),
375375 branch = update.next_sync_committee_branch,
376- depth = floorlog2(NEXT_SYNC_COMMITTEE_INDEX ),
377- index = get_subtree_index(NEXT_SYNC_COMMITTEE_INDEX ),
376+ depth = floorlog2(NEXT_SYNC_COMMITTEE_GINDEX ),
377+ index = get_subtree_index(NEXT_SYNC_COMMITTEE_GINDEX ),
378378 root = update.attested_header.beacon.state_root,
379379 )
380380
@@ -493,7 +493,7 @@ def process_light_client_finality_update(store: LightClientStore,
493493 update = LightClientUpdate(
494494 attested_header = finality_update.attested_header,
495495 next_sync_committee = SyncCommittee(),
496- next_sync_committee_branch = [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_INDEX ))],
496+ next_sync_committee_branch = [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_GINDEX ))],
497497 finalized_header = finality_update.finalized_header,
498498 finality_branch = finality_update.finality_branch,
499499 sync_aggregate = finality_update.sync_aggregate,
@@ -512,9 +512,9 @@ def process_light_client_optimistic_update(store: LightClientStore,
512512 update = LightClientUpdate(
513513 attested_header = optimistic_update.attested_header,
514514 next_sync_committee = SyncCommittee(),
515- next_sync_committee_branch = [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_INDEX ))],
515+ next_sync_committee_branch = [Bytes32() for _ in range (floorlog2(NEXT_SYNC_COMMITTEE_GINDEX ))],
516516 finalized_header = LightClientHeader(),
517- finality_branch = [Bytes32() for _ in range (floorlog2(FINALIZED_ROOT_INDEX ))],
517+ finality_branch = [Bytes32() for _ in range (floorlog2(FINALIZED_ROOT_GINDEX ))],
518518 sync_aggregate = optimistic_update.sync_aggregate,
519519 signature_slot = optimistic_update.signature_slot,
520520 )
0 commit comments