Request manager: Handle blobless blocks (#4833)
Post-Deneb, when the request manager receives a missing block from a peer, it needs to check if the corresponding blobs are available, and if so pass them along. If they aren't available, the newly-fetched block must be put in blobless quarantine (while the blobs are retrieved, coming in next commit).
This commit is contained in:
parent
0fc89484de
commit
12d640b691
|
@ -340,6 +340,30 @@ proc initFullNode(
|
|||
resfut,
|
||||
maybeFinalized = maybeFinalized)
|
||||
resfut
|
||||
rmanBlockVerifier = proc(signedBlock: ForkedSignedBeaconBlock,
|
||||
maybeFinalized: bool):
|
||||
Future[Result[void, VerifierError]] =
|
||||
let resfut = newFuture[Result[void, VerifierError]]("rmanBlockVerifier")
|
||||
withBlck(signedBlock):
|
||||
when typeof(blck).toFork() >= ConsensusFork.Deneb:
|
||||
if not blobQuarantine[].hasBlobs(blck):
|
||||
# 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, blck):
|
||||
let e = Result[void, VerifierError].err(VerifierError.UnviableFork)
|
||||
resfut.complete(e)
|
||||
return
|
||||
let blobs = blobQuarantine[].popBlobs(blck.root)
|
||||
blockProcessor[].addBlock(MsgSource.gossip, signedBlock,
|
||||
blobs,
|
||||
resfut,
|
||||
maybeFinalized = maybeFinalized)
|
||||
else:
|
||||
blockProcessor[].addBlock(MsgSource.gossip, signedBlock,
|
||||
BlobSidecars @[],
|
||||
resfut,
|
||||
maybeFinalized = maybeFinalized)
|
||||
resfut
|
||||
processor = Eth2Processor.new(
|
||||
config.doppelgangerDetection,
|
||||
blockProcessor, node.validatorMonitor, dag, attestationPool,
|
||||
|
@ -390,7 +414,7 @@ proc initFullNode(
|
|||
node.requestManager = RequestManager.init(node.network,
|
||||
dag.cfg.DENEB_FORK_EPOCH,
|
||||
getBeaconTime,
|
||||
blockVerifier)
|
||||
rmanBlockVerifier)
|
||||
node.syncManager = syncManager
|
||||
node.backfiller = backfiller
|
||||
node.router = router
|
||||
|
|
|
@ -32,8 +32,7 @@ const
|
|||
|
||||
type
|
||||
BlockVerifier* =
|
||||
proc(signedBlock: ForkedSignedBeaconBlock, blobs: BlobSidecars,
|
||||
maybeFinalized: bool):
|
||||
proc(signedBlock: ForkedSignedBeaconBlock, maybeFinalized: bool):
|
||||
Future[Result[void, VerifierError]] {.gcsafe, raises: [Defect].}
|
||||
RequestManager* = object
|
||||
network*: Eth2Node
|
||||
|
@ -91,9 +90,7 @@ proc fetchAncestorBlocksFromNetwork(rman: RequestManager,
|
|||
gotUnviableBlock = false
|
||||
|
||||
for b in ublocks:
|
||||
let ver = await rman.blockVerifier(b[], BlobSidecars @[], false)
|
||||
# TODO:
|
||||
# blob handling for Deneb blocks
|
||||
let ver = await rman.blockVerifier(b[], false)
|
||||
if ver.isErr():
|
||||
case ver.error()
|
||||
of VerifierError.MissingParent:
|
||||
|
|
Loading…
Reference in New Issue