Skip to content

Electra Light Client -- Sync Protocol

Introduction

This upgrade updates light client data to include the Electra changes to the generalized indices of BeaconState. It extends the Deneb Light Client specifications. The fork document explains how to upgrade existing Deneb based deployments to Electra.

Additional documents describe the impact of the upgrade on certain roles:

Types

Modified CurrentSyncCommitteeBranch

1
2
3
4
5
# [Modified in Electra]
class CurrentSyncCommitteeBranch(Vector[Bytes32, floorlog2(CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA)]):
    """
    A Merkle branch proving ``current_sync_committee`` within ``BeaconState``.
    """

Modified FinalityBranch

1
2
3
4
5
6
# [Modified in Electra]
class FinalityBranch(Vector[Bytes32, floorlog2(FINALIZED_ROOT_GINDEX_ELECTRA)]):
    """
    A Merkle branch proving ``finalized_checkpoint.root`` within
    ``BeaconState``.
    """

Modified NextSyncCommitteeBranch

1
2
3
4
5
# [Modified in Electra]
class NextSyncCommitteeBranch(Vector[Bytes32, floorlog2(NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA)]):
    """
    A Merkle branch proving ``next_sync_committee`` within ``BeaconState``.
    """

Constants

Frozen constants

Existing GeneralizedIndex constants are frozen at their Altair values.

Name Value
FINALIZED_ROOT_GINDEX get_generalized_index(altair.BeaconState, 'finalized_checkpoint', 'root') (= 105)
CURRENT_SYNC_COMMITTEE_GINDEX get_generalized_index(altair.BeaconState, 'current_sync_committee') (= 54)
NEXT_SYNC_COMMITTEE_GINDEX get_generalized_index(altair.BeaconState, 'next_sync_committee') (= 55)

New constants

Name Value
FINALIZED_ROOT_GINDEX_ELECTRA get_generalized_index(BeaconState, 'finalized_checkpoint', 'root') (= 169)
CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA get_generalized_index(BeaconState, 'current_sync_committee') (= 86)
NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA get_generalized_index(BeaconState, 'next_sync_committee') (= 87)

Helpers

Modified finalized_root_gindex_at_slot

1
2
3
4
5
6
7
def finalized_root_gindex_at_slot(slot: Slot) -> GeneralizedIndex:
    epoch = compute_epoch_at_slot(slot)

    # [Modified in Electra]
    if epoch >= ELECTRA_FORK_EPOCH:
        return FINALIZED_ROOT_GINDEX_ELECTRA
    return FINALIZED_ROOT_GINDEX

Modified current_sync_committee_gindex_at_slot

1
2
3
4
5
6
7
def current_sync_committee_gindex_at_slot(slot: Slot) -> GeneralizedIndex:
    epoch = compute_epoch_at_slot(slot)

    # [Modified in Electra]
    if epoch >= ELECTRA_FORK_EPOCH:
        return CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA
    return CURRENT_SYNC_COMMITTEE_GINDEX

Modified next_sync_committee_gindex_at_slot

1
2
3
4
5
6
7
def next_sync_committee_gindex_at_slot(slot: Slot) -> GeneralizedIndex:
    epoch = compute_epoch_at_slot(slot)

    # [Modified in Electra]
    if epoch >= ELECTRA_FORK_EPOCH:
        return NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA
    return NEXT_SYNC_COMMITTEE_GINDEX