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): check the new admin address when updating the group policy admin #18350

Merged

Conversation

lukema95
Copy link
Contributor

@lukema95 lukema95 commented Nov 3, 2023

Check the new admin address when updating the group policy admin.

Description

Closes: #XXXX

Check the new admin address when updating the group policy admin. Add relevant unit test cases.


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
  • run make lint and make test
  • 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)

Summary by CodeRabbit

Bug Fixes:

  • Added a validation check in the UpdateGroupPolicyAdmin function to ensure only valid addresses can be set as the new admin for a group policy, enhancing the security and integrity of group policy administration.

Tests:

  • Introduced new test cases to verify the correct handling of invalid admin addresses when updating the group admin and group policy admin, improving the robustness of our testing suite.

@lukema95 lukema95 requested a review from a team as a code owner November 3, 2023 04:29
Copy link
Contributor

coderabbitai bot commented Nov 3, 2023

Walkthrough

The changes introduced add a new layer of validation for updating group and group policy admins in the Keeper struct. The validation ensures that only valid addresses can be set as new admins. The changes also include new test cases to verify the functionality of these updates.

Changes

File Path Summary
x/group/keeper/.../msg_server.go Introduced a new check in the UpdateGroupPolicyAdmin function to validate the msg.NewAdmin address.
x/group/keeper/.../msg_server_test.go Added new test cases for updating the group admin and group policy admin with invalid new admin addresses.

Poem

"In the heart of autumn's glow, 🍂
Code changes come, steady flow. 💻
Validations strong and new,
Ensuring addresses are true. 🏡
Tests are written, checks are made,
In the codebase's shade. 🌳
Celebrate, for we've done well,
In the code, where we dwell. 🎉"


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

@github-prbot github-prbot requested review from a team, kocubinski and samricotta and removed request for a team November 3, 2023 04:29
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 32c8ab9 and e2b7b12.
Files selected for processing (2)
  • x/group/keeper/msg_server.go (1 hunks)
  • x/group/keeper/msg_server_test.go (2 hunks)
Additional comments: 3
x/group/keeper/msg_server_test.go (2)
  • 666-674: The test case for an invalid new admin address is correctly set up. The expected error message should match the one returned by the function when an invalid address is provided.

  • 1229-1245: The test case for an invalid new admin address in the group policy is correctly set up. The expected error message should match the one returned by the function when an invalid address is provided.

x/group/keeper/msg_server.go (1)
  • 429-434: The check for the new admin address being the same as the old one and the validation of the new admin address are good additions for ensuring data integrity and preventing unnecessary operations.

x/group/keeper/msg_server.go Show resolved Hide resolved
@julienrbrt julienrbrt added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Nov 3, 2023
@julienrbrt julienrbrt added this pull request to the merge queue Nov 3, 2023
Merged via the queue into cosmos:main with commit 4579499 Nov 3, 2023
57 of 59 checks passed
mergify bot pushed a commit that referenced this pull request Nov 3, 2023
tac0turtle pushed a commit that referenced this pull request Nov 3, 2023
…p policy admin (backport #18350) (#18352)

Co-authored-by: Luke Ma <lukema95@gmail.com>
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release C:x/group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants