Skip to content

Commit f26799b

Browse files
committed
rework and cleanup
1 parent 73c5cef commit f26799b

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

beacon_chain/gossip_processing/eth2_processor.nim

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,17 @@ proc processSignedBeaconBlock*(
274274

275275
v
276276

277-
proc processBlobSidecar*(
278-
self: ref Eth2Processor, src: MsgSource,
279-
blobSidecar: deneb.BlobSidecar, subnet_id: BlobId):
280-
Future[ValidationRes] {.async: (raises: [CancelledError]).} =
281-
template block_header: untyped = blobSidecar.signed_block_header.message
282-
let block_root = hash_tree_root(block_header)
277+
proc validateBlobSidecarFromEL(
278+
self: ref Eth2Processor,
279+
block_root: Eth2Digest):
280+
Future[Result[void, ValidationError]] {.async: (raises: [CancelledError]).} =
283281

284282
if (let o = self.quarantine[].popBlobless(block_root); o.isSome):
285283
let blobless = o.get()
286284
withBlck(blobless):
287285
when consensusFork >= ConsensusFork.Electra:
288-
let blobsFromElOpt = await self.elManager.sendGetBlobs(forkyBlck)
289-
debugEcho "pulled blobs from el"
290-
debugEcho blobsFromElOpt.get.len
286+
let blobsFromElOpt =
287+
await self.elManager.sendGetBlobs(forkyBlck)
291288
if blobsFromElOpt.get.len > 0 and blobsFromElOpt.isSome():
292289
let blobsEl = blobsFromElOpt.get()
293290
# check lengths of array[BlobAndProofV1] with blobs
@@ -307,6 +304,24 @@ proc processBlobSidecar*(
307304
MsgSource.gossip, blobless,
308305
Opt.some(self.blobQuarantine[].popBlobs(block_root, forkyBlck)))
309306

307+
return ok()
308+
309+
else:
310+
return errIgnore("EL did not respond with blobs and proofs")
311+
312+
proc processBlobSidecar*(
313+
self: ref Eth2Processor, src: MsgSource,
314+
blobSidecar: deneb.BlobSidecar, subnet_id: BlobId):
315+
Future[ValidationRes] {.async: (raises: [CancelledError]).} =
316+
template block_header: untyped = blobSidecar.signed_block_header.message
317+
let block_root = hash_tree_root(block_header)
318+
319+
let vEl =
320+
await self.validateBlobSidecarFromEL(block_root)
321+
322+
if vEl.isOk():
323+
return vEl
324+
310325
let
311326
wallTime = self.getCurrentBeaconTime()
312327
(_, wallSlot) = wallTime.toSlot()

beacon_chain/nimbus_beacon_node.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{.push raises: [].}
99

1010
import
11-
std/[os, random, terminal, times, exitprocs, sequtils],
11+
std/[os, random, terminal, times, exitprocs],
1212
chronos, chronicles,
1313
metrics, metrics/chronos_httpserver,
1414
ssz_serialization/types,

0 commit comments

Comments
 (0)