-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
refactor!: move network logic into NetworkCore #5351
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good direction, nice spin off from the main thread PR to lay some groundwork
/** | ||
* Some attnet subscription functionality is needed to be mirrored on the chain side of the thread boundary to determine if attestations should be processed | ||
*/ | ||
export class SimpleAttnetsService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? This data will be send from the worker to the main thread? IMO:
- Main thread receives validator subscription requests via rest API
- Main thread forward sends those network worker subscription updates
- Worker tracks internal state on what to process and what to subscribe to
- Worker emits gossip object to main thread along with a flag "should_process" or "process_before_slot"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is used when submitting attestations via API, where a process_before_slot is not available
Converting back to draft |
Motivation
In anticipation of moving the network to a separate thread, move all network functionality to a separate module with an interface that may be implemented as a worker thread.
Description
In anticipation of moving the network to a separate thread, move all network functionality to a separate module with an interface that may be implemented as a worker thread.
Pulled into separate PRs
LocalClock
into anEventEmitter
that emitsClockEvent
s, Allows theNetworkCore
to rely only on a clock for clock events without using the chain directoy. This will be used by the threaded implementation to instantiate its own clock. (refactor!: move clock events to clock class #5446)StatusCache
instead of the full chain to allowNetworkCore
to get the status without the chain. (refactor(network)!: use StatusCache in PeerManager #5451)Important points
NetworkCore
which implementsINetworkCore
Network
implementation to allow for synchronousgetConnectedPeers
andgetConnectedPeerCount
.SimpleAttnetsService
info to allow for synchronousshouldProcessAttestation
during gossip and api attestation processingnetworkEventBus
->network.events
,prepareBeaconCommitteeSubnet
->prepareBeaconCommitteeSubnets