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(slashing): spinout to new go module #18201

Merged
merged 14 commits into from
Oct 25, 2023
Merged

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Oct 22, 2023

Description

spinout slashing module into its own go.mod

ref #11899


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

  • Refactor: The slashing module has been separated into its own go.mod file, improving the modularity and maintainability of the codebase. This change also updates the import paths for the slashing module across various files.
  • New Feature: A new job called "test-x-slashing" has been added to the workflow, enhancing the testing process for the slashing package.
  • Chore: SonarCloud analysis has been included in the workflow for certain conditions, improving code quality checks.
  • Documentation: An initial template for a changelog file has been added to the slashing module, providing a structured way to track and communicate changes.
  • Test: Various test files have been updated to reflect the new import paths for the slashing module, ensuring the tests remain accurate and up-to-date.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2023

Walkthrough

The changes primarily involve the migration of the slashing module from the github.com/cosmos/cosmos-sdk repository to its own repository at cosmossdk.io/x/slashing. This includes updates to import paths across multiple files, addition of new tests and workflows, and updates to documentation and configuration files.

Changes

Files Summary
.github/workflows/test.yml, x/slashing/sonar-project.properties Addition of new workflows and configuration for testing and SonarCloud analysis.
UPGRADING.md, CHANGELOG.md, x/slashing/CHANGELOG.md Documentation updates to reflect the migration of the slashing module.
proto/cosmos/slashing/..., x/slashing/... Import path updates from github.com/cosmos/cosmos-sdk/x/slashing to cosmossdk.io/x/slashing.
simapp/..., tests/integration/..., x/.../testutil/app_config.go Updates to import paths and addition of the slashing module in various application configurations and tests.

🐇 "In the realm of code, where modules reside,
A shift occurred, a new path to abide.
From the cosmos we leapt, to a domain anew,
Slashing our way, to a view that's true.
With tests and docs, we make our claim,
In the land of Go, it's a whole new game!" 🎉


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.

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

@tac0turtle tac0turtle changed the title spinout slashing refactor(slashing): spinout to new go module Oct 22, 2023
Base automatically changed from marko/spinout_dist to main October 24, 2023 15:16
@tac0turtle tac0turtle marked this pull request as ready for review October 24, 2023 15:53
@tac0turtle tac0turtle requested a review from a team as a code owner October 24, 2023 15:53
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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2f23e8a and 13edc04.
Files ignored due to filter (17)
  • client/v2/go.mod
  • go.mod
  • simapp/go.mod
  • tests/go.mod
  • tests/starship/tests/go.mod
  • x/circuit/go.mod
  • x/distribution/go.mod
  • x/evidence/go.mod
  • x/feegrant/go.mod
  • x/gov/go.mod
  • x/group/go.mod
  • x/nft/go.mod
  • x/params/go.mod
  • x/protocolpool/go.mod
  • x/slashing/go.mod
  • x/slashing/go.sum
  • x/upgrade/go.mod
