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(core): add migrations registering #19370

Merged
merged 14 commits into from
Feb 9, 2024
Merged

feat(core): add migrations registering #19370

merged 14 commits into from
Feb 9, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Feb 7, 2024

Description

Ref: #19330

On main we just need to create an interface and migrate the modules migrations functions to use context directly and environement.

On the server_modular branch, once synced with main, we should implement the MigrationRegistrar in runtime/v2 own module manager, which should takes this feedback into account: #15120

Group cannot be migrated just yet: #19382


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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a mechanism to register in-place store migrations for modules, enhancing the system's adaptability to changes over time.
    • Added new methods across various modules to support the migration process, ensuring seamless updates and compatibility.
  • Documentation

    • Updated the documentation to include guidance on the new migration process, aiding developers in implementing necessary changes.
  • Refactor

    • Refined interface structures and method signatures to better align with module functionalities and migration requirements.
    • Shifted context handling approach from sdk.Context to standard Go's context.Context, standardizing the way context is managed across the system.
  • Tests

    • Enhanced testing for migrations, incorporating new logging capabilities to facilitate debugging and verification of migration logic.

Copy link
Contributor

coderabbitai bot commented Feb 7, 2024

Walkthrough

Walkthrough

The recent updates across various components introduce a consistent shift towards utilizing context.Context over sdk.Context for better context handling, and a significant emphasis on migration functionalities. Interfaces have been refined, with new methods for registering migrations and services, aligning with grpc standards. These changes streamline module interactions, enhance migration processes for store versions, and improve service registration, reflecting a broader move towards modernizing and standardizing the framework's architecture.

Changes

Files Change Summary
core/appmodule/migrations.go
core/appmodule/module.go
types/module/configurator.go
types/module/core_module.go
types/module/module.go
x/*/module.go
Introduced or updated migration registration functionalities, shifting context handling from sdk.Context to context.Context, and aligning service registration with grpc.
docs/build/building-modules/13-upgrade.md Added explanation regarding migration process updates.
runtime/services/autocli.go Added a new Register method for command-line interface configuration.
x/auth/keeper/migrations.go
x/authz/keeper/migrations.go
x/bank/keeper/migrations.go
.../x/*/keeper/migrations.go
x/*/migrations/v*/store.go
x/*/migrations/v*/migrate*.go
Updated context handling from sdk.Context to context.Context in migration functions and adjusted import statements accordingly.
x/staking/migrations/v5/migrations_test.go Enhanced testing by incorporating log.NewTestLogger and updating function calls to include a logger parameter.

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@julienrbrt julienrbrt marked this pull request as ready for review February 7, 2024 23:58
@julienrbrt julienrbrt requested a review from a team as a code owner February 7, 2024 23:58

This comment has been minimized.

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

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between cd1da8d and d973b87.
Files selected for processing (41)
  • core/appmodule/migrations.go (1 hunks)
  • core/appmodule/module.go (2 hunks)
  • docs/build/building-modules/13-upgrade.md (1 hunks)
  • runtime/services/autocli.go (1 hunks)
  • types/module/configurator.go (4 hunks)
  • types/module/core_module.go (1 hunks)
  • types/module/module.go (1 hunks)
  • x/auth/keeper/migrations.go (2 hunks)
  • x/auth/module.go (3 hunks)
  • x/authz/keeper/migrations.go (2 hunks)
  • x/authz/module/module.go (3 hunks)
  • x/bank/keeper/migrations.go (2 hunks)
  • x/bank/module.go (3 hunks)
  • x/circuit/module.go (3 hunks)
  • x/crisis/keeper/migrator.go (2 hunks)
  • x/crisis/module.go (3 hunks)
  • x/distribution/keeper/migrations.go (2 hunks)
  • x/distribution/migrations/v4/migrate.go (1 hunks)
  • x/distribution/migrations/v4/migrate_funds.go (2 hunks)
  • x/distribution/module.go (3 hunks)
  • x/feegrant/keeper/migrations.go (2 hunks)
  • x/feegrant/module/module.go (3 hunks)
  • x/gov/keeper/migrations.go (2 hunks)
  • x/gov/migrations/v5/store.go (2 hunks)
  • x/gov/migrations/v6/store.go (1 hunks)
  • x/gov/module.go (3 hunks)
  • x/group/keeper/migrations.go (1 hunks)
  • x/group/module/module.go (4 hunks)
  • x/mint/keeper/migrator.go (2 hunks)
  • x/mint/module.go (3 hunks)
  • x/params/module.go (3 hunks)
  • x/protocolpool/module.go (3 hunks)
  • x/slashing/keeper/migrations.go (2 hunks)
  • x/slashing/migrations/v4/migrate.go (7 hunks)
  • x/slashing/module.go (3 hunks)
  • x/staking/keeper/migrations.go (2 hunks)
  • x/staking/migrations/v5/migrations_test.go (5 hunks)
  • x/staking/migrations/v5/store.go (3 hunks)
  • x/staking/module.go (3 hunks)
  • x/upgrade/keeper/migrations.go (4 hunks)
  • x/upgrade/module.go (3 hunks)
