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

Update ica simulated proposals to check which modules are instantianted. #6377

Merged

Conversation

Taztingo
Copy link
Contributor

@Taztingo Taztingo commented May 23, 2024

Description

Updates the ICA proposals for simtests to only generate the proposals for provided keepers to have it match the functionality in v6. This was first found in v8.2.x that is currently used by Provenance.

closes: #6375


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Summary by CodeRabbit

  • Bug Fixes
    • Resolved an issue with generating ICA simtest proposals to ensure they are created only for provided keepers in the interchain accounts module.

Copy link
Contributor

coderabbitai bot commented May 23, 2024

Walkthrough

The changes involve updating the ProposalMsgs function in the apps/27-interchain-accounts module to properly handle scenarios where only one of the ICA Controller or Host modules is provided. This ensures that simtest proposals are generated only for the available keepers, addressing a bug that required both modules to be present.

Changes

File Change Summary
CHANGELOG.md Updated to reflect the bug fix related to generating ICA simtest proposals only for provided keepers in the apps/27-interchain-accounts module.
modules/.../module.go Modified ProposalMsgs function to accept additional parameters and return a different type of value.
modules/.../simulation/proposals.go Added imports for controllerkeeper and hostkeeper, and updated ProposalMsgs function to conditionally append proposal messages based on the presence of these keepers.
modules/.../simulation/proposals_test.go Added imports for controllerkeeper and hostkeeper, and modified TestProposalMsgs function to handle different scenarios with controllers and hosts, adjusting testing logic.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant SimState
    participant AppModule
    participant ControllerKeeper
    participant HostKeeper
    
    SimState->>AppModule: Call ProposalMsgs(simState)
    AppModule->>ControllerKeeper: Check if ControllerKeeper is provided
    AppModule->>HostKeeper: Check if HostKeeper is provided
    AppModule-->>SimState: Return proposal messages based on available keepers
Loading

Assessment against linked issues

Objective Addressed Explanation
Allow ICA simtests to run with only the Controller or Host modules provided (Issue #6375).
Ensure conditional generation of proposal messages based on the presence of Controller and Host keepers.
Update testing logic to accommodate the changes in ProposalMsgs function.

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 your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Actionable comments posted: 2

Outside diff range and nitpick comments (3)
CHANGELOG.md (3)

Line range hint 217-217: Remove trailing spaces to maintain clean and professional code formatting.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. 
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.

Line range hint 267-267: Remove trailing spaces to maintain clean and professional code formatting.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. 
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.

Line range hint 202-202: Consider replacing the bare URL with a markdown link to enhance readability and maintain consistency with other entries that use markdown links.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.
Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 180501e and 13640e2.
Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • modules/apps/27-interchain-accounts/module.go (1 hunks)
  • modules/apps/27-interchain-accounts/simulation/proposals.go (2 hunks)
  • modules/apps/27-interchain-accounts/simulation/proposals_test.go (2 hunks)
Additional Context Used
Markdownlint (3)
CHANGELOG.md (3)

217: Expected: 0 or 2; Actual: 1
Trailing spaces


267: Expected: 0 or 2; Actual: 1
Trailing spaces


202: null
Bare URL used

Path-based Instructions (4)
modules/apps/27-interchain-accounts/simulation/proposals.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

modules/apps/27-interchain-accounts/simulation/proposals_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

modules/apps/27-interchain-accounts/module.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Additional comments not posted (4)
modules/apps/27-interchain-accounts/simulation/proposals.go (1)

11-13: The new imports for controllerkeeper and hostkeeper are correctly placed and necessary for the updated function signature.

modules/apps/27-interchain-accounts/simulation/proposals_test.go (1)

15-17: The new imports for controllerkeeper and hostkeeper are correctly placed and necessary for the updated test function.

modules/apps/27-interchain-accounts/module.go (1)

198-199: The modification to the ProposalMsgs function correctly delegates to the updated simulation.ProposalMsgs, ensuring consistency across the module with the new keeper parameters.

CHANGELOG.md (1)

71-72: The changelog entry for PR #6377 correctly summarizes the changes made to the ICA simulation proposals. It's good to see that the changelog is being kept up-to-date with significant modifications.

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.

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
CHANGELOG.md (2)

Line range hint 57-57: Remove trailing spaces to maintain clean and consistent formatting in the markdown file.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. 
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.

Also applies to: 219-219, 269-269


Line range hint 204-204: Consider replacing the bare URL with a markdown link to enhance the readability and presentation of the document.

- * [\#6193](https://github.com/cosmos/ibc-go/pull/6193) Bump Cosmos SDK to v0.50.6.
+ * [Bump Cosmos SDK to v0.50.6](https://github.com/cosmos/ibc-go/pull/6193).
Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 13640e2 and d4cc632.
Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional Context Used
Markdownlint (4)
CHANGELOG.md (4)

57: Expected: 0 or 2; Actual: 1
Trailing spaces


219: Expected: 0 or 2; Actual: 1
Trailing spaces


269: Expected: 0 or 2; Actual: 1
Trailing spaces


204: null
Bare URL used

Path-based Instructions (1)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Additional comments not posted (1)
CHANGELOG.md (1)

73-74: The changelog entry for the ICA simtest proposals update is correctly documented under the "Bug Fixes" section.

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.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d4cc632 and 4c8a11d.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
Path-based instructions (1)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Markdownlint
CHANGELOG.md

220-220: Expected: 0 or 2; Actual: 1
Trailing spaces


270-270: Expected: 0 or 2; Actual: 1
Trailing spaces


205-205: null
Bare URL used

Additional comments not posted (1)
CHANGELOG.md (1)

74-75: The changelog entry correctly documents the bug fix related to ICA simtest proposals.

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.

Actionable comments posted: 0

Outside diff range and nitpick comments (3)
CHANGELOG.md (3)

Line range hint 220-220: Remove trailing spaces to adhere to Markdown best practices.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. 
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.

Line range hint 270-270: Remove trailing spaces to adhere to Markdown best practices.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers. 
+ * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.

Line range hint 205-205: Avoid using bare URLs. Provide a descriptive link text.

- * (apps/27-interchain-accounts) [\#6377](https://github.com/cosmos/ibc-go/pull/6377) Generate ICA simtest proposals only for provided keepers.
+ * (apps/27-interchain-accounts) [Generate ICA simtest proposals only for provided keepers](https://github.com/cosmos/ibc-go/pull/6377).
Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4c8a11d and 2a4bacd.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
Path-based instructions (1)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Markdownlint
CHANGELOG.md

220-220: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


270-270: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


205-205: null (MD034, no-bare-urls)
Bare URL used

Additional comments not posted (1)
CHANGELOG.md (1)

74-75: The changelog entry for the bug fix is well-documented and correctly links to the PR.

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Thanks @Taztingo for opening a fix!

cc @crodriguezvega I realized we have two options for backport:

  • remove sim functionality on backports (allows for patch release)
  • add new function (ProposalMsgsWithKeeper, possible in minor release)

controller *controllerkeeper.Keeper
host *hostkeeper.Keeper
proposalMsgs int
isHost []bool
Copy link
Contributor

Choose a reason for hiding this comment

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

happy with this, but could also maybe do expMsgs []interface where test case 1 has []interface{msgHostUpdateParams, msgControllerUpdateParams} (we can create the expected host and controller msgs at the top of the test since they are predictable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great idea. I also updated the tests to match your others so they include a name and run in a goroutine. Let me know if there is anything else.

Copy link
Member

Choose a reason for hiding this comment

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

Could we use []sdk.Msg or []proto.Message instead of []interface to have stronger typing?

@colin-axner colin-axner added the priority PRs that need prompt reviews label Jun 5, 2024
Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Thanks a lot! LGTM!

name string
controller *controllerkeeper.Keeper
host *hostkeeper.Keeper
expMsgs []interface{}
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use []sdk.Msg here? or at least proto.Message

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Thank you @Taztingo!

If you could sync the branch one more time please we can try to get this merged asap! And/or edit the PR to check the "allow edits from maintainers" box if possible (not sure if it can be done after the fact), so that we could keep it in sync ourselves without having to bother you! ❤️

@damiannolan damiannolan merged commit 5eaa770 into cosmos:main Jun 10, 2024
74 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority PRs that need prompt reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICA simtests require an application to have both the controller and host modules.
4 participants