Implement PeerDAS subnet decoupling (aka custody groups) (#6736)

* Implement PeerDAS subnet decoupling (aka custody groups).

* Merge branch 'unstable' into decouple-subnets

* Refactor feature testing for spec tests (#6737)

Squashed commit of the following:

commit 898d05ee17
Merge: ffbd25e2b 7e0cddef3
Author: Jimmy Chen <jchen.tc@gmail.com>
Date:   Tue Dec 24 14:41:19 2024 +1100

    Merge branch 'unstable' into refactor-ef-tests-features

commit ffbd25e2be
Author: Jimmy Chen <jchen.tc@gmail.com>
Date:   Tue Dec 24 14:40:38 2024 +1100

    Fix `SszStatic` tests for PeerDAS: exclude eip7594 test vectors when testing Electra types.

commit aa593cf35c
Author: Jimmy Chen <jchen.tc@gmail.com>
Date:   Fri Dec 20 12:08:54 2024 +1100

    Refactor spec testing for features and simplify usage.

* Fix build.

* Add input validation and improve arithmetic handling when calculating custody groups.

* Address review comments re code style consistency.

* Merge branch 'unstable' into decouple-subnets

# Conflicts:
#	beacon_node/beacon_chain/src/kzg_utils.rs
#	beacon_node/beacon_chain/src/observed_data_sidecars.rs
#	beacon_node/lighthouse_network/src/discovery/subnet_predicate.rs
#	common/eth2_network_config/built_in_network_configs/chiado/config.yaml
#	common/eth2_network_config/built_in_network_configs/gnosis/config.yaml
#	common/eth2_network_config/built_in_network_configs/holesky/config.yaml
#	common/eth2_network_config/built_in_network_configs/mainnet/config.yaml
#	common/eth2_network_config/built_in_network_configs/sepolia/config.yaml
#	consensus/types/src/chain_spec.rs

* Update consensus/types/src/chain_spec.rs

Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com>

* Merge remote-tracking branch 'origin/unstable' into decouple-subnets

* Update error handling.

* Address review comment.

* Merge remote-tracking branch 'origin/unstable' into decouple-subnets

# Conflicts:
#	consensus/types/src/chain_spec.rs

* Update PeerDAS spec tests to `1.5.0-beta.0` and fix failing unit tests.

* Merge remote-tracking branch 'origin/unstable' into decouple-subnets

# Conflicts:
#	beacon_node/lighthouse_network/src/peer_manager/mod.rs
This commit is contained in:
Jimmy Chen
2025-01-15 18:40:26 +11:00
committed by GitHub
parent dd7591f712
commit e98209d118
39 changed files with 552 additions and 430 deletions

View File

@@ -39,6 +39,10 @@ pub trait Handler {
}
}
// Run feature tests for future forks that are not yet added to `ForkName`.
// This runs tests in the directory named by the feature instead of the fork name.
// e.g. consensus-spec-tests/tests/general/[feature_name]/[runner_name]
// e.g. consensus-spec-tests/tests/general/peerdas/ssz_static
for feature_name in FeatureName::list_all() {
if self.is_enabled_for_feature(feature_name) {
self.run_for_feature(feature_name);
@@ -350,23 +354,20 @@ where
self.supported_forks.contains(&fork_name)
}
fn is_enabled_for_feature(&self, _feature_name: FeatureName) -> bool {
// This ensures we only run the tests **once** for `Eip7594`, using the types matching the
// correct fork, e.g. `Eip7594` uses SSZ types from `Deneb` as of spec test version
// `v1.5.0-alpha.8`, therefore the `Eip7594` tests should get included when testing Deneb types.
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
// This ensures we only run the tests **once** for the feature, using the types matching the
// correct fork, e.g. `Fulu` uses SSZ types from `Electra` fork as of spec test version
// `v1.5.0-beta.0`, therefore the `Fulu` tests should get included when testing Electra types.
//
// e.g. Eip7594 test vectors are executed in the first line below, but excluded in the 2nd
// e.g. Fulu test vectors are executed in the first line below, but excluded in the 2nd
// line when testing the type `AttestationElectra`:
//
// ```
// SszStaticHandler::<AttestationBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra().run();
// SszStaticHandler::<AttestationElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only().run();
// ```
/* TODO(das): re-enable
feature_name == FeatureName::Eip7594
feature_name == FeatureName::Fulu
&& self.supported_forks.contains(&feature_name.fork_name())
*/
false
}
}
@@ -388,10 +389,8 @@ where
BeaconState::<E>::name().into()
}
fn is_enabled_for_feature(&self, _feature_name: FeatureName) -> bool {
// TODO(das): re-enable
// feature_name == FeatureName::Eip7594
false
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
feature_name == FeatureName::Fulu
}
}
@@ -415,10 +414,8 @@ where
T::name().into()
}
fn is_enabled_for_feature(&self, _feature_name: FeatureName) -> bool {
// TODO(das): re-enable
// feature_name == FeatureName::Eip7594
false
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
feature_name == FeatureName::Fulu
}
}
@@ -877,10 +874,10 @@ impl<E: EthSpec> Handler for KZGVerifyKZGProofHandler<E> {
#[derive(Derivative)]
#[derivative(Default(bound = ""))]
pub struct GetCustodyColumnsHandler<E>(PhantomData<E>);
pub struct GetCustodyGroupsHandler<E>(PhantomData<E>);
impl<E: EthSpec + TypeName> Handler for GetCustodyColumnsHandler<E> {
type Case = cases::GetCustodyColumns<E>;
impl<E: EthSpec + TypeName> Handler for GetCustodyGroupsHandler<E> {
type Case = cases::GetCustodyGroups<E>;
fn config_name() -> &'static str {
E::name()
@@ -891,7 +888,27 @@ impl<E: EthSpec + TypeName> Handler for GetCustodyColumnsHandler<E> {
}
fn handler_name(&self) -> String {
"get_custody_columns".into()
"get_custody_groups".into()
}
}
#[derive(Derivative)]
#[derivative(Default(bound = ""))]
pub struct ComputeColumnsForCustodyGroupHandler<E>(PhantomData<E>);
impl<E: EthSpec + TypeName> Handler for ComputeColumnsForCustodyGroupHandler<E> {
type Case = cases::ComputeColumnsForCustodyGroups<E>;
fn config_name() -> &'static str {
E::name()
}
fn runner_name() -> &'static str {
"networking"
}
fn handler_name(&self) -> String {
"compute_columns_for_custody_group".into()
}
}
@@ -1002,10 +1019,8 @@ impl<E: EthSpec + TypeName> Handler for KzgInclusionMerkleProofValidityHandler<E
fork_name.deneb_enabled()
}
fn is_enabled_for_feature(&self, _feature_name: FeatureName) -> bool {
// TODO(das): re-enable this
// feature_name == FeatureName::Eip7594
false
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
feature_name == FeatureName::Fulu
}
}