Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(nns): Add pagination to list_neurons API #3358
base: master
Are you sure you want to change the base?
feat(nns): Add pagination to list_neurons API #3358
Changes from all commits
a9dadaf
717a138
4b08f81
b389dba
e8a4732
9e8a53f
ab6209b
631aaa7
33d49b4
98e4557
4386b8c
d0ccfca
cbf10ff
fe99240
3741d83
b5d8622
8aaecc0
e8e7423
cf262a6
1e16148
584905b
f54c20a
c899296
eac51a6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
IIUC, this is the only place in the code where there is documentation on how to use the
list_neurons
API? I could imagine that the common use case is to pass inNone
for bothpage_number
andpage_size
in the initial call, and if the number of neurons returned in the response is smaller thantotal_neurons_found
, calllist_neurons
again withpage_number: Some(1)
andpage_size: None
, and continue with increasing values ofpage_number
until the total number of neurons received (sum of all neurons in all responses) matchestotal_neurons_found
, but also only as long astotal_neurons_found
doesn't change (increase) between responses. What about if someone passes in apage_size
that is larger thanMAX_LIST_NEURONS_RESULTS
, in the hope of being able to avoid pagination? IIUC, they would, from the number of neurons returned in the response, and the value oftotal_neurons_found
, have to figure out that thepage_size
they specified is too large? All this to say that while this design change certainly helps for the cold storage wallet case (thanks for taking this into account!), there do seem to be some edge cases that could benefit from more documentation/examples.The documentation in the portal should also be updated.
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.
@mbjorkqvist Do the doc changes and design changes address your concern?
Instead of total_neurons_found, it is now returning 'total_pages_available', which avoids specifying whether or not each neuron they put in the list actually exists. It avoids some edge cases there. I also explained how that works in the documentation. Let me know if you think it can be improved more, and also thank you for the thoughtful feedback!