-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(jellyfish-api-core): Update listGovProposalVotes arguments #1908
Conversation
Code Climate has analyzed commit 5c9ac5a and detected 0 issues on this pull request. View more on Code Climate. |
✅ Deploy Preview for jellyfishsdk ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov ReportBase: 89.61% // Head: 93.03% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1908 +/- ##
==========================================
+ Coverage 89.61% 93.03% +3.42%
==========================================
Files 366 367 +1
Lines 10768 10772 +4
Branches 1378 1378
==========================================
+ Hits 9650 10022 +372
+ Misses 1064 714 -350
+ Partials 54 36 -18
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Docker build preview for jellyfish/apps is ready! Built with commit c893dfc
You can also get an immutable image with the commit hash
|
return await this.client.call('listgovproposalvotes', [proposalId, masternode, cycle], 'number') | ||
async listGovProposalVotes ( | ||
options: ListGovProposalVotesOptions, | ||
pagination: ListGovProposalVotesPagination = { |
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.
Correct me if i am wrong, from the code in ain
https://github.com/DeFiCh/ain/blob/90c05a00d40381bf6da1b5db05a5e6301cd95a33/src/masternodes/rpc_proposals.cpp#L604
should pagination
object be nested inside options
?
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.
No, the pagination
object is a top level argument, there is no options
argument.
In the RPC, all of the arguments can be passed as JSON object, which prevents having to define optional arguments. The PR description talks about this.
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.
ah okay got it, thanks for explaining!
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.
Misunderstood what you meant, we are using the JSON object here to pass all the arguments so the pagination object should be inside the options object. Fixed this in 028f92c.
Thanks for bringing this up🫡
Signed-off-by: Shoham Chakraborty <shhmchk@gmail.com>
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.
will be good to add test cases for pagination as well
const votes1 = await testing.rpc.governance.listGovProposalVotes({ | ||
proposalId: proposalId, | ||
pagination: { | ||
start: 0, | ||
including_start: true, | ||
limit: 2 | ||
} | ||
}) | ||
const votes2 = await testing.rpc.governance.listGovProposalVotes({ | ||
proposalId: proposalId, | ||
pagination: { | ||
start: 2, | ||
including_start: true, | ||
limit: 2 | ||
} | ||
}) |
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.
apart from this test, would be also good to test the different combinations of pagination options (eg. start
is omitted, including_start
is omitted or false, limit
is omitted or 0)
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.
Fixed: 09c483e
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.
The test should be in separated it()
s describing the pagination condition.
const votes1 = await testing.rpc.governance.listGovProposalVotes({ | ||
proposalId: proposalId, | ||
pagination: { | ||
start: 0, | ||
including_start: true, | ||
limit: 2 | ||
} | ||
}) | ||
const votes2 = await testing.rpc.governance.listGovProposalVotes({ | ||
proposalId: proposalId, | ||
pagination: { | ||
start: 2, | ||
including_start: true, | ||
limit: 2 | ||
} | ||
}) |
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.
The test should be in separated it()
s describing the pagination condition.
What this PR does / why we need it:
listgovproposalvotes
ain#1635. This is required to keep compatibility with the next release.