rename EIP4844 > Deneb for light client (#4713)

* rename `EIP4844` > `Deneb` for light client

* regenerate test logs
This commit is contained in:
Etan Kissling 2023-03-10 18:16:26 +01:00 committed by GitHub
parent 8fd3723e82
commit 57b2151f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 126 additions and 128 deletions

View File

@ -2034,7 +2034,7 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ Testing Withdrawal OK
```
OK: 49/49 Fail: 0/49 Skip: 0/49
## EF - EIP4844 - Unittests - Light client - Sync protocol [Preset: mainnet]
## EF - Deneb - Unittests - Light client - Sync protocol [Preset: mainnet]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK

View File

@ -2210,7 +2210,7 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ Testing Withdrawal OK
```
OK: 49/49 Fail: 0/49 Skip: 0/49
## EF - EIP4844 - Unittests - Light client - Sync protocol [Preset: minimal]
## EF - Deneb - Unittests - Light client - Sync protocol [Preset: minimal]
```diff
+ process_light_client_update_finality_updated OK
+ process_light_client_update_timeout OK

View File

@ -531,10 +531,9 @@ proc new*(T: type BeaconChainDB,
"lc_capella_headers"
else:
"",
eip4844Headers:
denebHeaders:
if cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:
# TODO: We should probably rename this to match the official fork name
"lc_eip4844_headers"
"lc_deneb_headers"
else:
"",
altairCurrentBranches: "lc_altair_current_branches",
@ -542,7 +541,7 @@ proc new*(T: type BeaconChainDB,
legacyAltairBestUpdates: "lc_altair_best_updates",
bestUpdates: "lc_best_updates",
sealedPeriods: "lc_sealed_periods")).expectDb()
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
var blobs : KvStoreRef
if cfg.DENEB_FORK_EPOCH != FAR_FUTURE_EPOCH:

View File

@ -27,14 +27,14 @@ logScope: topics = "lcdata"
# Mainnet data size (all columns):
# - Altair: ~38 KB per `SyncCommitteePeriod` (~1.0 MB per month)
# - Capella: ~222 KB per `SyncCommitteePeriod` (~6.1 MB per month)
# - EIP4844: ~230 KB per `SyncCommitteePeriod` (~6.3 MB per month)
# - Deneb: ~230 KB per `SyncCommitteePeriod` (~6.3 MB per month)
#
# `lc_altair_current_branches` holds merkle proofs needed to
# construct `LightClientBootstrap` objects.
# SSZ because this data does not compress well, and because this data
# needs to be bundled together with other data to fulfill requests.
# Mainnet data size (all columns):
# - Altair ... EIP4844: ~42 KB per `SyncCommitteePeriod` (~1.1 MB per month)
# - Altair ... Deneb: ~42 KB per `SyncCommitteePeriod` (~1.1 MB per month)
#
# `lc_altair_sync_committees` contains a copy of finalized sync committees.
# They are initially populated from the main DAG (usually a fast state access).
@ -42,7 +42,7 @@ logScope: topics = "lcdata"
# SSZ because this data does not compress well, and because this data
# needs to be bundled together with other data to fulfill requests.
# Mainnet data size (all columns):
# - Altair ... EIP4844: ~32 KB per `SyncCommitteePeriod` (~0.9 MB per month)
# - Altair ... Deneb: ~32 KB per `SyncCommitteePeriod` (~0.9 MB per month)
#
# `lc_best_updates` holds full `LightClientUpdate` objects in SSZ form.
# These objects are frequently queried in bulk, but there is only one per
@ -58,7 +58,7 @@ logScope: topics = "lcdata"
# Mainnet data size (all columns):
# - Altair: ~33 KB per `SyncCommitteePeriod` (~0.9 MB per month)
# - Capella: ~34 KB per `SyncCommitteePeriod` (~0.9 MB per month)
# - EIP4844: ~34 KB per `SyncCommitteePeriod` (~0.9 MB per month)
# - Deneb: ~34 KB per `SyncCommitteePeriod` (~0.9 MB per month)
#
# `lc_sealed_periods` contains the sync committee periods for which
# full light client data was imported. Data for these periods may no longer
@ -675,7 +675,7 @@ func keepPeriodsFrom*(
type LightClientDataDBNames* = object
altairHeaders*: string
capellaHeaders*: string
eip4844Headers*: string
denebHeaders*: string
altairCurrentBranches*: string
altairSyncCommittees*: string
legacyAltairBestUpdates*: string
@ -685,7 +685,7 @@ type LightClientDataDBNames* = object
proc initLightClientDataDB*(
backend: SqStoreRef,
names: LightClientDataDBNames): KvResult[LightClientDataDB] =
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
let
headers = [
# LightClientDataFork.None
@ -696,9 +696,9 @@ proc initLightClientDataDB*(
# LightClientDataFork.Capella
? backend.initHeadersStore(
names.capellaHeaders, "capella.LightClientHeader"),
# LightClientDataFork.EIP4844
# LightClientDataFork.Deneb
? backend.initHeadersStore(
names.eip4844Headers, "eip4844.LightClientHeader")
names.denebHeaders, "deneb.LightClientHeader")
]
currentBranches =
? backend.initCurrentBranchesStore(names.altairCurrentBranches)

View File

@ -347,7 +347,7 @@ proc installMessageValidators*(
withLcDataFork(lcDataForkAtStateFork(stateFork)):
when lcDataFork > LightClientDataFork.None:
let
contextFork = stateFork # Copy to avoid capturing `EIP4844` (Nim 1.6)
contextFork = stateFork # Copy to avoid capturing `Deneb` (Nim 1.6)
digest = forkDigests[].atStateFork(contextFork)
lightClient.network.addValidator(

View File

@ -111,7 +111,6 @@ type
kzgs*: KZGCommitments
blobs*: Blobs
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.2/specs/eip4844/beacon-chain.md#executionpayloadheader
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/beacon-chain.md#executionpayloadheader
ExecutionPayloadHeader* = object
parent_hash*: Eth2Digest
@ -552,7 +551,7 @@ func shortLog*(v: ExecutionPayload): auto =
num_withdrawals: len(v.withdrawals)
)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#get_lc_execution_root
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/sync-protocol.md#modified-get_lc_execution_root
func get_lc_execution_root*(
header: LightClientHeader, cfg: RuntimeConfig): Eth2Digest =
let epoch = header.beacon.slot.epoch
@ -581,7 +580,7 @@ func get_lc_execution_root*(
ZERO_HASH
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/sync-protocol.md#is_valid_light_client_header
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/sync-protocol.md#modified-is_valid_light_client_header
func is_valid_light_client_header*(
header: LightClientHeader, cfg: RuntimeConfig): bool =
let epoch = header.beacon.slot.epoch
@ -602,8 +601,8 @@ func is_valid_light_client_header*(
get_subtree_index(EXECUTION_PAYLOAD_INDEX),
header.beacon.body_root)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_header_to_eip4844
func upgrade_lc_header_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
func upgrade_lc_header_to_deneb*(
pre: capella.LightClientHeader): LightClientHeader =
LightClientHeader(
beacon: pre.beacon,
@ -625,41 +624,41 @@ func upgrade_lc_header_to_eip4844*(
withdrawals_root: pre.execution.withdrawals_root),
execution_branch: pre.execution_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_bootstrap_to_eip4844
func upgrade_lc_bootstrap_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
func upgrade_lc_bootstrap_to_deneb*(
pre: capella.LightClientBootstrap): LightClientBootstrap =
LightClientBootstrap(
header: upgrade_lc_header_to_eip4844(pre.header),
header: upgrade_lc_header_to_deneb(pre.header),
current_sync_committee: pre.current_sync_committee,
current_sync_committee_branch: pre.current_sync_committee_branch)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_update_to_eip4844
func upgrade_lc_update_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
func upgrade_lc_update_to_deneb*(
pre: capella.LightClientUpdate): LightClientUpdate =
LightClientUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
attested_header: upgrade_lc_header_to_deneb(pre.attested_header),
next_sync_committee: pre.next_sync_committee,
next_sync_committee_branch: pre.next_sync_committee_branch,
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finalized_header: upgrade_lc_header_to_deneb(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_finality_update_to_eip4844
func upgrade_lc_finality_update_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
func upgrade_lc_finality_update_to_deneb*(
pre: capella.LightClientFinalityUpdate): LightClientFinalityUpdate =
LightClientFinalityUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
attested_header: upgrade_lc_header_to_deneb(pre.attested_header),
finalized_header: upgrade_lc_header_to_deneb(pre.finalized_header),
finality_branch: pre.finality_branch,
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_optimistic_update_to_eip4844
func upgrade_lc_optimistic_update_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-light-client-data
func upgrade_lc_optimistic_update_to_deneb*(
pre: capella.LightClientOptimisticUpdate): LightClientOptimisticUpdate =
LightClientOptimisticUpdate(
attested_header: upgrade_lc_header_to_eip4844(pre.attested_header),
attested_header: upgrade_lc_header_to_deneb(pre.attested_header),
sync_aggregate: pre.sync_aggregate,
signature_slot: pre.signature_slot)
@ -706,20 +705,20 @@ chronicles.formatIt LightClientUpdate: shortLog(it)
chronicles.formatIt LightClientFinalityUpdate: shortLog(it)
chronicles.formatIt LightClientOptimisticUpdate: shortLog(it)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/fork.md#upgrade_lc_store_to_eip4844
func upgrade_lc_store_to_eip4844*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/fork.md#upgrading-the-store
func upgrade_lc_store_to_deneb*(
pre: capella.LightClientStore): LightClientStore =
let best_valid_update =
if pre.best_valid_update.isNone:
Opt.none(LightClientUpdate)
else:
Opt.some upgrade_lc_update_to_eip4844(pre.best_valid_update.get)
Opt.some upgrade_lc_update_to_deneb(pre.best_valid_update.get)
LightClientStore(
finalized_header: upgrade_lc_header_to_eip4844(pre.finalized_header),
finalized_header: upgrade_lc_header_to_deneb(pre.finalized_header),
current_sync_committee: pre.current_sync_committee,
next_sync_committee: pre.next_sync_committee,
best_valid_update: best_valid_update,
optimistic_header: upgrade_lc_header_to_eip4844(pre.optimistic_header),
optimistic_header: upgrade_lc_header_to_deneb(pre.optimistic_header),
previous_max_active_participants: pre.previous_max_active_participants,
current_max_active_participants: pre.current_max_active_participants)

View File

@ -904,9 +904,9 @@ func forkVersion*(cfg: RuntimeConfig, consensusFork: ConsensusFork): Version =
of ConsensusFork.Deneb: cfg.DENEB_FORK_VERSION
func lcDataForkAtStateFork*(stateFork: ConsensusFork): LightClientDataFork =
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
if stateFork >= ConsensusFork.Deneb:
LightClientDataFork.EIP4844
LightClientDataFork.Deneb
elif stateFork >= ConsensusFork.Capella:
LightClientDataFork.Capella
elif stateFork >= ConsensusFork.Altair:

View File

@ -16,7 +16,7 @@ type
None = 0, # only use non-0 in DB to detect accidentally uninitialized data
Altair = 1,
Capella = 2,
EIP4844 = 3
Deneb = 3
ForkyLightClientHeader* =
altair.LightClientHeader |
@ -72,8 +72,8 @@ type
altairData*: altair.LightClientHeader
of LightClientDataFork.Capella:
capellaData*: capella.LightClientHeader
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientHeader
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientHeader
ForkedLightClientBootstrap* = object
case kind*: LightClientDataFork
@ -83,8 +83,8 @@ type
altairData*: altair.LightClientBootstrap
of LightClientDataFork.Capella:
capellaData*: capella.LightClientBootstrap
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientBootstrap
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientBootstrap
ForkedLightClientUpdate* = object
case kind*: LightClientDataFork
@ -94,8 +94,8 @@ type
altairData*: altair.LightClientUpdate
of LightClientDataFork.Capella:
capellaData*: capella.LightClientUpdate
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientUpdate
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientUpdate
ForkedLightClientFinalityUpdate* = object
case kind*: LightClientDataFork
@ -105,8 +105,8 @@ type
altairData*: altair.LightClientFinalityUpdate
of LightClientDataFork.Capella:
capellaData*: capella.LightClientFinalityUpdate
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientFinalityUpdate
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientFinalityUpdate
ForkedLightClientOptimisticUpdate* = object
case kind*: LightClientDataFork
@ -116,8 +116,8 @@ type
altairData*: altair.LightClientOptimisticUpdate
of LightClientDataFork.Capella:
capellaData*: capella.LightClientOptimisticUpdate
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientOptimisticUpdate
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientOptimisticUpdate
SomeForkedLightClientUpdateWithSyncCommittee* =
ForkedLightClientUpdate
@ -143,14 +143,14 @@ type
altairData*: altair.LightClientStore
of LightClientDataFork.Capella:
capellaData*: capella.LightClientStore
of LightClientDataFork.EIP4844:
eip4844Data*: deneb.LightClientStore
of LightClientDataFork.Deneb:
denebData*: deneb.LightClientStore
func lcDataForkAtEpoch*(
cfg: RuntimeConfig, epoch: Epoch): LightClientDataFork =
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
if epoch >= cfg.DENEB_FORK_EPOCH:
LightClientDataFork.EIP4844
LightClientDataFork.Deneb
elif epoch >= cfg.CAPELLA_FORK_EPOCH:
LightClientDataFork.Capella
elif epoch >= cfg.ALTAIR_FORK_EPOCH:
@ -186,10 +186,10 @@ template kind*(
deneb.LightClientFinalityUpdate |
deneb.LightClientOptimisticUpdate |
deneb.LightClientStore]): LightClientDataFork =
LightClientDataFork.EIP4844
LightClientDataFork.Deneb
template LightClientHeader*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientHeader]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientHeader]
@ -199,7 +199,7 @@ template LightClientHeader*(kind: static LightClientDataFork): auto =
static: raiseAssert "Unreachable"
template LightClientBootstrap*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientBootstrap]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientBootstrap]
@ -209,7 +209,7 @@ template LightClientBootstrap*(kind: static LightClientDataFork): auto =
static: raiseAssert "Unreachable"
template LightClientUpdate*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientUpdate]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientUpdate]
@ -219,7 +219,7 @@ template LightClientUpdate*(kind: static LightClientDataFork): auto =
static: raiseAssert "Unreachable"
template LightClientFinalityUpdate*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientFinalityUpdate]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientFinalityUpdate]
@ -229,7 +229,7 @@ template LightClientFinalityUpdate*(kind: static LightClientDataFork): auto =
static: raiseAssert "Unreachable"
template LightClientOptimisticUpdate*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientOptimisticUpdate]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientOptimisticUpdate]
@ -239,7 +239,7 @@ template LightClientOptimisticUpdate*(kind: static LightClientDataFork): auto =
static: raiseAssert "Unreachable"
template LightClientStore*(kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
when kind == LightClientDataFork.Deneb:
typedesc[deneb.LightClientStore]
elif kind == LightClientDataFork.Capella:
typedesc[capella.LightClientStore]
@ -298,9 +298,9 @@ template Forked*(x: typedesc[ForkyLightClientStore]): auto =
template withAll*(
x: typedesc[LightClientDataFork], body: untyped): untyped =
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
block:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
body
block:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -315,8 +315,8 @@ template withAll*(
template withLcDataFork*(
x: LightClientDataFork, body: untyped): untyped =
case x
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -331,9 +331,9 @@ template withLcDataFork*(
template withForkyHeader*(
x: ForkedLightClientHeader, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyHeader: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyHeader: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -350,9 +350,9 @@ template withForkyHeader*(
template withForkyBootstrap*(
x: ForkedLightClientBootstrap, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyBootstrap: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyBootstrap: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -369,9 +369,9 @@ template withForkyBootstrap*(
template withForkyUpdate*(
x: ForkedLightClientUpdate, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyUpdate: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyUpdate: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -388,9 +388,9 @@ template withForkyUpdate*(
template withForkyFinalityUpdate*(
x: ForkedLightClientFinalityUpdate, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyFinalityUpdate: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyFinalityUpdate: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -407,9 +407,9 @@ template withForkyFinalityUpdate*(
template withForkyOptimisticUpdate*(
x: ForkedLightClientOptimisticUpdate, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyOptimisticUpdate: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyOptimisticUpdate: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -426,9 +426,9 @@ template withForkyOptimisticUpdate*(
template withForkyObject*(
x: SomeForkedLightClientObject, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyObject: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyObject: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -445,9 +445,9 @@ template withForkyObject*(
template withForkyStore*(
x: ForkedLightClientStore, body: untyped): untyped =
case x.kind
of LightClientDataFork.EIP4844:
const lcDataFork {.inject, used.} = LightClientDataFork.EIP4844
template forkyStore: untyped {.inject, used.} = x.eip4844Data
of LightClientDataFork.Deneb:
const lcDataFork {.inject, used.} = LightClientDataFork.Deneb
template forkyStore: untyped {.inject, used.} = x.denebData
body
of LightClientDataFork.Capella:
const lcDataFork {.inject, used.} = LightClientDataFork.Capella
@ -587,8 +587,8 @@ template forky*(
SomeForkedLightClientObject |
ForkedLightClientStore,
kind: static LightClientDataFork): untyped =
when kind == LightClientDataFork.EIP4844:
x.eip4844Data
when kind == LightClientDataFork.Deneb:
x.denebData
elif kind == LightClientDataFork.Capella:
x.capellaData
elif kind == LightClientDataFork.Altair:
@ -620,15 +620,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_header_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientHeader(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_header_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_header_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migrateToDataFork*(
@ -655,15 +655,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_bootstrap_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientBootstrap(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_bootstrap_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_bootstrap_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migrateToDataFork*(
@ -690,15 +690,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_update_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientUpdate(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_update_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_update_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migrateToDataFork*(
@ -725,15 +725,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_finality_update_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientFinalityUpdate(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_finality_update_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_finality_update_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migrateToDataFork*(
@ -760,15 +760,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_optimistic_update_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientOptimisticUpdate(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_optimistic_update_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_optimistic_update_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migrateToDataFork*(
@ -795,15 +795,15 @@ func migrateToDataFork*(
capellaData: upgrade_lc_store_to_capella(
x.forky(LightClientDataFork.Altair)))
# Upgrade to EIP4844
when newKind >= LightClientDataFork.EIP4844:
# Upgrade to Deneb
when newKind >= LightClientDataFork.Deneb:
if x.kind == LightClientDataFork.Capella:
x = ForkedLightClientStore(
kind: LightClientDataFork.EIP4844,
eip4844Data: upgrade_lc_store_to_eip4844(
kind: LightClientDataFork.Deneb,
denebData: upgrade_lc_store_to_deneb(
x.forky(LightClientDataFork.Capella)))
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
static: doAssert LightClientDataFork.high == LightClientDataFork.Deneb
doAssert x.kind == newKind
func migratingToDataFork*[
@ -868,8 +868,8 @@ func toCapellaLightClientHeader(
execution_branch: blck.message.body.build_proof(
capella.EXECUTION_PAYLOAD_INDEX).get)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/eip4844/light-client/full-node.md#block_to_light_client_header
func toEIP4844LightClientHeader(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.3/specs/deneb/light-client/full-node.md#modified-block_to_light_client_header
func toDenebLightClientHeader(
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
@ -884,7 +884,7 @@ func toEIP4844LightClientHeader(
deneb.LightClientHeader(
beacon: blck.message.toBeaconBlockHeader())
func toEIP4844LightClientHeader(
func toDenebLightClientHeader(
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
): deneb.LightClientHeader =
@ -910,7 +910,7 @@ func toEIP4844LightClientHeader(
execution_branch: blck.message.body.build_proof(
capella.EXECUTION_PAYLOAD_INDEX).get)
func toEIP4844LightClientHeader(
func toDenebLightClientHeader(
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock
): deneb.LightClientHeader =
@ -945,8 +945,8 @@ func toLightClientHeader*(
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock |
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock,
kind: static LightClientDataFork): auto =
when kind == LightClientDataFork.EIP4844:
blck.toEIP4844LightClientHeader()
when kind == LightClientDataFork.Deneb:
blck.toDenebLightClientHeader()
elif kind == LightClientDataFork.Capella:
blck.toCapellaLightClientHeader()
elif kind == LightClientDataFork.Altair:

View File

@ -27,7 +27,7 @@ suite "Light client" & preset():
res.ALTAIR_FORK_EPOCH = 1.Epoch
res.BELLATRIX_FORK_EPOCH = 2.Epoch
# $capellaImplementationMissing res.CAPELLA_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 1).Epoch
# $eip4844ImplementationMissing res.DENEB_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 2).Epoch
# $denebImplementationMissing res.DENEB_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 2).Epoch
res
altairStartSlot = cfg.ALTAIR_FORK_EPOCH.start_slot

View File

@ -30,7 +30,7 @@ suite "Light client processor" & preset():
res.ALTAIR_FORK_EPOCH = 1.Epoch
res.BELLATRIX_FORK_EPOCH = 2.Epoch
# $capellaImplementationMissing res.CAPELLA_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 1).Epoch
# $eip4844ImplementationMissing res.DENEB_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 2).Epoch
# $denebImplementationMissing res.DENEB_FORK_EPOCH = (EPOCHS_PER_SYNC_COMMITTEE_PERIOD * 2).Epoch
res
const numValidators = SLOTS_PER_EPOCH