Files selected for processing (54)
  • .github/workflows/test.yml (1 hunks)
  • UPGRADING.md (1 hunks)
  • proto/cosmos/slashing/module/v1/module.proto (1 hunks)
  • proto/cosmos/slashing/v1beta1/genesis.proto (1 hunks)
  • proto/cosmos/slashing/v1beta1/query.proto (1 hunks)
  • proto/cosmos/slashing/v1beta1/slashing.proto (1 hunks)
  • proto/cosmos/slashing/v1beta1/tx.proto (1 hunks)
  • simapp/app.go (2 hunks)
  • simapp/app_config.go (2 hunks)
  • simapp/app_test.go (2 hunks)
  • simapp/app_v2.go (2 hunks)
  • simapp/export.go (1 hunks)
  • simapp/sim_test.go (2 hunks)
  • tests/integration/evidence/keeper/infraction_test.go (2 hunks)
  • tests/integration/rapidgen/rapidgen.go (2 hunks)
  • tests/integration/slashing/keeper/keeper_test.go (2 hunks)
  • tests/integration/tx/aminojson/aminojson_test.go (2 hunks)
  • tests/integration/tx/decode_test.go (2 hunks)
  • testutil/testnet/genesis.go (2 hunks)
  • x/distribution/testutil/app_config.go (1 hunks)
  • x/evidence/testutil/app_config.go (1 hunks)
  • x/slashing/CHANGELOG.md (1 hunks)
  • x/slashing/abci.go (1 hunks)
  • x/slashing/abci_test.go (1 hunks)
  • x/slashing/app_test.go (2 hunks)
  • x/slashing/keeper/genesis.go (1 hunks)
  • x/slashing/keeper/genesis_test.go (1 hunks)
  • x/slashing/keeper/grpc_query.go (1 hunks)
  • x/slashing/keeper/grpc_query_test.go (1 hunks)
  • x/slashing/keeper/hooks.go (1 hunks)
  • x/slashing/keeper/infractions.go (1 hunks)
  • x/slashing/keeper/keeper.go (1 hunks)
  • x/slashing/keeper/keeper_test.go (2 hunks)
  • x/slashing/keeper/migrations.go (1 hunks)
  • x/slashing/keeper/msg_server.go (1 hunks)
  • x/slashing/keeper/msg_server_test.go (1 hunks)
  • x/slashing/keeper/signing_info.go (1 hunks)
  • x/slashing/keeper/signing_info_test.go (1 hunks)
  • x/slashing/keeper/unjail.go (1 hunks)
  • x/slashing/migrations/v4/migrate.go (1 hunks)
  • x/slashing/migrations/v4/migrate_test.go (1 hunks)
  • x/slashing/module.go (1 hunks)
  • x/slashing/simulation/decoder.go (1 hunks)
  • x/slashing/simulation/decoder_test.go (1 hunks)
  • x/slashing/simulation/genesis.go (1 hunks)
  • x/slashing/simulation/genesis_test.go (1 hunks)
  • x/slashing/simulation/operations.go (2 hunks)
  • x/slashing/simulation/operations_test.go (2 hunks)
  • x/slashing/simulation/proposals.go (1 hunks)
  • x/slashing/simulation/proposals_test.go (1 hunks)
  • x/slashing/sonar-project.properties (1 hunks)
  • x/slashing/testutil/app_config.go (1 hunks)
  • x/slashing/testutil/params.go (1 hunks)
  • x/staking/testutil/app_config.go (2 hunks)
Files skipped from review due to trivial changes (44)
  • .github/workflows/test.yml
  • UPGRADING.md
  • proto/cosmos/slashing/module/v1/module.proto
  • proto/cosmos/slashing/v1beta1/genesis.proto
  • proto/cosmos/slashing/v1beta1/query.proto
  • proto/cosmos/slashing/v1beta1/slashing.proto
  • simapp/app.go
  • simapp/export.go
  • simapp/sim_test.go
  • tests/integration/evidence/keeper/infraction_test.go
  • tests/integration/tx/aminojson/aminojson_test.go
  • tests/integration/tx/decode_test.go
  • testutil/testnet/genesis.go
  • x/distribution/testutil/app_config.go
  • x/slashing/CHANGELOG.md
  • x/slashing/abci.go
  • x/slashing/app_test.go
  • x/slashing/keeper/genesis.go
  • x/slashing/keeper/genesis_test.go
  • x/slashing/keeper/grpc_query.go
  • x/slashing/keeper/grpc_query_test.go
  • x/slashing/keeper/hooks.go
  • x/slashing/keeper/infractions.go
  • x/slashing/keeper/keeper.go
  • x/slashing/keeper/keeper_test.go
  • x/slashing/keeper/msg_server.go
  • x/slashing/keeper/msg_server_test.go
  • x/slashing/keeper/signing_info.go
  • x/slashing/keeper/signing_info_test.go
  • x/slashing/keeper/unjail.go
  • x/slashing/migrations/v4/migrate_test.go
  • x/slashing/module.go
  • x/slashing/simulation/decoder.go
  • x/slashing/simulation/decoder_test.go
  • x/slashing/simulation/genesis.go
  • x/slashing/simulation/genesis_test.go
  • x/slashing/simulation/operations.go
  • x/slashing/simulation/operations_test.go
  • x/slashing/simulation/proposals.go
  • x/slashing/simulation/proposals_test.go
  • x/slashing/sonar-project.properties
  • x/slashing/testutil/app_config.go
  • x/slashing/testutil/params.go
  • x/staking/testutil/app_config.go
Additional comments: 15
x/evidence/testutil/app_config.go (1)
  • 5-5: The import path for the slashing module has been updated from github.com/cosmos/cosmos-sdk/x/slashing to cosmossdk.io/x/slashing. Ensure that the new path is correct and the module is accessible at this location. Also, verify that all references to the slashing module in the codebase have been updated to use the new import path.
