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

Support for sending funds to the community pool #5249

Merged
merged 27 commits into from
Dec 10, 2019
Merged

Support for sending funds to the community pool #5249

merged 27 commits into from
Dec 10, 2019

Conversation

RiccardoM
Copy link
Contributor

@RiccardoM RiccardoM commented Oct 25, 2019

Description

Closes #5206

To do

  • Add tests
  • Add tx command
  • Add documentation

Checklist

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote tests
  • Updated relevant documentation (docs/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the github PR explorer

For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@RiccardoM RiccardoM changed the title Support for sending funds to the community pool [WIP] Support for sending funds to the community pool Oct 25, 2019
@codecov
Copy link

codecov bot commented Oct 25, 2019

Codecov Report

Merging #5249 into master will increase coverage by 0.08%.
The diff coverage is 30.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5249      +/-   ##
==========================================
+ Coverage   54.55%   54.64%   +0.08%     
==========================================
  Files         311      311              
  Lines       18653    18529     -124     
==========================================
- Hits        10176    10125      -51     
+ Misses       7700     7631      -69     
+ Partials      777      773       -4
Impacted Files Coverage Δ
simapp/test_helpers.go 0% <0%> (ø) ⬆️
x/distribution/client/cli/tx.go 4.76% <0%> (-0.8%) ⬇️
x/distribution/handler.go 7.14% <0%> (-1.63%) ⬇️
simapp/app.go 90.06% <100%> (+0.31%) ⬆️
x/distribution/types/msg.go 56.92% <58.82%> (+0.67%) ⬆️
x/distribution/keeper/keeper.go 82.71% <71.42%> (-1.07%) ⬇️
x/params/subspace/subspace.go 0% <0%> (-77.36%) ⬇️
x/params/subspace/table.go 74.35% <0%> (-25.65%) ⬇️
x/params/proposal_handler.go 62.96% <0%> (-10.73%) ⬇️
x/mock/app.go 62.83% <0%> (-1.36%) ⬇️
... and 15 more

simapp/app.go Outdated Show resolved Hide resolved
@RiccardoM RiccardoM changed the title [WIP] Support for sending funds to the community pool Support for sending funds to the community pool Oct 28, 2019
Copy link
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.

Thanks @RiccardoM, I would like to see the following:

  1. A changelog entry
  2. A test case testing you can send to the community pool address and only that address

Thanks for the contribution!

simapp/app.go Show resolved Hide resolved
@RiccardoM
Copy link
Contributor Author

Thanks @RiccardoM, I would like to see the following:

  1. A changelog entry
  2. A test case testing you can send to the community pool address and only that address

Thanks for the contribution!

I've implemented the tests. The only thing missing is the changelog. Under which section and tag should I put it?

Copy link
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.

ACK -- @RiccardoM you can simply add the following under Features and state-machine-breakingin the changelog:

* (modules) [\#5249](https://github.com/cosmos/cosmos-sdk/pull/5249) Funds are now allowed to be directly sent to the community pool (via the distribution module account).

@alexanderbez alexanderbez added the T: State Machine Breaking State machine breaking changes (impacts consensus). label Nov 29, 2019
@RiccardoM
Copy link
Contributor Author

ACK -- @RiccardoM you can simply add the following under Features and state-machine-breakingin the changelog:

* (modules) [\#5249](https://github.com/cosmos/cosmos-sdk/pull/5249) Funds are now allowed to be directly sent to the community pool (via the distribution module account).

Done! :D

@alexanderbez alexanderbez removed the T: State Machine Breaking State machine breaking changes (impacts consensus). label Nov 30, 2019
Copy link
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.

Apologies @RiccardoM, but after testing this, I've realized that this solution is not correct as it turns out that the community fund pool is unique and not an actual module account.

We'll need to adjust this PR slightly. We'll need a custom message type that sends funds from an account to the distribution module account AND also adds the funds to the pool itself:

k.supplyKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, amount)
feePool.CommunityPool = feePool.CommunityPool.Add(amount)
k.SetFeePool(ctx, feePool)

@alexanderbez
Copy link
Contributor

@RiccardoM do you need assistance on this PR? We can complete it together if you wish.

@RiccardoM
Copy link
Contributor Author

@alexanderbez Sorry, been very busy with other stuff. It should be mostly done now

Copy link
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.

Looks great @RiccardoM -- just a few bits of minor feedback.

x/distribution/client/cli/tx.go Show resolved Hide resolved
x/distribution/client/cli/tx.go Outdated Show resolved Hide resolved
x/distribution/client/cli/tx.go Outdated Show resolved Hide resolved
x/distribution/client/cli/tx.go Outdated Show resolved Hide resolved
x/distribution/keeper/keeper.go Outdated Show resolved Hide resolved
x/distribution/keeper/keeper.go Outdated Show resolved Hide resolved
RiccardoM and others added 7 commits December 9, 2019 21:28
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-Authored-By: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Copy link
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.

ACK -- I think the message type name can change, but we can do that in another PR.

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Minor nits mostly. Please add the msg validation on the cli as well

x/distribution/client/cli/tx.go Show resolved Hide resolved
x/distribution/client/rest/tx.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
x/distribution/types/msg.go Show resolved Hide resolved
@alexanderbez
Copy link
Contributor

I'm addressing all comments in a subsequent PR @fedekunze + adding support for simulation.

@alexanderbez alexanderbez merged commit 09bd174 into cosmos:master Dec 10, 2019
@alexanderbez alexanderbez mentioned this pull request Dec 10, 2019
11 tasks
xiangjianmeng pushed a commit to xiangjianmeng/cosmos-sdk that referenced this pull request Dec 18, 2019
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/distribution distribution module related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for sending funds to the community pool
4 participants