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(group): Prune expired proposals and votes #11315

Merged
merged 43 commits into from
Mar 28, 2022
Merged

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Mar 3, 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:


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)

@amaury1093 amaury1093 changed the title fea(group)t: Prune expired proposals and votes feat(group): Prune expired proposals and votes Mar 3, 2022
@codecov
Copy link

codecov bot commented Mar 9, 2022

Codecov Report

Merging #11315 (fee7d95) into master (cc0b9df) will increase coverage by 0.06%.
The diff coverage is 60.30%.

❗ Current head fee7d95 differs from pull request most recent head 364ddfb. Consider uploading reports for the commit 364ddfb to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11315      +/-   ##
==========================================
+ Coverage   65.88%   65.94%   +0.06%     
==========================================
  Files         675      675              
  Lines       69830    69773      -57     
==========================================
+ Hits        46006    46012       +6     
+ Misses      21123    21067      -56     
+ Partials     2701     2694       -7     
Impacted Files Coverage Δ
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/group/keeper/tally.go 62.50% <100.00%> (-7.50%) ⬇️
x/group/simulation/genesis.go 95.71% <100.00%> (ø)
crypto/keys/internal/ecdsa/privkey.go 82.45% <0.00%> (-1.76%) ⬇️
... and 5 more

@likhita-809 likhita-809 marked this pull request as ready for review March 10, 2022 14:59
expErrMsg: "load proposal: not found",
expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS,
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we also need few tests with the try_exec set on Voting and Submitting proposal.

cc: @AmauryM @blushi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! There might be some duplicated tests with TestVote and TestSubmitProposal, but I guess that's okay.

blushi and others added 2 commits March 25, 2022 12:06
* Rm TallyVotesInvariant

* Update TallyVotesSumInvariant to check for proposal voting period end

* Do not check for updated group and group policy on Vote

* Do not check for updated group and group policy on Exec

* Test invariants

* Update TallyVotesSumInvariant to check proposal status

* Add back invariants

* Nit

* Fix invariant

* Fix it.Close()

* Update docs

* Fix genesis sim

* Test genesis

* Test UpdateTallyOfVPEndProposals

* Do proposals update after index iterator closed in UpdateTallyOfVPEndProposals

* fix: Try fix group sims issue (#11458)

* Fix sims?

* Remove useless index

* Add comment

* Fix iterateProposalsByVPEnd

* Fix some other places

* Fix build

* Add unit test

* Use iterateProposalsByVPEnd again

Co-authored-by: Amaury <[email protected]>
Copy link
Contributor Author

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

Approving ✅

(a lot of people contributed to this PR, thanks!)

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, pending some more docs

@blushi
Copy link
Contributor

blushi commented Mar 25, 2022

Still related to the docs but not directly to this PR (but to previous ones), we forgot to add some client docs for TallyResult query.
IMO that shouldn't block this PR, let's just make sure to tackle this as part of the audit, I'll add a note about that in #10968.

@amaury1093
Copy link
Contributor Author

Added docs about tallying, pruning, and state. I didn't add docs on client.md in this PR.

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 25, 2022
@mergify mergify bot merged commit 5491be2 into master Mar 28, 2022
@mergify mergify bot deleted the am/11245-prune-group branch March 28, 2022 04:44
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:Simulations
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Prune group proposals and votes at VotingPeriodEnd + MaxExecutionPeriod
6 participants