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

Limit and add optional "offset" & "count" parameters for "delegators" RPC #3330

Closed
shryder opened this issue Jun 12, 2021 · 1 comment
Closed

Comments

@shryder
Copy link
Contributor

shryder commented Jun 12, 2021

Summary

Limit the amount of delegators returned by the "delegators" RPC and add the optional parameters "offset" and "count".

What problem would be solved by this feature?

If I send multiple "delegators" RPC commands to my node for the rep NF#1 for example (it has ~16 million delegators)

  1. If the server is not strong enough, it would crash after few requests. 100% disk and cpu load. (Is this a small attack vector maybe? create millions of dust accounts and delegate to nf#1 and call delegators rpc on public nodes)
  2. If the server is strong enough, it would take a really long time to fetch all delegators.

The second problem is for services having to cache this data instead of getting up-to-date information through the RPC when desired.

Are there any previous requests for this feature?

I don't know

Do you have a suggested solution?

So my suggestion is

  1. Set a limit to the amount of delegators returned by this RPC command
  2. Add the optional fields "offset" and "count" to facilitate viewing this data.
  3. Exclude dust amounts from the response (make the dust amount configurable maybe)

The first suggestion is so the weak nodes don't crash
The second and third is so the user/service doesn't have to wait a long time to get the current delegators list.

Explorers currently make the request every once in a while and cache the delegators instead of showing live data.

If this feature is approved, would you be willing to submit a pull request with the solution?

I would

Possible solution

No response

Supporting files

No response

@shryder
Copy link
Contributor Author

shryder commented Jun 13, 2021

The account_history RPC action has the count parameter required. Should it be the same for this RPC?

shryder added a commit to shryder/nano-node that referenced this issue Jun 13, 2021
clemahieu pushed a commit that referenced this issue Jun 15, 2021
…ameters (#3330) (#3333)

This commit allows the 'delegators' RPC to limit the response by a 'count' and start the search at a 'start'. The response from 'delegators' can be potentially large and this lets the requestor stream the response in smaller chunks.
@shryder shryder closed this as completed Jun 16, 2021
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

No branches or pull requests

1 participant