Skip to content

Commit 3ff9b69

Browse files
authored
simplify eth2_network error handling (#5765)
This PR gets rid of a bunch of redundant exception handling through async raises guarantees. More can be removed once libp2p gets properly annotated.
1 parent a5daa6d commit 3ff9b69

File tree

13 files changed

+442
-492
lines changed

13 files changed

+442
-492
lines changed

beacon_chain/gossip_processing/block_processor.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type
6161
blobs*: Opt[BlobSidecars]
6262
maybeFinalized*: bool
6363
## The block source claims the block has been finalized already
64-
resfut*: Future[Result[void, VerifierError]]
64+
resfut*: Future[Result[void, VerifierError]].Raising([CancelledError])
6565
queueTick*: Moment # Moment when block was enqueued
6666
validationDur*: Duration # Time it took to perform gossip validation
6767
src*: MsgSource
@@ -385,7 +385,7 @@ proc checkBloblessSignature(self: BlockProcessor,
385385
proc enqueueBlock*(
386386
self: var BlockProcessor, src: MsgSource, blck: ForkedSignedBeaconBlock,
387387
blobs: Opt[BlobSidecars],
388-
resfut: Future[Result[void, VerifierError]] = nil,
388+
resfut: Future[Result[void, VerifierError]].Raising([CancelledError]) = nil,
389389
maybeFinalized = false,
390390
validationDur = Duration()) =
391391
withBlck(blck):
@@ -756,7 +756,7 @@ proc storeBlock(
756756
proc addBlock*(
757757
self: var BlockProcessor, src: MsgSource, blck: ForkedSignedBeaconBlock,
758758
blobs: Opt[BlobSidecars], maybeFinalized = false,
759-
validationDur = Duration()): Future[Result[void, VerifierError]] =
759+
validationDur = Duration()): Future[Result[void, VerifierError]] {.async: (raises: [CancelledError], raw: true).} =
760760
## Enqueue a Gossip-validated block for consensus verification
761761
# Backpressure:
762762
# There is no backpressure here - producers must wait for `resfut` to

0 commit comments

Comments
 (0)