Repository navigation
identify: rate limit id push protocol - #3266
Conversation
58d3e36 to
beb9ef8
Compare
4069b71 to
7016aa4
Compare
The rate limits id pushes from peers to one every five second with an allowed burst of 10 pushes. This should be enough for all but malfunctioning and malicious peers. We can use the exact same code for autonat, autonatv2, circuit v2, etc. Introducing limits to identify separately to get some feedback for the rate limiting module. For this PR, I'd like to ignore issues regarding where should this piece of code go, and focus on how specifically it should behave. See the long comment in `rateLimiter.allow` for example. We should probably modify `x/time/rate` for our usecase.
89f574d to
a6c9c71
Compare
| @@ -0,0 +1,325 @@ | |||
| package identify | |||
There was a problem hiding this comment.
Any reason this is in the identify package?
There was a problem hiding this comment.
I'll move this when introducing it for connections.
There was a problem hiding this comment.
For this PR, I'd like to ignore issues regarding where should this piece of code go, and focus on how specifically it should behave.
There was a problem hiding this comment.
That's fine, but fwiw I would prefer an internal package instead. I know we don't have them very often, but it makes it a little easier to review since the interface is well defined and I can focus on just the one package.
There was a problem hiding this comment.
That's better. Moved to p2p/internal/rate
guillaumemichel
left a comment
There was a problem hiding this comment.
Rate limiting mechanism looks good overall. Left a few comments
d4620d8 to
bb1e289
Compare
The rate limits id pushes from peers to one every five second with an allowed burst of 10 pushes. This should be enough for all but malfunctioning and malicious peers.
We can use the exact same code for autonat, autonatv2, circuit v2, etc.
Introducing limits to identify separately to get some feedback for #3265. For this PR, I'd like to ignore issues regarding where should this piece of code go, and focus on how specifically it should behave. See the long comment in
rateLimiter.allowfor example. We should probably modifyx/time/ratefor our usecase.Part of: #3265