Skip to content

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Apr 3, 2025

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.allow for example. We should probably modify x/time/rate for our usecase.

Part of: #3265

@sukunrt sukunrt force-pushed the push-ywoykpktmmtp branch from 58d3e36 to beb9ef8 Compare April 3, 2025 13:04
@sukunrt sukunrt marked this pull request as draft April 3, 2025 13:05
@sukunrt sukunrt force-pushed the push-ywoykpktmmtp branch 5 times, most recently from 4069b71 to 7016aa4 Compare April 3, 2025 14:16
@MarcoPolo MarcoPolo self-requested a review April 9, 2025 00:19
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.
@sukunrt sukunrt force-pushed the push-ywoykpktmmtp branch 2 times, most recently from 89f574d to a6c9c71 Compare April 14, 2025 09:50
@sukunrt sukunrt requested a review from guillaumemichel April 14, 2025 09:52
@sukunrt sukunrt marked this pull request as ready for review April 14, 2025 09:53
@@ -0,0 +1,325 @@
package identify
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is in the identify package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this when introducing it for connections.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better. Moved to p2p/internal/rate

Copy link
Contributor

@guillaumemichel guillaumemichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate limiting mechanism looks good overall. Left a few comments

Copy link
Collaborator

@MarcoPolo MarcoPolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@sukunrt sukunrt force-pushed the push-ywoykpktmmtp branch 3 times, most recently from d4620d8 to bb1e289 Compare May 1, 2025 15:48
@sukunrt sukunrt force-pushed the push-ywoykpktmmtp branch from bb1e289 to 61c0681 Compare May 1, 2025 15:52
@sukunrt sukunrt merged commit 50d714c into master May 1, 2025
11 checks passed
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 this pull request may close these issues.

3 participants