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

Cap number of nodes allowed to connect for third party networks #314

Merged
merged 3 commits into from
Mar 25, 2021

Conversation

dvdplm
Copy link
Contributor

@dvdplm dvdplm commented Mar 25, 2021

In an attempt to stem the flood of nodes connecting to the telemetry server from third party networks this PR caps the maximum number of nodes to 500.

Only add a new node if the current number of connected nodes is below the max
Define "first party networks" to be: Polkadot, Kusama, Westend and Rococo. All other networks are capped to 500 nodes
@dvdplm dvdplm requested review from maciejhirsz and insipx March 25, 2021 10:09
backend/src/main.rs Outdated Show resolved Hide resolved
Comment on lines +35 to +38
set.insert("Polkadot");
set.insert("Kusama");
set.insert("Westend");
set.insert("Rococo");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs some vetting. Is that the full list of networks we want to consider "first party"?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks fine to me, at least; we also run Canvas but I think we can ignore that for now. The only one I'm not super sure about is "Local Testnet" but that's well under 500 at the moment so...

@dvdplm dvdplm marked this pull request as ready for review March 25, 2021 12:33
@dvdplm dvdplm merged commit a0b9ce7 into master Mar 25, 2021
@dvdplm dvdplm deleted the dp-cap-third-party-nodes branch March 25, 2021 12:36
let label: Label = label.into();
let cid = self.chains.add_with(|cid| {
ChainEntry {
addr: Chain::new(cid, addr, label.clone()).start(),
label: label.clone(),
network_id: network.clone(),
network_id: None, // TODO: this doesn't seem to be used anywhere. Can it be removed?
Copy link
Member

Choose a reason for hiding this comment

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

Is network_id still used in the fn handler inside of the impl Handler?

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