cosmos / interchain-security

Interchain Security is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.
https://cosmos.github.io/interchain-security/
Other
154 stars 115 forks source link

fix: migration and error code duplication + e2e tests #1930

Closed bermuell closed 4 months ago

bermuell commented 4 months ago

Description

Fix merge issues resulting in duplicated migration registriation and duplicated error codes Fix e2e tests Fix github workflows due to move to go version 1.22

Closes: N/A


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

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

Summary by CodeRabbit

coderabbitai[bot] commented 4 months ago
Walkthrough ## Walkthrough The changes primarily involve updating the Go version from 1.21 to 1.22 across various GitHub workflow files and Dockerfiles. Additionally, there are significant updates to the E2E test files, including refactoring functions and modifying method signatures to improve code clarity and functionality. Furthermore, the `RegisterServices` method in the `AppModule` struct has been revised to correct migration registrations, and error constants in the `errors.go` file have been reordered. ## Changes | Files / Paths | Change Summary | |--------------------------------------------------|----------------------------------------------------------------------------------------------------| | `.github/workflows/codeql-analysis.yml` | Updated Go version from 1.21 to 1.22. | | `.github/workflows/golangci-lint.yml` | Updated Go version from 1.21 to 1.22. | | `.github/workflows/nightly-e2e.yml` | Updated Go version from 1.21 to 1.22 across multiple jobs. | | `.github/workflows/test.yml` | Updated Go version from 1.21 to 1.22 in multiple places. | | `Dockerfile` | Changed base image from `golang:1.21-alpine` to `golang:1.22-alpine`. | | `Dockerfile.gaia` | Updated to use `golang:1.22-alpine` instead of `golang:1.21-alpine` for building Gaia. | | `tests/e2e/actions.go` | Refactored functions to use `Chain` type instead of `TestConfig`, updated command execution flow. | | `tests/e2e/state.go` | Renamed and restructured functions within `Commands` struct, updated method calls. | | `tests/e2e/testlib/types.go` | Added `GetHasToValidate` method to `ChainCommands` interface, new field in `ChainState` struct. | | `tests/e2e/v4/state.go` | Added `GetHasToValidate` function to `Commands` struct, currently not implemented. | | `x/ccv/provider/module.go` | Modified `RegisterServices` to remove duplicate migration for version 4, added migration 5 to 6. | | `x/ccv/provider/types/errors.go` | Adjusted registration order of error constants, changing associated error codes and messages. |

Recent review details **Configuration used: .coderabbit.yml** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 78f9b1ee6c491392a508ea673f7d8435e18acc63 and c246fc292371288cee43715ed54c1bb795ff6f1a.
Files selected for processing (12) * .github/workflows/codeql-analysis.yml (1 hunks) * .github/workflows/golangci-lint.yml (1 hunks) * .github/workflows/nightly-e2e.yml (17 hunks) * .github/workflows/test.yml (6 hunks) * Dockerfile (1 hunks) * Dockerfile.gaia (3 hunks) * tests/e2e/actions.go (5 hunks) * tests/e2e/state.go (3 hunks) * tests/e2e/testlib/types.go (2 hunks) * tests/e2e/v4/state.go (1 hunks) * x/ccv/provider/module.go (1 hunks) * x/ccv/provider/types/errors.go (1 hunks)
Files not reviewed due to errors (5) * Dockerfile.gaia (no review received) * x/ccv/provider/types/errors.go (no review received) * x/ccv/provider/module.go (no review received) * .github/workflows/nightly-e2e.yml (no review received) * tests/e2e/testlib/types.go (no review received)
Files skipped from review due to trivial changes (3) * .github/workflows/codeql-analysis.yml * .github/workflows/golangci-lint.yml * .github/workflows/test.yml
Additional context used
Path-based instructions (6)
x/ccv/provider/types/errors.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
x/ccv/provider/module.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
tests/e2e/testlib/types.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
tests/e2e/v4/state.go (1) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
tests/e2e/state.go (2) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations. --- Pattern `tests/e2e/*`: "Assess the e2e test code assessing sufficient code coverage for the changes associated in the pull request"
tests/e2e/actions.go (2) Pattern `**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations. --- Pattern `tests/e2e/*`: "Assess the e2e test code assessing sufficient code coverage for the changes associated in the pull request"
Hadolint
Dockerfile
[warning] 7-7: Pin versions in apk add. Instead of `apk add ` use `apk add =` --- [error] 20-20: Use COPY instead of ADD for files and folders --- [info] 26-26: Multiple consecutive `RUN` instructions. Consider consolidation. --- [info] 29-29: Multiple consecutive `RUN` instructions. Consider consolidation. --- [warning] 32-32: Do not use --platform flag with FROM --- [warning] 40-40: Do not use --platform flag with FROM --- [info] 42-42: Multiple consecutive `RUN` instructions. Consider consolidation. --- [warning] 42-42: `dnf clean all` missing after dnf command. --- [warning] 42-42: Specify version with `dnf install -y -`. --- [warning] 43-43: Last USER should not be root --- [error] 55-55: Use COPY instead of ADD for files and folders --- [error] 58-58: Use COPY instead of ADD for files and folders
Dockerfile.gaia
[warning] 10-10: Pin versions in apk add. Instead of `apk add ` use `apk add =` --- [error] 22-22: Use COPY instead of ADD for files and folders --- [warning] 28-28: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check --- [warning] 28-28: Quote this to prevent word splitting. --- [info] 43-43: Multiple consecutive `RUN` instructions. Consider consolidation. --- [info] 44-44: Multiple consecutive `RUN` instructions. Consider consolidation. --- [warning] 49-49: Pin versions in apk add. Instead of `apk add ` use `apk add =` --- [error] 56-56: Use COPY instead of ADD for files and folders --- [warning] 64-64: Do not use --platform flag with FROM --- [warning] 66-66: Do not use --platform flag with FROM --- [warning] 68-68: Specify version with `dnf install -y -`. --- [warning] 68-68: `dnf clean all` missing after dnf command. --- [info] 68-68: Multiple consecutive `RUN` instructions. Consider consolidation. --- [warning] 69-69: Last USER should not be root --- [error] 80-80: Use COPY instead of ADD for files and folders --- [error] 83-83: Use COPY instead of ADD for files and folders
Additional comments not posted (3)
Dockerfile (1)
`4-4`: Update to Go 1.22 is consistent with PR objectives.
tests/e2e/v4/state.go (1)
`652-654`: Verify the implementation status of `GetHasToValidate`. This function currently throws a panic indicating it's not implemented. If this is intentional as a placeholder, consider adding a TODO comment to clarify that it's pending implementation. This helps maintain clarity in the codebase.
tests/e2e/state.go (1)
`818-825`: Review the implementation of `GetHasToValidate`. The function implementation for fetching consumer chain IDs appears robust. However, ensure that the error handling is comprehensive, especially considering different failure modes of the command execution or JSON parsing. Consider adding more specific error messages or handling potential edge cases.
--- 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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.