Skip to content

Commit 703e698

Browse files
committed
implement paylaod availability check for PTC attestations
1 parent a299bcd commit 703e698

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

beacon_chain/validators/beacon_validators.nim

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -838,17 +838,32 @@ proc sendSyncCommitteeContributions(
838838
asyncSpawn signAndSendContribution(
839839
node, validator, subcommitteeIdx, head, slot)
840840

841-
proc checkPayloadPresent*(
842-
node: BeaconNode, beacon_block_root: Eth2Digest
843-
): bool =
844-
## Check if we received the payload envelope for this slot
845-
debugGloasComment"TODO - check for envelope availability"
846-
return true
841+
proc checkPayloadPresent(
842+
node: BeaconNode, beacon_block_root: Eth2Digest): bool =
843+
## Check if we received the payload envelope for
844+
## this slot and a corresponding block
845+
846+
let blockData = node.dag.getForkedBlock(beacon_block_root).valueOr:
847+
return false
848+
849+
withBlck(blockData):
850+
when consensusFork >= ConsensusFork.Gloas:
851+
var envelope: TrustedSignedExecutionPayloadEnvelope
852+
if not node.dag.db.getExecutionPayloadEnvelope(
853+
beacon_block_root, envelope):
854+
return false
855+
856+
# check that the envelope correctly references this block
857+
if envelope.message.beacon_block_root != beacon_block_root:
858+
return false
859+
return true
860+
else:
861+
return true
847862

848863
proc checkBlobDataAvailable*(
849864
node: BeaconNode, beacon_block_root: Eth2Digest
850865
): bool =
851-
## Check if the blob(s) for this slot is/are available
866+
## Check if the blob sidecars for this slot are available
852867
debugGloasComment"TODO - check for blob availability"
853868
return true
854869

0 commit comments

Comments
 (0)