mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Implement Subnet Sampling for PeerDAS (#6410)
* Add `SAMPLES_PER_SLOT` config. * Rename `sampling` module to `peer_sampling` * Implement subnet sampling. * Update lookup test. * Merge branch 'unstable' into subnet-sampling * Merge branch 'unstable' into subnet-sampling # Conflicts: # beacon_node/beacon_chain/src/data_availability_checker.rs # beacon_node/http_api/src/publish_blocks.rs # beacon_node/lighthouse_network/src/types/globals.rs # beacon_node/network/src/sync/manager.rs * Merge branch 'unstable' into subnet-sampling
This commit is contained in:
@@ -198,6 +198,7 @@ pub struct ChainSpec {
|
||||
pub custody_requirement: u64,
|
||||
pub data_column_sidecar_subnet_count: u64,
|
||||
pub number_of_columns: usize,
|
||||
pub samples_per_slot: u64,
|
||||
|
||||
/*
|
||||
* Networking
|
||||
@@ -811,6 +812,7 @@ impl ChainSpec {
|
||||
custody_requirement: 4,
|
||||
data_column_sidecar_subnet_count: 128,
|
||||
number_of_columns: 128,
|
||||
samples_per_slot: 8,
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
@@ -1132,6 +1134,7 @@ impl ChainSpec {
|
||||
custody_requirement: 4,
|
||||
data_column_sidecar_subnet_count: 128,
|
||||
number_of_columns: 128,
|
||||
samples_per_slot: 8,
|
||||
/*
|
||||
* Network specific
|
||||
*/
|
||||
@@ -1382,6 +1385,9 @@ pub struct Config {
|
||||
#[serde(default = "default_number_of_columns")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
number_of_columns: u64,
|
||||
#[serde(default = "default_samples_per_slot")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
samples_per_slot: u64,
|
||||
}
|
||||
|
||||
fn default_bellatrix_fork_version() -> [u8; 4] {
|
||||
@@ -1521,17 +1527,21 @@ const fn default_maximum_gossip_clock_disparity_millis() -> u64 {
|
||||
}
|
||||
|
||||
const fn default_custody_requirement() -> u64 {
|
||||
1
|
||||
4
|
||||
}
|
||||
|
||||
const fn default_data_column_sidecar_subnet_count() -> u64 {
|
||||
32
|
||||
128
|
||||
}
|
||||
|
||||
const fn default_number_of_columns() -> u64 {
|
||||
128
|
||||
}
|
||||
|
||||
const fn default_samples_per_slot() -> u64 {
|
||||
8
|
||||
}
|
||||
|
||||
fn max_blocks_by_root_request_common(max_request_blocks: u64) -> usize {
|
||||
let max_request_blocks = max_request_blocks as usize;
|
||||
RuntimeVariableList::<Hash256>::from_vec(
|
||||
@@ -1727,6 +1737,7 @@ impl Config {
|
||||
custody_requirement: spec.custody_requirement,
|
||||
data_column_sidecar_subnet_count: spec.data_column_sidecar_subnet_count,
|
||||
number_of_columns: spec.number_of_columns as u64,
|
||||
samples_per_slot: spec.samples_per_slot,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1802,6 +1813,7 @@ impl Config {
|
||||
custody_requirement,
|
||||
data_column_sidecar_subnet_count,
|
||||
number_of_columns,
|
||||
samples_per_slot,
|
||||
} = self;
|
||||
|
||||
if preset_base != E::spec_name().to_string().as_str() {
|
||||
@@ -1881,6 +1893,7 @@ impl Config {
|
||||
custody_requirement,
|
||||
data_column_sidecar_subnet_count,
|
||||
number_of_columns: number_of_columns as usize,
|
||||
samples_per_slot,
|
||||
|
||||
..chain_spec.clone()
|
||||
})
|
||||
@@ -2125,6 +2138,7 @@ mod yaml_tests {
|
||||
CUSTODY_REQUIREMENT: 1
|
||||
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
|
||||
NUMBER_OF_COLUMNS: 128
|
||||
SAMPLES_PER_SLOT: 8
|
||||
"#;
|
||||
|
||||
let chain_spec: Config = serde_yaml::from_str(spec).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user