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

discv5: need more info on global topic queue limit #110

Closed
FrankSzendzielarz opened this issue Aug 19, 2019 · 3 comments · Fixed by #120
Closed

discv5: need more info on global topic queue limit #110

FrankSzendzielarz opened this issue Aug 19, 2019 · 3 comments · Fixed by #120

Comments

@FrankSzendzielarz
Copy link
Member

The topic discovery mechanism has a global limit on topic advertisements:

There is also a global limit on the number of ads regardless of the topic queue which contains them. When the global limit is reached, the last entry of the least recently requested topic queue is removed.

There are three possible issues with this that I can see:

  1. An attack where malicious nodes can conspire to continuously register random, new topics, and request the ads placed in those topics to make them no 'least recently requested'
  2. A similar attack but where the topic registrations are made concurrently, as if I understand correctly there is no prevention over issuing concurrent ad requests for 1000 different new topics (eg)
  3. Legitimate advertisers placing ads on a server with the global limit at threshold may find their ads being selected for immediate removal.
@FrankSzendzielarz
Copy link
Member Author

I suggest a global limiter that applies to the overall rate of new topic creations.

@fjl fjl changed the title Need more guidance on topic discovery global topic limiters discv5: need more info on global topic queue limit Aug 19, 2019
@FrankSzendzielarz
Copy link
Member Author

Open question: how to decide which ad is least valuable and so which is evicted.

@fjl
Copy link
Collaborator

fjl commented Aug 19, 2019

@zsfelfoldi says:

I've been thinking a bit more about the global limit eviction priority. Now I think it is perfectly fine and simple if we just enforce the same 10 min lifetime for every ad and if registration is limited by the global limit then evict the first ad (regardless of topic importance) whose guaranteed lifetime is over. We just need a per-topic FIFO and a global FIFO. For more popular topics the length of the topic queue will still be limited by per-topic limit. For less popular ones it will be proportional to the total global efforts to register that topic and I think that is fine. Filling most of the table's total allowance with junk is possible but the important thing is that it will not significantly hinder the registration of important and popular topics. For popular topics (where the topic queue size is at its limit) the time of the next round of "competition" only depends on the first expiring ad from the same queue. The only trick is that we should mark the soonest expiring ad for eviction when we first issue a ticket for the next registration in that queue and until that happens we do not select it for eviction based on global limit (which happens much more frequently). So we can be sure that in the next round for "important" topic registration we are actually have an ad to evict and we can register one of the candidates.

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 a pull request may close this issue.

2 participants