dc quarantine activation, keeping blobs compatible

This commit is contained in:
Agnish Ghosh 2024-06-29 14:07:09 +05:30
parent ca3bd3eeee
commit 742669052a
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
2 changed files with 35 additions and 19 deletions

View File

@ -407,26 +407,20 @@ proc initFullNode(
maybeFinalized: bool):
Future[Result[void, VerifierError]] {.async: (raises: [CancelledError]).} =
withBlck(signedBlock):
# when consensusFork >= ConsensusFork.Deneb:
# if not blobQuarantine[].hasBlobs(forkyBlck):
# # We don't have all the blobs for this block, so we have
# # to put it in blobless quarantine.
# if not quarantine[].addBlobless(dag.finalizedHead.slot, forkyBlck):
# err(VerifierError.UnviableFork)
# else:
# err(VerifierError.MissingParent)
# else:
# let blobs = blobQuarantine[].popBlobs(forkyBlck.root, forkyBlck)
# await blockProcessor[].addBlock(MsgSource.gossip, signedBlock,
# Opt.some(blobs), Opt.none(DataColumnSidecars),
# maybeFinalized = maybeFinalized)
# else:
# await blockProcessor[].addBlock(MsgSource.gossip, signedBlock,
# Opt.none(BlobSidecars), Opt.none(DataColumnSidecars),
# maybeFinalized = maybeFinalized)
when consensusFork >= ConsensusFork.Deneb:
if not dataColumnQuarantine[].hasDataColumns(forkyBlck):
if not blobQuarantine[].hasBlobs(forkyBlck):
# We don't have all the blobs for this block, so we have
# to put it in blobless quarantine.
if not quarantine[].addBlobless(dag.finalizedHead.slot, forkyBlck):
err(VerifierError.UnviableFork)
else:
err(VerifierError.MissingParent)
elif blobQuarantine[].hasBlobs(forkyBlck):
let blobs = blobQuarantine[].popBlobs(forkyBlck.root, forkyBlck)
await blockProcessor[].addBlock(MsgSource.gossip, signedBlock,
Opt.some(blobs), Opt.none(DataColumnSidecars),
maybeFinalized = maybeFinalized)
elif not dataColumnQuarantine[].hasDataColumns(forkyBlck):
# We don't have all the data columns for this block, so we have
# to put it in columnless quarantine.
if not quarantine[].addColumnless(dag.finalizedHead.slot, forkyBlck):

View File

@ -133,6 +133,28 @@ proc getShortMap*[T](req: SyncRequest[T],
res.add('|')
res
proc getShortMap*[T](req: SyncRequest[T],
data: openArray[ref DataColumnSidecar]): string =
# Returns all slot numbers in ``data`` as a placement map
var
res = newStringOfCap(req.count * MAX_BLOBS_PER_BLOCK)
cur: uint64 = 0
for slot in req.slot..<req.slot+req.count:
if cur >= lenu64(data):
res.add('|')
continue
if slot == data[cur].signed_block_header.message.slot:
for k in cur..<cur+MAX_BLOBS_PER_BLOCK:
if k >= lenu64(data) or slot != data[k].signed_block_header.message.slot:
res.add('|')
break
else:
inc(cur)
res.add('|')
else:
res.add('|')
res
proc contains*[T](req: SyncRequest[T], slot: Slot): bool {.inline.} =
slot >= req.slot and slot < req.slot + req.count