@@ -432,20 +432,33 @@ template validateBeaconBlockGloas(
432432 phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
433433 bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock |
434434 deneb.SignedBeaconBlock | electra.SignedBeaconBlock |
435- fulu.SignedBeaconBlock ): untyped =
435+ fulu.SignedBeaconBlock ,
436+ _: BlockRef ): untyped =
436437 discard
437438
438439# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.1/specs/gloas/p2p-interface.md#beacon_block
439440template validateBeaconBlockGloas (
440441 dag: ChainDAGRef ,
441- signed_beacon_block: gloas.SignedBeaconBlock ): untyped =
442+ signed_beacon_block: gloas.SignedBeaconBlock ,
443+ parent: BlockRef ): untyped =
442444 template blck : untyped = signed_beacon_block.message
443445 template bid : untyped = blck.body.signed_execution_payload_bid.message
444446
445447 # If `execution_payload` verification of block's execution payload parent by
446448 # an execution node **is complete**
447- debugGloasComment (" update is_execution_block" )
448- if signed_beacon_block.is_execution_block:
449+ debugGloasComment (" " )
450+ let isExecutionEnabled =
451+ if signed_beacon_block.message.is_execution_block:
452+ true
453+ else :
454+ # If we don't know whether the parent block had execution enabled,
455+ # assume it didn't. This way, we don't reject here if the timestamp
456+ # is invalid, and let state transition check the timestamp.
457+ # This is an edge case, and may be hit in a pathological scenario with
458+ # checkpoint sync, because the checkpoint block may be unavailable
459+ # and it could already be the parent of the new block before backfill.
460+ not dag.loadExecutionBlockHash (parent).get (ZERO_HASH ).isZero
461+ if isExecutionEnabled:
449462 # [REJECT] The block's execution payload parent (defined by
450463 # `bid.parent_block_hash`) passes all validation.
451464 withState (dag.headState):
@@ -969,7 +982,7 @@ proc validateBeaconBlock*(
969982
970983 dag.validateBeaconBlockDeneb (signed_beacon_block, wallTime)
971984
972- dag.validateBeaconBlockGloas (signed_beacon_block)
985+ dag.validateBeaconBlockGloas (signed_beacon_block, parent )
973986
974987 # [REJECT] The block is from a higher slot than its parent.
975988 if not (signed_beacon_block.message.slot > parent.bid.slot):
0 commit comments