waku-org / nwaku

Waku node and protocol.
Other
202 stars 52 forks source link

chore: rate limit peer exchange protocol, enhanced response status in RPC #3035

Closed NagyZoltanPeter closed 2 months ago

NagyZoltanPeter commented 2 months ago

Description

As part of DOS protection for req-res protocols and metrics Waku PeerExchange protocol must be protected just as Lightpush/Store and Filter.

Changes

Warning

The last bullet point introduces a refactored rate limit configuration over CLI/TOML file. This was necessary as identified different needs for different protocols (out of dogfooding and dashboard data) This change will break former CLI as removed two former rate-limit option and replaced them by one - formatted string - that can be repeated.

As rate-limit configuration is not yet used this breaking change shall not cause trouble, just we need to handle upgrades with care.

New CLI option is --rate-limit which has to be set as string in a proper format. Examples:

As this option can be repeated rate limit configuration can be fine-grained for every needs.

How to test

Tests are adjusted and extended. Every peer exchange test must run without error.

Issue

https://github.com/waku-org/nwaku/issues/3028

Further actions:

github-actions[bot] commented 2 months ago

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3035

Built from cf4e1673d3c0d5e9240d614de57fc419b04320a5

NagyZoltanPeter commented 2 months ago

Latest changes done on the peer-exchange specification is reflected now in nwaku code. This was necessary to ensure backward compatibility of the protocol while allowing added status to return. Also all review findings addressed.