disallow non-(genesis, far-future) equal transition epochs (#3691)

This commit is contained in:
tersec 2022-06-03 09:37:03 +00:00 committed by GitHub
parent 7492f99f35
commit ea113fc420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -673,8 +673,18 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB,
for j in i+1 ..< forkVersions.len:
doAssert forkVersions[i] != forkVersions[j]
doAssert cfg.ALTAIR_FORK_EPOCH <= cfg.BELLATRIX_FORK_EPOCH
doAssert cfg.BELLATRIX_FORK_EPOCH <= cfg.SHARDING_FORK_EPOCH
template assertForkEpochOrder(
firstForkEpoch: Epoch, secondForkEpoch: Epoch) =
doAssert firstForkEpoch <= secondForkEpoch
# TODO https://github.com/ethereum/consensus-specs/issues/2902 multiple
# fork transitions per epoch don't work in a well-defined way.
doAssert firstForkEpoch < secondForkEpoch or
firstForkEpoch in [GENESIS_EPOCH, FAR_FUTURE_EPOCH]
assertForkEpochOrder(cfg.ALTAIR_FORK_EPOCH, cfg.BELLATRIX_FORK_EPOCH)
assertForkEpochorder(cfg.BELLATRIX_FORK_EPOCH, cfg.SHARDING_FORK_EPOCH)
doAssert updateFlags in [{}, {verifyFinalization}],
"Other flags not supported in ChainDAG"

View File

@ -617,6 +617,8 @@ proc push*[T](sq: SyncQueue[T], sr: SyncRequest[T],
missingParentSlot: Option[Slot]
# compiler segfault if this is moved into the for loop, at time of writing
# TODO this does segfault in 1.2 but not 1.6, so remove workaround when 1.2
# is dropped.
res: Result[void, BlockError]
for blk in sq.blocks(item):