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

fix(jellyfish-api-core): Update listGovProposalVotes arguments #1908

Merged
merged 10 commits into from
Jan 11, 2023

Conversation

shohamc1
Copy link
Contributor

@shohamc1 shohamc1 commented Dec 7, 2022

What this PR does / why we need it:

@codeclimate
Copy link

codeclimate bot commented Dec 7, 2022

Code Climate has analyzed commit 5c9ac5a and detected 0 issues on this pull request.

View more on Code Climate.

@netlify
Copy link

netlify bot commented Dec 7, 2022

Deploy Preview for jellyfishsdk ready!

Name Link
🔨 Latest commit 5c9ac5a
🔍 Latest deploy log https://app.netlify.com/sites/jellyfishsdk/deploys/63bd3665e26ca60008a37ee4
😎 Deploy Preview https://deploy-preview-1908--jellyfishsdk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Base: 89.61% // Head: 93.03% // Increases project coverage by +3.42% 🎉

Coverage data is based on head (5c9ac5a) compared to base (f68021f).
Patch coverage: 100.00% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
...ages/jellyfish-api-core/src/category/governance.ts 100.00% <100.00%> (ø)
...atus-api/src/controllers/OracleStatusController.ts 19.56% <0.00%> (-78.27%) ⬇️
packages/jellyfish-address/src/p2wsh.ts 48.27% <0.00%> (-51.73%) ⬇️
apps/legacy-api/src/modules/WhaleApiModule.ts 45.83% <0.00%> (-45.84%) ⬇️
packages/jellyfish-wallet-mnemonic/src/mnemonic.ts 63.63% <0.00%> (-36.37%) ⬇️
...yfish-transaction/src/script/dftx/dftx_unmapped.ts 77.77% <0.00%> (-22.23%) ⬇️
...ish-transaction/src/script/dftx/dftx_governance.ts 84.61% <0.00%> (-15.39%) ⬇️
...s/jellyfish-transaction-builder/src/txn/txn_fee.ts 89.28% <0.00%> (-10.72%) ⬇️
apps/whale-api/src/module.api/fee.controller.ts 90.00% <0.00%> (-10.00%) ⬇️
packages/testcontainers/src/utils.ts 91.66% <0.00%> (-8.34%) ⬇️
... and 62 more

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Dec 7, 2022

Docker build preview for jellyfish/apps is ready!

Built with commit c893dfc

  • ghcr.io/jellyfishsdk/legacy-api:pr-1908
  • ghcr.io/jellyfishsdk/ocean-api:pr-1908
  • ghcr.io/jellyfishsdk/playground-api:pr-1908
  • ghcr.io/jellyfishsdk/status-api:pr-1908
  • ghcr.io/jellyfishsdk/whale-api:pr-1908

You can also get an immutable image with the commit hash

  • ghcr.io/jellyfishsdk/legacy-api:c893dfce5891a3d3664e80b4f6d23e17d8bbc5d8
  • ghcr.io/jellyfishsdk/ocean-api:c893dfce5891a3d3664e80b4f6d23e17d8bbc5d8
  • ghcr.io/jellyfishsdk/playground-api:c893dfce5891a3d3664e80b4f6d23e17d8bbc5d8
  • ghcr.io/jellyfishsdk/status-api:c893dfce5891a3d3664e80b4f6d23e17d8bbc5d8
  • ghcr.io/jellyfishsdk/whale-api:c893dfce5891a3d3664e80b4f6d23e17d8bbc5d8

return await this.client.call('listgovproposalvotes', [proposalId, masternode, cycle], 'number')
async listGovProposalVotes (
options: ListGovProposalVotesOptions,
pagination: ListGovProposalVotesPagination = {
Copy link
Contributor

@kyleleow kyleleow Jan 5, 2023

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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!

Copy link
Contributor Author

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🫡

@shohamc1 shohamc1 marked this pull request as ready for review January 5, 2023 13:15
Signed-off-by: Shoham Chakraborty <shhmchk@gmail.com>
Copy link
Contributor

@delphk delphk left a 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

Comment on lines +91 to +106
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
}
})
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed: 09c483e

Copy link
Contributor

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.

delphk
delphk previously approved these changes Jan 10, 2023
Comment on lines +91 to +106
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
}
})
Copy link
Contributor

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.

@fuxingloh fuxingloh merged commit 5abb393 into main Jan 11, 2023
@fuxingloh fuxingloh deleted the shohamc1/update-listgovproposalvotes branch January 11, 2023 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants