`BeaconStateFork/BeaconBlockFork` -> `ConsensusFork` (#4560)

* `BeaconStateFork/BeaconBlockFork` -> `ConsensusFork`

* revert unrelated change

* revert unrelated changes

* update test summaries
This commit is contained in:
tersec 2023-01-28 19:53:41 +00:00 committed by GitHub
parent 67e2f854d5
commit 0fb726c420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 1173 additions and 1179 deletions

View File

@ -508,6 +508,11 @@ OK: 4/4 Fail: 0/4 Skip: 0/4
+ [SyncQueue] hasEndGap() test OK
```
OK: 23/23 Fail: 0/23 Skip: 0/23
## Type helpers
```diff
+ BeaconBlockType OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## Validator change pool testing suite
```diff
+ addValidatorChangeMessage/getAttesterSlashingMessage OK
@ -623,4 +628,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 9/9 Fail: 0/9 Skip: 0/9
---TOTAL---
OK: 348/353 Fail: 0/353 Skip: 5/353
OK: 349/354 Fail: 0/354 Skip: 5/354

View File

@ -111,13 +111,13 @@ type
checkpoint*: proc() {.gcsafe, raises: [Defect].}
keyValues: KvStoreRef # Random stuff using DbKeyKind - suitable for small values mainly!
blocks: array[BeaconBlockFork, KvStoreRef] # BlockRoot -> TrustedSignedBeaconBlock
blocks: array[ConsensusFork, KvStoreRef] # BlockRoot -> TrustedSignedBeaconBlock
blobs: KvStoreRef # (BlockRoot -> BlobsSidecar)
stateRoots: KvStoreRef # (Slot, BlockRoot) -> StateRoot
statesNoVal: array[BeaconStateFork, KvStoreRef] # StateRoot -> ForkBeaconStateNoImmutableValidators
statesNoVal: array[ConsensusFork, KvStoreRef] # StateRoot -> ForkBeaconStateNoImmutableValidators
stateDiffs: KvStoreRef ##\
## StateRoot -> BeaconStateDiff
@ -851,7 +851,7 @@ proc putState*(db: BeaconChainDB, state: ForkyHashedBeaconState) =
# For testing rollback
proc putCorruptState*(
db: BeaconChainDB, fork: static BeaconStateFork, key: Eth2Digest) =
db: BeaconChainDB, fork: static ConsensusFork, key: Eth2Digest) =
db.statesNoVal[fork].putSnappySSZ(key.data, Validator())
func stateRootKey(root: Eth2Digest, slot: Slot): array[40, byte] =
@ -869,20 +869,20 @@ proc putStateRoot*(db: BeaconChainDB, root: Eth2Digest, slot: Slot,
proc putStateDiff*(db: BeaconChainDB, root: Eth2Digest, value: BeaconStateDiff) =
db.stateDiffs.putSnappySSZ(root.data, value)
proc delBlock*(db: BeaconChainDB, fork: BeaconBlockFork, key: Eth2Digest): bool =
proc delBlock*(db: BeaconChainDB, fork: ConsensusFork, key: Eth2Digest): bool =
var deleted = false
db.withManyWrites:
discard db.summaries.del(key.data).expectDb()
deleted = db.blocks[fork].del(key.data).expectDb()
deleted
proc delState*(db: BeaconChainDB, fork: BeaconStateFork, key: Eth2Digest) =
proc delState*(db: BeaconChainDB, fork: ConsensusFork, key: Eth2Digest) =
discard db.statesNoVal[fork].del(key.data).expectDb()
proc clearBlocks*(db: BeaconChainDB, fork: BeaconBlockFork) =
proc clearBlocks*(db: BeaconChainDB, fork: ConsensusFork) =
discard db.blocks[fork].clear().expectDb()
proc clearStates*(db: BeaconChainDB, fork: BeaconStateFork) =
proc clearStates*(db: BeaconChainDB, fork: ConsensusFork) =
discard db.statesNoVal[fork].clear().expectDb()
proc delKeyValue*(db: BeaconChainDB, key: array[1, byte]) =
@ -1021,7 +1021,7 @@ proc getBlockSSZ*(
func decode(data: openArray[byte]) =
try: dataPtr[] = snappy.decode(data, maxDecompressedDbRecordSize)
except CatchableError: success = false
db.blocks[BeaconBlockFork.Phase0].get(key.data, decode).expectDb() and success or
db.blocks[ConsensusFork.Phase0].get(key.data, decode).expectDb() and success or
db.v0.getPhase0BlockSSZ(key, data)
proc getBlockSSZ*(
@ -1047,17 +1047,17 @@ proc getBlockSSZ*[
proc getBlockSSZ*(
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
fork: BeaconBlockFork): bool =
fork: ConsensusFork): bool =
case fork
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
getBlockSSZ(db, key, data, phase0.TrustedSignedBeaconBlock)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
getBlockSSZ(db, key, data, altair.TrustedSignedBeaconBlock)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
getBlockSSZ(db, key, data, bellatrix.TrustedSignedBeaconBlock)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
getBlockSSZ(db, key, data, capella.TrustedSignedBeaconBlock)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
getBlockSSZ(db, key, data, eip4844.TrustedSignedBeaconBlock)
@ -1077,7 +1077,7 @@ proc getBlockSZ*(
try: dataPtr[] = snappy.encodeFramed(
snappy.decode(data, maxDecompressedDbRecordSize))
except CatchableError: success = false
db.blocks[BeaconBlockFork.Phase0].get(key.data, decode).expectDb() and success or
db.blocks[ConsensusFork.Phase0].get(key.data, decode).expectDb() and success or
db.v0.getPhase0BlockSZ(key, data)
proc getBlockSZ*(
@ -1102,17 +1102,17 @@ proc getBlockSZ*[
proc getBlockSZ*(
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
fork: BeaconBlockFork): bool =
fork: ConsensusFork): bool =
case fork
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
getBlockSZ(db, key, data, phase0.TrustedSignedBeaconBlock)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
getBlockSZ(db, key, data, altair.TrustedSignedBeaconBlock)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
getBlockSZ(db, key, data, bellatrix.TrustedSignedBeaconBlock)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
getBlockSZ(db, key, data, capella.TrustedSignedBeaconBlock)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
getBlockSZ(db, key, data, eip4844.TrustedSignedBeaconBlock)
proc getStateOnlyMutableValidators(
@ -1301,7 +1301,7 @@ proc getState*(
rollback)
proc getState*(
db: BeaconChainDB, fork: BeaconStateFork, state_root: Eth2Digest,
db: BeaconChainDB, fork: ConsensusFork, state_root: Eth2Digest,
state: var ForkedHashedBeaconState, rollback: RollbackProc): bool =
if state.kind != fork:
# Avoid temporary (!)
@ -1368,13 +1368,13 @@ proc containsBlock*[
db: BeaconChainDB, key: Eth2Digest, T: type X): bool =
db.blocks[X.toFork].contains(key.data).expectDb()
proc containsBlock*(db: BeaconChainDB, key: Eth2Digest, fork: BeaconBlockFork): bool =
proc containsBlock*(db: BeaconChainDB, key: Eth2Digest, fork: ConsensusFork): bool =
case fork
of BeaconBlockFork.Phase0: containsBlock(db, key, phase0.TrustedSignedBeaconBlock)
of ConsensusFork.Phase0: containsBlock(db, key, phase0.TrustedSignedBeaconBlock)
else: db.blocks[fork].contains(key.data).expectDb()
proc containsBlock*(db: BeaconChainDB, key: Eth2Digest): bool =
for fork in countdown(BeaconBlockFork.high, BeaconBlockFork.low):
for fork in countdown(ConsensusFork.high, ConsensusFork.low):
if db.containsBlock(key, fork): return true
false
@ -1385,14 +1385,14 @@ proc containsState*(db: BeaconChainDBV0, key: Eth2Digest): bool =
db.backend.contains(sk).expectDb() or
db.backend.contains(subkey(phase0.BeaconState, key)).expectDb()
proc containsState*(db: BeaconChainDB, fork: BeaconStateFork, key: Eth2Digest,
proc containsState*(db: BeaconChainDB, fork: ConsensusFork, key: Eth2Digest,
legacy: bool = true): bool =
if db.statesNoVal[fork].contains(key.data).expectDb(): return true
(legacy and fork == BeaconStateFork.Phase0 and db.v0.containsState(key))
(legacy and fork == ConsensusFork.Phase0 and db.v0.containsState(key))
proc containsState*(db: BeaconChainDB, key: Eth2Digest, legacy: bool = true): bool =
for fork in countdown(BeaconStateFork.high, BeaconStateFork.low):
for fork in countdown(ConsensusFork.high, ConsensusFork.low):
if db.statesNoVal[fork].contains(key.data).expectDb(): return true
(legacy and db.v0.containsState(key))
@ -1505,7 +1505,7 @@ iterator getAncestorSummaries*(db: BeaconChainDB, root: Eth2Digest):
# Backwards compat for reading old databases, or those that for whatever
# reason lost a summary along the way..
static: doAssert BeaconBlockFork.high == BeaconBlockFork.EIP4844
static: doAssert ConsensusFork.high == ConsensusFork.EIP4844
while true:
if db.v0.backend.getSnappySSZ(
subkey(BeaconBlockSummary, res.root), res.summary) == GetResult.found:

View File

@ -47,9 +47,9 @@ proc initLightClient*(
dag = node.dag.head.bid,
wallSlot = node.currentSlot
withBlck(signedBlock):
when stateFork == BeaconStateFork.EIP4844:
when stateFork == ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": beacon_node_light_client.nim:initLightClient"
elif stateFork >= BeaconStateFork.Bellatrix:
elif stateFork >= ConsensusFork.Bellatrix:
if blck.message.is_execution_block:
template payload(): auto = blck.message.body.execution_payload

View File

@ -143,7 +143,7 @@ proc init*(T: type AttestationPool, dag: ChainDAGRef,
var unrealized: FinalityCheckpoints
if enableTestFeatures in dag.updateFlags and blckRef == dag.head:
unrealized = withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
forkyState.data.compute_unrealized_finality()
else:
var cache: StateCache

View File

@ -104,8 +104,8 @@ proc addResolvedHeadBlock(
var unrealized: FinalityCheckpoints
if enableTestFeatures in dag.updateFlags:
unrealized = withState(state):
static: doAssert high(BeaconStateFork) == BeaconStateFork.EIP4844
when stateFork >= BeaconStateFork.Altair:
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
when stateFork >= ConsensusFork.Altair:
forkyState.data.compute_unrealized_finality()
else:
forkyState.data.compute_unrealized_finality(cache)

View File

@ -142,7 +142,7 @@ func validatorKey*(
template is_merge_transition_complete*(
stateParam: ForkedHashedBeaconState): bool =
withState(stateParam):
when stateFork >= BeaconStateFork.Bellatrix:
when stateFork >= ConsensusFork.Bellatrix:
is_merge_transition_complete(forkyState.data)
else:
false
@ -209,7 +209,7 @@ proc getForkedBlock*(db: BeaconChainDB, root: Eth2Digest):
Opt[ForkedTrustedSignedBeaconBlock] =
# When we only have a digest, we don't know which fork it's from so we try
# them one by one - this should be used sparingly
static: doAssert high(BeaconBlockFork) == BeaconBlockFork.EIP4844
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
if (let blck = db.getBlock(root, eip4844.TrustedSignedBeaconBlock);
blck.isSome()):
ok(ForkedTrustedSignedBeaconBlock.init(blck.get()))
@ -731,7 +731,7 @@ proc currentSyncCommitteeForPeriod*(
bsi = ? dag.getBlockIdAtSlot(syncCommitteeSlot)
dag.withUpdatedState(tmpState, bsi) do:
withState(updatedState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
ok forkyState.data.current_sync_committee
else: err()
do: err()
@ -857,31 +857,31 @@ proc applyBlock(
loadStateCache(dag, cache, bid, getStateField(state, slot).epoch)
case dag.cfg.blockForkAtEpoch(bid.slot.epoch)
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let data = getBlock(dag, bid, phase0.TrustedSignedBeaconBlock).valueOr:
return err("Block load failed")
state_transition(
dag.cfg, state, data, cache, info,
dag.updateFlags + {slotProcessed}, noRollback)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let data = getBlock(dag, bid, altair.TrustedSignedBeaconBlock).valueOr:
return err("Block load failed")
state_transition(
dag.cfg, state, data, cache, info,
dag.updateFlags + {slotProcessed}, noRollback)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let data = getBlock(dag, bid, bellatrix.TrustedSignedBeaconBlock).valueOr:
return err("Block load failed")
state_transition(
dag.cfg, state, data, cache, info,
dag.updateFlags + {slotProcessed}, noRollback)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
let data = getBlock(dag, bid, capella.TrustedSignedBeaconBlock).valueOr:
return err("Block load failed")
state_transition(
dag.cfg, state, data, cache, info,
dag.updateFlags + {slotProcessed}, noRollback)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
let data = getBlock(dag, bid, eip4844.TrustedSignedBeaconBlock).valueOr:
return err("Block load failed")
state_transition(
@ -1034,11 +1034,11 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
let
configFork = case dag.headState.kind
of BeaconStateFork.Phase0: genesisFork(cfg)
of BeaconStateFork.Altair: altairFork(cfg)
of BeaconStateFork.Bellatrix: bellatrixFork(cfg)
of BeaconStateFork.Capella: capellaFork(cfg)
of BeaconStateFork.EIP4844: eip4844Fork(cfg)
of ConsensusFork.Phase0: genesisFork(cfg)
of ConsensusFork.Altair: altairFork(cfg)
of ConsensusFork.Bellatrix: bellatrixFork(cfg)
of ConsensusFork.Capella: capellaFork(cfg)
of ConsensusFork.EIP4844: eip4844Fork(cfg)
stateFork = getStateField(dag.headState, fork)
if stateFork != configFork:
@ -1165,7 +1165,7 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
dag.updateValidatorKeys(getStateField(dag.headState, validators).asSeq())
withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
dag.headSyncCommittees = forkyState.data.get_sync_committee_cache(cache)
info "Block DAG initialized",
@ -1184,7 +1184,7 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
# If these aren't actually optimistic, the first fcU will resolve that
withState(dag.headState):
when stateFork >= BeaconStateFork.Bellatrix:
when stateFork >= ConsensusFork.Bellatrix:
template executionPayloadHeader(): auto =
forkyState().data.latest_execution_payload_header
const emptyExecutionPayloadHeader =
@ -1700,7 +1700,7 @@ iterator syncSubcommitteePairs*(
func syncCommitteeParticipants*(dag: ChainDAGRef,
slot: Slot): seq[ValidatorIndex] =
withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
let
period = sync_committee_period(slot)
curPeriod = sync_committee_period(forkyState.data.slot)
@ -1730,7 +1730,7 @@ func getSubcommitteePositions*(
subcommitteeIdx: SyncSubcommitteeIndex,
validatorIdx: uint64): seq[uint64] =
withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
let
period = sync_committee_period(slot)
curPeriod = sync_committee_period(forkyState.data.slot)
@ -1920,25 +1920,25 @@ proc pruneHistory*(dag: ChainDAGRef, startup = false) =
# pruned easily by fork)
let stateFork = dag.cfg.stateForkAtEpoch(tailSlot.epoch)
if stateFork > BeaconStateFork.Phase0:
for fork in BeaconStateFork.Phase0..<stateFork:
if stateFork > ConsensusFork.Phase0:
for fork in ConsensusFork.Phase0..<stateFork:
dag.db.clearStates(fork)
let blockFork = dag.cfg.blockForkAtEpoch(blockHorizon.epoch)
if blockFork > BeaconBlockFork.Phase0:
for fork in BeaconBlockFork.Phase0..<blockFork:
if blockFork > ConsensusFork.Phase0:
for fork in ConsensusFork.Phase0..<blockFork:
dag.db.clearBlocks(fork)
proc loadExecutionBlockRoot*(dag: ChainDAGRef, bid: BlockId): Eth2Digest =
if dag.cfg.blockForkAtEpoch(bid.slot.epoch) < BeaconBlockFork.Bellatrix:
if dag.cfg.blockForkAtEpoch(bid.slot.epoch) < ConsensusFork.Bellatrix:
return ZERO_HASH
let blockData = dag.getForkedBlock(bid).valueOr:
return ZERO_HASH
withBlck(blockData):
when stateFork >= BeaconStateFork.Bellatrix:
when stateFork >= ConsensusFork.Bellatrix:
blck.message.body.execution_payload.block_hash
else:
ZERO_HASH
@ -2012,12 +2012,12 @@ proc updateHead*(
if dag.headState.kind > lastHeadKind:
case dag.headState.kind
of BeaconStateFork.Phase0 .. BeaconStateFork.Bellatrix:
of ConsensusFork.Phase0 .. ConsensusFork.Bellatrix:
discard
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
if dag.vanityLogs.onUpgradeToCapella != nil:
dag.vanityLogs.onUpgradeToCapella()
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
discard
dag.db.putHeadBlock(newHead.root)
@ -2025,7 +2025,7 @@ proc updateHead*(
updateBeaconMetrics(dag.headState, dag.head.bid, cache)
withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
dag.headSyncCommittees = forkyState.data.get_sync_committee_cache(cache)
let

View File

@ -119,7 +119,7 @@ proc syncCommitteeRootForPeriod(
bsi = ? dag.getExistingBlockIdAtSlot(syncCommitteeSlot)
dag.withUpdatedExistingState(tmpState, bsi) do:
withState(updatedState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
ok forkyState.syncCommitteeRoot
else: raiseAssert "Unreachable"
do: err()
@ -212,7 +212,7 @@ proc initLightClientBootstrapForPeriod(
res.err()
continue
withStateAndBlck(tmpState[], bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
const lcDataFork = lcDataForkAtStateFork(stateFork)
if not dag.lcDataStore.db.hasSyncCommittee(period):
dag.lcDataStore.db.putSyncCommittee(
@ -273,7 +273,7 @@ proc initLightClientUpdateForPeriod(
break
numParticipants =
withBlck(bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
blck.message.body.sync_aggregate.num_active_participants
else: raiseAssert "Unreachable"
if numParticipants >= maxParticipants:
@ -330,7 +330,7 @@ proc initLightClientUpdateForPeriod(
finalizedEpoch = block:
dag.withUpdatedExistingState(tmpState[], attestedBid.atSlot) do:
withState(updatedState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
forkyState.data.finalized_checkpoint.epoch
else: raiseAssert "Unreachable"
do:
@ -362,7 +362,7 @@ proc initLightClientUpdateForPeriod(
dag.handleUnexpectedLightClientError(bid.slot)
return err()
withStateAndBlck(updatedState, bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
const lcDataFork = lcDataForkAtStateFork(stateFork)
update = ForkedLightClientUpdate(kind: lcDataFork)
template forkyUpdate: untyped = update.forky(lcDataFork)
@ -391,7 +391,7 @@ proc initLightClientUpdateForPeriod(
dag.handleUnexpectedLightClientError(signatureBid.slot)
return err()
withBlck(bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
withForkyUpdate(update):
when lcDataFork > LightClientDataFork.None:
forkyUpdate.sync_aggregate =
@ -684,7 +684,7 @@ proc initLightClientDataCache*(dag: ChainDAGRef) =
if dag.head.slot < dag.lcDataStore.cache.tailSlot:
return
withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
dag.cacheLightClientData(forkyState, dag.head.bid)
else: raiseAssert "Unreachable" # `tailSlot` cannot be before Altair
if dag.lcDataStore.importMode == LightClientDataImportMode.OnlyNew:
@ -735,7 +735,7 @@ proc initLightClientDataCache*(dag: ChainDAGRef) =
res.err()
continue
withStateAndBlck(dag.headState, bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
# Cache light client data (non-finalized blocks may refer to this)
if i != blocks.low:
dag.cacheLightClientData(forkyState, bid) # `dag.head` already cached
@ -824,7 +824,7 @@ proc processHeadChangeForLightClient*(dag: ChainDAGRef) =
dag.lcDataStore.db.putBestUpdate(
period, dag.lcDataStore.cache.pendingBest.getOrDefault(key))
withState(dag.headState): # Common case separate to avoid `tmpState` copy
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
let key = (headPeriod, forkyState.syncCommitteeRoot)
dag.lcDataStore.db.putBestUpdate(
headPeriod, dag.lcDataStore.cache.pendingBest.getOrDefault(key))
@ -860,7 +860,7 @@ proc processFinalizationForLightClient*(
period = bid.slot.sync_committee_period
if not dag.lcDataStore.db.hasSyncCommittee(period):
let didPutSyncCommittee = withState(dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
if period == forkyState.data.slot.sync_committee_period:
dag.lcDataStore.db.putSyncCommittee(
period, forkyState.data.current_sync_committee)
@ -878,7 +878,7 @@ proc processFinalizationForLightClient*(
break
dag.lcDataStore.db.putSyncCommittee(period, syncCommittee)
withBlck(bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
const lcDataFork = lcDataForkAtStateFork(stateFork)
dag.lcDataStore.db.putHeader(blck.toLightClientHeader(lcDataFork))
else: raiseAssert "Unreachable"
@ -947,7 +947,7 @@ proc getLightClientBootstrap(
tmpState = assignClone(dag.headState)
dag.withUpdatedExistingState(tmpState[], bsi) do:
withState(updatedState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
if not dag.lcDataStore.db.hasSyncCommittee(period):
dag.lcDataStore.db.putSyncCommittee(
period, forkyState.data.current_sync_committee)
@ -1005,7 +1005,7 @@ proc getLightClientBootstrap*(
debug "LC bootstrap unavailable: Block not found", blockRoot
return default(ForkedLightClientBootstrap)
withBlck(bdata):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
const lcDataFork = lcDataForkAtStateFork(stateFork)
let
header = blck.toLightClientHeader(lcDataFork)

View File

@ -360,7 +360,7 @@ proc runProposalForkchoiceUpdated*(
feeRecipient = self[].getFeeRecipient(
nextProposer, Opt.some(validatorIndex), nextWallSlot.epoch)
withdrawals = withState(self.dag.headState):
when stateFork >= BeaconStateFork.Capella:
when stateFork >= ConsensusFork.Capella:
Opt.some get_expected_withdrawals(forkyState.data)
else:
Opt.none(seq[Withdrawal])

View File

@ -231,7 +231,7 @@ proc getBeaconBlockValidatorChanges*(
pool.proposer_slashings, cfg, state, indices, res.proposer_slashings)
getValidatorChangeMessagesForBlock(
pool.voluntary_exits, cfg, state, indices, res.voluntary_exits)
when typeof(state).toFork() >= BeaconStateFork.Capella:
when typeof(state).toFork() >= ConsensusFork.Capella:
getValidatorChangeMessagesForBlock(
pool.bls_to_execution_changes, cfg, state, indices,
res.bls_to_execution_changes)

View File

@ -392,13 +392,13 @@ iterator getBlockIds*(
# `case` ensures we're on a fork for which the `PartialBeaconState`
# definition is consistent
case db.cfg.stateForkAtEpoch(slot.epoch)
of BeaconStateFork.Phase0, BeaconStateFork.Altair, BeaconStateFork.Bellatrix:
of ConsensusFork.Phase0, ConsensusFork.Altair, ConsensusFork.Bellatrix:
let stateSlot = (slot.era() + 1).start_slot()
if not getPartialState(db, historical_roots, stateSlot, state[]):
state = nil # No `return` in iterators
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
debugRaiseAssert $capellaImplementationMissing & ": era_db.nim: getBlockIds"
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": era_db.nim: getBlockIds"
if state == nil:

View File

@ -165,7 +165,7 @@ proc storeBackfillBlock(
# Establish blob viability before calling addbackfillBlock to avoid
# writing the block in case of blob error.
let blobsOk =
when typeof(signedBlock).toFork() >= BeaconBlockFork.EIP4844:
when typeof(signedBlock).toFork() >= ConsensusFork.EIP4844:
blobs.isSome() and not
validate_blobs_sidecar(signedBlock.message.slot,
signedBlock.root,
@ -213,7 +213,7 @@ proc expectValidForkchoiceUpdated(
(payloadExecutionStatus, _) = await eth1Monitor.runForkchoiceUpdated(
headBlockHash, safeBlockHash, finalizedBlockHash)
receivedExecutionBlockHash =
when typeof(receivedBlock).toFork >= BeaconBlockFork.Bellatrix:
when typeof(receivedBlock).toFork >= ConsensusFork.Bellatrix:
receivedBlock.message.body.execution_payload.block_hash
else:
# https://github.com/nim-lang/Nim/issues/19802
@ -364,7 +364,7 @@ proc storeBlock*(
vm = self.validatorMonitor
dag = self.consensusManager.dag
payloadStatus =
when typeof(signedBlock).toFork() >= BeaconBlockFork.Bellatrix:
when typeof(signedBlock).toFork() >= ConsensusFork.Bellatrix:
await self.consensusManager.eth1Monitor.getExecutionValidity(signedBlock)
else:
NewPayloadStatus.valid # vacuously
@ -384,7 +384,7 @@ proc storeBlock*(
# Client software MUST validate blockHash value as being equivalent to
# Keccak256(RLP(ExecutionBlockHeader))
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.1/src/engine/specification.md#specification
when typeof(signedBlock).toFork() >= BeaconBlockFork.Bellatrix:
when typeof(signedBlock).toFork() >= ConsensusFork.Bellatrix:
template payload(): auto = signedBlock.message.body.execution_payload
if payload.block_hash != payload.compute_execution_block_hash():
debug "Execution block hash validation failed",
@ -402,7 +402,7 @@ proc storeBlock*(
# Establish blob viability before calling addHeadBlock to avoid
# writing the block in case of blob error.
when typeof(signedBlock).toFork() >= BeaconBlockFork.EIP4844:
when typeof(signedBlock).toFork() >= ConsensusFork.EIP4844:
if blobs.isSome():
let res = validate_blobs_sidecar(signedBlock.message.slot,
signedBlock.root,
@ -430,7 +430,7 @@ proc storeBlock*(
trustedBlock.message.slot)
withState(dag[].clearanceState):
when stateFork >= BeaconStateFork.Altair and
when stateFork >= ConsensusFork.Altair and
Trusted isnot phase0.TrustedSignedBeaconBlock: # altair+
for i in trustedBlock.message.body.sync_aggregate.sync_committee_bits.oneIndices():
vm[].registerSyncAggregateInBlock(

View File

@ -833,7 +833,7 @@ proc validateBlsToExecutionChange*(
# [REJECT] All of the conditions within `process_bls_to_execution_change`
# pass validation.
withState(pool.dag.headState):
when stateFork < BeaconStateFork.Capella:
when stateFork < ConsensusFork.Capella:
return errIgnore("validateBlsToExecutionChange: can't validate against pre-Capella state")
else:
let res = check_bls_to_execution_change(

View File

@ -283,7 +283,7 @@ proc installMessageValidators*(
template validate[T: SomeForkyLightClientObject](
msg: T,
contextFork: BeaconStateFork,
contextFork: ConsensusFork,
validatorProcName: untyped): ValidationResult =
msg.logReceived()
@ -343,7 +343,7 @@ proc installMessageValidators*(
ValidationResult.Ignore
let forkDigests = lightClient.forkDigests
for stateFork in BeaconStateFork:
for stateFork in ConsensusFork:
withLcDataFork(lcDataForkAtStateFork(stateFork)):
when lcDataFork > LightClientDataFork.None:
let
@ -412,7 +412,7 @@ proc updateGossipStatus*(
oldGossipForks = currentGossipState - targetGossipState
for gossipFork in oldGossipForks:
if gossipFork >= BeaconStateFork.Altair:
if gossipFork >= ConsensusFork.Altair:
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
lightClient.network.unsubscribe(
getLightClientFinalityUpdateTopic(forkDigest))
@ -420,7 +420,7 @@ proc updateGossipStatus*(
getLightClientOptimisticUpdateTopic(forkDigest))
for gossipFork in newGossipForks:
if gossipFork >= BeaconStateFork.Altair:
if gossipFork >= ConsensusFork.Altair:
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
lightClient.network.subscribe(
getLightClientFinalityUpdateTopic(forkDigest),

View File

@ -705,7 +705,7 @@ func subnetLog(v: BitArray): string =
$toSeq(v.oneIndices())
func forkDigests(node: BeaconNode): auto =
let forkDigestsArray: array[BeaconStateFork, auto] = [
let forkDigestsArray: array[ConsensusFork, auto] = [
node.dag.forkDigests.phase0,
node.dag.forkDigests.altair,
node.dag.forkDigests.bellatrix,
@ -786,11 +786,11 @@ proc updateBlocksGossipStatus*(
# Individual forks added / removed
discard
template blocksTopic(fork: BeaconStateFork, forkDigest: ForkDigest): auto =
template blocksTopic(fork: ConsensusFork, forkDigest: ForkDigest): auto =
case fork
of BeaconStateFork.Phase0 .. BeaconStateFork.Capella:
of ConsensusFork.Phase0 .. ConsensusFork.Capella:
getBeaconBlocksTopic(forkDigest)
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
getBeaconBlockAndBlobsSidecarTopic(forkDigest)
let
@ -844,7 +844,7 @@ func hasSyncPubKey(node: BeaconNode, epoch: Epoch): auto =
func getCurrentSyncCommiteeSubnets(node: BeaconNode, epoch: Epoch): SyncnetBits =
let syncCommittee = withState(node.dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
forkyState.data.current_sync_committee
else:
return static(default(SyncnetBits))
@ -853,7 +853,7 @@ func getCurrentSyncCommiteeSubnets(node: BeaconNode, epoch: Epoch): SyncnetBits
func getNextSyncCommitteeSubnets(node: BeaconNode, epoch: Epoch): SyncnetBits =
let syncCommittee = withState(node.dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
forkyState.data.next_sync_committee
else:
return static(default(SyncnetBits))
@ -872,7 +872,7 @@ func getSyncCommitteeSubnets(node: BeaconNode, epoch: Epoch): SyncnetBits =
# committee period begins, in which case `epochsToNextSyncPeriod` is none.
if epochsToSyncPeriod.isNone or
node.dag.cfg.stateForkAtEpoch(epoch + epochsToSyncPeriod.get) <
BeaconStateFork.Altair:
ConsensusFork.Altair:
return subnets
subnets + node.getNextSyncCommitteeSubnets(epoch)
@ -1062,7 +1062,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
let forkDigests = node.forkDigests()
const removeMessageHandlers: array[BeaconStateFork, auto] = [
const removeMessageHandlers: array[ConsensusFork, auto] = [
removePhase0MessageHandlers,
removeAltairMessageHandlers,
removeAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest)
@ -1073,7 +1073,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
for gossipFork in oldGossipForks:
removeMessageHandlers[gossipFork](node, forkDigests[gossipFork])
const addMessageHandlers: array[BeaconStateFork, auto] = [
const addMessageHandlers: array[ConsensusFork, auto] = [
addPhase0MessageHandlers,
addAltairMessageHandlers,
addAltairMessageHandlers, # bellatrix (altair handlers, different forkDigest)

View File

@ -111,7 +111,7 @@ programMain:
opt = signedBlock.toBlockId(),
wallSlot = getBeaconTime().slotOrZero
withBlck(signedBlock):
when stateFork >= BeaconStateFork.Bellatrix:
when stateFork >= ConsensusFork.Bellatrix:
if blck.message.is_execution_block:
template payload(): auto = blck.message.body.execution_payload

View File

@ -848,11 +848,11 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonError(Http400, BlockIncorrectFork)
case currentEpochFork
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
return RestApiResponse.jsonError(Http500, $eip4844ImplementationMissing)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
return RestApiResponse.jsonError(Http500, $capellaImplementationMissing)
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
let res =
block:
let restBlock = decodeBodyJsonOrSsz(SignedBlindedBeaconBlock, body).valueOr:
@ -867,7 +867,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonError(Http202, BlockValidationError)
return RestApiResponse.jsonMsgResponse(BlockValidationSuccess)
of BeaconStateFork.Altair, BeaconStateFork.Phase0:
of ConsensusFork.Altair, ConsensusFork.Phase0:
# Pre-Bellatrix, this endpoint will accept a `SignedBeaconBlock`.
#
# This is mostly the same as /eth/v1/beacon/blocks for phase 0 and

View File

@ -222,7 +222,7 @@ func syncCommitteeParticipants*(forkedState: ForkedHashedBeaconState,
epoch: Epoch
): Result[seq[ValidatorPubKey], cstring] =
withState(forkedState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
let
epochPeriod = sync_committee_period(epoch)
curPeriod = sync_committee_period(forkyState.data.slot)
@ -265,10 +265,10 @@ proc getStateOptimistic*(node: BeaconNode,
state: ForkedHashedBeaconState): Option[bool] =
if node.currentSlot().epoch() >= node.dag.cfg.BELLATRIX_FORK_EPOCH:
case state.kind
of BeaconStateFork.Phase0, BeaconStateFork.Altair:
of ConsensusFork.Phase0, ConsensusFork.Altair:
some[bool](false)
of BeaconStateFork.Bellatrix, BeaconStateFork.Capella,
BeaconStateFork.EIP4844:
of ConsensusFork.Bellatrix, ConsensusFork.Capella,
ConsensusFork.EIP4844:
# A state is optimistic iff the block which created it is
withState(state):
# The block root which created the state at slot `n` is at slot `n-1`
@ -286,9 +286,9 @@ proc getBlockOptimistic*(node: BeaconNode,
ForkedSignedBeaconBlock): Option[bool] =
if node.currentSlot().epoch() >= node.dag.cfg.BELLATRIX_FORK_EPOCH:
case blck.kind
of BeaconBlockFork.Phase0, BeaconBlockFork.Altair:
of ConsensusFork.Phase0, ConsensusFork.Altair:
some[bool](false)
of BeaconBlockFork.Bellatrix, BeaconBlockFork.Capella, BeaconBlockFork.EIP4844:
of ConsensusFork.Bellatrix, ConsensusFork.Capella, ConsensusFork.EIP4844:
some[bool](node.dag.is_optimistic(blck.root))
else:
none[bool]()
@ -296,9 +296,9 @@ proc getBlockOptimistic*(node: BeaconNode,
proc getBlockRefOptimistic*(node: BeaconNode, blck: BlockRef): bool =
let blck = node.dag.getForkedBlock(blck.bid).get()
case blck.kind
of BeaconBlockFork.Phase0, BeaconBlockFork.Altair:
of ConsensusFork.Phase0, ConsensusFork.Altair:
false
of BeaconBlockFork.Bellatrix, BeaconBlockFork.Capella, BeaconBlockFork.EIP4844:
of ConsensusFork.Bellatrix, ConsensusFork.Capella, ConsensusFork.EIP4844:
node.dag.is_optimistic(blck.root)
const

View File

@ -249,7 +249,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
if qSyncPeriod == headSyncPeriod:
let optimistic = node.getStateOptimistic(node.dag.headState)
let res = withState(node.dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
produceResponse(indexList,
forkyState.data.current_sync_committee.pubkeys.data,
forkyState.data.validators.asSeq)
@ -259,7 +259,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
elif qSyncPeriod == (headSyncPeriod + 1):
let optimistic = node.getStateOptimistic(node.dag.headState)
let res = withState(node.dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
produceResponse(indexList,
forkyState.data.next_sync_committee.pubkeys.data,
forkyState.data.validators.asSeq)
@ -290,7 +290,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
node.withStateForBlockSlotId(bsi):
let optimistic = node.getStateOptimistic(state)
let res = withState(state):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
produceResponse(indexList,
forkyState.data.current_sync_committee.pubkeys.data,
forkyState.data.validators.asSeq)
@ -476,7 +476,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
if res.isErr():
return RestApiResponse.jsonError(Http400, res.error())
return responsePlain(ForkedBlindedBeaconBlock(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: res.get()))
else:
# Pre-Bellatrix, this endpoint will return a BeaconBlock

View File

@ -105,6 +105,7 @@ type
BeaconStateRef* = ref BeaconState not nil
NilableBeaconStateRef* = ref BeaconState
# TODO: There should be only a single generic HashedBeaconState definition
HashedBeaconState* = object
data*: BeaconState
root*: Eth2Digest # hash_tree_root(data)
@ -300,6 +301,10 @@ func shortLog*(v: SomeBeaconBlock): auto =
fee_recipient: "",
)
# TODO: There should be only a single generic HashedBeaconState definition
func initHashedBeaconState*(s: BeaconState): HashedBeaconState =
HashedBeaconState(data: s)
func shortLog*(v: SomeSignedBeaconBlock): auto =
(
blck: shortLog(v.message),

View File

@ -139,7 +139,7 @@ type
RestVersioned*[T] = object
data*: T
jsonVersion*: BeaconStateFork
jsonVersion*: ConsensusFork
sszContext*: ForkDigest
{.push raises: [].}
@ -307,7 +307,7 @@ proc jsonResponseWOpt*(t: typedesc[RestApiResponse], data: auto,
RestApiResponse.response(res, Http200, "application/json")
proc jsonResponseWVersion*(t: typedesc[RestApiResponse], data: auto,
version: BeaconStateFork): RestApiResponse =
version: ConsensusFork): RestApiResponse =
let
headers = [("eth-consensus-version", version.toString())]
res =
@ -907,7 +907,7 @@ template unrecognizedFieldWarning =
## ForkedBeaconBlock
template prepareForkedBlockReading(
reader: var JsonReader[RestJson], value: untyped,
version: var Option[BeaconBlockFork],
version: var Option[ConsensusFork],
data: var Option[JsonString],
blockTypeName: cstring) =
for fieldName {.inject.} in readObjectFields(reader):
@ -919,13 +919,13 @@ template prepareForkedBlockReading(
let vres = reader.readValue(string).toLowerAscii()
case vres
of "phase0":
version = some(BeaconBlockFork.Phase0)
version = some(ConsensusFork.Phase0)
of "altair":
version = some(BeaconBlockFork.Altair)
version = some(ConsensusFork.Altair)
of "bellatrix":
version = some(BeaconBlockFork.Bellatrix)
version = some(ConsensusFork.Bellatrix)
of "capella":
version = some(BeaconBlockFork.Bellatrix)
version = some(ConsensusFork.Bellatrix)
else:
reader.raiseUnexpectedValue("Incorrect version field value")
of "block", "block_header", "data":
@ -945,13 +945,13 @@ proc readValue*[BlockType: ForkedBeaconBlock](
reader: var JsonReader[RestJson],
value: var BlockType) {.raises: [IOError, SerializationError, Defect].} =
var
version: Option[BeaconBlockFork]
version: Option[ConsensusFork]
data: Option[JsonString]
prepareForkedBlockReading(reader, value, version, data, "ForkedBeaconBlock")
case version.get():
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -963,7 +963,7 @@ proc readValue*[BlockType: ForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect phase0 block format")
value = ForkedBeaconBlock.init(res.get()).BlockType
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -975,7 +975,7 @@ proc readValue*[BlockType: ForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect altair block format")
value = ForkedBeaconBlock.init(res.get()).BlockType
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -987,7 +987,7 @@ proc readValue*[BlockType: ForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect bellatrix block format")
value = ForkedBeaconBlock.init(res.get()).BlockType
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -999,7 +999,7 @@ proc readValue*[BlockType: ForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect capella block format")
value = ForkedBeaconBlock.init(res.get()).BlockType
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
proc readValue*[BlockType: ForkedBlindedBeaconBlock](
@ -1007,14 +1007,14 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
value: var BlockType
) {.raises: [IOError, SerializationError, Defect].} =
var
version: Option[BeaconBlockFork]
version: Option[ConsensusFork]
data: Option[JsonString]
prepareForkedBlockReading(reader, value, version, data,
"ForkedBlindedBeaconBlock")
case version.get():
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let res =
try:
RestJson.decode(string(data.get()),
@ -1024,9 +1024,9 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
except SerializationError as exc:
reader.raiseUnexpectedValue("Incorrect phase0 block format, [" &
exc.formatMsg("BlindedBlock") & "]")
value = ForkedBlindedBeaconBlock(kind: BeaconBlockFork.Phase0,
value = ForkedBlindedBeaconBlock(kind: ConsensusFork.Phase0,
phase0Data: res)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let res =
try:
RestJson.decode(string(data.get()),
@ -1036,9 +1036,9 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
except SerializationError as exc:
reader.raiseUnexpectedValue("Incorrect altair block format, [" &
exc.formatMsg("BlindedBlock") & "]")
value = ForkedBlindedBeaconBlock(kind: BeaconBlockFork.Altair,
value = ForkedBlindedBeaconBlock(kind: ConsensusFork.Altair,
altairData: res)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let res =
try:
RestJson.decode(string(data.get()),
@ -1048,26 +1048,26 @@ proc readValue*[BlockType: ForkedBlindedBeaconBlock](
except SerializationError as exc:
reader.raiseUnexpectedValue("Incorrect bellatrix block format, [" &
exc.formatMsg("BlindedBlock") & "]")
value = ForkedBlindedBeaconBlock(kind: BeaconBlockFork.Bellatrix,
value = ForkedBlindedBeaconBlock(kind: ConsensusFork.Bellatrix,
bellatrixData: res)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
reader.raiseUnexpectedValue($capellaImplementationMissing)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
proc readValue*[BlockType: Web3SignerForkedBeaconBlock](
reader: var JsonReader[RestJson],
value: var BlockType) {.raises: [IOError, SerializationError, Defect].} =
var
version: Option[BeaconBlockFork]
version: Option[ConsensusFork]
data: Option[JsonString]
prepareForkedBlockReading(reader, value, version, data,
"Web3SignerForkedBeaconBlock")
case version.get():
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1079,9 +1079,9 @@ proc readValue*[BlockType: Web3SignerForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect phase0 block format")
value = Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: res.get())
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1093,9 +1093,9 @@ proc readValue*[BlockType: Web3SignerForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect altair block format")
value = Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Altair,
kind: ConsensusFork.Altair,
altairData: res.get())
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1107,9 +1107,9 @@ proc readValue*[BlockType: Web3SignerForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect bellatrix block format")
value = Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: res.get())
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1121,9 +1121,9 @@ proc readValue*[BlockType: Web3SignerForkedBeaconBlock](
if res.isNone():
reader.raiseUnexpectedValue("Incorrect capella block format")
value = Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Capella,
kind: ConsensusFork.Capella,
capellaData: res.get())
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
proc writeValue*[
@ -1136,19 +1136,19 @@ proc writeValue*[
# https://github.com/ConsenSys/web3signer/blob/d51337e96ba5ce410222943556bed7c4856b8e57/core/src/main/java/tech/pegasys/web3signer/core/service/http/handlers/signing/eth2/json/BlockRequestDeserializer.java#L42-L58
writer.beginRecord()
case value.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
writer.writeField("version", forkIdentifier "phase0")
writer.writeField("block", value.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
writer.writeField("version", forkIdentifier "altair")
writer.writeField("block", value.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
writer.writeField("version", forkIdentifier "bellatrix")
writer.writeField("block_header", value.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
writer.writeField("version", forkIdentifier "capella")
writer.writeField("block_header", value.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
writer.writeField("version", forkIdentifier "eip4844")
writer.writeField("block_header", value.eip4844Data)
writer.endRecord()
@ -1166,19 +1166,19 @@ proc writeValue*[
writer.beginRecord()
case value.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
writer.writeField("version", forkIdentifier "phase0")
writer.writeField("data", value.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
writer.writeField("version", forkIdentifier "altair")
writer.writeField("data", value.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
writer.writeField("version", forkIdentifier "bellatrix")
writer.writeField("data", value.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
writer.writeField("version", forkIdentifier "capella")
writer.writeField("data", value.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
writer.writeField("version", forkIdentifier "eip4844")
writer.writeField("data", value.eip4844Data)
writer.endRecord()
@ -1283,16 +1283,16 @@ proc readValue*(reader: var JsonReader[RestJson],
discard $capellaImplementationMissing & ": autodetect via added field"
let bodyKind =
if execution_payload.isSome() and sync_aggregate.isSome():
BeaconBlockFork.Bellatrix
ConsensusFork.Bellatrix
elif execution_payload.isNone() and sync_aggregate.isSome():
BeaconBlockFork.Altair
ConsensusFork.Altair
else:
BeaconBlockFork.Phase0
ConsensusFork.Phase0
case bodyKind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
value = RestPublishedBeaconBlockBody(
kind: BeaconBlockFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Body: phase0.BeaconBlockBody(
randao_reveal: randao_reveal.get(),
eth1_data: eth1_data.get(),
@ -1304,9 +1304,9 @@ proc readValue*(reader: var JsonReader[RestJson],
voluntary_exits: voluntary_exits.get()
)
)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
value = RestPublishedBeaconBlockBody(
kind: BeaconBlockFork.Altair,
kind: ConsensusFork.Altair,
altairBody: altair.BeaconBlockBody(
randao_reveal: randao_reveal.get(),
eth1_data: eth1_data.get(),
@ -1319,9 +1319,9 @@ proc readValue*(reader: var JsonReader[RestJson],
sync_aggregate: sync_aggregate.get()
)
)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
value = RestPublishedBeaconBlockBody(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixBody: bellatrix.BeaconBlockBody(
randao_reveal: randao_reveal.get(),
eth1_data: eth1_data.get(),
@ -1335,9 +1335,9 @@ proc readValue*(reader: var JsonReader[RestJson],
execution_payload: execution_payload.get()
)
)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
reader.raiseUnexpectedValue($capellaImplementationMissing)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
## RestPublishedBeaconBlock
@ -1395,7 +1395,7 @@ proc readValue*(reader: var JsonReader[RestJson],
let body = blockBody.get()
value = RestPublishedBeaconBlock(
case body.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
ForkedBeaconBlock.init(
phase0.BeaconBlock(
slot: slot.get(),
@ -1405,7 +1405,7 @@ proc readValue*(reader: var JsonReader[RestJson],
body: body.phase0Body
)
)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
ForkedBeaconBlock.init(
altair.BeaconBlock(
slot: slot.get(),
@ -1415,7 +1415,7 @@ proc readValue*(reader: var JsonReader[RestJson],
body: body.altairBody
)
)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
ForkedBeaconBlock.init(
bellatrix.BeaconBlock(
slot: slot.get(),
@ -1425,7 +1425,7 @@ proc readValue*(reader: var JsonReader[RestJson],
body: body.bellatrixBody
)
)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
ForkedBeaconBlock.init(
capella.BeaconBlock(
slot: slot.get(),
@ -1435,7 +1435,7 @@ proc readValue*(reader: var JsonReader[RestJson],
body: body.capellaBody
)
)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
)
@ -1468,35 +1468,35 @@ proc readValue*(reader: var JsonReader[RestJson],
let blck = ForkedBeaconBlock(message.get())
value = RestPublishedSignedBeaconBlock(
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
ForkedSignedBeaconBlock.init(
phase0.SignedBeaconBlock(
message: blck.phase0Data,
signature: signature.get()
)
)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
ForkedSignedBeaconBlock.init(
altair.SignedBeaconBlock(
message: blck.altairData,
signature: signature.get()
)
)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
ForkedSignedBeaconBlock.init(
bellatrix.SignedBeaconBlock(
message: blck.bellatrixData,
signature: signature.get()
)
)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
ForkedSignedBeaconBlock.init(
capella.SignedBeaconBlock(
message: blck.capellaData,
signature: signature.get()
)
)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
)
@ -1505,7 +1505,7 @@ proc readValue*(reader: var JsonReader[RestJson],
value: var ForkedSignedBeaconBlock) {.
raises: [IOError, SerializationError, Defect].} =
var
version: Option[BeaconBlockFork]
version: Option[ConsensusFork]
data: Option[JsonString]
for fieldName in readObjectFields(reader):
@ -1517,13 +1517,13 @@ proc readValue*(reader: var JsonReader[RestJson],
let vres = reader.readValue(string)
case vres
of "phase0":
version = some(BeaconBlockFork.Phase0)
version = some(ConsensusFork.Phase0)
of "altair":
version = some(BeaconBlockFork.Altair)
version = some(ConsensusFork.Altair)
of "bellatrix":
version = some(BeaconBlockFork.Bellatrix)
version = some(ConsensusFork.Bellatrix)
of "capella":
version = some(BeaconBlockFork.Capella)
version = some(ConsensusFork.Capella)
else:
reader.raiseUnexpectedValue("Incorrect version field value")
of "data":
@ -1540,7 +1540,7 @@ proc readValue*(reader: var JsonReader[RestJson],
reader.raiseUnexpectedValue("Field data is missing")
case version.get():
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1552,7 +1552,7 @@ proc readValue*(reader: var JsonReader[RestJson],
if res.isNone():
reader.raiseUnexpectedValue("Incorrect phase0 block format")
value = ForkedSignedBeaconBlock.init(res.get())
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1564,7 +1564,7 @@ proc readValue*(reader: var JsonReader[RestJson],
if res.isNone():
reader.raiseUnexpectedValue("Incorrect altair block format")
value = ForkedSignedBeaconBlock.init(res.get())
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1576,7 +1576,7 @@ proc readValue*(reader: var JsonReader[RestJson],
if res.isNone():
reader.raiseUnexpectedValue("Incorrect bellatrix block format")
value = ForkedSignedBeaconBlock.init(res.get())
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
let res =
try:
some(RestJson.decode(string(data.get()),
@ -1588,7 +1588,7 @@ proc readValue*(reader: var JsonReader[RestJson],
if res.isNone():
reader.raiseUnexpectedValue("Incorrect capella block format")
value = ForkedSignedBeaconBlock.init(res.get())
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
reader.raiseUnexpectedValue($eip4844ImplementationMissing)
withBlck(value):
blck.root = hash_tree_root(blck.message)
@ -1598,19 +1598,19 @@ proc writeValue*(writer: var JsonWriter[RestJson],
raises: [IOError, Defect].} =
writer.beginRecord()
case value.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
writer.writeField("version", "phase0")
writer.writeField("data", value.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
writer.writeField("version", "altair")
writer.writeField("data", value.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
writer.writeField("version", "bellatrix")
writer.writeField("data", value.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
writer.writeField("version", "capella")
writer.writeField("data", value.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
writer.writeField("version", "eip4844")
writer.writeField("data", value.eip4844Data)
writer.endRecord()
@ -1621,7 +1621,7 @@ proc readValue*(reader: var JsonReader[RestJson],
value: var ForkedHashedBeaconState) {.
raises: [IOError, SerializationError, Defect].} =
var
version: Option[BeaconStateFork]
version: Option[ConsensusFork]
data: Option[JsonString]
for fieldName in readObjectFields(reader):
@ -1632,11 +1632,11 @@ proc readValue*(reader: var JsonReader[RestJson],
"ForkedBeaconState")
let vres = reader.readValue(string)
version = case vres
of "phase0": some(BeaconStateFork.Phase0)
of "altair": some(BeaconStateFork.Altair)
of "bellatrix": some(BeaconStateFork.Bellatrix)
of "capella": some(BeaconStateFork.Capella)
of "eip4844": some(BeaconStateFork.EIP4844)
of "phase0": some(ConsensusFork.Phase0)
of "altair": some(ConsensusFork.Altair)
of "bellatrix": some(ConsensusFork.Bellatrix)
of "capella": some(ConsensusFork.Capella)
of "eip4844": some(ConsensusFork.EIP4844)
else: reader.raiseUnexpectedValue("Incorrect version field value")
of "data":
if data.isSome():
@ -1664,7 +1664,7 @@ proc readValue*(reader: var JsonReader[RestJson],
value.field.root = hash_tree_root(value.field.data)
case version.get():
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
try:
tmp[].phase0Data.data = RestJson.decode(
string(data.get()),
@ -1675,7 +1675,7 @@ proc readValue*(reader: var JsonReader[RestJson],
reader.raiseUnexpectedValue("Incorrect phase0 beacon state format")
toValue(phase0Data)
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
try:
tmp[].altairData.data = RestJson.decode(
string(data.get()),
@ -1686,7 +1686,7 @@ proc readValue*(reader: var JsonReader[RestJson],
reader.raiseUnexpectedValue("Incorrect altair beacon state format")
toValue(altairData)
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
try:
tmp[].bellatrixData.data = RestJson.decode(
string(data.get()),
@ -1696,7 +1696,7 @@ proc readValue*(reader: var JsonReader[RestJson],
except SerializationError:
reader.raiseUnexpectedValue("Incorrect bellatrix beacon state format")
toValue(bellatrixData)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
try:
tmp[].capellaData.data = RestJson.decode(
string(data.get()),
@ -1706,7 +1706,7 @@ proc readValue*(reader: var JsonReader[RestJson],
except SerializationError:
reader.raiseUnexpectedValue("Incorrect capella beacon state format")
toValue(capellaData)
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
try:
tmp[].eip4844Data.data = RestJson.decode(
string(data.get()),
@ -1721,19 +1721,19 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: ForkedHashedBeaconStat
{.raises: [IOError, Defect].} =
writer.beginRecord()
case value.kind
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
writer.writeField("version", "phase0")
writer.writeField("data", value.phase0Data.data)
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
writer.writeField("version", "altair")
writer.writeField("data", value.altairData.data)
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
writer.writeField("version", "bellatrix")
writer.writeField("data", value.bellatrixData.data)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
writer.writeField("version", "capella")
writer.writeField("data", value.capellaData.data)
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
writer.writeField("version", "eip4844")
writer.writeField("data", value.eip4844Data.data)
writer.endRecord()
@ -2633,9 +2633,9 @@ proc decodeBody*(
return err("Unexpected deserialization error")
ok(data)
elif body.contentType == OctetStreamMediaType:
let blockFork = ? BeaconBlockFork.decodeString(version)
let blockFork = ? ConsensusFork.decodeString(version)
case blockFork
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
let blck =
try:
SSZ.decode(body.data, phase0.SignedBeaconBlock)
@ -2644,7 +2644,7 @@ proc decodeBody*(
except CatchableError:
return err("Unexpected deserialization error")
ok(RestPublishedSignedBeaconBlock(ForkedSignedBeaconBlock.init(blck)))
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
let blck =
try:
SSZ.decode(body.data, altair.SignedBeaconBlock)
@ -2653,7 +2653,7 @@ proc decodeBody*(
except CatchableError:
return err("Unexpected deserialization error")
ok(RestPublishedSignedBeaconBlock(ForkedSignedBeaconBlock.init(blck)))
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
let blck =
try:
SSZ.decode(body.data, bellatrix.SignedBeaconBlock)
@ -2662,7 +2662,7 @@ proc decodeBody*(
except CatchableError:
return err("Unexpected deserialization error")
ok(RestPublishedSignedBeaconBlock(ForkedSignedBeaconBlock.init(blck)))
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
let blck =
try:
SSZ.decode(body.data, capella.SignedBeaconBlock)
@ -2671,7 +2671,7 @@ proc decodeBody*(
except CatchableError:
return err("Unexpected deserialization error")
ok(RestPublishedSignedBeaconBlock(ForkedSignedBeaconBlock.init(blck)))
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
return err($eip4844ImplementationMissing)
else:
return err("Unsupported or invalid content media type")
@ -3157,22 +3157,12 @@ proc decodeString*(t: typedesc[ValidatorFilter],
else:
err("Incorrect validator state identifier value")
proc decodeString*(t: typedesc[BeaconBlockFork],
value: string): Result[BeaconBlockFork, cstring] =
proc decodeString*(t: typedesc[ConsensusFork],
value: string): Result[ConsensusFork, cstring] =
case toLowerAscii(value)
of "phase0": ok(BeaconBlockFork.Phase0)
of "altair": ok(BeaconBlockFork.Altair)
of "bellatrix": ok(BeaconBlockFork.Bellatrix)
of "capella": ok(BeaconBlockFork.Capella)
of "eip4844": ok(BeaconBlockFork.EIP4844)
of "phase0": ok(ConsensusFork.Phase0)
of "altair": ok(ConsensusFork.Altair)
of "bellatrix": ok(ConsensusFork.Bellatrix)
of "capella": ok(ConsensusFork.Capella)
of "eip4844": ok(ConsensusFork.EIP4844)
else: err("Unsupported or invalid beacon block fork version")
proc decodeString*(t: typedesc[BeaconStateFork],
value: string): Result[BeaconStateFork, cstring] =
case toLowerAscii(value)
of "phase0": ok(BeaconStateFork.Phase0)
of "altair": ok(BeaconStateFork.Altair)
of "bellatrix": ok(BeaconStateFork.Bellatrix)
of "capella": ok(BeaconStateFork.Capella)
of "eip4844": ok(BeaconStateFork.EIP4844)
else: err("Unsupported or invalid beacon state fork version")

View File

@ -286,12 +286,12 @@ type
RestPublishedBeaconBlock* = distinct ForkedBeaconBlock
RestPublishedBeaconBlockBody* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Body*: phase0.BeaconBlockBody
of BeaconBlockFork.Altair: altairBody*: altair.BeaconBlockBody
of BeaconBlockFork.Bellatrix: bellatrixBody*: bellatrix.BeaconBlockBody
of BeaconBlockFork.Capella: capellaBody*: capella.BeaconBlockBody
of BeaconBlockFork.EIP4844: eip4844Body*: eip4844.BeaconBlockBody
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Body*: phase0.BeaconBlockBody
of ConsensusFork.Altair: altairBody*: altair.BeaconBlockBody
of ConsensusFork.Bellatrix: bellatrixBody*: bellatrix.BeaconBlockBody
of ConsensusFork.Capella: capellaBody*: capella.BeaconBlockBody
of ConsensusFork.EIP4844: eip4844Body*: eip4844.BeaconBlockBody
RestSpec* = object
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/presets/mainnet/phase0.yaml

View File

@ -8,6 +8,7 @@
{.push raises: [].}
import
std/macros,
stew/assign2,
stew/results,
chronicles,
@ -40,7 +41,7 @@ export
# these types and converters :)
type
BeaconStateFork* {.pure.} = enum
ConsensusFork* {.pure.} = enum
Phase0,
Altair,
Bellatrix,
@ -62,25 +63,23 @@ type
eip4844.HashedBeaconState
ForkedHashedBeaconState* = object
case kind*: BeaconStateFork
of BeaconStateFork.Phase0: phase0Data*: phase0.HashedBeaconState
of BeaconStateFork.Altair: altairData*: altair.HashedBeaconState
of BeaconStateFork.Bellatrix: bellatrixData*: bellatrix.HashedBeaconState
of BeaconStateFork.Capella: capellaData*: capella.HashedBeaconState
of BeaconStateFork.EIP4844: eip4844Data*: eip4844.HashedBeaconState
BeaconBlockFork* {.pure.} = enum
Phase0,
Altair,
Bellatrix,
Capella,
EIP4844
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.HashedBeaconState
of ConsensusFork.Altair: altairData*: altair.HashedBeaconState
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.HashedBeaconState
of ConsensusFork.Capella: capellaData*: capella.HashedBeaconState
of ConsensusFork.EIP4844: eip4844Data*: eip4844.HashedBeaconState
ForkyExecutionPayload* =
bellatrix.ExecutionPayload |
capella.ExecutionPayload |
eip4844.ExecutionPayload
ForkyExecutionPayloadHeader* =
bellatrix.ExecutionPayloadHeader |
capella.ExecutionPayloadHeader |
eip4844.ExecutionPayloadHeader
ForkyBeaconBlockBody* =
phase0.BeaconBlockBody |
altair.BeaconBlockBody |
@ -134,36 +133,36 @@ type
ForkyTrustedBeaconBlock
ForkedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.BeaconBlock
of BeaconBlockFork.Capella: capellaData*: capella.BeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: eip4844.BeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.BeaconBlock
of ConsensusFork.Altair: altairData*: altair.BeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.BeaconBlock
of ConsensusFork.Capella: capellaData*: capella.BeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: eip4844.BeaconBlock
Web3SignerForkedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: BeaconBlockHeader
of BeaconBlockFork.Capella: capellaData*: BeaconBlockHeader
of BeaconBlockFork.EIP4844: eip4844Data*: BeaconBlockHeader
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.BeaconBlock
of ConsensusFork.Altair: altairData*: altair.BeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: BeaconBlockHeader
of ConsensusFork.Capella: capellaData*: BeaconBlockHeader
of ConsensusFork.EIP4844: eip4844Data*: BeaconBlockHeader
ForkedBlindedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: BlindedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: BlindedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: BlindedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.BeaconBlock
of ConsensusFork.Altair: altairData*: altair.BeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: BlindedBeaconBlock
of ConsensusFork.Capella: capellaData*: BlindedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: BlindedBeaconBlock
ForkedTrustedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedBeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.TrustedBeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.TrustedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: capella.TrustedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: eip4844.TrustedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.TrustedBeaconBlock
of ConsensusFork.Altair: altairData*: altair.TrustedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella.TrustedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: eip4844.TrustedBeaconBlock
ForkySignedBeaconBlock* =
phase0.SignedBeaconBlock |
@ -173,12 +172,12 @@ type
eip4844.SignedBeaconBlock
ForkedSignedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.SignedBeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.SignedBeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.SignedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: capella.SignedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: eip4844.SignedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.SignedBeaconBlock
of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.SignedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella.SignedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: eip4844.SignedBeaconBlock
ForkySignedBlindedBeaconBlock* =
phase0.SignedBeaconBlock |
@ -186,12 +185,12 @@ type
SignedBlindedBeaconBlock
ForkedSignedBlindedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.SignedBeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.SignedBeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: SignedBlindedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: SignedBlindedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: SignedBlindedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.SignedBeaconBlock
of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: SignedBlindedBeaconBlock
of ConsensusFork.Capella: capellaData*: SignedBlindedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: SignedBlindedBeaconBlock
ForkySigVerifiedSignedBeaconBlock* =
phase0.SigVerifiedSignedBeaconBlock |
@ -215,20 +214,20 @@ type
eip4844.TrustedSignedBeaconBlock
ForkedMsgTrustedSignedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.MsgTrustedSignedBeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.MsgTrustedSignedBeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.MsgTrustedSignedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: capella.MsgTrustedSignedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: eip4844.MsgTrustedSignedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.MsgTrustedSignedBeaconBlock
of ConsensusFork.Altair: altairData*: altair.MsgTrustedSignedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.MsgTrustedSignedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella.MsgTrustedSignedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: eip4844.MsgTrustedSignedBeaconBlock
ForkedTrustedSignedBeaconBlock* = object
case kind*: BeaconBlockFork
of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedSignedBeaconBlock
of BeaconBlockFork.Altair: altairData*: altair.TrustedSignedBeaconBlock
of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.TrustedSignedBeaconBlock
of BeaconBlockFork.Capella: capellaData*: capella.TrustedSignedBeaconBlock
of BeaconBlockFork.EIP4844: eip4844Data*: eip4844.TrustedSignedBeaconBlock
case kind*: ConsensusFork
of ConsensusFork.Phase0: phase0Data*: phase0.TrustedSignedBeaconBlock
of ConsensusFork.Altair: altairData*: altair.TrustedSignedBeaconBlock
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedSignedBeaconBlock
of ConsensusFork.Capella: capellaData*: capella.TrustedSignedBeaconBlock
of ConsensusFork.EIP4844: eip4844Data*: eip4844.TrustedSignedBeaconBlock
SomeForkySignedBeaconBlock* =
ForkySignedBeaconBlock |
@ -281,134 +280,123 @@ func optBlobs*(b: ForkySignedBeaconBlockMaybeBlobs):
elif b is eip4844.SignedBeaconBlockAndBlobsSidecar:
Opt.some(b.blobs_sidecar)
template toFork*[T: phase0.BeaconState | phase0.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.Phase0
template toFork*[T: altair.BeaconState | altair.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.Altair
template toFork*[T: bellatrix.BeaconState | bellatrix.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.Bellatrix
template toFork*[T: capella.BeaconState | capella.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.Capella
template toFork*[T: eip4844.BeaconState | eip4844.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.EIP4844
macro getSymbolFromForkModule(fork: static ConsensusFork,
symbolName: static string): untyped =
let moduleName = case fork
of ConsensusFork.Phase0: "phase0"
of ConsensusFork.Altair: "altair"
of ConsensusFork.Bellatrix: "bellatrix"
of ConsensusFork.Capella: "capella"
of ConsensusFork.EIP4844: "eip4844"
newDotExpr(ident moduleName, ident symbolName)
template BeaconState*(kind: static BeaconStateFork): auto =
when kind == BeaconStateFork.EIP4844:
typedesc[eip4844.BeaconState]
elif kind == BeaconStateFork.Capella:
typedesc[capella.BeaconState]
elif kind == BeaconStateFork.Bellatrix:
typedesc[bellatrix.BeaconState]
elif kind == BeaconStateFork.Altair:
typedesc[altair.BeaconState]
elif kind == BeaconStateFork.Phase0:
typedesc[phase0.BeaconState]
else:
static: raiseAssert "Unreachable"
template BeaconStateType*(fork: static ConsensusFork): auto =
getSymbolFromForkModule(fork, "BeaconState")
template BeaconBlockType*(fork: static ConsensusFork): auto =
getSymbolFromForkModule(fork, "BeaconBlock")
template BeaconBlockBodyType*(fork: static ConsensusFork): auto =
getSymbolFromForkModule(fork, "BeaconBlockBody")
template withStateFork*(
x: BeaconStateFork, body: untyped): untyped =
x: ConsensusFork, body: untyped): untyped =
case x
of BeaconStateFork.EIP4844:
const stateFork {.inject, used.} = BeaconStateFork.Eip4844
of ConsensusFork.EIP4844:
const stateFork {.inject, used.} = ConsensusFork.Eip4844
body
of BeaconStateFork.Capella:
const stateFork {.inject, used.} = BeaconStateFork.Capella
of ConsensusFork.Capella:
const stateFork {.inject, used.} = ConsensusFork.Capella
body
of BeaconStateFork.Bellatrix:
const stateFork {.inject, used.} = BeaconStateFork.Bellatrix
of ConsensusFork.Bellatrix:
const stateFork {.inject, used.} = ConsensusFork.Bellatrix
body
of BeaconStateFork.Altair:
const stateFork {.inject, used.} = BeaconStateFork.Altair
of ConsensusFork.Altair:
const stateFork {.inject, used.} = ConsensusFork.Altair
body
of BeaconStateFork.Phase0:
const stateFork {.inject, used.} = BeaconStateFork.Phase0
of ConsensusFork.Phase0:
const stateFork {.inject, used.} = ConsensusFork.Phase0
body
# TODO when https://github.com/nim-lang/Nim/issues/21086 fixed, use return type
# `ref T`
func new*(T: type ForkedHashedBeaconState, data: phase0.BeaconState):
ref ForkedHashedBeaconState =
(ref T)(kind: BeaconStateFork.Phase0, phase0Data: phase0.HashedBeaconState(
(ref T)(kind: ConsensusFork.Phase0, phase0Data: phase0.HashedBeaconState(
data: data, root: hash_tree_root(data)))
func new*(T: type ForkedHashedBeaconState, data: altair.BeaconState):
ref ForkedHashedBeaconState =
(ref T)(kind: BeaconStateFork.Altair, altairData: altair.HashedBeaconState(
(ref T)(kind: ConsensusFork.Altair, altairData: altair.HashedBeaconState(
data: data, root: hash_tree_root(data)))
func new*(T: type ForkedHashedBeaconState, data: bellatrix.BeaconState):
ref ForkedHashedBeaconState =
(ref T)(kind: BeaconStateFork.Bellatrix, bellatrixData: bellatrix.HashedBeaconState(
(ref T)(kind: ConsensusFork.Bellatrix, bellatrixData: bellatrix.HashedBeaconState(
data: data, root: hash_tree_root(data)))
func new*(T: type ForkedHashedBeaconState, data: capella.BeaconState):
ref ForkedHashedBeaconState =
(ref T)(kind: BeaconStateFork.Capella, capellaData: capella.HashedBeaconState(
(ref T)(kind: ConsensusFork.Capella, capellaData: capella.HashedBeaconState(
data: data, root: hash_tree_root(data)))
func new*(T: type ForkedHashedBeaconState, data: eip4844.BeaconState):
ref ForkedHashedBeaconState =
(ref T)(kind: BeaconStateFork.EIP4844, eip4844Data: eip4844.HashedBeaconState(
(ref T)(kind: ConsensusFork.EIP4844, eip4844Data: eip4844.HashedBeaconState(
data: data, root: hash_tree_root(data)))
template init*(T: type ForkedBeaconBlock, blck: phase0.BeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)
T(kind: ConsensusFork.Phase0, phase0Data: blck)
template init*(T: type ForkedBeaconBlock, blck: altair.BeaconBlock): T =
T(kind: BeaconBlockFork.Altair, altairData: blck)
T(kind: ConsensusFork.Altair, altairData: blck)
template init*(T: type ForkedBeaconBlock, blck: bellatrix.BeaconBlock): T =
T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck)
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
template init*(T: type ForkedBeaconBlock, blck: capella.BeaconBlock): T =
T(kind: BeaconBlockFork.Capella, capellaData: blck)
T(kind: ConsensusFork.Capella, capellaData: blck)
template init*(T: type ForkedBeaconBlock, blck: eip4844.BeaconBlock): T =
T(kind: BeaconBlockFork.EIP4844, eip4844Data: blck)
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
template init*(T: type ForkedTrustedBeaconBlock, blck: phase0.TrustedBeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)
T(kind: ConsensusFork.Phase0, phase0Data: blck)
template init*(T: type ForkedTrustedBeaconBlock, blck: altair.TrustedBeaconBlock): T =
T(kind: BeaconBlockFork.Altair, altairData: blck)
T(kind: ConsensusFork.Altair, altairData: blck)
template init*(T: type ForkedTrustedBeaconBlock, blck: bellatrix.TrustedBeaconBlock): T =
T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck)
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
template init*(T: type ForkedTrustedBeaconBlock, blck: capella.TrustedBeaconBlock): T =
T(kind: BeaconBlockFork.Capella, capellaData: blck)
T(kind: ConsensusFork.Capella, capellaData: blck)
template init*(T: type ForkedSignedBeaconBlock, blck: phase0.SignedBeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)
T(kind: ConsensusFork.Phase0, phase0Data: blck)
template init*(T: type ForkedSignedBeaconBlock, blck: altair.SignedBeaconBlock): T =
T(kind: BeaconBlockFork.Altair, altairData: blck)
T(kind: ConsensusFork.Altair, altairData: blck)
template init*(T: type ForkedSignedBeaconBlock, blck: bellatrix.SignedBeaconBlock): T =
T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck)
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
template init*(T: type ForkedSignedBeaconBlock, blck: capella.SignedBeaconBlock): T =
T(kind: BeaconBlockFork.Capella, capellaData: blck)
T(kind: ConsensusFork.Capella, capellaData: blck)
template init*(T: type ForkedSignedBeaconBlock, blck: eip4844.SignedBeaconBlock): T =
T(kind: BeaconBlockFork.EIP4844, eip4844Data: blck)
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
func init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock,
blockRoot: Eth2Digest, signature: ValidatorSig): T =
case forked.kind
of BeaconBlockFork.Phase0:
T(kind: BeaconBlockFork.Phase0,
of ConsensusFork.Phase0:
T(kind: ConsensusFork.Phase0,
phase0Data: phase0.SignedBeaconBlock(message: forked.phase0Data,
root: blockRoot,
signature: signature))
of BeaconBlockFork.Altair:
T(kind: BeaconBlockFork.Altair,
of ConsensusFork.Altair:
T(kind: ConsensusFork.Altair,
altairData: altair.SignedBeaconBlock(message: forked.altairData,
root: blockRoot,
signature: signature))
of BeaconBlockFork.Bellatrix:
T(kind: BeaconBlockFork.Bellatrix,
of ConsensusFork.Bellatrix:
T(kind: ConsensusFork.Bellatrix,
bellatrixData: bellatrix.SignedBeaconBlock(message: forked.bellatrixData,
root: blockRoot,
signature: signature))
of BeaconBlockFork.Capella:
T(kind: BeaconBlockFork.Capella,
of ConsensusFork.Capella:
T(kind: ConsensusFork.Capella,
capellaData: capella.SignedBeaconBlock(message: forked.capellaData,
root: blockRoot,
signature: signature))
of BeaconBlockFork.EIP4844:
T(kind: BeaconBlockFork.EIP4844,
of ConsensusFork.EIP4844:
T(kind: ConsensusFork.EIP4844,
eip4844Data: eip4844.SignedBeaconBlock(message: forked.eip4844Data,
root: blockRoot,
signature: signature))
@ -417,122 +405,135 @@ func init*(T: type ForkedSignedBlindedBeaconBlock,
forked: ForkedBlindedBeaconBlock, blockRoot: Eth2Digest,
signature: ValidatorSig): T =
case forked.kind
of BeaconBlockFork.Phase0:
T(kind: BeaconBlockFork.Phase0,
of ConsensusFork.Phase0:
T(kind: ConsensusFork.Phase0,
phase0Data: phase0.SignedBeaconBlock(message: forked.phase0Data,
root: blockRoot,
signature: signature))
of BeaconBlockFork.Altair:
T(kind: BeaconBlockFork.Altair,
of ConsensusFork.Altair:
T(kind: ConsensusFork.Altair,
altairData: altair.SignedBeaconBlock(message: forked.altairData,
root: blockRoot,
signature: signature))
of BeaconBlockFork.Bellatrix:
T(kind: BeaconBlockFork.Bellatrix,
of ConsensusFork.Bellatrix:
T(kind: ConsensusFork.Bellatrix,
bellatrixData: SignedBlindedBeaconBlock(message: forked.bellatrixData,
signature: signature))
of BeaconBlockFork.Capella:
T(kind: BeaconBlockFork.Capella,
of ConsensusFork.Capella:
T(kind: ConsensusFork.Capella,
capellaData: SignedBlindedBeaconBlock(message: forked.capellaData,
signature: signature))
of BeaconBlockFork.EIP4844:
T(kind: BeaconBlockFork.EIP4844,
of ConsensusFork.EIP4844:
T(kind: ConsensusFork.EIP4844,
eip4844Data: SignedBlindedBeaconBlock(message: forked.eip4844Data,
signature: signature))
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: phase0.MsgTrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)
T(kind: ConsensusFork.Phase0, phase0Data: blck)
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: altair.MsgTrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Altair, altairData: blck)
T(kind: ConsensusFork.Altair, altairData: blck)
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: bellatrix.MsgTrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck)
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: capella.MsgTrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Capella, capellaData: blck)
T(kind: ConsensusFork.Capella, capellaData: blck)
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: eip4844.MsgTrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.EIP4844, eip4844Data: blck)
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: phase0.TrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)
T(kind: ConsensusFork.Phase0, phase0Data: blck)
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: altair.TrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Altair, altairData: blck)
T(kind: ConsensusFork.Altair, altairData: blck)
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: bellatrix.TrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck)
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: capella.TrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.Capella, capellaData: blck)
T(kind: ConsensusFork.Capella, capellaData: blck)
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: eip4844.TrustedSignedBeaconBlock): T =
T(kind: BeaconBlockFork.EIP4844, eip4844Data: blck)
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
template toString*(kind: BeaconBlockFork): string =
template toString*(kind: ConsensusFork): string =
case kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
"phase0"
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
"altair"
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
"bellatrix"
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
"capella"
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
"eip4844"
template toString*(kind: BeaconStateFork): string =
template toString*(kind: ConsensusFork): string =
case kind
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
"phase0"
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
"altair"
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
"bellatrix"
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
"capella"
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
"eip4844"
template toFork*[T:
phase0.BeaconState |
phase0.HashedBeaconState |
phase0.BeaconBlock |
phase0.SignedBeaconBlock |
phase0.TrustedBeaconBlock |
phase0.SigVerifiedSignedBeaconBlock |
phase0.MsgTrustedSignedBeaconBlock |
phase0.TrustedSignedBeaconBlock](
t: type T): BeaconBlockFork =
BeaconBlockFork.Phase0
t: type T): ConsensusFork =
ConsensusFork.Phase0
template toFork*[T:
altair.BeaconState |
altair.HashedBeaconState |
altair.BeaconBlock |
altair.SignedBeaconBlock |
altair.TrustedBeaconBlock |
altair.SigVerifiedSignedBeaconBlock |
altair.MsgTrustedSignedBeaconBlock |
altair.TrustedSignedBeaconBlock](
t: type T): BeaconBlockFork =
BeaconBlockFork.Altair
t: type T): ConsensusFork =
ConsensusFork.Altair
template toFork*[T:
bellatrix.BeaconState |
bellatrix.HashedBeaconState |
bellatrix.ExecutionPayload |
bellatrix.ExecutionPayloadHeader |
bellatrix.BeaconBlock |
bellatrix.SignedBeaconBlock |
bellatrix.TrustedBeaconBlock |
bellatrix.SigVerifiedSignedBeaconBlock |
bellatrix.MsgTrustedSignedBeaconBlock |
bellatrix.TrustedSignedBeaconBlock](
t: type T): BeaconBlockFork =
BeaconBlockFork.Bellatrix
t: type T): ConsensusFork =
ConsensusFork.Bellatrix
template toFork*[T:
capella.BeaconState |
capella.HashedBeaconState |
capella.ExecutionPayload |
capella.ExecutionPayloadHeader |
capella.BeaconBlock |
capella.SignedBeaconBlock |
capella.TrustedBeaconBlock |
capella.SigVerifiedSignedBeaconBlock |
capella.MsgTrustedSignedBeaconBlock |
capella.TrustedSignedBeaconBlock](
t: type T): BeaconBlockFork =
BeaconBlockFork.Capella
t: type T): ConsensusFork =
ConsensusFork.Capella
template toFork*[T:
eip4844.BeaconState |
eip4844.HashedBeaconState |
eip4844.ExecutionPayload |
eip4844.ExecutionPayloadHeader |
eip4844.BeaconBlock |
eip4844.SignedBeaconBlock |
eip4844.SignedBeaconBlockAndBlobsSidecar |
@ -540,22 +541,8 @@ template toFork*[T:
eip4844.SigVerifiedSignedBeaconBlock |
eip4844.MsgTrustedSignedBeaconBlock |
eip4844.TrustedSignedBeaconBlock](
t: type T): BeaconBlockFork =
BeaconBlockFork.EIP4844
template BeaconBlockBody*(kind: static BeaconBlockFork): auto =
when kind == BeaconBlockFork.EIP4844:
typedesc[eip4844.BeaconBlockBody]
elif kind == BeaconBlockFork.Capella:
typedesc[capella.BeaconBlockBody]
elif kind == BeaconBlockFork.Bellatrix:
typedesc[bellatrix.BeaconBlockBody]
elif kind == BeaconBlockFork.Altair:
typedesc[altair.BeaconBlockBody]
elif kind == BeaconBlockFork.Phase0:
typedesc[phase0.BeaconBlockBody]
else:
static: raiseAssert "Unreachable"
t: type T): ConsensusFork =
ConsensusFork.EIP4844
template init*(T: type ForkedEpochInfo, info: phase0.EpochInfo): T =
T(kind: EpochInfoFork.Phase0, phase0Data: info)
@ -564,24 +551,24 @@ template init*(T: type ForkedEpochInfo, info: altair.EpochInfo): T =
template withState*(x: ForkedHashedBeaconState, body: untyped): untyped =
case x.kind
of BeaconStateFork.EIP4844:
const stateFork {.inject, used.} = BeaconStateFork.EIP4844
of ConsensusFork.EIP4844:
const stateFork {.inject, used.} = ConsensusFork.EIP4844
template forkyState: untyped {.inject, used.} = x.eip4844Data
body
of BeaconStateFork.Capella:
const stateFork {.inject, used.} = BeaconStateFork.Capella
of ConsensusFork.Capella:
const stateFork {.inject, used.} = ConsensusFork.Capella
template forkyState: untyped {.inject, used.} = x.capellaData
body
of BeaconStateFork.Bellatrix:
const stateFork {.inject, used.} = BeaconStateFork.Bellatrix
of ConsensusFork.Bellatrix:
const stateFork {.inject, used.} = ConsensusFork.Bellatrix
template forkyState: untyped {.inject, used.} = x.bellatrixData
body
of BeaconStateFork.Altair:
const stateFork {.inject, used.} = BeaconStateFork.Altair
of ConsensusFork.Altair:
const stateFork {.inject, used.} = ConsensusFork.Altair
template forkyState: untyped {.inject, used.} = x.altairData
body
of BeaconStateFork.Phase0:
const stateFork {.inject, used.} = BeaconStateFork.Phase0
of ConsensusFork.Phase0:
const stateFork {.inject, used.} = ConsensusFork.Phase0
template forkyState: untyped {.inject, used.} = x.phase0Data
body
@ -617,15 +604,15 @@ template withEpochInfo*(
func assign*(tgt: var ForkedHashedBeaconState, src: ForkedHashedBeaconState) =
if tgt.kind == src.kind:
case tgt.kind
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
assign(tgt.eip4844Data, src.eip4844Data):
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
assign(tgt.capellaData, src.capellaData):
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
assign(tgt.bellatrixData, src.bellatrixData):
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
assign(tgt.altairData, src.altairData):
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
assign(tgt.phase0Data, src.phase0Data):
else:
# Ensure case object and discriminator get updated simultaneously, even
@ -639,11 +626,11 @@ template getStateField*(x: ForkedHashedBeaconState, y: untyped): untyped =
# ```
# Without `unsafeAddr`, the `validators` list would be copied to a temporary variable.
(case x.kind
of BeaconStateFork.EIP4844: unsafeAddr x.eip4844Data.data.y
of BeaconStateFork.Capella: unsafeAddr x.capellaData.data.y
of BeaconStateFork.Bellatrix: unsafeAddr x.bellatrixData.data.y
of BeaconStateFork.Altair: unsafeAddr x.altairData.data.y
of BeaconStateFork.Phase0: unsafeAddr x.phase0Data.data.y)[]
of ConsensusFork.EIP4844: unsafeAddr x.eip4844Data.data.y
of ConsensusFork.Capella: unsafeAddr x.capellaData.data.y
of ConsensusFork.Bellatrix: unsafeAddr x.bellatrixData.data.y
of ConsensusFork.Altair: unsafeAddr x.altairData.data.y
of ConsensusFork.Phase0: unsafeAddr x.phase0Data.data.y)[]
func getStateRoot*(x: ForkedHashedBeaconState): Eth2Digest =
withState(x): forkyState.root
@ -651,59 +638,59 @@ func getStateRoot*(x: ForkedHashedBeaconState): Eth2Digest =
func setStateRoot*(x: var ForkedHashedBeaconState, root: Eth2Digest) =
withState(x): forkyState.root = root
func stateForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): BeaconStateFork =
func stateForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): ConsensusFork =
## Return the current fork for the given epoch.
static:
doAssert high(BeaconStateFork) == BeaconStateFork.EIP4844
doAssert BeaconStateFork.EIP4844 > BeaconStateFork.Capella
doAssert BeaconStateFork.Capella > BeaconStateFork.Bellatrix
doAssert BeaconStateFork.Bellatrix > BeaconStateFork.Altair
doAssert BeaconStateFork.Altair > BeaconStateFork.Phase0
doAssert high(ConsensusFork) == ConsensusFork.EIP4844
doAssert ConsensusFork.EIP4844 > ConsensusFork.Capella
doAssert ConsensusFork.Capella > ConsensusFork.Bellatrix
doAssert ConsensusFork.Bellatrix > ConsensusFork.Altair
doAssert ConsensusFork.Altair > ConsensusFork.Phase0
doAssert GENESIS_EPOCH == 0
if epoch >= cfg.EIP4844_FORK_EPOCH: BeaconStateFork.EIP4844
elif epoch >= cfg.CAPELLA_FORK_EPOCH: BeaconStateFork.Capella
elif epoch >= cfg.BELLATRIX_FORK_EPOCH: BeaconStateFork.Bellatrix
elif epoch >= cfg.ALTAIR_FORK_EPOCH: BeaconStateFork.Altair
else: BeaconStateFork.Phase0
if epoch >= cfg.EIP4844_FORK_EPOCH: ConsensusFork.EIP4844
elif epoch >= cfg.CAPELLA_FORK_EPOCH: ConsensusFork.Capella
elif epoch >= cfg.BELLATRIX_FORK_EPOCH: ConsensusFork.Bellatrix
elif epoch >= cfg.ALTAIR_FORK_EPOCH: ConsensusFork.Altair
else: ConsensusFork.Phase0
func blockForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): BeaconBlockFork =
func blockForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): ConsensusFork =
## Return the current fork for the given epoch.
static: doAssert high(BeaconBlockFork) == BeaconBlockFork.EIP4844
if epoch >= cfg.EIP4844_FORK_EPOCH: BeaconBlockFork.EIP4844
elif epoch >= cfg.CAPELLA_FORK_EPOCH: BeaconBlockFork.Capella
elif epoch >= cfg.BELLATRIX_FORK_EPOCH: BeaconBlockFork.Bellatrix
elif epoch >= cfg.ALTAIR_FORK_EPOCH: BeaconBlockFork.Altair
else: BeaconBlockFork.Phase0
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
if epoch >= cfg.EIP4844_FORK_EPOCH: ConsensusFork.EIP4844
elif epoch >= cfg.CAPELLA_FORK_EPOCH: ConsensusFork.Capella
elif epoch >= cfg.BELLATRIX_FORK_EPOCH: ConsensusFork.Bellatrix
elif epoch >= cfg.ALTAIR_FORK_EPOCH: ConsensusFork.Altair
else: ConsensusFork.Phase0
func stateForkForDigest*(
forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[BeaconStateFork] =
static: doAssert high(BeaconStateFork) == BeaconStateFork.EIP4844
forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[ConsensusFork] =
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
if forkDigest == forkDigests.eip4844:
ok BeaconStateFork.EIP4844
ok ConsensusFork.EIP4844
elif forkDigest == forkDigests.capella:
ok BeaconStateFork.Capella
ok ConsensusFork.Capella
elif forkDigest == forkDigests.bellatrix:
ok BeaconStateFork.Bellatrix
ok ConsensusFork.Bellatrix
elif forkDigest == forkDigests.altair:
ok BeaconStateFork.Altair
ok ConsensusFork.Altair
elif forkDigest == forkDigests.phase0:
ok BeaconStateFork.Phase0
ok ConsensusFork.Phase0
else:
err()
func atStateFork*(
forkDigests: ForkDigests, stateFork: BeaconStateFork): ForkDigest =
forkDigests: ForkDigests, stateFork: ConsensusFork): ForkDigest =
case stateFork
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
forkDigests.eip4844
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
forkDigests.capella
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
forkDigests.bellatrix
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
forkDigests.altair
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
forkDigests.phase0
template atEpoch*(
@ -753,24 +740,24 @@ template withBlck*(
ForkedSignedBlindedBeaconBlock,
body: untyped): untyped =
case x.kind
of BeaconBlockFork.Phase0:
const stateFork {.inject, used.} = BeaconStateFork.Phase0
of ConsensusFork.Phase0:
const stateFork {.inject, used.} = ConsensusFork.Phase0
template blck: untyped {.inject.} = x.phase0Data
body
of BeaconBlockFork.Altair:
const stateFork {.inject, used.} = BeaconStateFork.Altair
of ConsensusFork.Altair:
const stateFork {.inject, used.} = ConsensusFork.Altair
template blck: untyped {.inject.} = x.altairData
body
of BeaconBlockFork.Bellatrix:
const stateFork {.inject, used.} = BeaconStateFork.Bellatrix
of ConsensusFork.Bellatrix:
const stateFork {.inject, used.} = ConsensusFork.Bellatrix
template blck: untyped {.inject.} = x.bellatrixData
body
of BeaconBlockFork.Capella:
const stateFork {.inject, used.} = BeaconStateFork.Capella
of ConsensusFork.Capella:
const stateFork {.inject, used.} = ConsensusFork.Capella
template blck: untyped {.inject.} = x.capellaData
body
of BeaconBlockFork.EIP4844:
const stateFork {.inject, used.} = BeaconStateFork.EIP4844
of ConsensusFork.EIP4844:
const stateFork {.inject, used.} = ConsensusFork.EIP4844
template blck: untyped {.inject.} = x.eip4844Data
body
@ -788,11 +775,11 @@ template getForkedBlockField*(
y: untyped): untyped =
# unsafeAddr avoids a copy of the field in some cases
(case x.kind
of BeaconBlockFork.Phase0: unsafeAddr x.phase0Data.message.y
of BeaconBlockFork.Altair: unsafeAddr x.altairData.message.y
of BeaconBlockFork.Bellatrix: unsafeAddr x.bellatrixData.message.y
of BeaconBlockFork.Capella: unsafeAddr x.capellaData.message.y
of BeaconBlockFork.EIP4844: unsafeAddr x.eip4844Data.message.y)[]
of ConsensusFork.Phase0: unsafeAddr x.phase0Data.message.y
of ConsensusFork.Altair: unsafeAddr x.altairData.message.y
of ConsensusFork.Bellatrix: unsafeAddr x.bellatrixData.message.y
of ConsensusFork.Capella: unsafeAddr x.capellaData.message.y
of ConsensusFork.EIP4844: unsafeAddr x.eip4844Data.message.y)[]
template signature*(x: ForkedSignedBeaconBlock |
ForkedMsgTrustedSignedBeaconBlock |
@ -833,28 +820,28 @@ template withStateAndBlck*(
ForkedTrustedSignedBeaconBlock,
body: untyped): untyped =
case s.kind
of BeaconStateFork.EIP4844:
const stateFork {.inject.} = BeaconStateFork.EIP4844
of ConsensusFork.EIP4844:
const stateFork {.inject.} = ConsensusFork.EIP4844
template forkyState: untyped {.inject.} = s.eip4844Data
template blck: untyped {.inject.} = b.eip4844Data
body
of BeaconStateFork.Capella:
const stateFork {.inject.} = BeaconStateFork.Capella
of ConsensusFork.Capella:
const stateFork {.inject.} = ConsensusFork.Capella
template forkyState: untyped {.inject.} = s.capellaData
template blck: untyped {.inject.} = b.capellaData
body
of BeaconStateFork.Bellatrix:
const stateFork {.inject.} = BeaconStateFork.Bellatrix
of ConsensusFork.Bellatrix:
const stateFork {.inject.} = ConsensusFork.Bellatrix
template forkyState: untyped {.inject.} = s.bellatrixData
template blck: untyped {.inject.} = b.bellatrixData
body
of BeaconStateFork.Altair:
const stateFork {.inject.} = BeaconStateFork.Altair
of ConsensusFork.Altair:
const stateFork {.inject.} = ConsensusFork.Altair
template forkyState: untyped {.inject.} = s.altairData
template blck: untyped {.inject.} = b.altairData
body
of BeaconStateFork.Phase0:
const stateFork {.inject.} = BeaconStateFork.Phase0
of ConsensusFork.Phase0:
const stateFork {.inject.} = ConsensusFork.Phase0
template forkyState: untyped {.inject.} = s.phase0Data
template blck: untyped {.inject.} = b.phase0Data
body
@ -912,35 +899,43 @@ func eip4844Fork*(cfg: RuntimeConfig): Fork =
func forkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): Fork =
case cfg.stateForkAtEpoch(epoch)
of BeaconStateFork.EIP4844: cfg.eip4844Fork
of BeaconStateFork.Capella: cfg.capellaFork
of BeaconStateFork.Bellatrix: cfg.bellatrixFork
of BeaconStateFork.Altair: cfg.altairFork
of BeaconStateFork.Phase0: cfg.genesisFork
of ConsensusFork.EIP4844: cfg.eip4844Fork
of ConsensusFork.Capella: cfg.capellaFork
of ConsensusFork.Bellatrix: cfg.bellatrixFork
of ConsensusFork.Altair: cfg.altairFork
of ConsensusFork.Phase0: cfg.genesisFork
func forkVersionAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): Version =
case cfg.stateForkAtEpoch(epoch)
of BeaconStateFork.EIP4844: cfg.EIP4844_FORK_VERSION
of BeaconStateFork.Capella: cfg.CAPELLA_FORK_VERSION
of BeaconStateFork.Bellatrix: cfg.BELLATRIX_FORK_VERSION
of BeaconStateFork.Altair: cfg.ALTAIR_FORK_VERSION
of BeaconStateFork.Phase0: cfg.GENESIS_FORK_VERSION
of ConsensusFork.EIP4844: cfg.EIP4844_FORK_VERSION
of ConsensusFork.Capella: cfg.CAPELLA_FORK_VERSION
of ConsensusFork.Bellatrix: cfg.BELLATRIX_FORK_VERSION
of ConsensusFork.Altair: cfg.ALTAIR_FORK_VERSION
of ConsensusFork.Phase0: cfg.GENESIS_FORK_VERSION
func nextForkEpochAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): Epoch =
case cfg.stateForkAtEpoch(epoch)
of BeaconStateFork.EIP4844: FAR_FUTURE_EPOCH
of BeaconStateFork.Capella: cfg.EIP4844_FORK_EPOCH
of BeaconStateFork.Bellatrix: cfg.CAPELLA_FORK_EPOCH
of BeaconStateFork.Altair: cfg.BELLATRIX_FORK_EPOCH
of BeaconStateFork.Phase0: cfg.ALTAIR_FORK_EPOCH
of ConsensusFork.EIP4844: FAR_FUTURE_EPOCH
of ConsensusFork.Capella: cfg.EIP4844_FORK_EPOCH
of ConsensusFork.Bellatrix: cfg.CAPELLA_FORK_EPOCH
of ConsensusFork.Altair: cfg.BELLATRIX_FORK_EPOCH
of ConsensusFork.Phase0: cfg.ALTAIR_FORK_EPOCH
func lcDataForkAtStateFork*(stateFork: BeaconStateFork): LightClientDataFork =
func forkVersion*(cfg: RuntimeConfig, consensusFork: ConsensusFork): Version =
case consensusFork
of ConsensusFork.Phase0: cfg.GENESIS_FORK_VERSION
of ConsensusFork.Altair: cfg.ALTAIR_FORK_VERSION
of ConsensusFork.Bellatrix: cfg.BELLATRIX_FORK_VERSION
of ConsensusFork.Capella: cfg.CAPELLA_FORK_VERSION
of ConsensusFork.EIP4844: cfg.EIP4844_FORK_VERSION
func lcDataForkAtStateFork*(stateFork: ConsensusFork): LightClientDataFork =
static: doAssert LightClientDataFork.high == LightClientDataFork.EIP4844
if stateFork >= BeaconStateFork.EIP4844:
if stateFork >= ConsensusFork.EIP4844:
LightClientDataFork.EIP4844
elif stateFork >= BeaconStateFork.Capella:
elif stateFork >= ConsensusFork.Capella:
LightClientDataFork.Capella
elif stateFork >= BeaconStateFork.Altair:
elif stateFork >= ConsensusFork.Altair:
LightClientDataFork.Altair
else:
LightClientDataFork.None
@ -1009,14 +1004,6 @@ func readSszForkedSignedBeaconBlock*(
withBlck(result):
readSszBytes(data, blck)
func toBeaconBlockFork*(fork: BeaconStateFork): BeaconBlockFork =
case fork
of BeaconStateFork.Phase0: BeaconBlockFork.Phase0
of BeaconStateFork.Altair: BeaconBlockFork.Altair
of BeaconStateFork.Bellatrix: BeaconBlockFork.Bellatrix
of BeaconStateFork.Capella: BeaconBlockFork.Capella
of BeaconStateFork.EIP4844: BeaconBlockFork.EIP4844
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/phase0/beacon-chain.md#compute_fork_data_root
func compute_fork_data_root*(current_version: Version,
genesis_validators_root: Eth2Digest): Eth2Digest =
@ -1043,7 +1030,7 @@ func compute_fork_digest*(current_version: Version,
func init*(T: type ForkDigests,
cfg: RuntimeConfig,
genesis_validators_root: Eth2Digest): T =
static: doAssert high(BeaconStateFork) == BeaconStateFork.EIP4844
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
T(
phase0:
compute_fork_digest(cfg.GENESIS_FORK_VERSION, genesis_validators_root),

View File

@ -339,7 +339,7 @@ func is_merge_transition_complete*(
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/sync/optimistic.md#helpers
func is_execution_block*(blck: SomeForkyBeaconBlock): bool =
when typeof(blck).toFork >= BeaconBlockFork.Bellatrix:
when typeof(blck).toFork >= ConsensusFork.Bellatrix:
const defaultExecutionPayload =
default(typeof(blck.body.execution_payload))
blck.body.execution_payload != defaultExecutionPayload
@ -420,12 +420,12 @@ proc payloadToBlockHeader*(
let
txRoot = payload.computeTransactionsTrieRoot()
withdrawalsRoot =
when typeof(payload).toFork >= BeaconBlockFork.Capella:
when typeof(payload).toFork >= ConsensusFork.Capella:
some payload.computeWithdrawalsTrieRoot()
else:
none(Hash256)
excessDataGas =
when typeof(payload).toFork >= BeaconBlockFork.EIP4844:
when typeof(payload).toFork >= ConsensusFork.EIP4844:
some payload.excess_data_gas
else:
none(UInt256)

View File

@ -146,7 +146,7 @@ func getDiscoveryForkID*(cfg: RuntimeConfig,
next_fork_epoch: FAR_FUTURE_EPOCH)
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-rc.1/specs/altair/p2p-interface.md#transitioning-the-gossip
type GossipState* = set[BeaconStateFork]
type GossipState* = set[ConsensusFork]
func getTargetGossipState*(
epoch, ALTAIR_FORK_EPOCH, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH,
EIP4844_FORK_EPOCH: Epoch, isBehind: bool): GossipState =
@ -166,22 +166,22 @@ func getTargetGossipState*(
var targetForks: GossipState
template maybeIncludeFork(
targetFork: BeaconStateFork, targetForkEpoch: Epoch,
targetFork: ConsensusFork, targetForkEpoch: Epoch,
successiveForkEpoch: Epoch) =
# Subscribe one epoch ahead
if epoch + 1 >= targetForkEpoch and epoch < successiveForkEpoch:
targetForks.incl targetFork
maybeIncludeFork(
BeaconStateFork.Phase0, GENESIS_EPOCH, ALTAIR_FORK_EPOCH)
ConsensusFork.Phase0, GENESIS_EPOCH, ALTAIR_FORK_EPOCH)
maybeIncludeFork(
BeaconStateFork.Altair, ALTAIR_FORK_EPOCH, BELLATRIX_FORK_EPOCH)
ConsensusFork.Altair, ALTAIR_FORK_EPOCH, BELLATRIX_FORK_EPOCH)
maybeIncludeFork(
BeaconStateFork.Bellatrix, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH)
ConsensusFork.Bellatrix, BELLATRIX_FORK_EPOCH, CAPELLA_FORK_EPOCH)
maybeIncludeFork(
BeaconStateFork.Capella, CAPELLA_FORK_EPOCH, EIP4844_FORK_EPOCH)
ConsensusFork.Capella, CAPELLA_FORK_EPOCH, EIP4844_FORK_EPOCH)
maybeIncludeFork(
BeaconStateFork.EIP4844, EIP4844_FORK_EPOCH, FAR_FUTURE_EPOCH)
ConsensusFork.EIP4844, EIP4844_FORK_EPOCH, FAR_FUTURE_EPOCH)
doAssert len(targetForks) <= 2
targetForks

View File

@ -376,7 +376,7 @@ proc collectSignatureSets*(
# 7. SyncAggregate
# ----------------------------------------------------
withState(state):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
if signed_block.message.body.sync_aggregate.sync_committee_bits.countOnes() == 0:
if signed_block.message.body.sync_aggregate.sync_committee_signature != ValidatorSig.infinity():
return err("collectSignatureSets: empty sync aggregates need signature of point at infinity")

View File

@ -172,10 +172,10 @@ func maybeUpgradeStateToAltair(
# Both process_slots() and state_transition_block() call this, so only run it
# once by checking for existing fork.
if getStateField(state, slot).epoch == cfg.ALTAIR_FORK_EPOCH and
state.kind == BeaconStateFork.Phase0:
state.kind == ConsensusFork.Phase0:
let newState = upgrade_to_altair(cfg, state.phase0Data.data)
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Altair,
kind: ConsensusFork.Altair,
altairData: altair.HashedBeaconState(
root: hash_tree_root(newState[]), data: newState[]))[]
@ -184,10 +184,10 @@ func maybeUpgradeStateToBellatrix(
# Both process_slots() and state_transition_block() call this, so only run it
# once by checking for existing fork.
if getStateField(state, slot).epoch == cfg.BELLATRIX_FORK_EPOCH and
state.kind == BeaconStateFork.Altair:
state.kind == ConsensusFork.Altair:
let newState = upgrade_to_bellatrix(cfg, state.altairData.data)
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: bellatrix.HashedBeaconState(
root: hash_tree_root(newState[]), data: newState[]))[]
@ -196,10 +196,10 @@ func maybeUpgradeStateToCapella(
# Both process_slots() and state_transition_block() call this, so only run it
# once by checking for existing fork.
if getStateField(state, slot).epoch == cfg.CAPELLA_FORK_EPOCH and
state.kind == BeaconStateFork.Bellatrix:
state.kind == ConsensusFork.Bellatrix:
let newState = upgrade_to_capella(cfg, state.bellatrixData.data)
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Capella,
kind: ConsensusFork.Capella,
capellaData: capella.HashedBeaconState(
root: hash_tree_root(newState[]), data: newState[]))[]
@ -208,10 +208,10 @@ func maybeUpgradeStateToEIP4844(
# Both process_slots() and state_transition_block() call this, so only run it
# once by checking for existing fork.
if getStateField(state, slot).epoch == cfg.EIP4844_FORK_EPOCH and
state.kind == BeaconStateFork.Capella:
state.kind == ConsensusFork.Capella:
let newState = upgrade_to_eip4844(cfg, state.capellaData.data)
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.EIP4844,
kind: ConsensusFork.EIP4844,
eip4844Data: eip4844.HashedBeaconState(
root: hash_tree_root(newState[]), data: newState[]))[]
@ -293,7 +293,7 @@ proc state_transition_block*(
doAssert not rollback.isNil, "use noRollback if it's ok to mess up state"
let res = withState(state):
when stateFork.toBeaconBlockFork() == type(signedBlock).toFork:
when stateFork == type(signedBlock).toFork:
state_transition_block_aux(cfg, forkyState, signedBlock, cache, flags)
else:
err("State/block fork mismatch")
@ -539,7 +539,7 @@ proc makeBeaconBlock*[T: bellatrix.ExecutionPayload | capella.ExecutionPayload |
# Override for MEV
if transactions_root.isSome and execution_payload_root.isSome:
withState(state):
when stateFork >= BeaconStateFork.Bellatrix:
when stateFork >= ConsensusFork.Bellatrix:
forkyState.data.latest_execution_payload_header.transactions_root =
transactions_root.get
@ -567,23 +567,23 @@ proc makeBeaconBlock*[T: bellatrix.ExecutionPayload | capella.ExecutionPayload |
when T is bellatrix.ExecutionPayload:
case state.kind
of BeaconStateFork.Phase0: makeBeaconBlock(phase0)
of BeaconStateFork.Altair: makeBeaconBlock(altair)
of BeaconStateFork.Bellatrix: makeBeaconBlock(bellatrix)
of BeaconStateFork.Capella, BeaconStateFork.EIP4844:
of ConsensusFork.Phase0: makeBeaconBlock(phase0)
of ConsensusFork.Altair: makeBeaconBlock(altair)
of ConsensusFork.Bellatrix: makeBeaconBlock(bellatrix)
of ConsensusFork.Capella, ConsensusFork.EIP4844:
raiseAssert "Attempt to use Bellatrix payload with post-Bellatrix state"
elif T is capella.ExecutionPayload:
case state.kind
of BeaconStateFork.Phase0, BeaconStateFork.Altair,
BeaconStateFork.Bellatrix, BeaconStateFork.EIP4844:
of ConsensusFork.Phase0, ConsensusFork.Altair,
ConsensusFork.Bellatrix, ConsensusFork.EIP4844:
raiseAssert "Attempt to use Capella payload with non-Capella state"
of BeaconStateFork.Capella: makeBeaconBlock(capella)
of ConsensusFork.Capella: makeBeaconBlock(capella)
elif T is eip4844.ExecutionPayload:
case state.kind
of BeaconStateFork.Phase0, BeaconStateFork.Altair,
BeaconStateFork.Bellatrix, BeaconStateFork.Capella:
of ConsensusFork.Phase0, ConsensusFork.Altair,
ConsensusFork.Bellatrix, ConsensusFork.Capella:
raiseAssert "Attempt to use EIP4844 payload with non-EIP4844 state"
of BeaconStateFork.EIP4844: makeBeaconBlock(eip4844)
of ConsensusFork.EIP4844: makeBeaconBlock(eip4844)
# workaround for https://github.com/nim-lang/Nim/issues/20900 rather than have

View File

@ -1679,15 +1679,15 @@ proc publishBlock*(
vc.firstSuccessParallel(RestPlainResponse, SlotDuration,
{BeaconNodeRole.BlockProposalPublish}):
case data.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
publishBlock(it, data.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
publishBlock(it, data.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
publishBlock(it, data.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
publishBlock(it, data.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": validator_client/api.nim:publishBlock (1)"
let f = newFuture[RestPlainResponse]("")
f.fail(new RestError)
@ -1734,15 +1734,15 @@ proc publishBlock*(
vc.firstSuccessSequential(RestPlainResponse, SlotDuration,
{BeaconNodeRole.BlockProposalPublish}):
case data.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
publishBlock(it, data.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
publishBlock(it, data.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
publishBlock(it, data.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
publishBlock(it, data.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": validator_client/api.nim:publishBlock (2)"
let f = newFuture[RestPlainResponse]("")
f.fail(new RestError)
@ -1884,15 +1884,15 @@ proc publishBlindedBlock*(
vc.firstSuccessParallel(RestPlainResponse, SlotDuration,
{BeaconNodeRole.BlockProposalPublish}):
case data.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
publishBlindedBlock(it, data.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
publishBlindedBlock(it, data.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
publishBlindedBlock(it, data.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
publishBlindedBlock(it, data.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": validator_client/api.nim:publishBlindedBlock (1)"
let f = newFuture[RestPlainResponse]("")
f.fail(new RestError)
@ -1938,15 +1938,15 @@ proc publishBlindedBlock*(
vc.firstSuccessSequential(RestPlainResponse, SlotDuration,
{BeaconNodeRole.BlockProposalPublish}):
case data.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
publishBlindedBlock(it, data.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
publishBlindedBlock(it, data.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
publishBlindedBlock(it, data.bellatrixData)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
publishBlindedBlock(it, data.capellaData)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": validator_client/api.nim:publishBlindedBlock (2)"
let f = newFuture[RestPlainResponse]("")
f.fail(new RestError)

View File

@ -277,7 +277,7 @@ proc routeSyncCommitteeMessages*(
router: ref MessageRouter, msgs: seq[SyncCommitteeMessage]):
Future[seq[SendResult]] {.async.} =
return withState(router[].dag.headState):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
var statuses = newSeq[Option[SendResult]](len(msgs))
let

View File

@ -356,14 +356,14 @@ proc getExecutionPayload[T](
# transmit this information through the Forked types, so this has to
# be re-proven here.
withState(proposalState[]):
when (stateFork == BeaconStateFork.EIP4844 and
when (stateFork == ConsensusFork.EIP4844 and
T is eip4844.ExecutionPayload) or
(stateFork == BeaconStateFork.Capella and
(stateFork == ConsensusFork.Capella and
T is capella.ExecutionPayload) or
(stateFork == BeaconStateFork.Bellatrix and
(stateFork == ConsensusFork.Bellatrix and
T is bellatrix.ExecutionPayload):
build_empty_execution_payload(forkyState.data, feeRecipient)
elif stateFork >= BeaconStateFork.Bellatrix:
elif stateFork >= ConsensusFork.Bellatrix:
raiseAssert "getExecutionPayload: mismatched proposalState and ExecutionPayload fork"
else:
default(T)
@ -394,7 +394,7 @@ proc getExecutionPayload[T](
timestamp = withState(proposalState[]):
compute_timestamp_at_slot(forkyState.data, forkyState.data.slot)
withdrawals = withState(proposalState[]):
when stateFork >= BeaconStateFork.Capella:
when stateFork >= ConsensusFork.Capella:
Opt.some get_expected_withdrawals(forkyState.data)
else:
Opt.none(seq[Withdrawal])

View File

@ -369,25 +369,25 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
let
web3SignerBlock =
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: blck.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Altair,
kind: ConsensusFork.Altair,
altairData: blck.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: blck.bellatrixData.toBeaconBlockHeader)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Capella,
kind: ConsensusFork.Capella,
capellaData: blck.capellaData.toBeaconBlockHeader)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.EIP4844,
kind: ConsensusFork.EIP4844,
eip4844Data: blck.eip4844Data.toBeaconBlockHeader)
request = Web3SignerRequest.init(
@ -397,32 +397,32 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
let request = Web3SignerRequest.init(
fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: blck.toBeaconBlockHeader))
await v.signData(request)
else:
let
web3SignerBlock =
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: blck.phase0Data)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Altair,
kind: ConsensusFork.Altair,
altairData: blck.altairData)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: blck.bellatrixData.toBeaconBlockHeader)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.Capella,
kind: ConsensusFork.Capella,
capellaData: blck.capellaData.toBeaconBlockHeader)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
Web3SignerForkedBeaconBlock(
kind: BeaconBlockFork.EIP4844,
kind: ConsensusFork.EIP4844,
eip4844Data: blck.eip4844Data.toBeaconBlockHeader)
request = Web3SignerRequest.init(

View File

@ -81,11 +81,11 @@ type
template saveSSZFile(filename: string, value: ForkedHashedBeaconState) =
case value.kind:
of BeaconStateFork.Phase0: SSZ.saveFile(filename, value.phase0Data.data)
of BeaconStateFork.Altair: SSZ.saveFile(filename, value.altairData.data)
of BeaconStateFork.Bellatrix: SSZ.saveFile(filename, value.bellatrixData.data)
of BeaconStateFork.Capella: SSZ.saveFile(filename, value.capellaData.data)
of BeaconStateFork.EIP4844: SSZ.saveFile(filename, value.eip4844Data.data)
of ConsensusFork.Phase0: SSZ.saveFile(filename, value.phase0Data.data)
of ConsensusFork.Altair: SSZ.saveFile(filename, value.altairData.data)
of ConsensusFork.Bellatrix: SSZ.saveFile(filename, value.bellatrixData.data)
of ConsensusFork.Capella: SSZ.saveFile(filename, value.capellaData.data)
of ConsensusFork.EIP4844: SSZ.saveFile(filename, value.eip4844Data.data)
proc loadFile(filename: string, T: type): T =
let

View File

@ -56,7 +56,7 @@ const
func copyParticipationFlags*(auxiliaryState: var AuxiliaryState,
forkedState: ForkedHashedBeaconState) =
withState(forkedState):
when stateFork > BeaconStateFork.Phase0:
when stateFork > ConsensusFork.Phase0:
template flags: untyped = auxiliaryState.epochParticipationFlags
flags.currentEpochParticipation =
forkyState.data.current_epoch_participation
@ -367,7 +367,7 @@ func collectFromAttestations(
epochParticipationFlags: var ParticipationFlags,
cache: var StateCache) =
withStateAndBlck(forkedState, forkedBlock):
when stateFork > BeaconStateFork.Phase0:
when stateFork > ConsensusFork.Phase0:
let base_reward_per_increment = get_base_reward_per_increment(
get_total_active_balance(forkyState.data, cache))
doAssert base_reward_per_increment > 0
@ -418,7 +418,7 @@ func collectFromSyncAggregate(
forkedBlock: ForkedTrustedSignedBeaconBlock,
cache: var StateCache) =
withStateAndBlck(forkedState, forkedBlock):
when stateFork > BeaconStateFork.Phase0:
when stateFork > ConsensusFork.Phase0:
let
total_active_balance = get_total_active_balance(forkyState.data, cache)
participant_reward = get_participant_reward(total_active_balance)

View File

@ -251,19 +251,19 @@ proc cmdBench(conf: DbConf, cfg: RuntimeConfig) =
withTimer(timers[tLoadBlock]):
case cfg.blockForkAtEpoch(blck.slot.epoch)
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
blocks[0].add dag.db.getBlock(
blck.root, phase0.TrustedSignedBeaconBlock).get()
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
blocks[1].add dag.db.getBlock(
blck.root, altair.TrustedSignedBeaconBlock).get()
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
blocks[2].add dag.db.getBlock(
blck.root, bellatrix.TrustedSignedBeaconBlock).get()
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
blocks[3].add dag.db.getBlock(
blck.root, capella.TrustedSignedBeaconBlock).get()
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
raiseAssert $eip4844ImplementationMissing
let stateData = newClone(dag.headState)
@ -321,28 +321,28 @@ proc cmdBench(conf: DbConf, cfg: RuntimeConfig) =
withTimer(timers[tDbLoad]):
case stateFork
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
doAssert dbBenchmark.getState(
forkyState.root, loadedState[0][].data, noRollback)
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
doAssert dbBenchmark.getState(
forkyState.root, loadedState[1][].data, noRollback)
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
doAssert dbBenchmark.getState(
forkyState.root, loadedState[2][].data, noRollback)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
doAssert dbBenchmark.getState(
forkyState.root, loadedState[3][].data, noRollback)
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
raiseAssert $eip4844ImplementationMissing & ": ncli_db.nim: cmdBench (1)"
if forkyState.data.slot.epoch mod 16 == 0:
let loadedRoot = case stateFork
of BeaconStateFork.Phase0: hash_tree_root(loadedState[0][].data)
of BeaconStateFork.Altair: hash_tree_root(loadedState[1][].data)
of BeaconStateFork.Bellatrix: hash_tree_root(loadedState[2][].data)
of BeaconStateFork.Capella: hash_tree_root(loadedState[3][].data)
of BeaconStateFork.EIP4844: raiseAssert $eip4844ImplementationMissing & ": ncli_db.nim: cmdBench (2)"
of ConsensusFork.Phase0: hash_tree_root(loadedState[0][].data)
of ConsensusFork.Altair: hash_tree_root(loadedState[1][].data)
of ConsensusFork.Bellatrix: hash_tree_root(loadedState[2][].data)
of ConsensusFork.Capella: hash_tree_root(loadedState[3][].data)
of ConsensusFork.EIP4844: raiseAssert $eip4844ImplementationMissing & ": ncli_db.nim: cmdBench (2)"
doAssert hash_tree_root(forkyState.data) == loadedRoot
processBlocks(blocks[0])
@ -1035,7 +1035,7 @@ proc cmdValidatorDb(conf: DbConf, cfg: RuntimeConfig) =
if nextSlot.is_epoch:
withState(tmpState[]):
var stateData = newClone(forkyState.data)
when stateFork == BeaconStateFork.EIP4844:
when stateFork == ConsensusFork.EIP4844:
debugRaiseAssert $eip4844ImplementationMissing & ": ncli_db.nim:cmdValidatorDb"
else:
rewardsAndPenalties.collectEpochRewardsAndPenalties(

View File

@ -117,7 +117,7 @@ proc nfuzz_block(input: openArray[byte], xoutput: ptr byte,
fhState = (ref ForkedHashedBeaconState)(
phase0Data: phase0.HashedBeaconState(
data: data.state, root: hash_tree_root(data.state)),
kind: BeaconStateFork.Phase0)
kind: ConsensusFork.Phase0)
cache = StateCache()
info = ForkedEpochInfo()
result =

View File

@ -701,11 +701,11 @@ cli do(slots = SLOTS_PER_EPOCH * 6,
if blockRatio > 0.0:
withTimer(timers[t]):
case dag.cfg.stateForkAtEpoch(slot.epoch)
of BeaconStateFork.EIP4844: proposeEIP4844Block(slot)
of BeaconStateFork.Capella: proposeCapellaBlock(slot)
of BeaconStateFork.Bellatrix: proposeBellatrixBlock(slot)
of BeaconStateFork.Altair: proposeAltairBlock(slot)
of BeaconStateFork.Phase0: proposePhase0Block(slot)
of ConsensusFork.EIP4844: proposeEIP4844Block(slot)
of ConsensusFork.Capella: proposeCapellaBlock(slot)
of ConsensusFork.Bellatrix: proposeBellatrixBlock(slot)
of ConsensusFork.Altair: proposeAltairBlock(slot)
of ConsensusFork.Phase0: proposePhase0Block(slot)
if attesterRatio > 0.0:
withTimer(timers[tAttest]):
handleAttestations(slot)

View File

@ -111,7 +111,7 @@ proc loadGenesis*(validators: Natural, validate: bool):
depositContractState: merkleizer.toDepositContractState)
let res = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
cfg, ZERO_HASH, 0, deposits, flags))

View File

@ -168,7 +168,7 @@ cli do(validatorsDir: string, secretsDir: string,
cache).get()
case message.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
blockRoot = hash_tree_root(message.phase0Data)
let signedBlock = phase0.SignedBeaconBlock(
message: message.phase0Data,
@ -177,7 +177,7 @@ cli do(validatorsDir: string, secretsDir: string,
fork, genesis_validators_root, slot, blockRoot,
validators[proposer]).toValidatorSig())
dump(".", signedBlock)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
blockRoot = hash_tree_root(message.altairData)
let signedBlock = altair.SignedBeaconBlock(
message: message.altairData,
@ -186,7 +186,7 @@ cli do(validatorsDir: string, secretsDir: string,
fork, genesis_validators_root, slot, blockRoot,
validators[proposer]).toValidatorSig())
dump(".", signedBlock)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
blockRoot = hash_tree_root(message.bellatrixData)
let signedBlock = bellatrix.SignedBeaconBlock(
message: message.bellatrixData,
@ -195,7 +195,7 @@ cli do(validatorsDir: string, secretsDir: string,
fork, genesis_validators_root, slot, blockRoot,
validators[proposer]).toValidatorSig())
dump(".", signedBlock)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
blockRoot = hash_tree_root(message.capellaData)
let signedBlock = capella.SignedBeaconBlock(
message: message.capellaData,
@ -204,7 +204,7 @@ cli do(validatorsDir: string, secretsDir: string,
fork, genesis_validators_root, slot, blockRoot,
validators[proposer]).toValidatorSig())
dump(".", signedBlock)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
blockRoot = hash_tree_root(message.eip4844Data)
let signedBlock = eip4844.SignedBeaconBlock(
message: message.eip4844Data,
@ -255,7 +255,7 @@ cli do(validatorsDir: string, secretsDir: string,
aggregates.add(attestation)
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
let
nextSlot = slot + 1
pubkeys =

View File

@ -25,8 +25,8 @@ export
# #######################
# Path parsing
func forkForPathComponent*(forkPath: string): Opt[BeaconStateFork] =
for fork in BeaconStateFork:
func forkForPathComponent*(forkPath: string): Opt[ConsensusFork] =
for fork in ConsensusFork:
if ($fork).toLowerAscii() == forkPath:
return ok fork
err()
@ -41,24 +41,24 @@ func readValue*(r: var JsonReader, a: var seq[byte]) =
# #######################
# Mock RuntimeConfig
func genesisTestRuntimeConfig*(stateFork: BeaconStateFork): RuntimeConfig =
func genesisTestRuntimeConfig*(stateFork: ConsensusFork): RuntimeConfig =
var res = defaultRuntimeConfig
case stateFork
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
res.EIP4844_FORK_EPOCH = GENESIS_EPOCH
res.CAPELLA_FORK_EPOCH = GENESIS_EPOCH
res.BELLATRIX_FORK_EPOCH = GENESIS_EPOCH
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
res.CAPELLA_FORK_EPOCH = GENESIS_EPOCH
res.BELLATRIX_FORK_EPOCH = GENESIS_EPOCH
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
res.BELLATRIX_FORK_EPOCH = GENESIS_EPOCH
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
res.ALTAIR_FORK_EPOCH = GENESIS_EPOCH
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
discard
res
@ -127,32 +127,32 @@ from ../../beacon_chain/spec/datatypes/capella import BeaconState
from ../../beacon_chain/spec/datatypes/eip4844 import BeaconState
proc loadForkedState*(
path: string, fork: BeaconStateFork): ref ForkedHashedBeaconState =
path: string, fork: ConsensusFork): ref ForkedHashedBeaconState =
var forkedState: ref ForkedHashedBeaconState
case fork
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
let state = newClone(parseTest(path, SSZ, eip4844.BeaconState))
forkedState = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.EIP4844)
forkedState = (ref ForkedHashedBeaconState)(kind: ConsensusFork.EIP4844)
forkedState.eip4844Data.data = state[]
forkedState.eip4844Data.root = hash_tree_root(state[])
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
let state = newClone(parseTest(path, SSZ, capella.BeaconState))
forkedState = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.Capella)
forkedState = (ref ForkedHashedBeaconState)(kind: ConsensusFork.Capella)
forkedState.capellaData.data = state[]
forkedState.capellaData.root = hash_tree_root(state[])
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
let state = newClone(parseTest(path, SSZ, bellatrix.BeaconState))
forkedState = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.Bellatrix)
forkedState = (ref ForkedHashedBeaconState)(kind: ConsensusFork.Bellatrix)
forkedState.bellatrixData.data = state[]
forkedState.bellatrixData.root = hash_tree_root(state[])
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
let state = newClone(parseTest(path, SSZ, altair.BeaconState))
forkedState = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.Altair)
forkedState = (ref ForkedHashedBeaconState)(kind: ConsensusFork.Altair)
forkedState.altairData.data = state[]
forkedState.altairData.root = hash_tree_root(state[])
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
let state = newClone(parseTest(path, SSZ, phase0.BeaconState))
forkedState = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.Phase0)
forkedState = (ref ForkedHashedBeaconState)(kind: ConsensusFork.Phase0)
forkedState.phase0Data.data = state[]
forkedState.phase0Data.root = hash_tree_root(state[])
forkedState

View File

@ -126,7 +126,7 @@ proc initialLoad(
(dag, fkChoice)
proc loadOps(path: string, fork: BeaconStateFork): seq[Operation] =
proc loadOps(path: string, fork: ConsensusFork): seq[Operation] =
let stepsYAML = readFile(path/"steps.yaml")
let steps = yaml.loadToJson(stepsYAML)
@ -146,35 +146,35 @@ proc loadOps(path: string, fork: BeaconStateFork): seq[Operation] =
elif step.hasKey"block":
let filename = step["block"].getStr()
case fork
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
let blck = parseTest(
path/filename & ".ssz_snappy",
SSZ, phase0.SignedBeaconBlock
)
result.add Operation(kind: opOnBlock,
blck: ForkedSignedBeaconBlock.init(blck))
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
let blck = parseTest(
path/filename & ".ssz_snappy",
SSZ, altair.SignedBeaconBlock
)
result.add Operation(kind: opOnBlock,
blck: ForkedSignedBeaconBlock.init(blck))
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
let blck = parseTest(
path/filename & ".ssz_snappy",
SSZ, bellatrix.SignedBeaconBlock
)
result.add Operation(kind: opOnBlock,
blck: ForkedSignedBeaconBlock.init(blck))
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
let blck = parseTest(
path/filename & ".ssz_snappy",
SSZ, capella.SignedBeaconBlock
)
result.add Operation(kind: opOnBlock,
blck: ForkedSignedBeaconBlock.init(blck))
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
let blck = parseTest(
path/filename & ".ssz_snappy",
SSZ, eip4844.SignedBeaconBlock
@ -228,7 +228,7 @@ proc stepOnBlock(
)
# 2. Add block to DAG
static: doAssert high(BeaconBlockFork) == BeaconBlockFork.EIP4844
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
when signedBlock is phase0.SignedBeaconBlock:
type TrustedBlock = phase0.TrustedSignedBeaconBlock
elif signedBlock is altair.SignedBeaconBlock:
@ -330,22 +330,22 @@ proc stepChecks(
else:
doAssert false, "Unsupported check '" & $check & "'"
proc doRunTest(path: string, fork: BeaconStateFork) =
proc doRunTest(path: string, fork: ConsensusFork) =
let db = BeaconChainDB.new("", inMemory = true)
defer:
db.close()
let stores =
case fork
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
initialLoad(path, db, eip4844.BeaconState, eip4844.BeaconBlock)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
initialLoad(path, db, capella.BeaconState, capella.BeaconBlock)
of BeaconStateFork.Bellatrix:
of ConsensusFork.Bellatrix:
initialLoad(path, db, bellatrix.BeaconState, bellatrix.BeaconBlock)
of BeaconStateFork.Altair:
of ConsensusFork.Altair:
initialLoad(path, db, altair.BeaconState, altair.BeaconBlock)
of BeaconStateFork.Phase0:
of ConsensusFork.Phase0:
initialLoad(path, db, phase0.BeaconState, phase0.BeaconBlock)
var
@ -391,7 +391,7 @@ proc doRunTest(path: string, fork: BeaconStateFork) =
else:
doAssert false, "Unsupported"
proc runTest(testType: static[string], path: string, fork: BeaconStateFork) =
proc runTest(testType: static[string], path: string, fork: ConsensusFork) =
const SKIP = [
# protoArray can handle blocks in the future gracefully
# spec: https://github.com/ethereum/consensus-specs/blame/v1.1.3/specs/phase0/fork-choice.md#L349

View File

@ -64,12 +64,11 @@ suite "EF - Light client - Single merkle proof" & preset():
continue
let objName = path
withStateFork(fork):
const blockFork = stateFork.toBeaconBlockFork()
for kind, path in walkDir(suitePath, relative = true, checkDir = true):
case objName
of "BeaconBlockBody":
runTest(suitePath/path, blockFork.BeaconBlockBody)
runTest(suitePath/path, BeaconBlockBodyType(stateFork))
of "BeaconState":
runTest(suitePath/path, stateFork.BeaconState)
runTest(suitePath/path, BeaconStateType(stateFork))
else:
raiseAssert "Unknown test object: " & suitePath/path

View File

@ -26,7 +26,7 @@ proc initGenesisState*(
)
result = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
cfg, eth1BlockHash, 0, deposits, {}))

View File

@ -99,7 +99,7 @@ func withDigest(blck: eip4844.TrustedBeaconBlock):
root: hash_tree_root(blck)
)
proc getTestStates(stateFork: BeaconStateFork): auto =
proc getTestStates(stateFork: ConsensusFork): auto =
let
db = makeTestDB(SLOTS_PER_EPOCH)
validatorMonitor = newClone(ValidatorMonitor.init())
@ -114,11 +114,11 @@ proc getTestStates(stateFork: BeaconStateFork): auto =
# Each set of states gets used twice, so scope them to module
let
testStatesPhase0 = getTestStates(BeaconStateFork.Phase0)
testStatesAltair = getTestStates(BeaconStateFork.Altair)
testStatesBellatrix = getTestStates(BeaconStateFork.Bellatrix)
testStatesCapella = getTestStates(BeaconStateFork.Capella)
testStatesEIP4844 = getTestStates(BeaconStateFork.EIP4844)
testStatesPhase0 = getTestStates(ConsensusFork.Phase0)
testStatesAltair = getTestStates(ConsensusFork.Altair)
testStatesBellatrix = getTestStates(ConsensusFork.Bellatrix)
testStatesCapella = getTestStates(ConsensusFork.Capella)
testStatesEIP4844 = getTestStates(ConsensusFork.EIP4844)
doAssert len(testStatesPhase0) > 8
doAssert len(testStatesAltair) > 8
doAssert len(testStatesBellatrix) > 8
@ -158,7 +158,7 @@ suite "Beacon chain DB" & preset():
uncompressedLenFramed(tmp2).isSome
check:
db.delBlock(BeaconBlockFork.Phase0, root)
db.delBlock(ConsensusFork.Phase0, root)
not db.containsBlock(root)
not db.containsBlock(root, phase0.TrustedSignedBeaconBlock)
not db.containsBlock(root, altair.TrustedSignedBeaconBlock)
@ -205,7 +205,7 @@ suite "Beacon chain DB" & preset():
uncompressedLenFramed(tmp2).isSome
check:
db.delBlock(BeaconBlockFork.Altair, root)
db.delBlock(ConsensusFork.Altair, root)
not db.containsBlock(root)
not db.containsBlock(root, phase0.TrustedSignedBeaconBlock)
not db.containsBlock(root, altair.TrustedSignedBeaconBlock)
@ -252,7 +252,7 @@ suite "Beacon chain DB" & preset():
uncompressedLenFramed(tmp2).isSome
check:
db.delBlock(BeaconBlockFork.Bellatrix, root)
db.delBlock(ConsensusFork.Bellatrix, root)
not db.containsBlock(root)
not db.containsBlock(root, phase0.TrustedSignedBeaconBlock)
not db.containsBlock(root, altair.TrustedSignedBeaconBlock)
@ -299,7 +299,7 @@ suite "Beacon chain DB" & preset():
uncompressedLenFramed(tmp2).isSome
check:
db.delBlock(BeaconBlockFork.Capella, root)
db.delBlock(ConsensusFork.Capella, root)
not db.containsBlock(root)
not db.containsBlock(root, phase0.TrustedSignedBeaconBlock)
not db.containsBlock(root, altair.TrustedSignedBeaconBlock)
@ -346,7 +346,7 @@ suite "Beacon chain DB" & preset():
uncompressedLenFramed(tmp2).isSome
check:
db.delBlock(BeaconBlockFork.EIP4844, root)
db.delBlock(ConsensusFork.EIP4844, root)
not db.containsBlock(root)
not db.containsBlock(root, phase0.TrustedSignedBeaconBlock)
not db.containsBlock(root, altair.TrustedSignedBeaconBlock)
@ -379,7 +379,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(db.getPhase0StateRef(root)[]) == root
db.delState(BeaconStateFork.Phase0, root)
db.delState(ConsensusFork.Phase0, root)
check:
not db.containsState(root)
db.getPhase0StateRef(root).isNil
@ -397,7 +397,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(db.getAltairStateRef(root)[]) == root
db.delState(BeaconStateFork.Altair, root)
db.delState(ConsensusFork.Altair, root)
check:
not db.containsState(root)
db.getAltairStateRef(root).isNil
@ -415,7 +415,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(db.getBellatrixStateRef(root)[]) == root
db.delState(BeaconStateFork.Bellatrix, root)
db.delState(ConsensusFork.Bellatrix, root)
check:
not db.containsState(root)
db.getBellatrixStateRef(root).isNil
@ -433,7 +433,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(db.getCapellaStateRef(root)[]) == root
db.delState(BeaconStateFork.Capella, root)
db.delState(ConsensusFork.Capella, root)
check:
not db.containsState(root)
db.getCapellaStateRef(root).isNil
@ -451,7 +451,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(db.getEIP4844StateRef(root)[]) == root
db.delState(BeaconStateFork.EIP4844, root)
db.delState(ConsensusFork.EIP4844, root)
check:
not db.containsState(root)
db.getEIP4844StateRef(root).isNil
@ -471,7 +471,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(stateBuffer[]) == root
db.delState(BeaconStateFork.Phase0, root)
db.delState(ConsensusFork.Phase0, root)
check:
not db.containsState(root)
not db.getState(root, stateBuffer[], noRollback)
@ -491,7 +491,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(stateBuffer[]) == root
db.delState(BeaconStateFork.Altair, root)
db.delState(ConsensusFork.Altair, root)
check:
not db.containsState(root)
not db.getState(root, stateBuffer[], noRollback)
@ -511,7 +511,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(stateBuffer[]) == root
db.delState(BeaconStateFork.Bellatrix, root)
db.delState(ConsensusFork.Bellatrix, root)
check:
not db.containsState(root)
not db.getState(root, stateBuffer[], noRollback)
@ -531,7 +531,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(stateBuffer[]) == root
db.delState(BeaconStateFork.Capella, root)
db.delState(ConsensusFork.Capella, root)
check:
not db.containsState(root)
not db.getState(root, stateBuffer[], noRollback)
@ -551,7 +551,7 @@ suite "Beacon chain DB" & preset():
db.containsState(root)
hash_tree_root(stateBuffer[]) == root
db.delState(BeaconStateFork.EIP4844, root)
db.delState(ConsensusFork.EIP4844, root)
check:
not db.containsState(root)
not db.getState(root, stateBuffer[], noRollback)
@ -564,12 +564,12 @@ suite "Beacon chain DB" & preset():
validatorMonitor = newClone(ValidatorMonitor.init())
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: phase0.HashedBeaconState(data: phase0.BeaconState(
slot: 10.Slot)))
root = Eth2Digest()
db.putCorruptState(BeaconStateFork.Phase0, root)
db.putCorruptState(ConsensusFork.Phase0, root)
let restoreAddr = addr dag.headState
@ -587,12 +587,12 @@ suite "Beacon chain DB" & preset():
validatorMonitor = newClone(ValidatorMonitor.init())
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Altair,
kind: ConsensusFork.Altair,
altairData: altair.HashedBeaconState(data: altair.BeaconState(
slot: 10.Slot)))
root = Eth2Digest()
db.putCorruptState(BeaconStateFork.Altair, root)
db.putCorruptState(ConsensusFork.Altair, root)
let restoreAddr = addr dag.headState
@ -604,7 +604,7 @@ suite "Beacon chain DB" & preset():
not db.getState(root, state[].altairData.data, restore)
# assign() has switched the case object fork
state[].kind == BeaconStateFork.Phase0
state[].kind == ConsensusFork.Phase0
state[].phase0Data.data.slot != 10.Slot
test "sanity check Bellatrix and cross-fork getState rollback" & preset():
@ -613,12 +613,12 @@ suite "Beacon chain DB" & preset():
validatorMonitor = newClone(ValidatorMonitor.init())
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Bellatrix,
kind: ConsensusFork.Bellatrix,
bellatrixData: bellatrix.HashedBeaconState(data: bellatrix.BeaconState(
slot: 10.Slot)))
root = Eth2Digest()
db.putCorruptState(BeaconStateFork.Bellatrix, root)
db.putCorruptState(ConsensusFork.Bellatrix, root)
let restoreAddr = addr dag.headState
@ -630,7 +630,7 @@ suite "Beacon chain DB" & preset():
not db.getState(root, state[].bellatrixData.data, restore)
# assign() has switched the case object fork
state[].kind == BeaconStateFork.Phase0
state[].kind == ConsensusFork.Phase0
state[].phase0Data.data.slot != 10.Slot
test "sanity check Capella and cross-fork getState rollback" & preset():
@ -639,12 +639,12 @@ suite "Beacon chain DB" & preset():
validatorMonitor = newClone(ValidatorMonitor.init())
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Capella,
kind: ConsensusFork.Capella,
capellaData: capella.HashedBeaconState(data: capella.BeaconState(
slot: 10.Slot)))
root = Eth2Digest()
db.putCorruptState(BeaconStateFork.Capella, root)
db.putCorruptState(ConsensusFork.Capella, root)
let restoreAddr = addr dag.headState
@ -656,7 +656,7 @@ suite "Beacon chain DB" & preset():
not db.getState(root, state[].capellaData.data, restore)
# assign() has switched the case object fork
state[].kind == BeaconStateFork.Phase0
state[].kind == ConsensusFork.Phase0
state[].phase0Data.data.slot != 10.Slot
test "sanity check EIP4844 and cross-fork getState rollback" & preset():
@ -665,12 +665,12 @@ suite "Beacon chain DB" & preset():
validatorMonitor = newClone(ValidatorMonitor.init())
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.EIP4844,
kind: ConsensusFork.EIP4844,
eip4844Data: eip4844.HashedBeaconState(data: eip4844.BeaconState(
slot: 10.Slot)))
root = Eth2Digest()
db.putCorruptState(BeaconStateFork.EIP4844, root)
db.putCorruptState(ConsensusFork.EIP4844, root)
let restoreAddr = addr dag.headState
@ -682,7 +682,7 @@ suite "Beacon chain DB" & preset():
not db.getState(root, state[].eip4844Data.data, restore)
# assign() has switched the case object fork
state[].kind == BeaconStateFork.Phase0
state[].kind == ConsensusFork.Phase0
state[].phase0Data.data.slot != 10.Slot
test "find ancestors" & preset():
@ -734,7 +734,7 @@ suite "Beacon chain DB" & preset():
check db.containsState(state[].root)
let state2 = db.getPhase0StateRef(state[].root)
db.delState(BeaconStateFork.Phase0, state[].root)
db.delState(ConsensusFork.Phase0, state[].root)
check not db.containsState(state[].root)
db.close()

View File

@ -300,7 +300,7 @@ suite "Block pool altair processing" & preset():
cfg, state[], cfg.ALTAIR_FORK_EPOCH.start_slot(), cache,
info, {}).isOk()
state[].kind == BeaconStateFork.Altair
state[].kind == ConsensusFork.Altair
var
b1 = addTestBlock(state[], cache).altairData
@ -535,7 +535,7 @@ suite "chain DAG finalization tests" & preset():
check: dag2.getForkedBlock(lateBlock.root).isNone
test "orphaned epoch block" & preset():
let prestate = (ref ForkedHashedBeaconState)(kind: BeaconStateFork.Phase0)
let prestate = (ref ForkedHashedBeaconState)(kind: ConsensusFork.Phase0)
for i in 0 ..< SLOTS_PER_EPOCH:
if i == SLOTS_PER_EPOCH - 1:
assign(prestate[], dag.headState)
@ -743,7 +743,7 @@ suite "Backfill":
setup:
let
genState = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH.uint64, flags = {skipBlsValidation}),
@ -937,7 +937,7 @@ suite "Starting states":
setup:
let
genState = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH.uint64, flags = {skipBlsValidation}),

View File

@ -34,6 +34,14 @@ template testTrustedSignedBeaconBlock(T: type, s: Slot) =
check:
forked.kind == T.toFork()
suite "Type helpers":
test "BeaconBlockType":
check:
BeaconBlockType(ConsensusFork.Phase0) is phase0.BeaconBlock
BeaconBlockType(ConsensusFork.Bellatrix) is bellatrix.BeaconBlock
BeaconBlockBodyType(ConsensusFork.Altair) is altair.BeaconBlockBody
BeaconBlockBodyType(ConsensusFork.Bellatrix) is bellatrix.BeaconBlockBody
suite "Forked SSZ readers":
var
cfg = defaultRuntimeConfig

View File

@ -18,490 +18,490 @@ template getTargetGossipState(a, b, c, d, e: int, isBehind: bool): auto =
suite "Gossip fork transition":
test "Gossip fork transition":
check:
getTargetGossipState( 5, 0, 1, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 0, 1, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 4, 7, 9, 11, true) == {}
getTargetGossipState( 3, 0, 5, 6, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 2, 6, 10, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 4, 6, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 9, 2, 4, 9, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 2, 3, 5, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 9, 0, 4, 8, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 1, 2, 3, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState(11, 3, 4, 5, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 3, 0, 5, 6, 10, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 2, 6, 10, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 4, 6, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 9, 2, 4, 9, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 2, 3, 5, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 9, 0, 4, 8, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 7, 1, 2, 3, 10, false) == {ConsensusFork.Capella}
getTargetGossipState(11, 3, 4, 5, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 0, 1, 2, 3, true) == {}
getTargetGossipState(10, 0, 6, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 1, 3, 4, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 3, 7, 10, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState(10, 0, 5, 8, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 8, 1, 3, 6, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 1, 4, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 3, 0, 5, 7, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 3, 2, 3, 4, 7, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 4, 3, 6, 7, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 2, 6, 7, 9, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(11, 1, 5, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 0, 6, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 1, 3, 4, 7, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 3, 7, 10, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState(10, 0, 5, 8, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 8, 1, 3, 6, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 1, 4, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 3, 0, 5, 7, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 3, 2, 3, 4, 7, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 4, 3, 6, 7, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 2, 6, 7, 9, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(11, 1, 5, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 2, 7, 10, true) == {}
getTargetGossipState( 2, 1, 2, 3, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 4, 0, 4, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 4, 5, 7, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 0, 0, 4, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 5, 7, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 0, 2, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 1, 2, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 0, 2, 3, 6, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 2, 2, 6, 8, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 0, 6, 8, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 2, 1, 2, 3, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 4, 0, 4, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 4, 4, 5, 7, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 8, 0, 0, 4, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 5, 7, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 6, 0, 2, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 1, 2, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 5, 0, 2, 3, 6, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 2, 2, 6, 8, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 0, 6, 8, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 8, 0, 0, 2, 3, true) == {}
getTargetGossipState( 4, 3, 7, 8, 9, true) == {}
getTargetGossipState( 0, 0, 2, 5, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 1, 3, 4, 5, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 5, 2, 6, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 7, 0, 1, 4, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 3, 2, 3, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 0, 2, 5, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 1, 3, 4, 5, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 5, 2, 6, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 7, 0, 1, 4, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 3, 2, 3, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 8, 3, 5, 9, 11, true) == {}
getTargetGossipState( 9, 3, 6, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 1, 2, 8, 9, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 6, 2, 7, 8, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 3, 4, 6, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 1, 3, 5, 8, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 9, 3, 6, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 1, 2, 8, 9, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 6, 2, 7, 8, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 2, 3, 4, 6, 7, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 1, 3, 5, 8, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState( 1, 2, 5, 8, 10, true) == {}
getTargetGossipState( 9, 4, 5, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 5, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 1, 5, 7, 9, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 9, 4, 5, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 5, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 1, 5, 7, 9, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 0, 2, 6, 8, 10, true) == {}
getTargetGossipState( 8, 0, 5, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 4, 7, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 2, 3, 5, 7, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 1, 3, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 5, 6, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 2, 5, 8, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(11, 1, 5, 9, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 3, 6, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 3, 0, 1, 6, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 1, 6, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 2, 3, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 2, 8, 9, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 3, 1, 3, 4, 5, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(11, 2, 7, 10, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 3, 5, 10, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 5, 2, 6, 8, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 2, 6, 8, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 2, 0, 1, 4, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 0, 5, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 4, 7, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 6, 2, 3, 5, 7, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 1, 3, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 5, 6, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 2, 5, 8, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(11, 1, 5, 9, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 3, 6, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 3, 0, 1, 6, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 5, 1, 6, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 5, 2, 3, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 4, 2, 8, 9, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 3, 1, 3, 4, 5, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState(11, 2, 7, 10, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 3, 5, 10, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 5, 2, 6, 8, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 4, 2, 6, 8, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 2, 0, 1, 4, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 1, 4, 6, 10, true) == {}
getTargetGossipState( 4, 0, 6, 7, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 4, 0, 6, 7, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 7, 3, 4, 7, 8, true) == {}
getTargetGossipState( 1, 0, 0, 6, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 0, 0, 6, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 1, 3, 6, 10, true) == {}
getTargetGossipState( 7, 2, 3, 7, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 3, 2, 4, 5, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 4, 5, 7, 8, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 1, 3, 7, 8, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 8, 0, 1, 6, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 1, 5, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 1, 6, 8, 10, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 0, 1, 2, 3, 7, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(11, 2, 4, 5, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 1, 5, 7, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 7, 0, 3, 5, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 0, 3, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 2, 7, 8, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 3, 5, 6, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 0, 4, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 0, 3, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 4, 1, 2, 4, 6, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 0, 2, 4, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 1, 0, 2, 7, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 1, 2, 5, 7, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(10, 0, 1, 8, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 2, 3, 7, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 3, 2, 4, 5, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 1, 4, 5, 7, 8, false) == {ConsensusFork.Phase0}
getTargetGossipState( 1, 3, 7, 8, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState( 8, 0, 1, 6, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 1, 5, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 1, 6, 8, 10, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 0, 1, 2, 3, 7, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(11, 2, 4, 5, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 1, 5, 7, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 7, 0, 3, 5, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 0, 3, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 8, 2, 7, 8, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 3, 5, 6, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 0, 4, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 0, 3, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 4, 1, 2, 4, 6, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 0, 2, 4, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 1, 0, 2, 7, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 6, 1, 2, 5, 7, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(10, 0, 1, 8, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 1, 3, 4, 5, true) == {}
getTargetGossipState(11, 0, 2, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 2, 7, 8, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 0, 0, 5, 6, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 4, 2, 6, 8, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 2, 2, 6, 7, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 0, 2, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 7, 2, 7, 8, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 0, 0, 5, 6, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 4, 2, 6, 8, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 2, 2, 6, 7, 8, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 2, 8, 9, 10, true) == {}
getTargetGossipState( 8, 1, 2, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 0, 1, 2, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 7, 0, 1, 8, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 3, 1, 7, 9, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 6, 2, 6, 7, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 2, 3, 5, 7, 10, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(10, 4, 5, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 1, 4, 5, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 2, 7, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 8, 1, 5, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 1, 3, 7, 9, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 4, 0, 3, 4, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 1, 5, 9, 10, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 3, 4, 6, 7, 8, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(11, 4, 5, 6, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 2, 4, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(11, 0, 3, 5, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 3, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState(11, 1, 7, 8, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 0, 1, 3, 4, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 3, 4, 5, 7, 9, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 8, 1, 2, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 0, 1, 2, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 7, 0, 1, 8, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 3, 1, 7, 9, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 2, 6, 7, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 2, 3, 5, 7, 10, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(10, 4, 5, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 1, 4, 5, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 2, 7, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 8, 1, 5, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 1, 3, 7, 9, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 3, 4, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 1, 5, 9, 10, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 3, 4, 6, 7, 8, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(11, 4, 5, 6, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 2, 4, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(11, 0, 3, 5, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 3, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState(11, 1, 7, 8, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 0, 1, 3, 4, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 3, 4, 5, 7, 9, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(10, 3, 6, 8, 9, true) == {}
getTargetGossipState( 6, 7, 9, 10, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 7, 2, 4, 5, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 0, 6, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 7, 9, 10, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 7, 2, 4, 5, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 0, 6, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 4, 2, 3, 7, 10, true) == {}
getTargetGossipState( 3, 0, 2, 3, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 4, 6, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 3, 0, 2, 3, 5, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 4, 6, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 2, 6, 9, 11, true) == {}
getTargetGossipState( 7, 0, 1, 3, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 0, 1, 3, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 6, 8, 11, true) == {}
getTargetGossipState( 6, 2, 4, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 1, 3, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 0, 5, 7, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 6, 2, 4, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 8, 1, 3, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 0, 5, 7, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 0, 4, 7, true) == {}
getTargetGossipState( 0, 1, 2, 5, 9, true) == {}
getTargetGossipState( 6, 2, 3, 10, 11, true) == {}
getTargetGossipState( 5, 1, 5, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(10, 3, 5, 7, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 3, 0, 1, 2, 5, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 0, 1, 7, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 0, 5, 7, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 0, 1, 3, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 5, 7, 8, 9, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 5, 1, 5, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(10, 3, 5, 7, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 3, 0, 1, 2, 5, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 0, 1, 7, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 0, 5, 7, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 0, 1, 3, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 5, 7, 8, 9, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 0, 0, 0, 1, 11, true) == {}
getTargetGossipState( 6, 1, 4, 5, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 2, 4, 5, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 5, 8, 9, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState(10, 2, 5, 6, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 1, 2, 5, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 1, 5, 6, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 5, 0, 0, 1, 4, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 0, 2, 5, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 3, 4, 8, 10, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 9, 1, 6, 9, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 5, 4, 5, 7, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 2, 8, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 0, 2, 4, 7, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState(11, 1, 4, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 0, 6, 8, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 0, 1, 6, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 0, 1, 3, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 2, 2, 5, 6, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 1, 0, 4, 5, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 5, 0, 2, 3, 8, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 6, 7, 8, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 2, 2, 4, 6, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 2, 5, 6, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 1, 4, 5, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 2, 4, 5, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 5, 8, 9, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState(10, 2, 5, 6, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 1, 2, 5, 9, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 1, 5, 6, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 5, 0, 0, 1, 4, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 0, 2, 5, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 7, 3, 4, 8, 10, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 9, 1, 6, 9, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 5, 4, 5, 7, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 5, 2, 8, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 0, 2, 4, 7, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState(11, 1, 4, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 6, 8, 10, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 0, 1, 6, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 1, 3, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 2, 2, 5, 6, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 1, 0, 4, 5, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 5, 0, 2, 3, 8, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 6, 7, 8, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 2, 2, 4, 6, 7, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 2, 5, 6, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 5, 8, 9, 10, true) == {}
getTargetGossipState( 0, 0, 3, 5, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 0, 1, 2, 4, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 5, 7, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 8, 1, 3, 6, 9, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 1, 5, 6, 7, 8, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 5, 0, 5, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 0, 2, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 4, 6, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 5, 9, 10, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState(10, 3, 5, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 0, 1, 2, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 0, 5, 8, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 1, 1, 2, 8, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 4, 7, 9, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(10, 0, 1, 6, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 3, 5, 6, 9, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 4, 0, 1, 6, 7, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 1, 2, 5, 6, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 9, 0, 6, 9, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 2, 5, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 0, 3, 5, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 0, 1, 2, 4, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 5, 7, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 8, 1, 3, 6, 9, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 1, 5, 6, 7, 8, false) == {ConsensusFork.Phase0}
getTargetGossipState( 5, 0, 5, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 0, 0, 2, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 4, 6, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 5, 9, 10, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState(10, 3, 5, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 0, 1, 2, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 0, 5, 8, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 1, 1, 2, 8, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 6, 4, 7, 9, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState(10, 0, 1, 6, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 3, 5, 6, 9, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState( 4, 0, 1, 6, 7, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 4, 1, 2, 5, 6, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 9, 0, 6, 9, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 2, 5, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 2, 6, 9, true) == {}
getTargetGossipState( 5, 1, 5, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 0, 1, 5, 7, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 1, 5, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 0, 0, 1, 5, 7, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 9, 4, 5, 6, 7, true) == {}
getTargetGossipState( 6, 1, 2, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 0, 3, 4, 8, false) == {BeaconStateFork.Capella}
getTargetGossipState( 3, 1, 3, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 0, 3, 5, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 1, 2, 5, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 1, 3, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 0, 3, 4, 7, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState(11, 4, 7, 8, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 0, 2, 3, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 1, 2, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 6, 0, 3, 4, 8, false) == {ConsensusFork.Capella}
getTargetGossipState( 3, 1, 3, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 8, 0, 3, 5, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 1, 2, 5, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 1, 3, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 2, 0, 3, 4, 7, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState(11, 4, 7, 8, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 2, 3, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 4, 1, 2, 8, 10, true) == {}
getTargetGossipState( 6, 3, 5, 6, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 3, 5, 6, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 1, 3, 4, 9, 10, true) == {}
getTargetGossipState( 7, 0, 4, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 1, 0, 5, 7, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 7, 3, 4, 7, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 7, 0, 4, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 1, 0, 5, 7, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 7, 3, 4, 7, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(10, 5, 7, 8, 9, true) == {}
getTargetGossipState( 9, 1, 3, 4, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 1, 8, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 3, 4, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 1, 8, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 4, 7, 11, true) == {}
getTargetGossipState( 3, 0, 2, 5, 11, true) == {}
getTargetGossipState( 5, 1, 3, 7, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 2, 3, 8, 10, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 5, 1, 3, 7, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 2, 3, 8, 10, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 6, 0, 4, 5, 10, true) == {}
getTargetGossipState( 9, 0, 0, 4, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 2, 3, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 2, 4, 7, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 4, 1, 6, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 9, 0, 0, 4, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 7, 2, 3, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 2, 4, 7, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 4, 1, 6, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 1, 2, 9, 11, true) == {}
getTargetGossipState( 6, 1, 6, 7, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 2, 2, 6, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 6, 0, 1, 6, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 9, 1, 2, 5, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 6, 1, 6, 7, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 2, 2, 6, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 0, 1, 6, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 9, 1, 2, 5, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 6, 1, 2, 5, 11, true) == {}
getTargetGossipState( 5, 3, 4, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 0, 2, 5, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 7, 1, 4, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 0, 4, 7, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 4, 6, 8, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState(11, 1, 2, 4, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 6, 8, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 1, 0, 9, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 9, 1, 2, 6, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 3, 4, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 0, 2, 5, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 7, 1, 4, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 5, 0, 4, 7, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 4, 6, 8, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState(11, 1, 2, 4, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 6, 8, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 1, 0, 9, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 9, 1, 2, 6, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 1, 6, 8, 11, true) == {}
getTargetGossipState( 6, 1, 4, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 2, 3, 5, 8, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 1, 2, 3, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 4, 3, 6, 8, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 0, 2, 4, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 1, 4, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 5, 2, 3, 5, 8, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 1, 2, 3, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 4, 3, 6, 8, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 0, 2, 4, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 0, 1, 6, 10, true) == {}
getTargetGossipState( 3, 1, 9, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 7, 2, 6, 8, 10, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 7, 2, 3, 7, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 5, 8, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 3, 6, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 0, 0, 5, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 2, 6, 7, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 2, 2, 3, 5, 7, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 3, 1, 9, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 7, 2, 6, 8, 10, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 7, 2, 3, 7, 10, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 5, 8, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 3, 6, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 0, 0, 5, 11, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 2, 6, 7, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 2, 2, 3, 5, 7, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState(10, 2, 7, 8, 10, true) == {}
getTargetGossipState( 5, 0, 4, 5, 9, true) == {}
getTargetGossipState( 5, 0, 1, 2, 3, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 2, 3, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 1, 3, 4, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 5, 0, 1, 3, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 9, 0, 4, 10, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 4, 1, 5, 7, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 0, 1, 4, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 5, 8, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(11, 2, 3, 5, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 6, 7, 9, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 3, 4, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 1, 2, 3, 6, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 0, 3, 4, 5, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 5, 3, 6, 7, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 5, 7, 8, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 1, 3, 7, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 3, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 0, 1, 2, 3, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 2, 3, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 1, 3, 4, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 5, 0, 1, 3, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 9, 0, 4, 10, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 4, 1, 5, 7, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 4, 0, 1, 4, 7, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 5, 8, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(11, 2, 3, 5, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 6, 7, 9, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 3, 4, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 1, 2, 3, 6, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 0, 3, 4, 5, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 5, 3, 6, 7, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 5, 5, 7, 8, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 1, 3, 7, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 3, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 2, 3, 4, true) == {}
getTargetGossipState( 1, 0, 1, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 0, 1, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 6, 0, 6, 7, 8, true) == {}
getTargetGossipState( 4, 0, 1, 4, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState(11, 4, 5, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 1, 4, 5, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 4, 0, 1, 4, 10, false) == {ConsensusFork.Capella}
getTargetGossipState(11, 4, 5, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 1, 4, 5, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 0, 2, 4, 7, true) == {}
getTargetGossipState( 6, 3, 8, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 3, 0, 1, 7, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 0, 6, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 7, 2, 4, 6, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState(10, 0, 3, 5, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 0, 5, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 2, 8, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 3, 0, 1, 5, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 0, 0, 3, 4, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 2, 4, 5, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 6, 0, 0, 3, 8, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 3, 8, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 3, 0, 1, 7, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 0, 6, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 7, 2, 4, 6, 10, false) == {ConsensusFork.Capella}
getTargetGossipState(10, 0, 3, 5, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 0, 5, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 2, 8, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 3, 0, 1, 5, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 0, 0, 3, 4, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 2, 4, 5, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 0, 0, 3, 8, false) == {ConsensusFork.Capella}
getTargetGossipState( 4, 0, 2, 5, 6, true) == {}
getTargetGossipState( 2, 0, 2, 3, 5, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 8, 0, 5, 6, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 7, 0, 2, 5, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 1, 2, 5, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 0, 3, 6, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 0, 2, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 1, 2, 7, 8, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 5, 0, 1, 2, 8, false) == {BeaconStateFork.Capella}
getTargetGossipState( 5, 3, 6, 9, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 4, 5, 9, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 1, 5, 6, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState( 3, 0, 0, 4, 8, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 3, 0, 0, 1, 4, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 2, 0, 2, 5, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 4, 7, 8, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 6, 0, 3, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 9, 2, 3, 5, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 1, 6, 10, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 1, 4, 7, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 4, 5, 7, 9, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 8, 10, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 5, 0, 1, 4, 5, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 2, 7, 8, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 7, 3, 6, 7, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(10, 3, 4, 7, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 2, 3, 5, 8, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState(11, 1, 2, 3, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 2, 8, 9, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 1, 1, 5, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 2, 2, 9, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 0, 0, 1, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 2, 4, 6, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 1, 0, 3, 5, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 2, 3, 4, 9, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 8, 1, 2, 4, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 4, 5, 6, 7, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 5, 3, 7, 9, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 3, 0, 5, 6, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 4, 6, 9, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 5, 8, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(11, 2, 3, 4, 5, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 3, 5, 6, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState(11, 5, 6, 7, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 2, 6, 8, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 1, 3, 6, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 6, 0, 0, 1, 3, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 2, 6, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 3, 5, 6, 7, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 2, 0, 2, 3, 5, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 8, 0, 5, 6, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 7, 0, 2, 5, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 1, 2, 5, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 0, 3, 6, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 0, 0, 2, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 1, 2, 7, 8, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 5, 0, 1, 2, 8, false) == {ConsensusFork.Capella}
getTargetGossipState( 5, 3, 6, 9, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 4, 4, 5, 9, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 1, 1, 5, 6, 7, false) == {ConsensusFork.Altair}
getTargetGossipState( 3, 0, 0, 4, 8, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 3, 0, 0, 1, 4, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 2, 5, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 4, 7, 8, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState( 6, 0, 3, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 9, 2, 3, 5, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 1, 6, 10, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 1, 4, 7, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 4, 5, 7, 9, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 8, 10, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 5, 0, 1, 4, 5, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 2, 7, 8, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 7, 3, 6, 7, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState(10, 3, 4, 7, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 2, 3, 5, 8, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState(11, 1, 2, 3, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 2, 8, 9, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 1, 1, 5, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 2, 2, 9, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 0, 0, 1, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 8, 2, 4, 6, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 1, 0, 3, 5, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 2, 3, 4, 9, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 8, 1, 2, 4, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 4, 5, 6, 7, false) == {ConsensusFork.Phase0}
getTargetGossipState( 5, 3, 7, 9, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 3, 0, 5, 6, 9, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 4, 6, 9, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 5, 8, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 2, 3, 4, 5, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 3, 5, 6, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState(11, 5, 6, 7, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 2, 6, 8, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 1, 1, 3, 6, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 0, 0, 1, 3, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 2, 6, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 1, 3, 5, 6, 7, false) == {ConsensusFork.Phase0}
getTargetGossipState(10, 3, 4, 5, 8, true) == {}
getTargetGossipState( 8, 3, 7, 8, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 5, 1, 3, 6, 10, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 1, 0, 1, 2, 7, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 0, 0, 5, 6, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 3, 7, 8, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 5, 1, 3, 6, 10, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 1, 0, 1, 2, 7, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 0, 0, 5, 6, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 9, 2, 4, 5, 8, true) == {}
getTargetGossipState( 1, 0, 0, 2, 10, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 3, 0, 3, 7, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(10, 2, 3, 5, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 0, 0, 2, 10, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 3, 0, 3, 7, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(10, 2, 3, 5, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 3, 6, 9, 10, true) == {}
getTargetGossipState( 4, 2, 3, 8, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 1, 3, 10, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 0, 5, 7, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 2, 3, 8, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 1, 3, 10, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 4, 0, 5, 7, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 8, 2, 3, 7, 8, true) == {}
getTargetGossipState( 8, 2, 4, 7, 9, true) == {}
getTargetGossipState(10, 4, 5, 6, 8, true) == {}
getTargetGossipState( 1, 1, 2, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 1, 1, 2, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 3, 5, 6, 8, 9, true) == {}
getTargetGossipState( 7, 0, 0, 1, 6, true) == {}
getTargetGossipState( 8, 0, 4, 5, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 0, 6, 8, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 0, 1, 4, 8, 10, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(10, 0, 0, 0, 4, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 3, 5, 9, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 8, 0, 4, 5, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 0, 6, 8, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 0, 1, 4, 8, 10, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(10, 0, 0, 0, 4, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 3, 5, 9, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 1, 4, 10, 11, true) == {}
getTargetGossipState(11, 1, 8, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 0, 1, 4, 5, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 3, 4, 8, 10, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 5, 7, 8, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 6, 0, 1, 3, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 0, 2, 6, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 3, 0, 5, 9, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState( 5, 0, 6, 7, 9, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 6, 7, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 3, 4, 8, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState(10, 6, 7, 9, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 5, 1, 2, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(10, 4, 7, 9, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 0, 0, 2, 3, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState(11, 1, 8, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 1, 4, 5, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 3, 4, 8, 10, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 5, 7, 8, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 6, 0, 1, 3, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 0, 2, 6, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 3, 0, 5, 9, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 5, 0, 6, 7, 9, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 8, 6, 7, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 2, 3, 4, 8, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState(10, 6, 7, 9, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 5, 1, 2, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(10, 4, 7, 9, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 0, 0, 2, 3, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 6, 0, 5, 7, 8, true) == {}
getTargetGossipState(10, 1, 2, 3, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 1, 2, 3, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 3, 3, 5, 7, 8, true) == {}
getTargetGossipState( 7, 1, 2, 3, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 6, 3, 4, 7, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 4, 0, 3, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 9, 0, 0, 0, 2, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 5, 3, 6, 7, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 9, 0, 2, 4, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 4, 9, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 3, 5, 6, 10, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 4, 7, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 9, 0, 5, 8, 10, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 7, 1, 2, 3, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 6, 3, 4, 7, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 4, 0, 3, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 9, 0, 0, 0, 2, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 3, 6, 7, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 9, 0, 2, 4, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 4, 9, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 3, 5, 6, 10, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 4, 7, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 9, 0, 5, 8, 10, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 5, 4, 5, 7, 9, true) == {}
getTargetGossipState( 4, 0, 1, 2, 3, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 0, 2, 8, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(10, 0, 1, 4, 5, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 4, 5, 8, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 4, 0, 1, 2, 3, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 2, 8, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(10, 0, 1, 4, 5, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 4, 5, 8, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 7, 1, 3, 7, 11, true) == {}
getTargetGossipState(11, 0, 1, 2, 10, true) == {}
getTargetGossipState( 8, 1, 4, 8, 10, true) == {}
getTargetGossipState( 2, 2, 3, 9, 11, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 3, 2, 6, 8, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 7, 0, 7, 8, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 7, 0, 5, 6, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 9, 10, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 9, 4, 5, 6, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 2, 2, 3, 9, 11, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 3, 2, 6, 8, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 7, 0, 7, 8, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 7, 0, 5, 6, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 9, 10, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 9, 4, 5, 6, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 9, 1, 4, 6, 8, true) == {}
getTargetGossipState( 4, 0, 3, 8, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 2, 3, 6, 10, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 9, 2, 4, 7, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 3, 0, 3, 7, 9, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 4, 0, 3, 8, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 0, 2, 3, 6, 10, false) == {ConsensusFork.Phase0}
getTargetGossipState( 9, 2, 4, 7, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 3, 0, 3, 7, 9, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 9, 1, 2, 3, 8, true) == {}
getTargetGossipState( 0, 2, 3, 6, 8, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 7, 6, 9, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 0, 2, 3, 6, 8, false) == {ConsensusFork.Phase0}
getTargetGossipState( 7, 6, 9, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 5, 1, 5, 8, 11, true) == {}
getTargetGossipState( 4, 1, 2, 5, 11, true) == {}
getTargetGossipState( 0, 4, 6, 10, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 7, 3, 6, 9, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 0, 4, 6, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 2, 4, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 4, 6, 10, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 7, 3, 6, 9, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 0, 4, 6, 7, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 2, 4, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 4, 6, 7, 8, 10, true) == {}
getTargetGossipState(11, 0, 1, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 0, 1, 2, 3, 4, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 3, 5, 6, 7, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 8, 0, 2, 3, 5, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 6, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 1, 2, 3, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 1, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 0, 1, 2, 3, 4, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 3, 5, 6, 7, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 8, 0, 2, 3, 5, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 6, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 1, 2, 3, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 3, 6, 10, true) == {}
getTargetGossipState( 0, 2, 7, 8, 9, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 2, 1, 2, 4, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 6, 0, 2, 7, 8, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 0, 1, 6, 7, 9, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 1, 5, 7, 9, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 1, 1, 8, 9, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 0, 2, 7, 8, 9, false) == {ConsensusFork.Phase0}
getTargetGossipState( 2, 1, 2, 4, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 6, 0, 2, 7, 8, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 0, 1, 6, 7, 9, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 1, 5, 7, 9, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 1, 1, 8, 9, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 9, 2, 6, 8, 11, true) == {}
getTargetGossipState( 3, 0, 4, 8, 10, false) == {BeaconStateFork.Altair, BeaconStateFork.Bellatrix}
getTargetGossipState( 9, 2, 3, 9, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 0, 1, 2, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 3, 8, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 2, 4, 5, 6, false) == {BeaconStateFork.Altair}
getTargetGossipState( 1, 1, 3, 6, 8, false) == {BeaconStateFork.Altair}
getTargetGossipState( 5, 1, 3, 6, 9, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 3, 0, 4, 8, 10, false) == {ConsensusFork.Altair, ConsensusFork.Bellatrix}
getTargetGossipState( 9, 2, 3, 9, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 0, 1, 2, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState(11, 0, 3, 8, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 2, 4, 5, 6, false) == {ConsensusFork.Altair}
getTargetGossipState( 1, 1, 3, 6, 8, false) == {ConsensusFork.Altair}
getTargetGossipState( 5, 1, 3, 6, 9, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 5, 1, 3, 6, 10, true) == {}
getTargetGossipState( 3, 2, 3, 8, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 2, 1, 2, 3, 10, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 3, 0, 1, 9, 10, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 1, 3, 7, 9, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 2, 3, 6, 10, 11, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 2, 0, 4, 6, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 0, 8, 9, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 0, 0, 4, 6, 9, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 1, 2, 3, 4, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 4, 0, 3, 4, 7, false) == {BeaconStateFork.Capella}
getTargetGossipState( 0, 2, 3, 8, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 3, 2, 3, 8, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 2, 1, 2, 3, 10, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 3, 0, 1, 9, 10, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 0, 1, 3, 7, 9, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 2, 3, 6, 10, 11, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 2, 0, 4, 6, 9, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 0, 8, 9, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 0, 0, 4, 6, 9, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 1, 2, 3, 4, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 4, 0, 3, 4, 7, false) == {ConsensusFork.Capella}
getTargetGossipState( 0, 2, 3, 8, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 0, 3, 5, 7, 10, true) == {}
getTargetGossipState( 9, 0, 0, 3, 7, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 2, 1, 5, 6, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 2, 3, 6, 10, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 9, 0, 0, 3, 7, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 2, 1, 5, 6, 11, false) == {ConsensusFork.Altair}
getTargetGossipState(10, 2, 3, 6, 10, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 5, 0, 4, 6, 11, true) == {}
getTargetGossipState( 1, 1, 3, 4, 5, false) == {BeaconStateFork.Altair}
getTargetGossipState( 1, 1, 3, 4, 5, false) == {ConsensusFork.Altair}
getTargetGossipState(11, 1, 7, 8, 11, true) == {}
getTargetGossipState( 3, 1, 5, 7, 9, true) == {}
getTargetGossipState( 6, 0, 2, 5, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 4, 0, 1, 4, 9, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 0, 2, 5, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 4, 0, 1, 4, 9, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 4, 8, 9, 11, true) == {}
getTargetGossipState(10, 0, 1, 2, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(10, 1, 3, 7, 11, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 3, 2, 5, 6, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState( 9, 4, 9, 10, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 2, 2, 4, 9, 10, false) == {BeaconStateFork.Altair}
getTargetGossipState(10, 0, 1, 2, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState(10, 1, 3, 7, 11, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 3, 2, 5, 6, 7, false) == {ConsensusFork.Altair}
getTargetGossipState( 9, 4, 9, 10, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 2, 2, 4, 9, 10, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 2, 4, 10, 11, true) == {}
getTargetGossipState(11, 0, 8, 10, 11, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 0, 1, 7, 8, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 4, 2, 8, 10, 11, false) == {BeaconStateFork.Altair}
getTargetGossipState( 8, 5, 6, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 8, 1, 5, 8, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 6, 1, 6, 7, 11, false) == {BeaconStateFork.Bellatrix, BeaconStateFork.Capella}
getTargetGossipState( 9, 3, 4, 5, 6, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 1, 0, 3, 4, 7, false) == {BeaconStateFork.Altair}
getTargetGossipState( 6, 1, 2, 3, 11, false) == {BeaconStateFork.Capella}
getTargetGossipState( 1, 2, 5, 9, 10, false) == {BeaconStateFork.Phase0, BeaconStateFork.Altair}
getTargetGossipState( 5, 0, 5, 7, 8, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 8, 0, 3, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState(11, 3, 6, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState(11, 0, 8, 10, 11, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 7, 0, 1, 7, 8, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 4, 2, 8, 10, 11, false) == {ConsensusFork.Altair}
getTargetGossipState( 8, 5, 6, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 8, 1, 5, 8, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 6, 1, 6, 7, 11, false) == {ConsensusFork.Bellatrix, ConsensusFork.Capella}
getTargetGossipState( 9, 3, 4, 5, 6, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 1, 0, 3, 4, 7, false) == {ConsensusFork.Altair}
getTargetGossipState( 6, 1, 2, 3, 11, false) == {ConsensusFork.Capella}
getTargetGossipState( 1, 2, 5, 9, 10, false) == {ConsensusFork.Phase0, ConsensusFork.Altair}
getTargetGossipState( 5, 0, 5, 7, 8, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 8, 0, 3, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState(11, 3, 6, 7, 8, false) == {ConsensusFork.EIP4844}
getTargetGossipState( 3, 6, 7, 9, 10, true) == {}
getTargetGossipState( 7, 1, 6, 10, 11, false) == {BeaconStateFork.Bellatrix}
getTargetGossipState( 0, 6, 9, 10, 11, false) == {BeaconStateFork.Phase0}
getTargetGossipState( 4, 1, 2, 3, 5, false) == {BeaconStateFork.Capella, BeaconStateFork.EIP4844}
getTargetGossipState( 9, 1, 2, 7, 8, false) == {BeaconStateFork.EIP4844}
getTargetGossipState( 7, 1, 6, 10, 11, false) == {ConsensusFork.Bellatrix}
getTargetGossipState( 0, 6, 9, 10, 11, false) == {ConsensusFork.Phase0}
getTargetGossipState( 4, 1, 2, 3, 5, false) == {ConsensusFork.Capella, ConsensusFork.EIP4844}
getTargetGossipState( 9, 1, 2, 7, 8, false) == {ConsensusFork.EIP4844}

View File

@ -198,19 +198,19 @@ suite "Gossip validation - Extra": # Not based on preset config
dag.headState, cache, int(SLOTS_PER_EPOCH), false, cfg = cfg):
let added =
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
const nilCallback = OnPhase0BlockAdded(nil)
dag.addHeadBlock(verifier, blck.phase0Data, nilCallback)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
const nilCallback = OnAltairBlockAdded(nil)
dag.addHeadBlock(verifier, blck.altairData, nilCallback)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
const nilCallback = OnBellatrixBlockAdded(nil)
dag.addHeadBlock(verifier, blck.bellatrixData, nilCallback)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
const nilCallback = OnCapellaBlockAdded(nil)
dag.addHeadBlock(verifier, blck.capellaData, nilCallback)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
const nilCallback = OnEIP4844BlockAdded(nil)
dag.addHeadBlock(verifier, blck.eip4844Data, nilCallback)
check: added.isOk()

View File

@ -22,7 +22,7 @@ suite "Light client" & preset():
headPeriod = 3.SyncCommitteePeriod
let
cfg = block: # Fork schedule so that each `LightClientDataFork` is covered
static: doAssert BeaconStateFork.high == BeaconStateFork.EIP4844
static: doAssert ConsensusFork.high == ConsensusFork.EIP4844
var res = defaultRuntimeConfig
res.ALTAIR_FORK_EPOCH = 1.Epoch
res.BELLATRIX_FORK_EPOCH = 2.Epoch
@ -64,19 +64,19 @@ suite "Light client" & preset():
attested, syncCommitteeRatio, cfg):
let added =
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
const nilCallback = OnPhase0BlockAdded(nil)
dag.addHeadBlock(verifier, blck.phase0Data, nilCallback)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
const nilCallback = OnAltairBlockAdded(nil)
dag.addHeadBlock(verifier, blck.altairData, nilCallback)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
const nilCallback = OnBellatrixBlockAdded(nil)
dag.addHeadBlock(verifier, blck.bellatrixData, nilCallback)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
const nilCallback = OnCapellaBlockAdded(nil)
dag.addHeadBlock(verifier, blck.capellaData, nilCallback)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
const nilCallback = OnEIP4844BlockAdded(nil)
dag.addHeadBlock(verifier, blck.eip4844Data, nilCallback)
@ -104,7 +104,7 @@ suite "Light client" & preset():
finalityUpdate = dag.getLightClientFinalityUpdate
optimisticUpdate = dag.getLightClientOptimisticUpdate
check:
dag.headState.kind == BeaconStateFork.Phase0
dag.headState.kind == ConsensusFork.Phase0
update.kind == LightClientDataFork.None
finalityUpdate.kind == LightClientDataFork.None
optimisticUpdate.kind == LightClientDataFork.None
@ -117,7 +117,7 @@ suite "Light client" & preset():
finalityUpdate = dag.getLightClientFinalityUpdate
optimisticUpdate = dag.getLightClientOptimisticUpdate
check:
dag.headState.kind == BeaconStateFork.Phase0
dag.headState.kind == ConsensusFork.Phase0
update.kind == LightClientDataFork.None
finalityUpdate.kind == LightClientDataFork.None
optimisticUpdate.kind == LightClientDataFork.None
@ -130,7 +130,7 @@ suite "Light client" & preset():
finalityUpdate = dag.getLightClientFinalityUpdate
optimisticUpdate = dag.getLightClientOptimisticUpdate
check:
dag.headState.kind == BeaconStateFork.Altair
dag.headState.kind == ConsensusFork.Altair
update.kind == LightClientDataFork.None
finalityUpdate.kind == LightClientDataFork.None
optimisticUpdate.kind == LightClientDataFork.None

View File

@ -25,7 +25,7 @@ suite "Light client processor" & preset():
highPeriod = 5.SyncCommitteePeriod
let
cfg = block: # Fork schedule so that each `LightClientDataFork` is covered
static: doAssert BeaconStateFork.high == BeaconStateFork.EIP4844
static: doAssert ConsensusFork.high == ConsensusFork.EIP4844
var res = defaultRuntimeConfig
res.ALTAIR_FORK_EPOCH = 1.Epoch
res.BELLATRIX_FORK_EPOCH = 2.Epoch
@ -51,19 +51,19 @@ suite "Light client processor" & preset():
attested = true, syncCommitteeRatio, cfg):
let added =
case blck.kind
of BeaconBlockFork.Phase0:
of ConsensusFork.Phase0:
const nilCallback = OnPhase0BlockAdded(nil)
dag.addHeadBlock(verifier, blck.phase0Data, nilCallback)
of BeaconBlockFork.Altair:
of ConsensusFork.Altair:
const nilCallback = OnAltairBlockAdded(nil)
dag.addHeadBlock(verifier, blck.altairData, nilCallback)
of BeaconBlockFork.Bellatrix:
of ConsensusFork.Bellatrix:
const nilCallback = OnBellatrixBlockAdded(nil)
dag.addHeadBlock(verifier, blck.bellatrixData, nilCallback)
of BeaconBlockFork.Capella:
of ConsensusFork.Capella:
const nilCallback = OnCapellaBlockAdded(nil)
dag.addHeadBlock(verifier, blck.capellaData, nilCallback)
of BeaconBlockFork.EIP4844:
of ConsensusFork.EIP4844:
const nilCallback = OnEIP4844BlockAdded(nil)
dag.addHeadBlock(verifier, blck.eip4844Data, nilCallback)
doAssert added.isOk()

View File

@ -29,7 +29,7 @@ suite "Beacon state" & preset():
test "process_slots":
var
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH, {}), {skipBlsValidation}))
@ -43,7 +43,7 @@ suite "Beacon state" & preset():
test "latest_block_root":
var
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH, {}), {skipBlsValidation}))
@ -69,7 +69,7 @@ suite "Beacon state" & preset():
test "get_beacon_proposer_index":
var
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH, {}), {skipBlsValidation}))
@ -94,7 +94,7 @@ suite "Beacon state" & preset():
test "dependent_root":
var
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH, {}), {skipBlsValidation}))
@ -134,7 +134,7 @@ suite "Beacon state" & preset():
test "can_advance_slots":
var
state = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig, ZERO_HASH, 0,
makeInitialDeposits(SLOTS_PER_EPOCH, {}), {skipBlsValidation}))

View File

@ -27,7 +27,7 @@ suite "state diff tests" & preset():
dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {})
test "random slot differences" & preset():
let testStates = getTestStates(dag.headState, BeaconStateFork.Bellatrix)
let testStates = getTestStates(dag.headState, ConsensusFork.Bellatrix)
for i in 0 ..< testStates.len:
for j in (i+1) ..< testStates.len:

View File

@ -168,9 +168,9 @@ proc addTestBlockAux[EP: bellatrix.ExecutionPayload | capella.ExecutionPayload](
let execution_payload =
withState(state):
when (stateFork == BeaconStateFork.Bellatrix and
when (stateFork == ConsensusFork.Bellatrix and
EP is bellatrix.ExecutionPayload) or
(stateFork == BeaconStateFork.Capella and
(stateFork == ConsensusFork.Capella and
EP is capella.ExecutionPayload):
# Merge shortly after Bellatrix
if forkyState.data.slot >
@ -225,15 +225,15 @@ proc addTestBlock*(
graffiti = default(GraffitiBytes), flags: set[UpdateFlag] = {},
nextSlot = true, cfg = defaultRuntimeConfig): ForkedSignedBeaconBlock =
case state.kind
of BeaconStateFork.Phase0, BeaconStateFork.Altair, BeaconStateFork.Bellatrix:
of ConsensusFork.Phase0, ConsensusFork.Altair, ConsensusFork.Bellatrix:
addTestBlockAux[bellatrix.ExecutionPayload](
state, cache, eth1_data, attestations, deposits, sync_aggregate,
graffiti, flags, nextSlot, cfg)
of BeaconStateFork.Capella:
of ConsensusFork.Capella:
addTestBlockAux[capella.ExecutionPayload](
state, cache, eth1_data, attestations, deposits, sync_aggregate,
graffiti, flags, nextSlot, cfg)
of BeaconStateFork.EIP4844:
of ConsensusFork.EIP4844:
raiseAssert $eip4844ImplementationMissing & ": tests/testblockutil.nim addTestBlock"
proc makeTestBlock*(
@ -409,7 +409,7 @@ proc makeSyncAggregate(
let
syncCommittee =
withState(state):
when stateFork >= BeaconStateFork.Altair:
when stateFork >= ConsensusFork.Altair:
if (forkyState.data.slot + 1).is_sync_committee_period():
forkyState.data.next_sync_committee
else:

View File

@ -19,7 +19,7 @@ export beacon_chain_db, testblockutil, kvstore, kvstore_sqlite3
proc makeTestDB*(validators: Natural): BeaconChainDB =
let
genState = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
kind: ConsensusFork.Phase0,
phase0Data: initialize_hashed_beacon_state_from_eth1(
defaultRuntimeConfig,
ZERO_HASH,

View File

@ -42,7 +42,7 @@ proc valid_deposit(state: var ForkyHashedBeaconState) =
state.root = hash_tree_root(state.data)
proc getTestStates*(
initialState: ForkedHashedBeaconState, stateFork: BeaconStateFork):
initialState: ForkedHashedBeaconState, stateFork: ConsensusFork):
seq[ref ForkedHashedBeaconState] =
# Randomly generated slot numbers, with a jump to around
# SLOTS_PER_HISTORICAL_ROOT to force wraparound of those
@ -65,14 +65,14 @@ proc getTestStates*(
info = ForkedEpochInfo()
cfg = defaultRuntimeConfig
static: doAssert high(BeaconStateFork) == BeaconStateFork.EIP4844
if stateFork >= BeaconStateFork.Altair:
static: doAssert high(ConsensusFork) == ConsensusFork.EIP4844
if stateFork >= ConsensusFork.Altair:
cfg.ALTAIR_FORK_EPOCH = 1.Epoch
if stateFork >= BeaconStateFork.Bellatrix:
if stateFork >= ConsensusFork.Bellatrix:
cfg.BELLATRIX_FORK_EPOCH = 2.Epoch
if stateFork >= BeaconStateFork.Capella:
if stateFork >= ConsensusFork.Capella:
cfg.CAPELLA_FORK_EPOCH = 3.Epoch
if stateFork >= BeaconStateFork.EIP4844:
if stateFork >= ConsensusFork.EIP4844:
cfg.EIP4844_FORK_EPOCH = 4.Epoch
for i, epoch in stateEpochs: