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

Add pagination support for listgovproposalvotes #1635

Merged
merged 11 commits into from
Jan 4, 2023

Conversation

shohamc1
Copy link
Contributor

@shohamc1 shohamc1 commented Dec 7, 2022

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

Provides pagination support for the listgovproposalvotes RPC.

Pagination arguments can be provided via the pagination CLI argument.

$ defi-cli listgovproposalvotes 'propId' 'all' -1 '{"limit": 2}'

If you do not want to set the RPC's optional arguments, users can pass arguments via an object instead.

$ defi-cli listgovproposalvotes '{"proposalId": "propId", "pagination": {"limit": 2}}'

There are three pagination arguments available:

  • start: Index of the first entry to return. Usually start + limit of the previous call.
  • including_start: To include first entry of the results. This is set to false if start has been set.
  • limit: Maximum number of entries to return in one RPC call.

Successive pagination calls would look like:

$ defi-cli listgovproposalvotes 'propId' 'all' -1 '{"start": 0, "including_start": true, "limit": 2}'
$ defi-cli listgovproposalvotes 'propId' 'all' -1 '{"start": 2, "including_start": true, "limit": 2}'
$ defi-cli listgovproposalvotes 'propId' 'all' -1 '{"start": 4, "including_start": true, "limit": 2}'

Copy link
Contributor

@dcorral dcorral left a comment

Choose a reason for hiding this comment

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

This will filter current cycle of the proposal which is internal to the proposal. We will need some mechanism to filter by global cycle meaning "get all proposals in the Nth voting round". Have a look at #1627 for a WIP implementation of this filter.

A suggestion was made to call this two filters differently:

  • global cycle filter -> batch
  • internal cycle -> cycle

UPDATE: This will apply for listgovproposals filtering, current implementation for listgovproposalvotes is actually valid.

@shohamc1 shohamc1 changed the title Pagination support for listgovproposalvotes Add pagination support for listgovproposalvotes Dec 13, 2022
Mixa84
Mixa84 previously approved these changes Dec 28, 2022
@Jouzo Jouzo added the v/3.2.1 label Dec 28, 2022
Mixa84 added a commit that referenced this pull request Dec 30, 2022
Co-authored-by: Jouzo <15011228+Jouzo@users.noreply.github.com>
@prasannavl prasannavl merged commit 18cb979 into master Jan 4, 2023
@prasannavl prasannavl deleted the onchaingov-pagination branch January 4, 2023 04:40
prasannavl added a commit that referenced this pull request Jan 5, 2023
* Add cycle filtering to listgovproposals

* Fix cycle param description

* Remove unused variable retMap

* Replace uint with unsigned int to fix windows compile error

* Add tests to listgovproposals

* Removes trailing whitespaces and unused imports

* Fix ForEachCycleProp returning early

* Add pagination to listgovproposal

* Fix lint

* Format src/masternodes/rpc_proposals.cpp

* Pagination nesting as in #1635

Co-authored-by: Jouzo <15011228+Jouzo@users.noreply.github.com>

* Make pagination rpc consistent

* Resolve compiler warning

* Update help message

Co-authored-by: Keng Ye <40191153+kyleleow@users.noreply.github.com>

Co-authored-by: jouzo <jdesclercs@gmail.com>
Co-authored-by: Jouzo <15011228+Jouzo@users.noreply.github.com>
Co-authored-by: Mihailo Milenkovic <mihailo.milenkovic84@gmail.com>
Co-authored-by: Peter John Bushnell <bushsolo@gmail.com>
Co-authored-by: Prasanna Loganathar <pvl@prasannavl.com>
Co-authored-by: Keng Ye <40191153+kyleleow@users.noreply.github.com>
fuxingloh pushed a commit to DeFiCh/jellyfishsdk that referenced this pull request Jan 11, 2023
<!--  Thanks for sending a pull request! -->

#### What this PR does / why we need it:

- Update listGovProposalVotes arguments as per
DeFiCh/ain#1635. This is required to keep
compatibility with the next release.

Signed-off-by: Shoham Chakraborty <shhmchk@gmail.com>
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.

6 participants