diff --git a/beacon_chain/consensus_object_pools/blob_quarantine.nim b/beacon_chain/consensus_object_pools/blob_quarantine.nim index e202c8722d..99f6af50a2 100644 --- a/beacon_chain/consensus_object_pools/blob_quarantine.nim +++ b/beacon_chain/consensus_object_pools/blob_quarantine.nim @@ -61,12 +61,14 @@ func hasBlob*( quarantine: BlobQuarantine, slot: Slot, proposer_index: uint64, - index: BlobIndex): bool = + index: BlobIndex, + kzg_commitment: KzgCommitment): bool = for blob_sidecar in quarantine.blobs.values: template block_header: untyped = blob_sidecar.signed_block_header.message if block_header.slot == slot and block_header.proposer_index == proposer_index and - blob_sidecar.index == index: + blob_sidecar.index == index and + blob_sidecar.kzg_commitment == kzg_commitment: return true false diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index 2b15ef75f0..ccee07559a 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -423,8 +423,20 @@ proc validateBlobSidecar*( let block_root = hash_tree_root(block_header) if dag.getBlockRef(block_root).isSome(): return errIgnore("BlobSidecar: already have block") + + # This adds KZG commitment matching to the spec gossip validation. It's an + # IGNORE condition, so it shouldn't affect Nimbus's scoring, and when some + # (slashable) double proposals happen with blobs present, without this one + # or the other block, or potentially both, won't get its full set of blobs + # through gossip validation and have to backfill them later. There is some + # cost in slightly more outgoing bandwidth on such double-proposals but it + # remains insignificant compared with other bandwidth usage. + # + # It would be good to fix this more properly, but this has come up often on + # Pectra devnet-6. if blobQuarantine[].hasBlob( - block_header.slot, block_header.proposer_index, blob_sidecar.index): + block_header.slot, block_header.proposer_index, blob_sidecar.index, + blob_sidecar.kzg_commitment): return errIgnore("BlobSidecar: already have valid blob from same proposer") # [REJECT] The sidecar's inclusion proof is valid as verified by