-
Notifications
You must be signed in to change notification settings - Fork 18
feat(governance): implement pagination for list_neurons endpoint #833
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
Conversation
size-limit report 📦
|
Hi @dskloetd @mstrasinskis @peterpeterparker @lmuntaner I'm pinging you all as you've contributed to the code related to the area of this change, and I would like your opinion on how to proceed. As mentioned in the description, the governance canister will introduce pagination to the list_neurons endpoint. I see several ways to move forward:
I prefer option 1, but I would like to know your thoughts. Note: the PR is a basic draft. I wanted to get a feeling of how it would look such a feature in ic-js. |
Why would option 3 be a breaking change? Aren't the new fields optional? I can see a client wanted to take care of the pagination, but probably most won't want to deal with it. IMHO, I would prefer a function with no pagination and another function with pagination. It makes sense that the current function offers no pagination. The current behavior was always to return all the neurons, so there is no change there, right? |
I think option 1 is fine for now. As long as we are aware that the issue is not solved for hardware wallets. |
Because of the large page size, I doubt that exposing pagination will provide much benefit to users. Option 1 sounds reasonable to me. |
@lmuntaner answering your questions
The response signature will change if we want to include pagination information.
The current function without pagination will work until the first user exceeds 500 neurons. At that point, the result will be incorrect, as it will only return the first 500 neurons, leaving the consumer unaware of the limitation. Therefore, everyone should eventually migrate to the new function. |
That will be managed by agent-js, right? the client of ic-js doesn't know about this. Would it break something for the ic-js client?
I agree. I meant that the current clients of |
The current |
Ah, I see. And we can't add the page of those results now. Got it. Thanks! I forgot. |
316a936
to
c8378b8
Compare
f9e9400
to
8ae4b67
Compare
# Motivation To test the pagination for `list_neurons`, introduced in dfinity/ic-js#833, an account must have more than 500 neurons. Ideally, this account should be an Internet Identity to evaluate its behavior in the UI and when generating a report. The script will create the specified number of neurons, which will be controlled by the provided `principalId`. Here’s an example of how to create 100 neurons for a given principal: ``` scripts/create_neurons -c 100 -p <principalId> ``` # Changes - Added new script. # Tests - Tested locally # Todos - [ ] Add entry to changelog (if necessary). Not necessary
# Motivation To test the pagination for `list_neurons`, introduced in dfinity/ic-js#833, an account must have more than 500 neurons. Ideally, this account should be an Internet Identity to evaluate its behavior in the UI and when generating a report. The script will create the specified number of neurons, which will be controlled by the provided `principalId`. Here’s an example of how to create 100 neurons for a given principal: ``` scripts/create_neurons -c 100 -p <principalId> ``` # Changes - Added new script. # Tests - Tested locally # Todos - [ ] Add entry to changelog (if necessary). Not necessary
# Motivation To test the pagination for `list_neurons`, introduced in dfinity/ic-js#833, an account must have more than 500 neurons. Ideally, this account should be an Internet Identity to evaluate its behavior in the UI and when generating a report. The script will create the specified number of neurons, which will be controlled by the provided `principalId`. Here’s an example of how to create 100 neurons for a given principal: ``` scripts/create_neurons -c 100 -p <principalId> ``` # Changes - Added new script. # Tests - Tested locally # Todos - [ ] Add entry to changelog (if necessary). Not necessary
7d2c8bd
to
021af98
Compare
In the PR description:
Is this outdated? |
d50f9c5
to
f157cdd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…ion (#843) # Motivation A bug was introduced in #833 in this [commit](45eb69d#diff-f4f0835b56118edf98f5b690eb524de8bd8738c8d742c69c3c2cd516d55e9857R174) as the initial page should be `0n`, and not `1n`, as shown [here](https://github.com/dfinity/ic/blob/a34724ef3feef15510ab055b4f5e4aa961ce9e86/rs/nns/governance/src/governance.rs#L2085). The bug was found through [this failing e2e pipeline](dfinity/nns-dapp#6419). # Changes - Changed the initially requested page from `1n` to `0n`. # Tests - Update expectations for the requested page. - Manually tested in [devenv](https://qsgjb-riaaa-aaaaa-aaaga-cai.yhabib-ingress.devenv.dfinity.network/neurons/?u=qsgjb-riaaa-aaaaa-aaaga-cai) - Tested against [e2e test](dfinity/nns-dapp#6428) from nns-dapp # Todos - [ ] Add entry to changelog (if necessary).
Motivation
As presented here and changed here, the NNS governance canister will implement pagination for the
list_neurons
endpoint.Pagination will only activate if the response contains more than 500 neurons. Currently, most of our cases involve requesting non-empty neurons, and we do not have users with such a high number of neurons, so for those users nothing has changed. However, the nns-dapp has a use case, Reporting, where we also request empty neurons. In this case, we have a few hundred users with more than 500 neurons.
Some insights from the Boundary Node.
Expect usage patterns:
Changes
list-neurons
.Tests
Screen.Recording.2025-02-11.at.16.37.00.mov
Todos