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

refactor: x/group proposal tally at the end of voting period #11310

Merged
merged 31 commits into from
Mar 11, 2022

Conversation

atheeshp
Copy link
Contributor

@atheeshp atheeshp commented Mar 2, 2022

Description

Closes: #11246


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)

}

func updateTallyOfVPEndProposals(ctx sdk.Context, k keeper.Keeper) error {
k.IterateVPEndProposals(ctx, sdk.FormatTimeBytes(ctx.BlockTime()), func(proposal group.Proposal) (stop bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do people think of emitting an event with the tally reslut and the updated proposal status/result on EndBlocker?

@atheeshp atheeshp marked this pull request as ready for review March 7, 2022 09:38
@atheeshp atheeshp requested review from blushi and amaury1093 March 7, 2022 09:38
@amaury1093 amaury1093 requested a review from cmwaters March 7, 2022 10:06
@blushi blushi self-assigned this Mar 7, 2022
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.

Implementation looks good, just some small comments.

@atheeshp atheeshp requested review from amaury1093 and blushi March 9, 2022 06:00
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.

Agree with the 2 proposed changes above, but since they are minor, I'm pre-approving 👍

@atheeshp atheeshp requested review from blushi and likhita-809 March 10, 2022 05:21
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

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

Lgtm, just a nit

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 10, 2022
@amaury1093
Copy link
Contributor

Nice! Putting automerge on

@amaury1093 amaury1093 mentioned this pull request Mar 10, 2022
19 tasks
@mergify mergify bot merged commit 9165c79 into master Mar 11, 2022
@mergify mergify bot deleted the ap/tally-at-end branch March 11, 2022 13:11
mergify bot pushed a commit that referenced this pull request Mar 28, 2022
## Description

Closes: #11245

### 1. Pruning proposal.

Proposals are pruned:
- after a successful MsgExec (or try_exec)
- on voting_period_end + max_execution_period

whichever happens first.

### 2. Pruning votes.

Votes are pruned:
  - on MsgExec (or try_exec) if tally is final
  - on voting_period_end

whichever happens first. 

### 3. Various group fixes

See #11404 for details

TODO:
- [x] Add vote pruning after Tally, once #11310  is merged
- [x] Add tests



---

### 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](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
- [ ] 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.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add tallying on proposal VotingEndPeriod
4 participants