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(x/gov): optimistic proposals #18620

Merged
merged 45 commits into from
Dec 20, 2023
Merged

feat(x/gov): optimistic proposals #18620

merged 45 commits into from
Dec 20, 2023

Conversation

julienrbrt
Copy link
Member

Description

ref: #18498

Based on #18532, #18532 should be merged before.


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
  • confirmed ! in 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
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • 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 all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Copy link
Contributor

coderabbitai bot commented Dec 4, 2023

Note

Reviews Paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The Cosmos governance module (x/gov) underwent a series of updates to enhance its functionality. New fields for optimistic governance were added, including authorized addresses and a rejection threshold. The codebase reflects these updates with changes in proposal submission, tallying, and parameter validation. The logic for different proposal types has been refactored, and error handling has been improved. Additionally, the testing suite was expanded to cover the new features and changes.

Changes

File(s) Change Summary
proto/cosmos/gov/v1/gov.proto Added optimistic_authorized_addresses and optimistic_rejected_threshold to Params.
x/gov/abci.go Modified EndBlocker function to handle expedited and optimistic proposals.
x/gov/keeper/msg_server.go, x/gov/keeper/proposal.go, x/gov/keeper/vote.go Updated proposal handling, removed certain validation checks, refactored error handling, and added new logic for optimistic proposals.
x/gov/keeper/tally.go, x/gov/keeper/tally_test.go Changed Tally function, added new tally functions and helper functions, and updated tests for different proposal types.
x/gov/keeper/msg_server_test.go Expanded test cases for voting on proposals with scenarios for optimistic proposals and inactive proposals.
x/gov/keeper/migrations.go Modified MigrateStore function to handle new paramsCollection parameter for optimistic proposals.
x/gov/simulation/genesis.go Added new constant and function for OptimisticRejectedThreshold and updated RandomizedGenState function.
x/gov/types/v1/params.go Added new parameters and validation for optimisticRejectedThreshold and optimisticAuthorizedAddreses.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

x/gov/keeper/msg_server.go Outdated Show resolved Hide resolved
julienrbrt and others added 2 commits December 15, 2023 16:53
Co-authored-by: Facundo Medica <[email protected]>
Copy link
Member

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

left a few comments, need to rereview the tally separation but otherwise looks good

@julienrbrt
Copy link
Member Author

julienrbrt commented Dec 15, 2023

left a few comments, need to rereview the tally separation but otherwise looks good

Do note, Tally separation completion isn't part of this PR. This is more split, but still without the tally interface.

@julienrbrt julienrbrt enabled auto-merge December 15, 2023 23:45
@julienrbrt julienrbrt force-pushed the julien/optimistic-proposals branch from b20186b to 228789f Compare December 19, 2023 21:00
Copy link
Member

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

a little more information on the go docs in tally.go, otherwise looks good

@julienrbrt julienrbrt added this pull request to the merge queue Dec 20, 2023
Merged via the queue into main with commit eb3ea8d Dec 20, 2023
61 of 63 checks passed
@julienrbrt julienrbrt deleted the julien/optimistic-proposals branch December 20, 2023 21:50
@julienrbrt
Copy link
Member Author

julienrbrt commented Dec 20, 2023

a little more information on the go docs in tally.go, otherwise looks good

Auto merge was on :D
Sure thing, I'll need to refactor that for the tally interface implementation. I'll make sure to do that then 👍🏾

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

Successfully merging this pull request may close these issues.

3 participants