proto/cosmos/slashing/v1beta1/tx.proto (1)
  • 4-4: The go_package option has been updated to reflect the new import path for the slashing module. Ensure that the new path cosmossdk.io/x/slashing/types is correct and accessible.
x/slashing/keeper/migrations.go (1)
  • 4-4: The import path for the v4 package has been updated to reflect the new location of the slashing module. Ensure that the new import path cosmossdk.io/x/slashing/migrations/v4 is correct and the package is accessible at this location.
x/slashing/abci_test.go (1)
  • 13-15: The import paths for the slashing module, its keeper, and test utilities have been updated to reflect the new location of the slashing module. Ensure that the new paths are correct and that the module, keeper, and test utilities are accessible at these locations.
x/slashing/migrations/v4/migrate.go (1)
  • 10-10: The import path for the slashing module's types has been updated from github.com/cosmos/cosmos-sdk/x/slashing/types to cosmossdk.io/x/slashing/types. Ensure that this new path is correct and accessible. Also, verify that all references to types from the slashing module in this file have been updated to use this new import path.
tests/integration/slashing/keeper/keeper_test.go (2)
  • 14-17: The import paths for the slashing module, its keeper, test utilities, and types have been updated to reflect the new location of the module. Ensure that the new paths are correct and that the module, keeper, test utilities, and types are available at these locations.

  • 30-35: The import paths for the staking module, its keeper, and test utilities have not been updated. If the staking module has also been moved to a new location, these import paths should be updated to reflect the new location.

tests/integration/rapidgen/rapidgen.go (2)
  • 38-38: The import path for the slashingtypes has been updated from github.com/cosmos/cosmos-sdk/x/slashing/types to cosmossdk.io/x/slashing/types. Ensure that the new path is correct and the package is available at this location.

  • 45-49: The import path for slashingtypes has been removed from this section. This change is consistent with the update in the previous hunk.

simapp/app_test.go (2)
  • 24-24: The import path for the slashing module has been updated from github.com/cosmos/cosmos-sdk/x/slashing to cosmossdk.io/x/slashing. Ensure that the new import path is correct and the module is accessible at this location.

  • 40-44: The old import path for the slashing module (github.com/cosmos/cosmos-sdk/x/slashing) has been removed. This change is consistent with the update to the new import path (cosmossdk.io/x/slashing) in line 24.

simapp/app_v2.go (2)
  • 24-24: The import path for the slashingkeeper has been updated to reflect the new location of the slashing module. Ensure that the new module at cosmossdk.io/x/slashing/keeper is functionally equivalent to the old one at github.com/cosmos/cosmos-sdk/x/slashing/keeper. Also, verify that the new module is available and accessible at the specified location.

  • 44-48: The import path for the slashingkeeper has been removed from this section. This change is consistent with the addition of the new import path for the slashingkeeper in line 24.

simapp/app_config.go (2)
  • 49-50: The import path for the slashing module has been updated to reflect its new location. Ensure that the new path cosmossdk.io/x/slashing is correct and accessible. Also, verify that all references to the slashing module in the codebase have been updated to use this new import path.

  • 69-74: The import statement for the slashing module has been removed from this section. This change is consistent with the update in lines 49-50 where the slashing module is now being imported from its new location.

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 13edc04 and 33e6077.
Files selected for processing (1)
  • contrib/images/simd-env/Dockerfile (1 hunks)
Additional comments: 1
contrib/images/simd-env/Dockerfile (1)
  • 19-19: The new hunk adds the go.mod and go.sum files of the x/slashing module to the Docker image. This is in line with the changes described in the PR summary and is necessary for the go mod download command to download the dependencies of the x/slashing module. Ensure that the x/slashing module's dependencies do not conflict with the dependencies of other modules.

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 33e6077 and 67b7948.
Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • x/slashing/simulation/operations_test.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • x/slashing/simulation/operations_test.go
Additional comments: 1
CHANGELOG.md (1)
  • 178-179: The changes in the CHANGELOG.md accurately reflect the updates made in the PR, specifically the relocation of the slashing module to its own go.mod file. This is a good practice as it helps keep track of significant changes and provides a useful reference for users and developers.

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 67b7948 and 0f260f2.
Files selected for processing (27)
  • x/slashing/abci.go (1 hunks)
  • x/slashing/abci_test.go (1 hunks)
  • x/slashing/app_test.go (2 hunks)
  • x/slashing/keeper/genesis.go (1 hunks)
  • x/slashing/keeper/genesis_test.go (1 hunks)
  • x/slashing/keeper/grpc_query.go (1 hunks)
  • x/slashing/keeper/grpc_query_test.go (1 hunks)
  • x/slashing/keeper/hooks.go (1 hunks)
  • x/slashing/keeper/infractions.go (1 hunks)
  • x/slashing/keeper/keeper.go (1 hunks)
  • x/slashing/keeper/migrations.go (1 hunks)
  • x/slashing/keeper/msg_server.go (1 hunks)
  • x/slashing/keeper/msg_server_test.go (1 hunks)
  • x/slashing/keeper/signing_info.go (1 hunks)
  • x/slashing/keeper/signing_info_test.go (1 hunks)
  • x/slashing/keeper/unjail.go (1 hunks)
  • x/slashing/migrations/v4/migrate.go (1 hunks)
  • x/slashing/migrations/v4/migrate_test.go (1 hunks)
  • x/slashing/simulation/decoder.go (1 hunks)
  • x/slashing/simulation/decoder_test.go (1 hunks)
  • x/slashing/simulation/genesis.go (1 hunks)
  • x/slashing/simulation/genesis_test.go (1 hunks)
  • x/slashing/simulation/operations.go (2 hunks)
  • x/slashing/simulation/operations_test.go (2 hunks)
  • x/slashing/simulation/proposals.go (1 hunks)
  • x/slashing/simulation/proposals_test.go (1 hunks)
  • x/slashing/testutil/app_config.go (2 hunks)
Files skipped from review due to trivial changes (24)
  • x/slashing/abci.go
  • x/slashing/app_test.go
  • x/slashing/keeper/genesis.go
  • x/slashing/keeper/genesis_test.go
  • x/slashing/keeper/grpc_query.go
  • x/slashing/keeper/grpc_query_test.go
  • x/slashing/keeper/hooks.go
  • x/slashing/keeper/infractions.go
  • x/slashing/keeper/keeper.go
  • x/slashing/keeper/msg_server.go
  • x/slashing/keeper/msg_server_test.go
  • x/slashing/keeper/signing_info.go
  • x/slashing/keeper/signing_info_test.go
  • x/slashing/keeper/unjail.go
  • x/slashing/migrations/v4/migrate.go
  • x/slashing/migrations/v4/migrate_test.go
  • x/slashing/simulation/decoder_test.go
  • x/slashing/simulation/genesis.go
  • x/slashing/simulation/genesis_test.go
  • x/slashing/simulation/operations.go
  • x/slashing/simulation/operations_test.go
  • x/slashing/simulation/proposals.go
  • x/slashing/simulation/proposals_test.go
  • x/slashing/testutil/app_config.go
Additional comments: 3
x/slashing/simulation/decoder.go (1)
  • 7-7: The import path for the slashing module has been updated from github.com/cosmos/cosmos-sdk/x/slashing/types to cosmossdk.io/x/slashing/types. Ensure that the new path is correct and accessible.
x/slashing/abci_test.go (1)
  • 12-14: The import paths for the slashing, slashing/keeper, and slashing/testutil packages have been updated to reflect the new location of the slashing module. Ensure that the new paths are correct and that the module is properly set up at the new location. Also, verify that all other parts of the codebase that depend on these packages have been updated with the new import paths.
x/slashing/keeper/migrations.go (1)
  • 4-4: The import path for the v4 package has been updated to reflect the new location of the slashing module. Ensure that the new path cosmossdk.io/x/slashing/migrations/v4 is correct and the package is accessible at this location.

@@ -0,0 +1,14 @@
sonar.projectKey=cosmos-sdk-x-slashing
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@facundomedica facundomedica left a comment

Choose a reason for hiding this comment

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

LGTM, CI is complaining about Sonar not being configured as Julien pointed out

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0f260f2 and a3e004e.
Files ignored due to filter (1)
  • client/v2/go.mod
Files selected for processing (1)
  • UPGRADING.md (1 hunks)
Files skipped from review due to trivial changes (1)
  • UPGRADING.md

@sonarcloud
Copy link

sonarcloud bot commented Oct 25, 2023

[Cosmos SDK - x/slashing] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@tac0turtle tac0turtle added this pull request to the merge queue Oct 25, 2023
Merged via the queue into main with commit 86eaeed Oct 25, 2023
67 of 69 checks passed
@tac0turtle tac0turtle deleted the marko/spinout_slashing branch October 25, 2023 15:32
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.

5 participants