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: remove dependency x/module -> sdk in InterfaceRegistry #19641

Closed
wants to merge 9 commits into from

Conversation

kocubinski
Copy link
Member

@kocubinski kocubinski commented Mar 4, 2024

High level Goal: Remove dependency of x/module -> SDK.
This PR's goal: Remove dependency on SDK/types/codec through interface registry.
Methodology: Interact with InterfaceRegistry through a thinner interface defined in core.
Status: Ready for review, building, a couple test failures I think related to mock generation.

Questions:

  • I edited the generated mock types to depend on core/registry/LegacyRegistry manually, a mock gen script somewhere should be modified to generate an implementation of the core type, is that right?
  • Modules still depend on SDK through adjacent usages; 1) RegisterImplementations takes sdk.Msg as a first parameter, but this can probably just be gogoproto.Message, and 2) RegisterLegacyAminoCodec, which I think is obviated by Amino codec now in x/tx.

I can explore questions 1) and 2) a bit here or in a separate PR.


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

  • New Features

    • Introduced a LegacyRegistry interface to improve registration of interfaces and their implementations, enhancing the system's compatibility and flexibility.
  • Refactor

    • Updated various modules and types across the system to utilize the new LegacyRegistry interface, streamlining interface registration processes.
    • Removed unnecessary imports and updated import paths to align with the new registry system.
  • Chores

    • Updated dependencies in go.mod and go.sum files, ensuring the latest versions for improved security and performance.
  • Bug Fixes

    • Removed an unnecessary empty line within a function to maintain code cleanliness and consistency.

Copy link
Contributor

coderabbitai bot commented Mar 4, 2024

Important

Auto Review Skipped

Auto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The overarching change involves transitioning from using codectypes.InterfaceRegistry to a new registry.LegacyRegistry interface across various modules and components. This shift entails updates to import paths, function signatures, and parameter types to accommodate the new registry interface. The modifications are part of an effort to streamline interface registration using gogoproto messages, enhancing compatibility and simplifying the codebase.

Changes

Files Change Summary
core/registry/legacy.go Introduced LegacyRegistry interface
runtime/v2/builder.go Removed an empty line in RegisterModules
runtime/v2/manager.go, simapp/v2/go.mod, simapp/v2/go.sum, testutil/mock/..., types/..., x/... (multiple files across modules) Replaced codectypes.InterfaceRegistry with registry.LegacyRegistry and updated import paths from github.com/cosmos/cosmos-sdk/codec/types to cosmossdk.io/core/registry. Adjusted function signatures to use registry.LegacyRegistry. Updated package versions in go.mod and go.sum.

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

@kocubinski kocubinski marked this pull request as ready for review March 4, 2024 18:16
@kocubinski kocubinski requested a review from a team as a code owner March 4, 2024 18:16
@kocubinski
Copy link
Member Author

@coderabbitai review

