@@ -428,6 +428,40 @@ template validateBeaconBlockDeneb(
428428 blob_params.MAX_BLOBS_PER_BLOCK ):
429429 return dag.checkedReject (" validateBeaconBlockDeneb: too many blob commitments" )
430430
431+ template validateBeaconBlockGloas (
432+ _: ChainDAGRef ,
433+ _:
434+ phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
435+ bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock |
436+ deneb.SignedBeaconBlock | electra.SignedBeaconBlock |
437+ fulu.SignedBeaconBlock ): untyped =
438+ discard
439+
440+ # https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.1/specs/gloas/p2p-interface.md#beacon_block
441+ template validateBeaconBlockGloas (
442+ dag: ChainDAGRef ,
443+ signed_beacon_block: gloas.SignedBeaconBlock ): untyped =
444+ template blck : untyped = signed_beacon_block.message
445+ template bid : untyped = blck.body.signed_execution_payload_bid.message
446+
447+ # If `execution_payload` verification of block's execution payload parent by
448+ # an execution node **is complete**
449+ debugGloasComment (" update is_execution_block" )
450+ if signed_beacon_block.is_execution_block:
451+ # [REJECT] The block's execution payload parent (defined by
452+ # `bid.parent_block_hash`) passes all validation.
453+ withState (dag.headState):
454+ when consensusFork >= ConsensusFork .Gloas :
455+ if bid.parent_block_hash != dag.headState.latest_block_hash:
456+ return dag.checkedReject (" validateBeaconBlockGloas: invalid execution payload parent" )
457+
458+ # [REJECT] The bid's parent (defined by `bid.parent_block_root`) equals the
459+ # block's parent (defined by `block.parent_root`).
460+ if bid.parent_block_root != blck.parent_root:
461+ return dag.checkedReject (" validateBeaconBlockGloas: parent block root mismatch" )
462+
463+ ok ()
464+
431465# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/p2p-interface.md#blob_sidecar_subnet_id
432466proc validateBlobSidecar * (
433467 dag: ChainDAGRef , quarantine: ref Quarantine ,
@@ -937,6 +971,8 @@ proc validateBeaconBlock*(
937971
938972 dag.validateBeaconBlockDeneb (signed_beacon_block, wallTime)
939973
974+ dag.validateBeaconBlockGloas (signed_beacon_block)
975+
940976 # [REJECT] The block is from a higher slot than its parent.
941977 if not (signed_beacon_block.message.slot > parent.bid.slot):
942978 return dag.checkedReject (
0 commit comments