Skip to content

feat!: add 'amount' field to withdrawal responses#11457

Merged
alexanderbez merged 1 commit intocosmos:masterfrom
ingenuity-build:11456-add-amount-to-withdrawal-tx-repsonses
Mar 28, 2022
Merged

feat!: add 'amount' field to withdrawal responses#11457
alexanderbez merged 1 commit intocosmos:masterfrom
ingenuity-build:11456-add-amount-to-withdrawal-tx-repsonses

Conversation

@joe-bowman
Copy link
Copy Markdown
Contributor

@joe-bowman joe-bowman commented Mar 25, 2022

Description

Closes: #11456

Updates distr/tx.proto protobufs to add an amount field of types repeated sdk.Coin to distrtypes.MsgWithdrawDelegatorRewardResponse and distrtypes.MsgWithdrawValidatorCommissionResponse.

x/distribution/keeper/msg_server.go populate return values of WithdrawValidatorCommission and WithdrawDelegatorReward with amount.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@github-actions github-actions bot added the C:x/distribution distribution module related label Mar 25, 2022
@joe-bowman
Copy link
Copy Markdown
Contributor Author

joe-bowman commented Mar 25, 2022

Would appreciate some guidance on where to test this - the unit tests for withdrawal don't submit a tx (they call the fn directly on the keeper), and the simapp tests discard the tx response.

Additionally w.r.t docs - I don't see any relevant docs to update (the proto generated docs are obviously automatically updated). Anything I have missed?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2022

Codecov Report

Merging #11457 (9d68416) into master (cc0b9df) will increase coverage by 0.05%.
The diff coverage is 70.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11457      +/-   ##
==========================================
+ Coverage   65.88%   65.93%   +0.05%     
==========================================
  Files         675      675              
  Lines       69830    69832       +2     
==========================================
+ Hits        46006    46047      +41     
+ Misses      21123    21092      -31     
+ Partials     2701     2693       -8     
Impacted Files Coverage Δ
types/simulation/account.go 86.95% <ø> (ø)
x/distribution/keeper/msg_server.go 1.88% <0.00%> (ø)
x/group/simulation/operations.go 68.13% <ø> (+0.72%) ⬆️
x/group/keeper/invariants.go 43.49% <48.38%> (-0.26%) ⬇️
x/group/keeper/keeper.go 54.10% <58.62%> (+1.78%) ⬆️
x/group/module/abci.go 50.00% <60.00%> (+16.66%) ⬆️
x/group/keeper/msg_server.go 68.92% <66.66%> (-0.88%) ⬇️
x/distribution/client/testutil/suite.go 98.79% <90.90%> (-0.92%) ⬇️
x/group/keeper/tally.go 62.50% <100.00%> (-7.50%) ⬇️
x/group/simulation/genesis.go 95.71% <100.00%> (ø)
... and 9 more

Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

LGTM

@anilcse
Copy link
Copy Markdown
Contributor

anilcse commented Mar 25, 2022

Would appreciate some guidance on where to test this - the unit tests for withdrawal don't submit a tx (they call the fn directly on the keeper), and the simapp tests discard the tx response.

Additionally w.r.t docs - I don't see any relevant docs to update (the proto generated docs are obviously automatically updated). Anything I have missed?

You can use integration tests https://github.com/cosmos/cosmos-sdk/blob/master/x/distribution/client/testutil/suite.go#L452-L517

@github-actions github-actions bot added the C:CLI label Mar 26, 2022
@joe-bowman
Copy link
Copy Markdown
Contributor Author

This PR is stalled on #11469

Copy link
Copy Markdown
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

🚀

@alexanderbez
Copy link
Copy Markdown
Contributor

We can backport this IIUC.

@joe-bowman joe-bowman force-pushed the 11456-add-amount-to-withdrawal-tx-repsonses branch from 8808115 to 44902bb Compare March 28, 2022 13:46
@joe-bowman joe-bowman force-pushed the 11456-add-amount-to-withdrawal-tx-repsonses branch from 44902bb to 9d68416 Compare March 28, 2022 13:49
@joe-bowman
Copy link
Copy Markdown
Contributor Author

Updated failing test, and rebased upon master. Should be good to go.

@alexanderbez
Copy link
Copy Markdown
Contributor

@AmauryM additions to proto structs are safe, but I'm not 100% sure if these are stored in any Tendermint objects. So I'm going to merge this w/o backporting. If we deem this can be backported w/o app state changes, then we can always do so later.

@alexanderbez alexanderbez merged commit 3cf11e1 into cosmos:master Mar 28, 2022
@joe-bowman joe-bowman deleted the 11456-add-amount-to-withdrawal-tx-repsonses branch March 28, 2022 19:31
Copy link
Copy Markdown
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

but I'm not 100% sure if these are stored in any Tendermint objects.

@alexanderbez Yes, they are in the data field in abci's {Check,DeliverTx}Response. do you know if that constitues a consensus-breaking change?

Fine to include it in v0.46, so okay for the merge. Just would like to add proto comments for clients.

// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type.
message MsgWithdrawDelegatorRewardResponse {}
message MsgWithdrawDelegatorRewardResponse {
repeated cosmos.base.v1beta1.Coin amount = 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
repeated cosmos.base.v1beta1.Coin amount = 1
// Since: cosmos-sdk 0.46
repeated cosmos.base.v1beta1.Coin amount = 1

// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
message MsgWithdrawValidatorCommissionResponse {}
message MsgWithdrawValidatorCommissionResponse {
repeated cosmos.base.v1beta1.Coin amount = 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
repeated cosmos.base.v1beta1.Coin amount = 1
// Since: cosmos-sdk 0.46
repeated cosmos.base.v1beta1.Coin amount = 1

@alexanderbez
Copy link
Copy Markdown
Contributor

@joe-bowman could you by any chance make the tiny tweaks @AmauryM suggested? I merged prior to his review 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:CLI C:x/distribution distribution module related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add amount field to rewards/commission response types

5 participants