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

Fix/discv5 not throttling #7511

Merged
merged 14 commits into from
Sep 30, 2024
Merged

Fix/discv5 not throttling #7511

merged 14 commits into from
Sep 30, 2024

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Sep 29, 2024

Changes

  • Includes Fix clear not working #7510
  • DiscV5 try to get PeerManager to throttle itself, but PeerManager require PeerPool which require INodeSource which Discv5App is one of creating a circular dipendency.
  • Therefore the passed in PeerManager is always null and the throttling never works.
  • This would have been made very clear if it used DI in the first place. Thats why you should support Refactor/More proper use of DI for Synchronizer  #7500. Although Autofac can use Lazy to overcome this and make it work, see this, it is still not a good idea.
  • This PR changes INodeSource.NodeAdded to use IAsyncEnumerable instead and simply throttle at PeerPool.
  • This also naturally throttle other INodeSource. However, DiscV4 does not integrate nicely. I plan to rewrote it so I just add a basic throttling which although slow down discovery when peer is full, it does not completely stop it like DiscV5.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • Optimization

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

  • Confirmed peer still gets added.
  • Using custom metrics, confirm yielded node rate from discv4/5 drops as peer is full.

@asdacap asdacap merged commit 481f302 into master Sep 30, 2024
66 checks passed
@asdacap asdacap deleted the fix/discv5-not-throttling branch September 30, 2024 09:18
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.

2 participants