Files skipped from review due to trivial changes (1)
  • x/group/keeper/migrations.go
Additional comments: 38
runtime/services/autocli.go (1)
  • 116-116: Looks good as a placeholder. Ensure future implementations are added as needed.
x/staking/migrations/v5/migrations_test.go (5)
  • 13-13: Adding logging to tests is a good practice for improved diagnostics.
  • 32-32: Proper use of log.NewTestLogger(t) for enhanced test output.
  • 68-68: Correctly passing logger to MigrateStore for logging within migration tests.
  • 88-88: Appropriate addition of logger for logging in migration tests.
  • 104-104: Properly using logger in MigrateStore call within test.
x/slashing/migrations/v4/migrate.go (7)
  • 4-4: Correctly updating imports to include context.
  • 20-20: Properly updating function signature to use context.Context.
  • 62-62: Appropriate update to function signature for context.Context.
  • 82-82: Correctly updating function signature to use context.Context.
  • 104-104: Properly updating function signature to use context.Context.
  • 119-119: Appropriate update to function signature for context.Context.
  • 128-128: Correctly updating function signature to use context.Context.
x/upgrade/module.go (4)
  • 10-10: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 37-38: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 89-94: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 96-106: Appropriately adding RegisterMigrations method for handling module migrations.
x/crisis/module.go (4)
  • 11-11: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 33-34: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 114-118: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 120-127: Appropriately adding RegisterMigrations method for handling module migrations.
x/feegrant/module/module.go (4)
  • 10-10: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 31-32: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 49-55: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 57-64: Appropriately adding RegisterMigrations method for handling module migrations.
types/module/core_module.go (1)
  • 204-209: Correctly adding conditional migration registration for modules implementing HasMigrations.
x/authz/module/module.go (4)
  • 10-10: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 33-34: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 47-53: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 55-61: Appropriately adding RegisterMigrations method for handling module migrations.
x/group/module/module.go (4)
  • 10-10: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 38-39: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 129-135: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 137-143: Commented out RegisterMigrations method indicates a placeholder for future migration logic. Ensure implementation is added as needed.
x/staking/module.go (4)
  • 11-11: Correctly adding google.golang.org/grpc import for GRPC service registration.
  • 40-41: Properly implementing appmodule.HasServices and appmodule.HasMigrations interfaces.
  • 125-130: Correctly refactoring RegisterServices to use grpc.ServiceRegistrar and adding error handling.
  • 132-147: Appropriately adding RegisterMigrations method for handling module migrations.

types/module/module.go Show resolved Hide resolved
@@ -1,9 +1,9 @@
package keeper

import (
v2 "cosmossdk.io/x/authz/migrations/v2"
"context"
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing import documentation.

+ // Package keeper provides functionality to manage and store authz grants.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"context"
// Package keeper provides functionality to manage and store authz grants.
"context"

@@ -17,6 +17,6 @@
}

// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
func (m Migrator) Migrate1to2(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect context usage for Migrate1to2. Ensure sdk.Context is used for compatibility with the SDK's context management.

- func (m Migrator) Migrate1to2(ctx context.Context) error {
+ func (m Migrator) Migrate1to2(ctx sdk.Context) error {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
func (m Migrator) Migrate1to2(ctx context.Context) error {
func (m Migrator) Migrate1to2(ctx sdk.Context) error {

@@ -1,9 +1,9 @@
package keeper

import (
v2 "cosmossdk.io/x/feegrant/migrations/v2"
"context"
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing import documentation.

+ // Package keeper provides functionality to manage and store feegrant grants.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"context"
// Package keeper provides functionality to manage and store feegrant grants.
"context"

@@ -17,6 +17,6 @@
}

// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
func (m Migrator) Migrate1to2(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect context usage for Migrate1to2. Use sdk.Context for SDK compatibility.

- func (m Migrator) Migrate1to2(ctx context.Context) error {
+ func (m Migrator) Migrate1to2(ctx sdk.Context) error {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
func (m Migrator) Migrate1to2(ctx context.Context) error {
func (m Migrator) Migrate1to2(ctx sdk.Context) error {

@@ -15,16 +13,16 @@
}

// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
func (m Migrator) Migrate1to2(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect context usage for Migrate1to2. Use sdk.Context for SDK compatibility.

- func (m Migrator) Migrate1to2(ctx context.Context) error {
+ func (m Migrator) Migrate1to2(ctx sdk.Context) error {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
func (m Migrator) Migrate1to2(ctx context.Context) error {
func (m Migrator) Migrate1to2(ctx sdk.Context) error {

return nil
}

// Migrate2to3 migrates x/bank storage from version 2 to 3.
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
func (m Migrator) Migrate2to3(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect context usage for Migrate2to3. Use sdk.Context for SDK compatibility.

- func (m Migrator) Migrate2to3(ctx context.Context) error {
+ func (m Migrator) Migrate2to3(ctx sdk.Context) error {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
func (m Migrator) Migrate2to3(ctx context.Context) error {
func (m Migrator) Migrate2to3(ctx sdk.Context) error {

return nil
}

// Migrate3to4 migrates x/bank storage from version 3 to 4.
func (m Migrator) Migrate3to4(ctx sdk.Context) error {
func (m Migrator) Migrate3to4(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect context usage for Migrate3to4. Use sdk.Context for SDK compatibility.

- func (m Migrator) Migrate3to4(ctx context.Context) error {
+ func (m Migrator) Migrate3to4(ctx sdk.Context) error {

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
func (m Migrator) Migrate3to4(ctx context.Context) error {
func (m Migrator) Migrate3to4(ctx sdk.Context) error {

@@ -0,0 +1,16 @@
package appmodule
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing package documentation.

+ // Package appmodule provides interfaces and structures for managing application modules.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
package appmodule
// Package appmodule provides interfaces and structures for managing application modules.
package appmodule

Comment on lines +5 to +15
type MigrationRegistrar interface {
// Register registers an in-place store migration for a module. The
// handler is a migration script to perform in-place migrations from version
// `fromVersion` to version `fromVersion+1`.
//
// EACH TIME a module's ConsensusVersion increments, a new migration MUST
// be registered using this function. If a migration handler is missing for
// a particular function, the upgrade logic (see RunMigrations function)
// will panic. If the ConsensusVersion bump does not introduce any store
// changes, then a no-op function must be registered here.
Register(moduleName string, fromVersion uint64, handler func(context.Context) error) error
Copy link
Contributor

Choose a reason for hiding this comment

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

The MigrationRegistrar interface documentation should clarify the expected behavior when fromVersion is not sequential.

+ // It is the caller's responsibility to ensure migrations are registered in a sequential manner without gaps.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
type MigrationRegistrar interface {
// Register registers an in-place store migration for a module. The
// handler is a migration script to perform in-place migrations from version
// `fromVersion` to version `fromVersion+1`.
//
// EACH TIME a module's ConsensusVersion increments, a new migration MUST
// be registered using this function. If a migration handler is missing for
// a particular function, the upgrade logic (see RunMigrations function)
// will panic. If the ConsensusVersion bump does not introduce any store
// changes, then a no-op function must be registered here.
Register(moduleName string, fromVersion uint64, handler func(context.Context) error) error
type MigrationRegistrar interface {
// Register registers an in-place store migration for a module. The
// handler is a migration script to perform in-place migrations from version
// `fromVersion` to version `fromVersion+1`.
//
// EACH TIME a module's ConsensusVersion increments, a new migration MUST
// be registered using this function. If a migration handler is missing for
// a particular function, the upgrade logic (see RunMigrations function)
// will panic. If the ConsensusVersion bump does not introduce any store
// changes, then a no-op function must be registered here.
// It is the caller's responsibility to ensure migrations are registered in a sequential manner without gaps.
Register(moduleName string, fromVersion uint64, handler func(context.Context) error) error

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

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between d973b87 and ac089cd.
Files selected for processing (4)
  • CHANGELOG.md (2 hunks)
  • UPGRADING.md (2 hunks)
  • core/CHANGELOG.md (1 hunks)
  • x/group/module/module.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/group/module/module.go
Additional comments: 8
core/CHANGELOG.md (1)
  • 41-49: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

Ensure the "Unreleased" section follows the guiding principles mentioned at the beginning of the file, especially regarding the grouping of the same types of changes and displaying the release date once the version is released.

UPGRADING.md (7)
  • 15-16: The merging of GasConsumptionDecorator and IncreaseSequenceDecorator into SigVerificationDecorator simplifies the AnteHandler setup. Ensure that the merged functionality is thoroughly tested to prevent any unintended side effects on transaction processing.
  • 20-23: The refactoring of the client package to use address codecs is a significant change. Verify that all instances where address codecs are required have been updated to include them in the client.Context. This is crucial for maintaining compatibility with the new address handling approach.
  • 38-38: The introduction of the appmodule.Environment interface is a notable enhancement for fetching services. Ensure that all modules that require access to services are updated to use this interface, and verify that the transition from sdk.UnwrapContext(ctx) is seamless and well-documented.
  • 46-46: Support for unordered transactions introduces a significant change in transaction processing. It's important to ensure that the implementation is compatible with existing transaction handling mechanisms and that the potential for transactions to be executed in any order is clearly communicated to developers and users.
  • 127-127: The removal of old module migrations and the requirement to migrate to v0.50 before upgrading to v0.51 could potentially impact developers who have not completed the necessary migrations. It's crucial to provide clear guidance and support for this migration process to ensure a smooth transition.
  • 131-131: The introduction of the Core API in v0.47 is a significant enhancement for module development. Ensure that the documentation and examples provided are sufficient for developers to effectively utilize the new interfaces and that the transition from sdk.Context is well-supported.
  • 133-133: The migration of dependency injection functions to cosmossdk.io/depinject/appconfig requires attention to ensure that all modules using dependency injection are updated accordingly. Verify that the migration is straightforward and well-documented to minimize disruption for developers.

CHANGELOG.md Outdated
Comment on lines 143 to 147
### Deprecated

* (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.

Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in "Depcreate". It should be "Deprecate".

- Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.
+ Deprecate `module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### Deprecated
* (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.
### Deprecated
* (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Deprecate `module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API.

@@ -41,8 +41,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#18379](https://github.com/cosmos/cosmos-sdk/pull/18379) Add branch service.
* [#18457](https://github.com/cosmos/cosmos-sdk/pull/18457) Add branch.ExecuteWithGasLimit.
* [#19041](https://github.com/cosmos/cosmos-sdk/pull/19041) Add `appmodule.Environment` interface to fetch different services
* [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Add `appmodule.Migrations` interface to handle migrations
Copy link
Contributor

Choose a reason for hiding this comment

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

The entry for PR #19370 lacks a brief description of what the appmodule.Migrations interface does or its impact. Consider adding a concise explanation to provide more context to the reader.


### API Breaking
### API Breaking Changes
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL in the entry for PR #18861 has a typo: httpes should be https.

- * [#18861](httpes://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.
+ * [#18861](https://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
### API Breaking Changes
### API Breaking Changes
* [#18861](https://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.

The entry for PR #19041 under "API Breaking Changes" is duplicated. It's already mentioned under "Features". Consider removing the duplicate or clarifying if there are distinct aspects of the PR that belong to both categories.

CHANGELOG.md Outdated
### Deprecated

* (simapp) [#19146](https://github.com/cosmos/cosmos-sdk/pull/19146) Replace `--v` CLI option with `--validator-count`/`-n`.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in "HasServicecs". It should be "HasServices".

- use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.
+ use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServicecs` instead from Core API.
* (module) [#19370](https://github.com/cosmos/cosmos-sdk/pull/19370) Depcreate ` module.Configurator`, use `appmodule.HasMigrations` and `appmodule.HasServices` instead from Core API.

Comment on lines +25 to +30
```diff
clientCtx = clientCtx.
+ WithAddressCodec(addressCodec).
+ WithValidatorAddressCodec(validatorAddressCodec).
+ WithConsensusAddressCodec(consensusAddressCodec)
```
Copy link
Contributor

Choose a reason for hiding this comment

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

The code snippet provided for updating the client.Context with address codecs is helpful. However, ensure that the snippet is placed in the correct context within the documentation and that it's clear to developers where and how to implement these changes in their applications.

+ Ensure this snippet is accompanied by a clear explanation of where to implement these changes in the application code.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
```diff
clientCtx = clientCtx.
+ WithAddressCodec(addressCodec).
+ WithValidatorAddressCodec(validatorAddressCodec).
+ WithConsensusAddressCodec(consensusAddressCodec)
```
clientCtx = clientCtx.
WithAddressCodec(addressCodec).
WithValidatorAddressCodec(validatorAddressCodec).
WithConsensusAddressCodec(consensusAddressCodec)

Comment on lines +42 to +44
```go
app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment((keys[circuittypes.StoreKey]), nil), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AuthKeeper.AddressCodec())
```
Copy link
Contributor

Choose a reason for hiding this comment

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

The example provided for using the appmodule.Environment interface with the CircuitKeeper is valuable. Recommend adding more examples or a detailed explanation to help developers understand how to implement this interface across different modules and services.

+ Consider adding additional examples or a more detailed guide on implementing the `appmodule.Environment` interface across various modules.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
```go
app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment((keys[circuittypes.StoreKey]), nil), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AuthKeeper.AddressCodec())
```
```go
app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment((keys[circuittypes.StoreKey]), nil), appCodec, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AuthKeeper.AddressCodec())

</details>
<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->


### Modules
##### Core API
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify the requirement for migrating to v0.50 before upgrading to v0.51 to ensure developers understand the importance of completing module migrations in the correct order. Providing additional resources or guidance on this process could be beneficial.

+ Add more detailed instructions or resources to assist developers with the migration process from v0.50 to v0.51.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
##### Core API
##### Core API
Add more detailed instructions or resources to assist developers with the migration process from v0.50 to v0.51.


##### Dependency Injection
##### Dependency Injection
Copy link
Contributor

Choose a reason for hiding this comment

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

Highlight the significance of updating imports for dependency injection functions and ensure that developers are aware of the changes to cosmossdk.io/depinject/appconfig. Providing examples of updated imports could help clarify the required changes.

+ Include examples of updated imports for dependency injection functions to guide developers through the migration process.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
##### Dependency Injection
##### Dependency Injection
Include examples of updated imports for dependency injection functions to guide developers through the migration process.

Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
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.yml

Commits Files that changed from the base of the PR and between ac089cd and 394a1e7.
Files selected for processing (2)
  • CHANGELOG.md (2 hunks)
  • types/module/configurator.go (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • CHANGELOG.md
  • types/module/configurator.go

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.

Nice changes

types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.accountKeeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.accountKeeper))
// RegisterServices registers module services.
func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting we could drop grpc here with an interface. Out of scope for this pr

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

Commits Files that changed from the base of the PR and between 394a1e7 and e3b7e1b.
Files selected for processing (1)
  • core/appmodule/module.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • core/appmodule/module.go

@tac0turtle tac0turtle added this pull request to the merge queue Feb 9, 2024
Merged via the queue into main with commit e15a0de Feb 9, 2024
76 of 78 checks passed
@tac0turtle tac0turtle deleted the julien/migrations branch February 9, 2024 09:32
@coderabbitai coderabbitai bot mentioned this pull request May 3, 2024
12 tasks
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