@@ -86,7 +86,7 @@ type HasAminoCodec interface {

// HasRegisterInterfaces is the interface for modules to register their msg types.
type HasRegisterInterfaces interface {
Copy link
Member

Choose a reason for hiding this comment

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

Can you move that to core/appmodule/v2 and alias it in core/appmodule?

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 710df04 and aeb018d.
Files selected for processing (53)
  • core/registry/legacy.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/manager.go (3 hunks)
  • simapp/v2/go.mod (2 hunks)
  • simapp/v2/go.sum (2 hunks)
  • testutil/mock/types_mock_appmodule.go (3 hunks)
  • testutil/mock/types_module_module.go (5 hunks)
  • types/module/core_module.go (3 hunks)
  • types/module/module.go (4 hunks)
  • types/msgservice/msg_service.go (1 hunks)
  • x/accounts/module.go (3 hunks)
  • x/auth/module.go (3 hunks)
  • x/auth/types/codec.go (2 hunks)
  • x/auth/vesting/module.go (2 hunks)
  • x/auth/vesting/types/codec.go (2 hunks)
  • x/authz/codec.go (2 hunks)
  • x/authz/module/module.go (2 hunks)
  • x/bank/module.go (3 hunks)
  • x/bank/types/codec.go (2 hunks)
  • x/circuit/module.go (3 hunks)
  • x/circuit/types/codec.go (1 hunks)
  • x/consensus/module.go (2 hunks)
  • x/consensus/types/codec.go (1 hunks)
  • x/counter/module.go (2 hunks)
  • x/counter/types/codec.go (1 hunks)
  • x/crisis/module.go (2 hunks)
  • x/crisis/types/codec.go (2 hunks)
  • x/distribution/module.go (3 hunks)
  • x/distribution/types/codec.go (2 hunks)
  • x/evidence/module.go (3 hunks)
  • x/evidence/types/codec.go (2 hunks)
  • x/feegrant/codec.go (2 hunks)
  • x/feegrant/module/module.go (2 hunks)
  • x/genutil/module.go (2 hunks)
  • x/gov/module.go (3 hunks)
  • x/gov/types/v1/codec.go (2 hunks)
  • x/gov/types/v1beta1/codec.go (2 hunks)
  • x/group/codec.go (2 hunks)
  • x/group/module/module.go (2 hunks)
  • x/mint/module.go (3 hunks)
  • x/mint/types/codec.go (2 hunks)
  • x/nft/codec.go (1 hunks)
  • x/nft/module/module.go (2 hunks)
  • x/params/module.go (3 hunks)
  • x/params/types/proposal/codec.go (1 hunks)
  • x/protocolpool/module.go (3 hunks)
  • x/protocolpool/types/codec.go (1 hunks)
  • x/slashing/module.go (2 hunks)
  • x/slashing/types/codec.go (2 hunks)
  • x/staking/module.go (3 hunks)
  • x/staking/types/codec.go (2 hunks)
  • x/upgrade/module.go (3 hunks)
  • x/upgrade/types/codec.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • runtime/v2/builder.go
Additional comments: 108
x/counter/types/codec.go (2)
  • 4-5: The import path has been updated to use cosmossdk.io/core/registry instead of the previous SDK/types/codec. This change aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface.
  • 10-10: The RegisterInterfaces function now accepts a registry.LegacyRegistry type instead of types.InterfaceRegistry. This modification is crucial for achieving the PR's goal of reducing direct dependencies on the Cosmos SDK. Ensure that all implementations of sdk.Msg that are registered here are compatible with the new LegacyRegistry interface.
x/nft/codec.go (2)
  • 4-5: The import path update to cosmossdk.io/core/registry is consistent with the PR's objective to streamline interactions with the InterfaceRegistry by using the LegacyRegistry interface. This change is appropriate and aligns with the overall goal of the PR.
  • 11-11: Changing the parameter type in the RegisterInterfaces function to registry.LegacyRegistry is a key step towards decoupling the NFT module from direct SDK dependencies. It's important to verify that all registered implementations are fully compatible with the new interface.
core/registry/legacy.go (1)
  • 1-14: The introduction of the LegacyRegistry interface in core/registry/legacy.go is a significant addition that supports the PR's goal of decoupling modules from direct SDK dependencies. The methods RegisterInterface and RegisterImplementations are well-defined, allowing for the registration of interfaces and their implementations using gogoproto.Message. This design promotes modularity and flexibility in the Cosmos SDK architecture.
x/circuit/types/codec.go (2)
  • 4-5: Updating the import path to cosmossdk.io/core/registry is consistent with the PR's objective of reducing direct dependencies on the Cosmos SDK. This change facilitates the use of the LegacyRegistry interface, which is central to the PR's goals.
  • 11-11: The modification of the RegisterInterfaces function to use registry.LegacyRegistry is a crucial step in decoupling the circuit module from the SDK. It's important to ensure that all registered implementations are compatible with the new interface.
x/protocolpool/types/codec.go (2)
  • 4-5: The change in the import path to cosmossdk.io/core/registry aligns with the PR's goal of simplifying and decoupling modules from direct SDK dependencies. This is a positive step towards a more modular architecture.
  • 10-10: Modifying the RegisterInterfaces function to accept registry.LegacyRegistry is consistent with the PR's objectives. It's crucial to verify the compatibility of all registered implementations with the new interface to ensure smooth integration.
x/params/types/proposal/codec.go (2)
  • 4-4: The update to the import path, introducing cosmossdk.io/core/registry, is in line with the PR's aim to streamline interactions with the InterfaceRegistry. This change supports the goal of enhancing modularity within the SDK.
  • 15-15: Changing the parameter type in the RegisterInterfaces function to registry.LegacyRegistry is a key step in reducing direct dependencies on the SDK. This change, particularly in the context of proposals, is crucial for ensuring that the module is compatible with the new interface.
x/consensus/types/codec.go (2)
  • 4-5: The update to the import path for cosmossdk.io/core/registry is consistent with the PR's objectives of decoupling modules from direct SDK dependencies. This change is crucial for the consensus module to utilize the LegacyRegistry interface.
  • 12-12: Modifying the RegisterInterfaces function to use registry.LegacyRegistry aligns with the PR's goal of simplifying module dependencies on the SDK. It's important to ensure that all registered implementations are fully compatible with the new interface.
x/mint/types/codec.go (2)
  • 4-5: The change in the import path to cosmossdk.io/core/registry is in line with the PR's objectives of reducing direct SDK dependencies. This modification is essential for the mint module to leverage the LegacyRegistry interface.
  • 19-19: The adjustment of the RegisterInterfaces function to accept registry.LegacyRegistry is a crucial step towards decoupling the mint module from the SDK. Verifying the compatibility of all registered implementations with the new interface is essential for ensuring seamless integration.
x/slashing/types/codec.go (2)
  • 4-5: Updating the import path to cosmossdk.io/core/registry aligns with the PR's goal of simplifying interactions with the InterfaceRegistry. This change is appropriate for the slashing module and supports the objective of enhancing modularity.
  • 20-20: Changing the parameter type in the RegisterInterfaces function to registry.LegacyRegistry is a key step in decoupling the slashing module from direct SDK dependencies. It's important to ensure that all registered implementations are compatible with the new interface.
x/crisis/types/codec.go (2)
  • 4-5: The update to the import path for cosmossdk.io/core/registry is consistent with the PR's objectives of reducing direct dependencies on the SDK. This change is crucial for the crisis module to utilize the LegacyRegistry interface effectively.
  • 20-20: Modifying the RegisterInterfaces function to use registry.LegacyRegistry aligns with the PR's goal of simplifying module dependencies on the SDK. It's important to verify the compatibility of all registered implementations with the new interface to ensure smooth integration.
x/evidence/types/codec.go (2)
  • 4-4: The import of "cosmossdk.io/core/registry" is correctly added to replace the previous dependency on types.InterfaceRegistry. This aligns with the PR's objective to decouple modules from direct SDK dependencies.
  • 22-22: The modification of the RegisterInterfaces function's parameter type from types.InterfaceRegistry to registry.LegacyRegistry is consistent with the PR's goal of simplifying and decoupling the modules from direct SDK dependencies. This change should ensure that the evidence module can register its interfaces and concrete types without relying directly on the Cosmos SDK's types package.
x/upgrade/types/codec.go (2)
  • 4-4: The addition of "cosmossdk.io/core/registry" to the imports is appropriate and supports the PR's objective of reducing direct dependencies on the Cosmos SDK. This change facilitates the use of a more streamlined interface for interface registration.
  • 22-22: Changing the parameter type of the RegisterInterfaces function to registry.LegacyRegistry is a positive step towards decoupling the upgrade module from the Cosmos SDK's types package. This change aligns with the PR's goals and should be beneficial for modularity.
x/bank/types/codec.go (2)
  • 4-4: The import of "cosmossdk.io/core/registry" is correctly added, which is essential for the transition to using registry.LegacyRegistry for interface registration. This change is in line with the PR's objective to minimize direct dependencies on the Cosmos SDK.
  • 24-24: Modifying the RegisterInterfaces function to accept registry.LegacyRegistry as its parameter type is a key step in decoupling the bank module from the Cosmos SDK's types package. This approach enhances modularity and aligns with the PR's goals.
x/gov/types/v1beta1/codec.go (2)
  • 4-4: Adding "cosmossdk.io/core/registry" to the imports supports the PR's goal of reducing the governance module's direct dependencies on the Cosmos SDK. This change is crucial for using the registry.LegacyRegistry for interface registration.
  • 24-24: The update to the RegisterInterfaces function's parameter type to registry.LegacyRegistry is consistent with the PR's objective of enhancing modularity by decoupling modules from the Cosmos SDK's types package. This change should facilitate a more flexible and modular approach to interface registration within the governance module.
x/auth/vesting/module.go (2)
  • 5-5: The inclusion of "cosmossdk.io/core/registry" in the imports is a necessary adjustment for utilizing the registry.LegacyRegistry in the vesting module. This change aligns with the PR's aim to minimize direct SDK dependencies, promoting a more modular architecture.
  • 48-48: Changing the RegisterInterfaces function to use registry.LegacyRegistry as its parameter type is a strategic move towards decoupling the vesting module from the Cosmos SDK's types package. This modification supports the PR's goals of enhancing modularity and reducing direct dependencies.
x/counter/module.go (2)
  • 4-4: The addition of "cosmossdk.io/core/registry" to the imports is appropriate for the counter module, facilitating the use of registry.LegacyRegistry for interface registration. This change is in line with the PR's objective to reduce direct dependencies on the Cosmos SDK, promoting a more modular design.
  • 50-50: Modifying the RegisterInterfaces function to accept registry.LegacyRegistry instead of codectypes.InterfaceRegistry is a positive step towards decoupling the counter module from the Cosmos SDK's types package. This change aligns with the PR's goals of enhancing modularity and simplifying dependencies.
x/distribution/types/codec.go (2)
  • 4-4: The inclusion of "cosmossdk.io/core/registry" in the imports is a necessary adjustment for the distribution module, enabling the use of registry.LegacyRegistry for interface registration. This change supports the PR's aim of reducing direct SDK dependencies and promoting a modular architecture.
  • 25-25: Changing the RegisterInterfaces function to use registry.LegacyRegistry as its parameter type is a strategic move towards decoupling the distribution module from the Cosmos SDK's types package. This modification aligns with the PR's goals of enhancing modularity and simplifying dependencies.
x/feegrant/codec.go (2)
  • 4-4: Adding "cosmossdk.io/core/registry" to the imports is appropriate for the feegrant module, facilitating the use of registry.LegacyRegistry for interface registration. This change aligns with the PR's objective to minimize direct dependencies on the Cosmos SDK, promoting a more modular design.
  • 25-25: Modifying the RegisterInterfaces function to accept registry.LegacyRegistry instead of codectypes.InterfaceRegistry is a positive step towards decoupling the feegrant module from the Cosmos SDK's types package. This change supports the PR's goals of enhancing modularity and simplifying dependencies.
x/gov/types/v1/codec.go (2)
  • 4-4: The inclusion of "cosmossdk.io/core/registry" in the imports is a necessary adjustment for the governance module, enabling the use of registry.LegacyRegistry for interface registration. This change supports the PR's aim of reducing direct SDK dependencies and promoting a modular architecture.
  • 27-27: Changing the RegisterInterfaces function to use registry.LegacyRegistry as its parameter type is a strategic move towards decoupling the governance module from the Cosmos SDK's types package. This modification aligns with the PR's goals of enhancing modularity and simplifying dependencies.
x/authz/codec.go (2)
  • 4-4: The addition of "cosmossdk.io/core/registry" to the imports is appropriate for the authz module, facilitating the use of registry.LegacyRegistry for interface registration. This change is in line with the PR's objective to reduce direct dependencies on the Cosmos SDK, promoting a more modular design.
  • 26-26: Modifying the RegisterInterfaces function to accept registry.LegacyRegistry instead of codectypes.InterfaceRegistry is a positive step towards decoupling the authz module from the Cosmos SDK's types package. This change supports the PR's goals of enhancing modularity and simplifying dependencies.
x/auth/types/codec.go (2)
  • 4-4: The import path change from "github.com/cosmos/cosmos-sdk/codec/types" to "cosmossdk.io/core/registry" aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface defined in core. This change is consistent with the goal of enhancing modularity within the SDK.
  • 31-31: The update of the RegisterInterfaces function signature to use registry.LegacyRegistry instead of types.InterfaceRegistry is a key part of the refactor aimed at reducing direct dependencies on the Cosmos SDK. This change is crucial for achieving the PR's objective of simplifying interactions with the InterfaceRegistry and promoting a more decoupled architecture. Ensure that all calls to RegisterInterfaces across the codebase are updated to reflect this new signature.
types/msgservice/msg_service.go (2)
  • 10-10: The import path change to "cosmossdk.io/core/registry" is consistent with the overarching goal of the PR to streamline interactions with the InterfaceRegistry by utilizing a more generalized interface. This modification supports the initiative to reduce direct SDK dependencies.
  • 24-24: Updating the RegisterMsgServiceDesc function signature to accept registry.LegacyRegistry instead of codectypes.InterfaceRegistry is in line with the PR's objective to decouple modules from the Cosmos SDK's direct dependencies. This change is essential for promoting a more modular architecture. Ensure compatibility and correct usage across all instances where this function is invoked.
x/staking/types/codec.go (2)
  • 4-4: The import path adjustment to "cosmossdk.io/core/registry" aligns with the PR's goal of reducing direct dependencies on the Cosmos SDK by utilizing a more generalized interface. This change supports the initiative to enhance modularity within the SDK.
  • 32-32: Modifying the RegisterInterfaces function to use registry.LegacyRegistry instead of types.InterfaceRegistry is a crucial step towards decoupling the x/staking module from direct SDK dependencies. This change is consistent with the PR's objective of simplifying interactions with the InterfaceRegistry and promoting a more decoupled architecture.
x/auth/vesting/types/codec.go (2)
  • 4-4: The addition of the import "cosmossdk.io/core/registry" and the removal of the direct dependency on the Cosmos SDK's codec/types is in line with the PR's objective to streamline module interactions with the InterfaceRegistry. This change enhances the modularity and decouples the x/auth/vesting module from the SDK.
  • 30-30: Changing the RegisterInterfaces function to accept registry.LegacyRegistry instead of types.InterfaceRegistry is a significant step towards achieving the PR's goal of reducing direct dependencies on the Cosmos SDK. This modification is crucial for promoting a more modular architecture within the SDK.
x/consensus/module.go (2)
  • 6-6: The import of "cosmossdk.io/core/registry" supports the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface. This change is consistent with the goal of enhancing modularity within the SDK.
  • 64-64: Updating the RegisterInterfaces function to use registry.LegacyRegistry instead of codectypes.InterfaceRegistry aligns with the PR's goal of simplifying interactions with the InterfaceRegistry. This change is essential for promoting a more decoupled and modular architecture within the SDK.
x/accounts/module.go (2)
  • 7-7: The import of "cosmossdk.io/core/registry" is in line with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more generalized interface. This change supports the initiative to enhance modularity within the SDK.
  • 55-55: Changing the RegisterInterfaces function to accept registry.LegacyRegistry instead of types.InterfaceRegistry is a crucial step towards decoupling the x/accounts module from direct SDK dependencies. This modification is consistent with the PR's goal of promoting a more modular architecture.
x/group/codec.go (2)
  • 4-4: The addition of the import "cosmossdk.io/core/registry" aligns with the PR's objective to streamline interactions with the InterfaceRegistry by utilizing a more generalized interface. This change supports the initiative to reduce direct SDK dependencies.
  • 37-37: Modifying the RegisterInterfaces function to use registry.LegacyRegistry instead of codectypes.InterfaceRegistry is a key part of the refactor aimed at reducing direct dependencies on the Cosmos SDK. This change is crucial for achieving the PR's objective of simplifying interactions with the InterfaceRegistry and promoting a more decoupled architecture.
x/params/module.go (2)
  • 6-6: The import of "cosmossdk.io/core/registry" is consistent with the PR's goal of decoupling modules from direct SDK dependencies by utilizing a more streamlined interface. This change supports the initiative to enhance modularity within the SDK.
  • 67-67: Updating the RegisterInterfaces function to use registry.LegacyRegistry instead of codectypes.InterfaceRegistry aligns with the PR's objective of simplifying interactions with the InterfaceRegistry. This change is essential for promoting a more decoupled and modular architecture within the SDK.
x/genutil/module.go (2)
  • 8-8: The import path update to "cosmossdk.io/core/registry" is in line with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more generalized interface. This change supports the initiative to enhance modularity within the SDK.
  • 101-101: The RegisterInterfaces function in this file has been updated to accept registry.LegacyRegistry, but it's left empty. This might be intentional, given the nature of the genutil module, which may not need to register specific interfaces. However, it's important to ensure that this aligns with the overall architecture and future plans for the module.
x/circuit/module.go (2)
  • 9-9: The addition of the import "cosmossdk.io/core/registry" aligns with the PR's objective to streamline interactions with the InterfaceRegistry by utilizing a more generalized interface. This change supports the initiative to reduce direct SDK dependencies and enhance modularity within the SDK.
  • 57-57: Modifying the RegisterInterfaces function to use registry.LegacyRegistry instead of codectypes.InterfaceRegistry is a key part of the refactor aimed at reducing direct dependencies on the Cosmos SDK. This change is crucial for achieving the PR's objective of simplifying interactions with the InterfaceRegistry and promoting a more decoupled architecture.
x/protocolpool/module.go (2)
  • 8-8: The addition of "cosmossdk.io/core/registry" import aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface defined in core. This change is necessary for the subsequent modification of the RegisterInterfaces function signature.
  • 75-75: The change in the RegisterInterfaces function signature from codectypes.InterfaceRegistry to registry.LegacyRegistry is consistent with the PR's goal to eliminate the dependency on SDK/types/codec through the interface registry. This modification simplifies interactions with the InterfaceRegistry and enhances modularity within the SDK.
x/nft/module/module.go (2)
  • 7-7: The addition of "cosmossdk.io/core/registry" import is appropriate for the changes made in the RegisterInterfaces function. This import is necessary for utilizing the LegacyRegistry interface, which is part of the effort to streamline module interactions with the interface registry.
  • 74-74: Modifying the RegisterInterfaces function signature to use registry.LegacyRegistry instead of cdctypes.InterfaceRegistry is in line with the PR's objectives. This change facilitates a more decoupled architecture by reducing direct dependencies on the SDK's types/codec.
x/crisis/module.go (2)
  • 9-9: Adding "cosmossdk.io/core/registry" to the imports is necessary for the subsequent modification in the RegisterInterfaces function. This change supports the PR's goal of decoupling modules from the SDK by using a more generalized interface registry.
  • 77-77: The update of the RegisterInterfaces function signature to accept registry.LegacyRegistry aligns with the overarching goal of the PR to simplify and decouple the modules from direct SDK dependencies. This change is consistent and necessary for achieving a more modular architecture.
x/upgrade/module.go (2)
  • 8-8: The addition of "cosmossdk.io/core/registry" to the imports is appropriate and necessary for the changes made in the RegisterInterfaces function. This import facilitates the use of the LegacyRegistry interface, which is crucial for the PR's objective to streamline interactions with the interface registry.
  • 82-82: Changing the RegisterInterfaces function signature to utilize registry.LegacyRegistry instead of codectypes.InterfaceRegistry is consistent with the PR's aim to reduce direct dependencies on the SDK's types/codec. This modification supports a more decoupled and modular architecture within the SDK.
x/feegrant/module/module.go (2)
  • 8-8: The import of "cosmossdk.io/core/registry" is correctly added to support the changes in the RegisterInterfaces function. This import is essential for utilizing the LegacyRegistry interface, aligning with the PR's goal to simplify module interactions with the interface registry.
  • 76-76: Updating the RegisterInterfaces function signature to use registry.LegacyRegistry is in line with the PR's objectives to decouple modules from direct SDK dependencies. This change enhances modularity by reducing reliance on the SDK's types/codec.
types/module/core_module.go (1)
  • 174-178: The modification of the RegisterInterfaces function signature within the coreAppModuleAdaptor struct to accept registry.LegacyRegistry instead of codectypes.InterfaceRegistry is consistent with the PR's aim to streamline and decouple module interactions with the interface registry. This change supports a more modular and flexible architecture by reducing direct dependencies on the SDK's types/codec.
x/evidence/module.go (2)
  • 8-8: The addition of cosmossdk.io/core/registry and removal of codectypes align with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more streamlined interface. This change is a positive step towards decoupling and modularization.
  • 85-85: Changing the parameter type in the RegisterInterfaces function from codectypes.InterfaceRegistry to registry.LegacyRegistry is in line with the PR's objectives to streamline interactions and reduce direct SDK dependencies. This modification enhances modularity and simplifies the module's interface with the SDK.
x/authz/module/module.go (2)
  • 8-8: The addition of cosmossdk.io/core/registry aligns with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more streamlined interface. This change is a positive step towards decoupling and modularization.
  • 95-95: Changing the parameter type in the RegisterInterfaces function from cdctypes.InterfaceRegistry to registry.LegacyRegistry is in line with the PR's objectives to streamline interactions and reduce direct SDK dependencies. This modification enhances modularity and simplifies the module's interface with the SDK.
x/group/module/module.go (2)
  • 8-8: The addition of cosmossdk.io/core/registry aligns with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more streamlined interface. This change is a positive step towards decoupling and modularization.
  • 86-86: Changing the parameter type in the RegisterInterfaces function to registry.LegacyRegistry is in line with the PR's objectives to streamline interactions and reduce direct SDK dependencies. This modification enhances modularity and simplifies the module's interface with the SDK.
x/mint/module.go (2)
  • 8-8: The addition of cosmossdk.io/core/registry aligns with the PR's objective to reduce direct dependencies on the Cosmos SDK by utilizing a more streamlined interface. This change is a positive step towards decoupling and modularization.
  • 86-86: Changing the parameter type in the RegisterInterfaces function to registry.LegacyRegistry is in line with the PR's objectives to streamline interactions and reduce direct SDK dependencies. This modification enhances modularity and simplifies the module's interface with the SDK.
x/slashing/module.go (2)
  • 8-8: The addition of the cosmossdk.io/core/registry import aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface defined in core. This change is necessary for the subsequent modification in the RegisterInterfaces function.
  • 85-85: Changing the parameter type in the RegisterInterfaces function from cdctypes.InterfaceRegistry to registry.LegacyRegistry is a key part of the PR's goal to eliminate the dependency on SDK/types/codec through the interface registry. This modification ensures that the slashing module interacts with the InterfaceRegistry through the new LegacyRegistry interface, promoting a more decoupled architecture.
x/bank/module.go (2)
  • 9-9: The addition of the cosmossdk.io/core/registry import is consistent with the PR's objective to reduce direct SDK dependencies by leveraging a more streamlined interface defined in core. This change is necessary for the subsequent modification in the RegisterInterfaces function and aligns with the broader goal of enhancing modularity within the SDK.
  • 86-86: Changing the parameter type in the RegisterInterfaces function from codectypes.InterfaceRegistry to registry.LegacyRegistry is crucial for achieving the PR's goal of decoupling the bank module from direct SDK dependencies. This modification ensures that the bank module interacts with the InterfaceRegistry through the new LegacyRegistry interface, promoting a more decoupled and modular architecture.
x/staking/module.go (2)
  • 8-8: The addition of the cosmossdk.io/core/registry import supports the PR's objective to facilitate a more streamlined and decoupled interaction with the InterfaceRegistry through the LegacyRegistry interface. This change is essential for the subsequent modification in the RegisterInterfaces function and aligns with the broader goal of reducing direct SDK dependencies.
  • 86-86: Modifying the parameter type in the RegisterInterfaces function from cdctypes.InterfaceRegistry to registry.LegacyRegistry is a critical step towards decoupling the staking module from direct SDK dependencies. This change ensures that the staking module interacts with the InterfaceRegistry through the new LegacyRegistry interface, promoting a more modular and loosely coupled architecture within the SDK.
x/auth/module.go (2)
  • 8-8: The addition of the cosmossdk.io/core/registry import aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface defined in core. This change is necessary for the subsequent modification in the RegisterInterfaces function and supports the broader goal of enhancing modularity within the SDK.
  • 80-80: Changing the parameter type in the RegisterInterfaces function from codectypes.InterfaceRegistry to registry.LegacyRegistry is crucial for achieving the PR's goal of decoupling the auth module from direct SDK dependencies. This modification ensures that the auth module interacts with the InterfaceRegistry through the new LegacyRegistry interface, promoting a more decoupled and modular architecture.
x/distribution/module.go (3)
  • 8-8: The addition of "cosmossdk.io/core/registry" aligns with the PR's objective to decouple modules from direct SDK dependencies. This change is appropriate and supports the goal of using a more streamlined interface.
  • 8-8: The removal of "github.com/cosmos/cosmos-sdk/codec/types" is consistent with the PR's goal to eliminate the dependency on SDK/types/codec. This change supports the objective of reducing direct SDK dependencies.
  • 96-96: Changing the parameter type in RegisterInterfaces from cdctypes.InterfaceRegistry to registry.LegacyRegistry is a key part of the refactor to decouple the module from the Cosmos SDK and enhance modularity. This change is consistent with the PR's objectives.
x/gov/module.go (3)
  • 8-8: The addition of "cosmossdk.io/core/registry" aligns with the PR's objective to decouple modules from direct SDK dependencies. This change is appropriate and supports the goal of using a more streamlined interface.
  • 8-8: The removal of "github.com/cosmos/cosmos-sdk/codec/types" is consistent with the PR's goal to eliminate the dependency on SDK/types/codec. This change supports the objective of reducing direct SDK dependencies.
  • 114-114: Changing the parameter type in RegisterInterfaces from codectypes.InterfaceRegistry to registry.LegacyRegistry is a key part of the refactor to decouple the module from the Cosmos SDK and enhance modularity. This change is consistent with the PR's objectives.
simapp/v2/go.mod (3)
  • 44-44: The update to cosmossdk.io/x/distribution aligns with the PR's objectives. Ensure compatibility and test thoroughly to avoid potential breaking changes.
  • 179-179: The update to github.com/prometheus/client_golang is noted. Verify compatibility and assess any performance impact due to this update.
  • 181-181: The update to github.com/prometheus/common is acknowledged. Ensure that this update does not affect the application's monitoring and metrics collection capabilities adversely.
runtime/v2/manager.go (2)
  • 10-10: The import changes align with the PR's objective to minimize direct dependencies on the Cosmos SDK by introducing cosmossdk.io/core/registry and removing github.com/cosmos/cosmos-sdk/codec/types. Ensure that the removal of the SDK codec types import does not lead to unresolved references elsewhere in the file or project.
  • 103-103: The change in the RegisterInterfaces function signature from codectypes.InterfaceRegistry to registry.LegacyRegistry supports the PR's goal of reducing SDK dependencies. Ensure that all modules implementing sdkmodule.HasRegisterInterfaces are compatible with this change.
testutil/mock/types_module_module.go (4)
  • 73-73: The change from types0.InterfaceRegistry to registry.LegacyRegistry in the RegisterInterfaces method of MockAppModuleBasic aligns with the PR's objective to decouple modules from direct SDK dependencies. This modification simplifies the interaction with the interface registry by utilizing a more streamlined interface defined in core.
  • 158-158: The update in MockAppModule to use registry.LegacyRegistry instead of types0.InterfaceRegistry for the RegisterInterfaces method is consistent with the overarching goal of reducing direct dependencies on the Cosmos SDK. This change contributes to a more modular architecture by leveraging the newly defined LegacyRegistry interface.
  • 330-330: Replacing types0.InterfaceRegistry with registry.LegacyRegistry in the RegisterInterfaces method of MockHasRegisterInterfaces is another step towards achieving the PR's goal of minimizing SDK dependencies. This adjustment ensures that mock types are in line with the new decoupled architecture, promoting better modularity and maintainability.
  • 707-707: The modification in MockHasABCIEndBlock to use registry.LegacyRegistry for the RegisterInterfaces method is in harmony with the PR's objectives. This change further exemplifies the effort to streamline interactions with the interface registry and enhance the modularity of the Cosmos SDK by reducing direct dependencies.
testutil/mock/types_mock_appmodule.go (2)
  • 140-140: The change from types0.InterfaceRegistry to registry.LegacyRegistry in the RegisterInterfaces method for MockAppModuleWithAllExtensions aligns with the PR's objective to decouple modules from direct SDK dependencies. This modification ensures that the mock implementation is consistent with the new interface defined in core/registry. It's crucial to verify that all references and usages of MockAppModuleWithAllExtensions throughout the test suite have been updated accordingly to avoid any integration issues.
  • 308-308: Similar to the previous comment, the update in the RegisterInterfaces method for MockAppModuleWithAllExtensionsABCI to use registry.LegacyRegistry is in line with the overarching goal of reducing direct dependencies on the Cosmos SDK. This change is essential for maintaining consistency across the codebase and ensuring that the mock implementations reflect the new architectural decisions. As with the previous change, it's important to ensure that all instances where MockAppModuleWithAllExtensionsABCI is used are checked and updated if necessary.
types/module/module.go (3)
  • 29-29: The import statement for cosmossdk.io/core/registry has been added, which aligns with the PR's objective to decouple modules from direct SDK dependencies by utilizing a more streamlined interface defined in core. This change is necessary for the subsequent modifications in the file that replace types.InterfaceRegistry with registry.LegacyRegistry.
  • 89-89: The RegisterInterfaces method signature in the HasRegisterInterfaces interface has been updated to accept registry.LegacyRegistry instead of the previous codectypes.InterfaceRegistry. This change is a direct implementation of the PR's objective to reduce direct dependencies on the Cosmos SDK's types/codec by utilizing a new interface defined within the core/registry package. It's a crucial step towards achieving better modularity and reduced coupling with the SDK.
  • 316-316: The implementation of the RegisterInterfaces method in the Manager struct has been updated to accept registry.LegacyRegistry as its parameter. This modification is consistent with the changes made in the HasRegisterInterfaces interface and supports the PR's goal of decoupling modules from the Cosmos SDK's types/codec. By doing so, it contributes to a more modular architecture where modules interact with the InterfaceRegistry through a more streamlined and decoupled interface.
simapp/v2/go.sum (2)
  • 899-900: The update to github.com/prometheus/client_golang v1.19.0 is noted. It's important to ensure compatibility with this new version through thorough testing, especially given Prometheus's role in monitoring and metrics.
  • 915-916: The update to github.com/prometheus/common v0.48.0 is observed. Similar to the previous update, verifying compatibility and conducting thorough testing are essential steps to ensure the update does not adversely affect the project.

@kocubinski kocubinski changed the title WIP: refactor: remove dependency x/module -> sdk in InterfaceRegistry refactor: remove dependency x/module -> sdk in InterfaceRegistry Mar 4, 2024
import gogoproto "github.com/cosmos/gogoproto/proto"

type LegacyRegistry interface {
RegisterInterface(protoName string, iface interface{}, impls ...gogoproto.Message)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RegisterInterface(protoName string, iface interface{}, impls ...gogoproto.Message)
RegisterInterface(protoName string, iface interface{}, impls ... protoiface.MessageV1)

Copy link
Member Author

Choose a reason for hiding this comment

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

This will take a bigger refactor though right? The concrete implementation we're passing around expects gogoproto.Message

func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, impls ...proto.Message) {
for _, impl := range impls {
typeURL := MsgTypeURL(impl)
registry.registerImpl(iface, typeURL, impl)
}
}

//
// Ex:
// registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{})
RegisterImplementations(iface interface{}, impls ...gogoproto.Message)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
RegisterImplementations(iface interface{}, impls ...gogoproto.Message)
RegisterImplementations(iface interface{}, impls ... protoiface.MessageV1)

@tac0turtle
Copy link
Member

do you want to do this straight to main instead of server branch. dont think its contingent on anything in server

@kocubinski
Copy link
Member Author

do you want to do this straight to main instead of server branch. dont think its contingent on anything in server

Yea I can try to rebase onto main and see how it turns out

@kocubinski
Copy link
Member Author

Close in favor of #19652

@kocubinski kocubinski closed this Mar 6, 2024
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.

3 participants