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

feat: Add MsgLeaveGroup to group module #10887

Merged
merged 52 commits into from
Mar 4, 2022
Merged

Conversation

aleem1314
Copy link
Contributor

@aleem1314 aleem1314 commented Jan 5, 2022

Description

Closes: #9657


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)

@aaronc
Copy link
Member

aaronc commented Jan 5, 2022

The challenge we're going to run into here is how do we adjust the threshold in ThresholdDecisionPolicy. Seems like that's not resolved from #9657. Ideas @aleem1314 @blushi @AmauryM ? Maybe we choose to switch to a PercentageDecisionPolicy or there's a method on DecisionPolicy to handle &/or reject members leaving

@blushi
Copy link
Contributor

blushi commented Jan 6, 2022

The challenge we're going to run into here is how do we adjust the threshold in ThresholdDecisionPolicy. Seems like that's not resolved from #9657. Ideas @aleem1314 @blushi @AmauryM ? Maybe we choose to switch to a PercentageDecisionPolicy or there's a method on DecisionPolicy to handle &/or reject members leaving

This issue could actually already happen when a group admin removes group members (through UpdateGroupMembers) and it's not currently handled... So I believe this should be addressed as a separate issue. I think a method on DecisionPolicy to reject members leaving if that would result in a conflict with its threshold (ie group.TotalWeight < policy.Threshold) could be a quick solution until we move to more flexible decision policies.

@blushi
Copy link
Contributor

blushi commented Jan 7, 2022

@aaronc Actually I've just realized that currently, you cannot create a proposal if the policy threshold is greater than the total group weight, see

err = policy.Validate(g)
and

cosmos-sdk/x/group/types.go

Lines 115 to 117 in aaa61e3

if threshold.Cmp(totalWeight) > 0 {
return sdkerrors.Wrap(errors.ErrInvalid, "policy threshold should not be greater than the total group weight")
}

So in this case, current proposals get invalidated (because group is updated) and new proposals can't be created.

But I agree this is not ideal from a user standpoint, this should error earlier on members updates rather than on proposal creation, thoughts?

@github-actions github-actions bot added the C:CLI label Jan 21, 2022
@aleem1314 aleem1314 requested a review from blushi January 21, 2022 15:40
@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #10887 (a4bfd0c) into master (489b399) will decrease coverage by 0.02%.
The diff coverage is 82.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10887      +/-   ##
==========================================
- Coverage   66.02%   66.00%   -0.03%     
==========================================
  Files         704      665      -39     
  Lines       71853    69032    -2821     
==========================================
- Hits        47442    45562    -1880     
+ Misses      21472    20799     -673     
+ Partials     2939     2671     -268     
Impacted Files Coverage Δ
client/flags/flags.go 20.68% <ø> (+0.35%) ⬆️
client/tx/factory.go 26.08% <0.00%> (-0.12%) ⬇️
x/auth/client/cli/tips.go 0.00% <0.00%> (ø)
x/group/codec.go 43.47% <50.00%> (+0.29%) ⬆️
x/group/msgs.go 53.87% <52.63%> (-0.05%) ⬇️
x/group/keeper/msg_server.go 71.92% <62.26%> (-0.78%) ⬇️
x/group/simulation/operations.go 66.92% <66.66%> (+0.05%) ⬆️
x/group/client/testutil/tx.go 99.77% <99.43%> (-0.03%) ⬇️
x/auth/client/testutil/suite.go 97.50% <100.00%> (+0.17%) ⬆️
orm/encoding/ormkv/seq.go
... and 42 more

@lgtm-com
Copy link

lgtm-com bot commented Jan 21, 2022

This pull request introduces 1 alert when merging d877e54 into eb01537 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 24, 2022

This pull request introduces 1 alert when merging 90306c1 into 6ea2049 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 24, 2022

This pull request introduces 1 alert when merging cce7b03 into 6ea2049 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 24, 2022

This pull request introduces 1 alert when merging 8f9bfb6 into 96bc6a5 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

proto/cosmos/group/v1beta1/tx.proto Outdated Show resolved Hide resolved
proto/cosmos/group/v1beta1/tx.proto Outdated Show resolved Hide resolved
x/group/client/cli/tx.go Outdated Show resolved Hide resolved
x/group/client/cli/tx.go Outdated Show resolved Hide resolved
x/group/keeper/msg_server.go Outdated Show resolved Hide resolved
Copy link
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.

LGTM

x/group/keeper/keeper_test.go Show resolved Hide resolved
x/group/keeper/keeper_test.go Outdated Show resolved Hide resolved
x/group/keeper/keeper_test.go Show resolved Hide resolved
@aleem1314 aleem1314 requested a review from blushi March 4, 2022 11:17
Copy link
Contributor

@blushi blushi left a comment

Choose a reason for hiding this comment

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

Pre-approving

x/group/spec/03_messages.md Outdated Show resolved Hide resolved
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 4, 2022
@mergify mergify bot merged commit 9ef249c into master Mar 4, 2022
@mergify mergify bot deleted the aleem/9657-msg-leave-group branch March 4, 2022 14:03
@blushi blushi mentioned this pull request Mar 10, 2022
19 tasks
mergify bot pushed a commit that referenced this pull request Mar 14, 2022
## Description

It seems like #10887 broke group simulations, fixing them here.



---

### 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...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:CLI C:Simulations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add MsgLeaveGroup to group module
4 participants