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,
|
resfut,
|
||||||
maybeFinalized = maybeFinalized)
|
maybeFinalized = maybeFinalized)
|
||||||
resfut
|
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(
|
processor = Eth2Processor.new(
|
||||||
config.doppelgangerDetection,
|
config.doppelgangerDetection,
|
||||||
blockProcessor, node.validatorMonitor, dag, attestationPool,
|
blockProcessor, node.validatorMonitor, dag, attestationPool,
|
||||||
|
@ -390,7 +414,7 @@ proc initFullNode(
|
||||||
node.requestManager = RequestManager.init(node.network,
|
node.requestManager = RequestManager.init(node.network,
|
||||||
dag.cfg.DENEB_FORK_EPOCH,
|
dag.cfg.DENEB_FORK_EPOCH,
|
||||||
getBeaconTime,
|
getBeaconTime,
|
||||||
blockVerifier)
|
rmanBlockVerifier)
|
||||||
node.syncManager = syncManager
|
node.syncManager = syncManager
|
||||||
node.backfiller = backfiller
|
node.backfiller = backfiller
|
||||||
node.router = router
|
node.router = router
|
||||||
|
|
|
@ -32,8 +32,7 @@ const
|
||||||
|
|
||||||
type
|
type
|
||||||
BlockVerifier* =
|
BlockVerifier* =
|
||||||
proc(signedBlock: ForkedSignedBeaconBlock, blobs: BlobSidecars,
|
proc(signedBlock: ForkedSignedBeaconBlock, maybeFinalized: bool):
|
||||||
maybeFinalized: bool):
|
|
||||||
Future[Result[void, VerifierError]] {.gcsafe, raises: [Defect].}
|
Future[Result[void, VerifierError]] {.gcsafe, raises: [Defect].}
|
||||||
RequestManager* = object
|
RequestManager* = object
|
||||||
network*: Eth2Node
|
network*: Eth2Node
|
||||||
|
@ -91,9 +90,7 @@ proc fetchAncestorBlocksFromNetwork(rman: RequestManager,
|
||||||
gotUnviableBlock = false
|
gotUnviableBlock = false
|
||||||
|
|
||||||
for b in ublocks:
|
for b in ublocks:
|
||||||
let ver = await rman.blockVerifier(b[], BlobSidecars @[], false)
|
let ver = await rman.blockVerifier(b[], false)
|
||||||
# TODO:
|
|
||||||
# blob handling for Deneb blocks
|
|
||||||
if ver.isErr():
|
if ver.isErr():
|
||||||
case ver.error()
|
case ver.error()
|
||||||
of VerifierError.MissingParent:
|
of VerifierError.MissingParent:
|
||||||
|
|
Loading…
Reference in New Issue