avoid modifying blobless collection during iteration in edge case (#6168)

The fallback when blobless quarantine contains a block with all blobs
modifies collection while iterating, potentially asserting if reachable.
Using a second loop to process this situation resolves that.
This commit is contained in:
Etan Kissling 2024-04-03 23:02:24 +02:00 committed by GitHub
parent 67ade106cc
commit 96e27d9d35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -299,7 +299,9 @@ proc getMissingBlobs(rman: RequestManager): seq[BlobIdentifier] =
delay = wallTime - wallSlot.start_beacon_time()
waitDur = TimeDiff(nanoseconds: BLOB_GOSSIP_WAIT_TIME_NS)
var fetches: seq[BlobIdentifier]
var
fetches: seq[BlobIdentifier]
ready: seq[Eth2Digest]
for blobless in rman.quarantine[].peekBlobless():
# give blobs a chance to arrive over gossip
if blobless.message.slot == wallSlot and delay < waitDur:
@ -321,9 +323,11 @@ proc getMissingBlobs(rman: RequestManager): seq[BlobIdentifier] =
warn "missing blob handler found blobless block with all blobs",
blk=blobless.root,
commitments=len(blobless.message.body.blob_kzg_commitments)
discard rman.blockVerifier(ForkedSignedBeaconBlock.init(blobless),
false)
rman.quarantine[].removeBlobless(blobless)
ready.add(blobless.root)
for root in ready:
let blobless = rman.quarantine[].popBlobless(root).valueOr:
continue
discard rman.blockVerifier(blobless, false)
fetches
proc requestManagerBlobLoop(