Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC rate limitting #3136

Open
Wondertan opened this issue Jan 24, 2024 · 5 comments
Open

RPC rate limitting #3136

Wondertan opened this issue Jan 24, 2024 · 5 comments
Labels

Comments

@Wondertan
Copy link
Member

Wondertan commented Jan 24, 2024

After deep discussions with @jbowen93 about #3129, the Astria team figured that there was a bug on their side, causing LNs to be spammed with ~1k req/s, subsequently causing RAM grow. This prompts the question about limiting the number of RPC requests.

To avoid similar issues in the future and unlimited growth of RAM because of malicious or faulty software, we should introduce request rate limiting on our RPC server.

The rate limit should be configurable with 10req/s as default, which would be more than enough for node usage patterns(e.g., a blob per 12s block).

@distractedm1nd
Copy link
Collaborator

To do this we need to modify go-jsonrpc

@Wondertan
Copy link
Member Author

Wondertan commented Jan 30, 2024

Potentially. I presumed we can do this through some form of middleware, the same way auth is working.

@ramin
Copy link
Contributor

ramin commented Mar 5, 2024

Adding some relevent context, we have a single "middleware" for auth, viewable here

srv.srv.Handler = &auth.Handler{

if we WERE to implement this, it'd be an opportunity to apply some common go http server middleware pattern for this, as, like with children, going from 1 -> 2 middleware, probably means at least 1 more will come along.

That said, i am not 100% sure this should be a concern of the node, and more a safeguard a node runner / infra operator would implement in their deployment and however it is deployed. Implementing this implies operational availability is a concern of celestia protocol developers, which i think it is not

I think the real solution here, would be to implement resource management for various parts of the protocol implementation, ie: storage etc, NOT to introduce a request rate limiter at RPC.

@Wondertan i'd be curious to discuss this with you.

@nodersteam
Copy link
Contributor

Hello @Wondertan @walldiss @renaynay can we take this issue?

@Wondertan
Copy link
Member Author

We haven't agreed on how to approach this, but if we would implement this in the node, then you would need to look at go-jsonrpc library we are using to see how you can integrate the rate-limiting middleware. I believe its worth a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants