Skip to content

Commit 5d5b8c5

Browse files
committed
refactor: execution payload gossip validation
1 parent cf8fb6e commit 5d5b8c5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

beacon_chain/gossip_processing/gossip_validation.nim

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import
1818
helpers, network, signatures, peerdas_helpers],
1919
../consensus_object_pools/[
2020
attestation_pool, blockchain_dag, blob_quarantine, block_quarantine,
21-
full_block_pool, light_client_pool,
22-
spec_cache, sync_committee_msg_pool,
21+
light_client_pool, spec_cache, sync_committee_msg_pool,
2322
validator_change_pool],
2423
".."/[beacon_clock],
2524
./batch_validation
@@ -976,21 +975,32 @@ proc validateBeaconBlock*(
976975

977976
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-beta.0/specs/gloas/p2p-interface.md#execution_payload
978977
proc validateExecutionPayload*(
979-
dag: ChainDAGRef, fullBlockPool: ref FullBlockPool,
978+
dag: ChainDAGRef, quarantine: ref Quarantine,
980979
signed_execution_payload_envelope: SignedExecutionPayloadEnvelope):
981980
Result[void, ValidationError] =
982981
template envelope: untyped = signed_execution_payload_envelope.message
983982

984983
# [IGNORE] The envelope's block root envelope.block_root has been seen (via
985984
# gossip or non-gossip sources) (a client MAY queue payload for processing
986985
# once the block is retrieved).
987-
if not fullBlockPool[].isBlockSeen(envelope.beacon_block_root):
986+
let blockSeen =
987+
block:
988+
var seen =
989+
envelope.beacon_block_root in quarantine.unviable or
990+
envelope.beacon_block_root in quarantine.missing or
991+
dag.getBlockRef(envelope.beacon_block_root).isSome()
992+
if not seen:
993+
for k, _ in quarantine.orphans:
994+
if k[0] == envelope.beacon_block_root:
995+
seen = true
996+
break
997+
seen
998+
if not blockSeen:
988999
return errIgnore("ExecutionPayload: block not found")
9891000

9901001
# [IGNORE] The node has not seen another valid SignedExecutionPayloadEnvelope
9911002
# for this block root from this builder.
992-
if fullBlockPool[].isEnvelopeValid(signed_execution_payload_envelope):
993-
return errIgnore("ExecutionPayload: already seen the envelope")
1003+
debugGloasComment("")
9941004

9951005
# [REJECT] block passes validation.
9961006
let blck =

0 commit comments

Comments
 (0)