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

Refactor gossip code #2132

Merged
merged 8 commits into from
Mar 8, 2021
Merged

Refactor gossip code #2132

merged 8 commits into from
Mar 8, 2021

Conversation

wemeetagain
Copy link
Member

@wemeetagain wemeetagain commented Mar 6, 2021

Refactors gossip code and adds easier support for supporting future HFs

  • A few general fork helpers, the IForkInfo interface, config.getForkInfoRecord(), and computeForkNameFromForkDigest
  • Remove outer Gossip wrapper, all logic is on Eth2Gossipsub, a class that extends Gossipsub.
  • Rework gossip topic typing, add type GossipTopic that supports referencing a topic in a friendly way
  • Generally, validation functions and gossip event handlers are added on initialization, removed on destruction. (rather than added/removed during subscription/unsubscription)
  • Subscription/unsubscription is toggled by starting/stopping the sync gossip handler, attestation collector, and interopSubnetTask
  • Generally, ForkDigest event handlers can/should be replaced with IForkName event handlers.
    • in many cases, the way to handle events is known ahead of time in a per-fork manner
    • fork digest is not immediately useful, rather, its derivative of the fork version/name
    • since genesisValidatorsRoot is a constant, we can code in terms of IForkName and derive a ForkDigest if/when/where its needed
  • Adds a few metrics:
    Screenshot from 2021-03-05 18-52-47

Fixes #2083

@github-actions github-actions bot added Api scope-networking All issues related to networking, gossip, and libp2p. labels Mar 6, 2021
@codeclimate
Copy link

codeclimate bot commented Mar 6, 2021

Code Climate has analyzed commit dcd7d4a and detected 11 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 5
Duplication 6

View more on Code Climate.

dapplion
dapplion previously approved these changes Mar 8, 2021
@wemeetagain wemeetagain merged commit 91f16a2 into master Mar 8, 2021
@wemeetagain wemeetagain deleted the cayman/fixup-gossipsub branch March 8, 2021 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope-networking All issues related to networking, gossip, and libp2p.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify Gossipsub validator fn Map
2 participants