Skip to content

Commit

Permalink
avoid perpetually sending blobs to peers (#5563)
Browse files Browse the repository at this point in the history
Fix regression from #4808 where blobs that are already known are issued
ACCEPT verdict, propagating them to peers over and over again.

`validateBlobSidecar` contains the correct IGNORE logic. Moved it above
the expensive checks to retain the performance of the check.
  • Loading branch information
etan-status authored Nov 4, 2023
1 parent 8d46809 commit f14389b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
7 changes: 1 addition & 6 deletions beacon_chain/gossip_processing/eth2_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,7 @@ proc processSignedBlobSidecar*(

# Potential under/overflows are fine; would just create odd metrics and logs
let delay = wallTime - signedBlobSidecar.message.slot.start_beacon_time

if self.blobQuarantine[].hasBlob(signedBlobSidecar.message):
debug "Blob received, already in quarantine", delay
return ValidationRes.ok
else:
debug "Blob received", delay
debug "Blob received", delay

let v =
self.dag.validateBlobSidecar(self.quarantine, self.blobQuarantine,
Expand Down
12 changes: 6 additions & 6 deletions beacon_chain/gossip_processing/gossip_validation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ proc validateBlobSidecar*(
if not (sbs.message.slot > dag.finalizedHead.slot):
return errIgnore("SignedBlobSidecar: slot already finalized")

# [IGNORE] The sidecar is the only sidecar with valid signature
# received for the tuple (sidecar.block_root, sidecar.index).
if blobQuarantine[].hasBlob(sbs.message):
return errIgnore(
"SignedBlobSidecar: already have blob with valid signature")

# [IGNORE] The block's parent (defined by block.parent_root) has
# been seen (via both gossip and non-gossip sources) (a client MAY
# queue blocks for processing once the parent block is retrieved).
Expand Down Expand Up @@ -376,12 +382,6 @@ proc validateBlobSidecar*(
sbs.signature):
return dag.checkedReject("SignedBlobSidecar: invalid blob signature")

# [IGNORE] The sidecar is the only sidecar with valid signature
# received for the tuple (sidecar.block_root, sidecar.index).
if blobQuarantine[].hasBlob(sbs.message):
return errIgnore(
"SignedBlobSidecar: already have blob with valid signature")

ok()


Expand Down

0 comments on commit f14389b

Please sign in to comment.