Skip to content

Commit bf344f0

Browse files
authored
add KZG commitment to first-blob-found check in blobs gossip validation (#6912)
1 parent 6e7c2f3 commit bf344f0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

beacon_chain/consensus_object_pools/blob_quarantine.nim

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ func hasBlob*(
6161
quarantine: BlobQuarantine,
6262
slot: Slot,
6363
proposer_index: uint64,
64-
index: BlobIndex): bool =
64+
index: BlobIndex,
65+
kzg_commitment: KzgCommitment): bool =
6566
for blob_sidecar in quarantine.blobs.values:
6667
template block_header: untyped = blob_sidecar.signed_block_header.message
6768
if block_header.slot == slot and
6869
block_header.proposer_index == proposer_index and
69-
blob_sidecar.index == index:
70+
blob_sidecar.index == index and
71+
blob_sidecar.kzg_commitment == kzg_commitment:
7072
return true
7173
false
7274

beacon_chain/gossip_processing/gossip_validation.nim

+13-1
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,20 @@ proc validateBlobSidecar*(
423423
let block_root = hash_tree_root(block_header)
424424
if dag.getBlockRef(block_root).isSome():
425425
return errIgnore("BlobSidecar: already have block")
426+
427+
# This adds KZG commitment matching to the spec gossip validation. It's an
428+
# IGNORE condition, so it shouldn't affect Nimbus's scoring, and when some
429+
# (slashable) double proposals happen with blobs present, without this one
430+
# or the other block, or potentially both, won't get its full set of blobs
431+
# through gossip validation and have to backfill them later. There is some
432+
# cost in slightly more outgoing bandwidth on such double-proposals but it
433+
# remains insignificant compared with other bandwidth usage.
434+
#
435+
# It would be good to fix this more properly, but this has come up often on
436+
# Pectra devnet-6.
426437
if blobQuarantine[].hasBlob(
427-
block_header.slot, block_header.proposer_index, blob_sidecar.index):
438+
block_header.slot, block_header.proposer_index, blob_sidecar.index,
439+
blob_sidecar.kzg_commitment):
428440
return errIgnore("BlobSidecar: already have valid blob from same proposer")
429441

430442
# [REJECT] The sidecar's inclusion proof is valid as verified by

0 commit comments

Comments
 (0)