From c2d5a55d95640777913b7d868df5197b7305d55f Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Fri, 26 Jul 2024 00:03:47 +0200 Subject: [PATCH] cleanup pre-deneb fallback --- beacon_chain/gossip_processing/block_processor.nim | 4 ++-- beacon_chain/rpc/rest_beacon_api.nim | 8 ++++++-- beacon_chain/spec/forks.nim | 6 ------ beacon_chain/validators/message_router.nim | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/beacon_chain/gossip_processing/block_processor.nim b/beacon_chain/gossip_processing/block_processor.nim index f53796000..059ff4dbd 100644 --- a/beacon_chain/gossip_processing/block_processor.nim +++ b/beacon_chain/gossip_processing/block_processor.nim @@ -173,7 +173,7 @@ from ../consensus_object_pools/block_clearance import proc storeBackfillBlock( self: var BlockProcessor, signedBlock: ForkySignedBeaconBlock, - blobsOpt: OptForkyBlobSidecars + blobsOpt: Opt[ForkyBlobSidecars] ): Result[void, VerifierError] = const consensusFork = typeof(signedBlock).kind @@ -441,7 +441,7 @@ proc enqueueBlock*( proc storeBlock( self: ref BlockProcessor, src: MsgSource, wallTime: BeaconTime, signedBlock: ForkySignedBeaconBlock, - blobsOpt: OptForkyBlobSidecars, + blobsOpt: Opt[ForkyBlobSidecars], maybeFinalized = false, queueTick: Moment = Moment.now(), validationDur = Duration() diff --git a/beacon_chain/rpc/rest_beacon_api.nim b/beacon_chain/rpc/rest_beacon_api.nim index 610a1898b..5dc9a43e1 100644 --- a/beacon_chain/rpc/rest_beacon_api.nim +++ b/beacon_chain/rpc/rest_beacon_api.nim @@ -1093,9 +1093,11 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) = return RestApiResponse.jsonError(Http400, InvalidBlockObjectError) let res = withBlck(forked): + const blobFork = + blobForkAtConsensusFork(consensusFork).get(BlobFork.Deneb) forkyBlck.root = hash_tree_root(forkyBlck.message) await node.router.routeSignedBeaconBlock( - forkyBlck, Opt.none(seq[deneb.BlobSidecar]), + forkyBlck, Opt.none(seq[blobFork.BlobSidecar]), checkValidator = true) if res.isErr(): @@ -1176,9 +1178,11 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) = return RestApiResponse.jsonError(Http400, InvalidBlockObjectError) let res = withBlck(forked): + const blobFork = + blobForkAtConsensusFork(consensusFork).get(BlobFork.Deneb) forkyBlck.root = hash_tree_root(forkyBlck.message) await node.router.routeSignedBeaconBlock( - forkyBlck, Opt.none(seq[deneb.BlobSidecar]), + forkyBlck, Opt.none(seq[blobFork.BlobSidecar]), checkValidator = true) if res.isErr(): diff --git a/beacon_chain/spec/forks.nim b/beacon_chain/spec/forks.nim index 7f5150082..3262070e0 100644 --- a/beacon_chain/spec/forks.nim +++ b/beacon_chain/spec/forks.nim @@ -280,15 +280,9 @@ type ForkyBlobSidecar* = deneb.BlobSidecar - OptSeqForkyBlobSidecar* = - Opt[seq[deneb.BlobSidecar]] - ForkyBlobSidecars* = deneb.BlobSidecars - OptForkyBlobSidecars* = - Opt[deneb.BlobSidecars] - ForkedBlobSidecar* = object case kind*: BlobFork of BlobFork.Deneb: diff --git a/beacon_chain/validators/message_router.nim b/beacon_chain/validators/message_router.nim index df8f303f8..3fb0ecb94 100644 --- a/beacon_chain/validators/message_router.nim +++ b/beacon_chain/validators/message_router.nim @@ -84,7 +84,7 @@ template getCurrentBeaconTime(router: MessageRouter): BeaconTime = type RouteBlockResult = Result[Opt[BlockRef], string] proc routeSignedBeaconBlock*( router: ref MessageRouter, blck: ForkySignedBeaconBlock, - blobsOpt: OptSeqForkyBlobSidecar, checkValidator: bool): + blobsOpt: Opt[seq[ForkyBlobSidecar]], checkValidator: bool): Future[RouteBlockResult] {.async: (raises: [CancelledError]).} = ## Validate and broadcast beacon block, then add it to the block database ## Returns the new Head when block is added successfully to dag, none when