Use utils.Limiter for discv5

Abierto
#162 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Empieza leyendo les/utils/limiter.go y les/utils/costfilter.go de la implementación WIP enlazada y, a continuación, compara sus supuestos con el procesamiento de solicitudes de discv5. El issue busca principalmente comentarios sobre seguridad y diseño de DHT; se consideraría terminado cuando exista un alcance acordado y un plan concreto de integración para discv5.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
JavaScript
Estrellas
1.1k
Forks
301
Merge medio
12 h 3 min
PR fusionados (30 d)
2

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ethereum/devp2p

Todos los issues de ethereum/devp2p

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.