Use bellatrix in upgrade_x_to_capella helpers

This commit is contained in:
Etan Kissling
2023-01-13 20:11:05 +01:00
parent a580f82c7d
commit 514d4431ca

View File

@@ -22,14 +22,14 @@ This document describes how to upgrade existing light client objects based on th
A Capella `LightClientStore` can still process earlier light client data. In order to do so, that pre-Capella data needs to be locally upgraded to Capella before processing.
```python
def upgrade_lc_header_to_capella(pre: altair.LightClientHeader) -> LightClientHeader:
def upgrade_lc_header_to_capella(pre: bellatrix.LightClientHeader) -> LightClientHeader:
return LightClientHeader(
beacon=pre.beacon,
)
```
```python
def upgrade_lc_bootstrap_to_capella(pre: altair.LightClientBootstrap) -> LightClientBootstrap:
def upgrade_lc_bootstrap_to_capella(pre: bellatrix.LightClientBootstrap) -> LightClientBootstrap:
return LightClientBootstrap(
header=upgrade_lc_header_to_capella(pre.header),
current_sync_committee=pre.current_sync_committee,
@@ -38,7 +38,7 @@ def upgrade_lc_bootstrap_to_capella(pre: altair.LightClientBootstrap) -> LightCl
```
```python
def upgrade_lc_update_to_capella(pre: altair.LightClientUpdate) -> LightClientUpdate:
def upgrade_lc_update_to_capella(pre: bellatrix.LightClientUpdate) -> LightClientUpdate:
return LightClientUpdate(
attested_header=upgrade_lc_header_to_capella(pre.attested_header),
next_sync_committee=pre.next_sync_committee,
@@ -51,7 +51,7 @@ def upgrade_lc_update_to_capella(pre: altair.LightClientUpdate) -> LightClientUp
```
```python
def upgrade_lc_finality_update_to_capella(pre: altair.LightClientFinalityUpdate) -> LightClientFinalityUpdate:
def upgrade_lc_finality_update_to_capella(pre: bellatrix.LightClientFinalityUpdate) -> LightClientFinalityUpdate:
return LightClientFinalityUpdate(
attested_header=upgrade_lc_header_to_capella(pre.attested_header),
finalized_header=upgrade_lc_header_to_capella(pre.finalized_header),
@@ -62,7 +62,7 @@ def upgrade_lc_finality_update_to_capella(pre: altair.LightClientFinalityUpdate)
```
```python
def upgrade_lc_optimistic_update_to_capella(pre: altair.LightClientOptimisticUpdate) -> LightClientOptimisticUpdate:
def upgrade_lc_optimistic_update_to_capella(pre: bellatrix.LightClientOptimisticUpdate) -> LightClientOptimisticUpdate:
return LightClientOptimisticUpdate(
attested_header=upgrade_lc_header_to_capella(pre.attested_header),
sync_aggregate=pre.sync_aggregate,
@@ -75,7 +75,7 @@ def upgrade_lc_optimistic_update_to_capella(pre: altair.LightClientOptimisticUpd
Existing `LightClientStore` objects based on Altair MUST be upgraded to Capella before Capella based light client data can be processed. The `LightClientStore` upgrade MAY be performed before `CAPELLA_FORK_EPOCH`.
```python
def upgrade_lc_store_to_capella(pre: altair.LightClientStore) -> LightClientStore:
def upgrade_lc_store_to_capella(pre: bellatrix.LightClientStore) -> LightClientStore:
if pre.best_valid_update is None:
best_valid_update = None
else: