Remove data dependency from from core module in `consensus/types (#8694)

#8652


  Implements "simplified" versions of `max_blobs_by_root_request` and `max_data_columns_by_root_request` which do not depend on type information from the `data` module. I've also added tests which test the original implementation against the simplified one to ensure they don't deviate.

Also moves `all_data_column_sidecar_subnets` from a method on `ChainSpec` to a function which just takes `ChainSpec` as an argument.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-01-26 23:25:39 +04:00
committed by GitHub
parent 7f065009a7
commit 1476c20cfc
7 changed files with 127 additions and 35 deletions

View File

@@ -3,7 +3,13 @@ use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use strum::AsRefStr;
use typenum::Unsigned;
use types::{ChainSpec, DataColumnSubnetId, EthSpec, ForkName, SubnetId, SyncSubnetId};
use types::{
ChainSpec, EthSpec,
attestation::SubnetId,
data::{DataColumnSubnetId, all_data_column_sidecar_subnets_from_spec},
fork::ForkName,
sync_committee::SyncSubnetId,
};
use crate::Subnet;
@@ -115,7 +121,7 @@ pub fn is_fork_non_core_topic(topic: &GossipTopic, _fork_name: ForkName) -> bool
pub fn all_topics_at_fork<E: EthSpec>(fork: ForkName, spec: &ChainSpec) -> Vec<GossipKind> {
// Compute the worst case of all forks
let sampling_subnets = HashSet::from_iter(spec.all_data_column_sidecar_subnets());
let sampling_subnets = HashSet::from_iter(all_data_column_sidecar_subnets_from_spec(spec));
let opts = TopicConfig {
enable_light_client_server: true,
subscribe_all_subnets: true,