From 87bc91febe3469e4a2d0269207594bfb5529a6cd Mon Sep 17 00:00:00 2001 From: Agnish Ghosh Date: Wed, 26 Jun 2024 02:38:04 +0530 Subject: [PATCH] fix: message router --- beacon_chain/nimbus_beacon_node.nim | 5 +++ beacon_chain/spec/eip7594_helpers.nim | 6 ---- beacon_chain/validators/message_router.nim | 42 +++++++++++----------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index c55ad9005..07c480c74 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1107,6 +1107,11 @@ proc addCapellaMessageHandlers( node.addAltairMessageHandlers(forkDigest, slot) node.network.subscribe(getBlsToExecutionChangeTopic(forkDigest), basicParams) +proc fetchCustodySubnetCount* (res: var uint64, node: BeaconNode) = + res = CUSTODY_REQUIREMENT + if node.config.subscribeAllSubnets: + res = DATA_COLUMN_SIDECAR_SUBNET_COUNT + proc addDenebMessageHandlers( node: BeaconNode, forkDigest: ForkDigest, slot: Slot) = node.addCapellaMessageHandlers(forkDigest, slot) diff --git a/beacon_chain/spec/eip7594_helpers.nim b/beacon_chain/spec/eip7594_helpers.nim index 94bb37cba..9c129a6da 100644 --- a/beacon_chain/spec/eip7594_helpers.nim +++ b/beacon_chain/spec/eip7594_helpers.nim @@ -13,7 +13,6 @@ import stew/results, ssz_serialization/proofs, chronicles, - ../beacon_node, ./[beacon_time, crypto], kzg4844/kzg_ex, eth/p2p/discoveryv5/[node], @@ -30,11 +29,6 @@ proc sortedColumnIndices*(columnsPerSubnet: ColumnIndex, subnetIds: HashSet[uint res.sort() res -proc fetchCustodySubnetCount* (res: var uint64, conf: BeaconNode) = - res = CUSTODY_REQUIREMENT - if node.config.subscribeAllSubnets: - res = DATA_COLUMN_SIDECAR_SUBNET_COUNT - proc get_custody_column_subnet*(node_id: NodeId, custody_subnet_count: uint64): Result[HashSet[uint64], cstring] = # fetches the subnets for custody column for the current node # assert custody_subnet_count <= DATA_COLUMN_SIDECAR_SUBNET_COUNT diff --git a/beacon_chain/validators/message_router.nim b/beacon_chain/validators/message_router.nim index 479a91e9d..2b945e8a4 100644 --- a/beacon_chain/validators/message_router.nim +++ b/beacon_chain/validators/message_router.nim @@ -161,27 +161,27 @@ proc routeSignedBeaconBlock*( notice "Blob sent", blob = shortLog(blobs[i]) blobRefs = Opt.some(blobs.mapIt(newClone(it))) - # var dataColumnRefs = Opt.none(DataColumnSidecars) - # when typeof(blck).kind >= ConsensusFork.Deneb: - # if blobsOpt.isSome(): - # let blobs = blobsOpt.get() - # let data_columns = get_data_column_sidecars(blck, blobs.mapIt(it.blob)).get() - # var das_workers = newSeq[Future[SendResult]](len(data_columns)) - # for i in 0..= ConsensusFork.Deneb: + if blobsOpt.isSome(): + let blobs = blobsOpt.get() + let data_columns = get_data_column_sidecars(blck, blobs.mapIt(it.blob)).get() + var das_workers = newSeq[Future[SendResult]](len(data_columns)) + for i in 0..