diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index bb7d6848e..9de1067a6 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -420,19 +420,28 @@ proc initFullNode( localSubnetCount)) accumulatedColumns = dataColumnQuarantine[].accumulateDataColumns(forkyBlck) - for ac in accumulatedColumns: - if ac notin localCustodyColumns: - # We don't have all the data columns for this block, so we have - # to put it in columnless quarantine. - if not quarantine[].addColumnless(dag.finalizedHead.slot, forkyBlck): - return err(VerifierError.UnviableFork) - else: - return err(VerifierError.MissingParent) + if accumulatedColumns.len == 0: + # We don't have all the data columns for this block, so we have + # to put it in columnless quarantine. + if not quarantine[].addColumnless(dag.finalizedHead.slot, forkyBlck): + return err(VerifierError.UnviableFork) else: - let data_columns = dataColumnQuarantine[].popDataColumns(forkyBlck.root, forkyBlck) - return await blockProcessor[].addBlock(MsgSource.gossip, signedBlock, - Opt.none(BlobSidecars), Opt.some(data_columns), - maybeFinalized = maybeFinalized) + return err(VerifierError.MissingParent) + elif supernode == true and accumulatedColumns.len >= localCustodyColumns.len div 2: + let data_columns = dataColumnQuarantine[].popDataColumns(forkyBlck.root, forkyBlck) + return await blockProcessor[].addBlock(MsgSource.gossip, signedBlock, + Opt.none(BlobSidecars), Opt.some(data_columns), + maybeFinalized = maybeFinalized) + + elif supernode == false and accumulatedColumns.len <= localCustodyColumns.len div 2: + let data_columns = dataColumnQuarantine[].popDataColumns(forkyBlck.root, forkyBlck) + return await blockProcessor[].addBlock(MsgSource.gossip, signedBlock, + Opt.none(BlobSidecars), Opt.some(data_columns), + maybeFinalized = maybeFinalized) + else: + return await blockProcessor[].addBlock(MsgSource.gossip, signedBlock, + Opt.none(BlobSidecars), Opt.none(DataColumnSidecars), + maybeFinalized = maybeFinalized) else: return await blockProcessor[].addBlock(MsgSource.gossip, signedBlock, Opt.none(BlobSidecars), Opt.none(DataColumnSidecars), diff --git a/beacon_chain/sync/sync_manager.nim b/beacon_chain/sync/sync_manager.nim index dad6d82a9..d8bf05935 100644 --- a/beacon_chain/sync/sync_manager.nim +++ b/beacon_chain/sync/sync_manager.nim @@ -360,11 +360,10 @@ func groupDataColumns*[T](req: SyncRequest[T], # The following data column sidecars, where they exist, MUST be sent in consecutive (slot, index) order. # https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/_features/eip7594/p2p-interface.md let header = forkyBlck.toSignedBeaconBlockHeader() - for column_idx in data_columns - if column_cursor >= data_columns.len: - return err("DataColumnSidecar: response too short") + for column_idx in 0..