Skip to content

Comments

feat: shared CustodyConfig on main thread and network thread#7632

Merged
matthewkeil merged 6 commits intopeerDASfrom
te/single_custody_config
Apr 7, 2025
Merged

feat: shared CustodyConfig on main thread and network thread#7632
matthewkeil merged 6 commits intopeerDASfrom
te/single_custody_config

Conversation

@twoeths
Copy link
Contributor

@twoeths twoeths commented Mar 28, 2025

Motivation

  • we want to have a single CustodyConfig as a preparation for validator custody config work see fix: do not always subscribe to all column subnets #7607 (review)
  • but since we need data on both, I designed to have CustodyConfig created on BeaconChain (main thread) and NetworkCore (network thread)
  • when we have a change on number of connected validators, need to update both

Description

  • on main thread store CustodyConfig on BeaconChain
  • on network thread, create a wrapped NetworkGlobal to store CustodyConfig and node id there. In the future we can consider storing more data there
  • add more data to CustodyConfig: sampleGroups, sampledSubnets
  • use that CustodyConfig everywhere

@twoeths twoeths requested a review from a team as a code owner March 28, 2025 10:45
Copy link
Member

@matthewkeil matthewkeil 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 overall. Curious why you want to move all the config objects onto a central, global config?

nm, you answered this in the PR body

Copy link
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

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

Just the question about naming but looks good. Can get this merged and then have the validator custody build on this commit!

* Store shared data for different modules in the network stack.
* TODO: consider moving similar shared data, for example PeersData, under NetworkGlobal.
*/
export class NetworkGlobal {
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind if we name this NetworkConfig? Or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good to me 👍

@matthewkeil matthewkeil merged commit 6c1a116 into peerDAS Apr 7, 2025
13 of 17 checks passed
@matthewkeil matthewkeil deleted the te/single_custody_config branch April 7, 2025 16:23
matthewkeil pushed a commit that referenced this pull request Apr 14, 2025
**Motivation**

@hughy and I have a basic implementation of [validator
custody](https://github.com/ethereum/consensus-specs/blob/dev/specs/fulu/validator.md)
for peerDAS.

We're planning to do more testing on this, but would appreciate a review
on the architecture since we're still pretty new!

This relates to #7632 - If it merges, we'll update our PR to account for
it.

**Description**

* Centralizes custody values like `sampledGroups` and `custodyGroups`
into `CustodyConfig`. `CustodyConfig` is now treated as a singleton.
* Creates a new `advertisedGroupCount` in `CustodyConfig`, used for the
custody group count in the node's metadata/ENR.
* Adds `setSamplingGroupCount` and `setAdvertisedGroupCount` to
NetworkCore API. Updated by an `EventEmitter` on `CustodyConfig`.
* Adds LocalValidatorRegistry to track connected validators.
* Updates custody requirement in `chain.onForkChoiceFinalized`.

**Not Included**

I'll open separate issues for these if we're okay merging this PR
without them.

* Backfilling groups when the target custody group count increases
* Handling changes in other peers' custody group counts
* Race conditions around group count changing during syncing

<!-- A clear and concise general description of the changes of this PR
commits -->

<!-- If applicable, add screenshots to help explain your solution -->

<!-- Link to issues: Resolves #111, Resolves #222 -->

Closes #7619

---------

Co-authored-by: Hugh Cunningham <hugh.e.cunningham@gmail.com>
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.34.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants