Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PeerDAS subnet decoupling (aka custody groups) #6736

Merged
merged 14 commits into from
Jan 15, 2025

Conversation

jimmygchen
Copy link
Member

@jimmygchen jimmygchen commented Dec 20, 2024

Issue Addressed

#6709

This spec change changes the custody unit from subnets to custody groups, in order to decouple networking and DAS core parameters - this allow us to tweak DAS core and network parameters in isolation, i.e. changing number of column subnets will not have a direct impact to sampling parameters & security.

Spec: ethereum/consensus-specs#3832

Proposed Changes:

On startup, we construct NetworkGlobals and compute sampling subnets and sampling columns from NodeId - this remains the same but the computation logic has been updated to compute these from custody groups. (node_id => custody_groups => subnets and columns)

  • Introduce "custody groups" and compute custody subnets and columns with custody group.
  • Change custody_subnet_count (csc) to custody_group_count (cgc) in MetaData and ENR. (spec)
  • Add a custody group to subnet mapping in PeerManager to avoid re-computing it when setting peer subnets based on their custody groups.
  • The sampling_size computation logic is has been updated to be base on custody groups instead of custody subnets. code (spec update)
  • Refactored sampling_size and custody_group_count logic into ChainSpec to keep them in one place.

@jimmygchen jimmygchen changed the title Implement PeerDAS subnet decoupling (aka custody groups). Implement PeerDAS subnet decoupling (aka custody groups) Dec 20, 2024
@jimmygchen jimmygchen added das Data Availability Sampling work-in-progress PR is a work-in-progress labels Dec 20, 2024
Squashed commit of the following:

commit 898d05e
Merge: ffbd25e 7e0cdde
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 ffbd25e
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 aa593cf
Author: Jimmy Chen <jchen.tc@gmail.com>
Date:   Fri Dec 20 12:08:54 2024 +1100

    Refactor spec testing for features and simplify usage.
@jimmygchen jimmygchen added ready-for-review The code is ready for review and removed work-in-progress PR is a work-in-progress labels Jan 3, 2025
@jimmygchen jimmygchen marked this pull request as ready for review January 3, 2025 02:10
@jimmygchen
Copy link
Member Author

@dapplion @pawanjay176 I think this PR is ready for review now. The failing spec tests are new electra tests, which Pawan and Michael are currently working on, and the DAS spec tests are all passing.

Please review and let me know what you think 🙏

@dapplion
Copy link
Collaborator

dapplion commented Jan 7, 2025

A few comments, else looks solid and good to go

# 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
@jimmygchen jimmygchen requested a review from jxs as a code owner January 10, 2025 07:23
Co-authored-by: Lion - dapplion <35266934+dapplion@users.noreply.github.com>
@jimmygchen
Copy link
Member Author

@dapplion thanks for the thorough review! I've addressed all comments and resolved conflicts.

"Custody group not found in subnet mapping";
"custody_index" => custody_index,
"peer_id" => %peer_id
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should never happen as we compute subnets_by_custody_group ourselves. Is it necessary to have a warn here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes agree that this should not happen - we also validate peer's custody_group_count when computing custody groups.

What error handling are you suggesting? I don't think we should panic, or just swallow the error if it happens in case of a bug or invalid input that somehow slip through our validation.

Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! We can review the error conditions later

# Conflicts:
#	beacon_node/lighthouse_network/src/peer_manager/mod.rs
Copy link
Collaborator

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jimmygchen
Copy link
Member Author

@mergify queue

@jimmygchen jimmygchen added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Jan 15, 2025
Copy link

mergify bot commented Jan 15, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at e98209d

mergify bot added a commit that referenced this pull request Jan 15, 2025
@mergify mergify bot merged commit e98209d into sigp:unstable Jan 15, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
das Data Availability Sampling ready-for-merge This PR is ready to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants