Use utils.Limiter for discv5

Aperta
#162 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
go

Direzione di ricerca

Inizia leggendo les/utils/limiter.go e les/utils/costfilter.go dall’implementazione WIP collegata, quindi confronta le loro assunzioni con la gestione delle richieste di discv5. L’issue cerca principalmente feedback sulla sicurezza e sul design di DHT; si considererebbe completata quando fossero definiti un ambito concordato e un piano concreto di integrazione per discv5.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I have a WIP branch where I implemented a fairly simple DDoS protector for lespay UDP talk requests (400 LOC total + utils.WeightedRandomSelect, does not use the NodeStateMachine). The reason I spent time with it at this early stage is that I think the token market interface really needs to be designed with this aspect in mind. Polling rates and unhealthy competition (arms race) can be a problem with markets, especially in a decentralized and uncontrolled, somewhat chaotic environment. The reason I opened an issue for discussion about it is because I think something like this could be a recommendation (maybe even an EIP) for our entire DHT and I am interested in your opinons from both a security and DHT centric perspective.
So basically what it does is

  • keeps request queues by both IP address (string) and enode.ID
  • has a single processing loop that even does time.Sleeps between serving them so that the DHT logic can never hurt other processes
  • has a probabilistic selection based throttling mechanism (which behaves trivially and deterministically when there is no extreme usage but tries to give a sufficient chance to the proven useful connections during extreme traffic).
  • 50% of serving probability weights are distributed equally between active individual IP addresses. Multiple enode.IDs can request from the same IP in which case the IP's weight is further distributed equally.
  • the other 50% is proportional to value / sumValue where the "value" is anything that is an indicator of usefulness in the (preferably not very distant) past.
  • the first half protects from DoS but gives limited protection againgst DDoS, the second one ensures that already proven connections can not be easily broken even with heavy DDoS so there is much less incentive to even try and spend money on. Basically an attacker can only hinder the forming of new connections but that will not do real damage very soon. This is also a Kademlia recommendation to prioritize older contiuous connections. Maybe for a Kademlia the weight could simply be the connection age. For lespay it is money received from the enode.ID. Multiple dimensions of value can also be easily added if necessary, each dimension getting a guaranteed total percentage of service.

https://github.com/zsfelfoldi/go-ethereum/blob/les4udp/les/utils/limiter.go

The service throttling can also take actual serving resource costs (CPU and/or bandwidth usually) into account. An attack deliberately making the most expensive requests will be proportionally more heavily throttled while economical usage of the resources of the serving node is rewarded by quicker responses. Practice with LES servers has shown though that direct time-based cost metering sometimes gives extreme outliers that are unrelated to the given request. utils.CostFilter ensures that these outliers will not block service for some nodes by accident.

https://github.com/zsfelfoldi/go-ethereum/blob/les4udp/les/utils/costfilter.go

Lingua principale
JavaScript
Stelle
1.1k
Fork
301
Merge medio
12h 3m
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ethereum/devp2p

Tutte le issue di ethereum/devp2p

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.