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: bump up irismod #2950

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

refactor: bump up irismod #2950

wants to merge 1 commit into from

Conversation

dreamer-zq
Copy link
Contributor

@dreamer-zq dreamer-zq commented Jul 5, 2024

Summary by CodeRabbit

  • Refactor

    • Updated import paths for various modules from github.com/irisnet/irismod to mods.irisnet.org to reflect module restructuring.
    • Renamed and introduced new interfaces in the mint module for more clarity and consistency.
    • Modified function signatures in the wrapper/token.go to use new types from mods.irisnet.org/modules/token/types.
  • Chores

    • Updated go.mod to reflect new module versions and paths.

Copy link

coderabbitai bot commented Jul 5, 2024

Walkthrough

The changes primarily involve updating import paths for various modules from github.com/irisnet/irismod to mods.irisnet.org throughout the project. These modifications reflect a restructuring or relocation of these modules. Additionally, some variable names and function signatures have been updated for clarity and consistency.

Changes

File Change Summary
app/ante/decorators.go Updated import paths for coinswaptypes, servicetypes, tokenkeeper, tokentypesv1, and tokentypesv1beta1.
app/ante/handler_options.go Changed import paths for oraclekeeper and tokenkeeper.
app/export.go Changed import paths for modules related to HTLC, oracle, random, and service.
app/keepers/keepers.go Updated import paths and modified function call NewProposalHandler.
app/keepers/keys.go Updated import paths for various modules
app/modules.go Changed import paths and replaced nftmodule with nft in app modules declarations.
app/sim_test.go Updated import paths for various modules.
cmd/iris/cmd/testnet.go Changed import paths for tokentypes, servicetypes, and updated function call.
cmd/iris/cmd/util.go Changed import paths for token-related modules.
go.mod Updated module versions and introduced new versions for tibc-go and Irisnet modules.
modules/internft/interface.go, modules/internft/keeper.go Changed import paths for irismodnftkeeper and nfttypes.
modules/mint/module.go Updated legacySubspace type from exported.Subspace to types.Subspace.
modules/mint/types/expected_keepers.go Renamed accountKeeper and bankKeeper and added Subspace interface.
types/runtime.go Changed import paths for tokentypes and tokenv1.
wrapper/farm.go Changed import path for farmkeeper.
wrapper/token.go Updated import paths for tokentypes and irismodtypes; updated function signatures.

Poem

🌸 Changes bloom in lines of code,
Modules moved, new paths bestowed.
Import paths now clean and neat,
A structured code, a coder's treat.
Tokens, services, all align,
A seamless flow, simply divine.
🐇 Cheers to progress, changes grand,
In our software wonderland. 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (2)
modules/mint/types/expected_keepers.go (1)

Line range hint 9-16:
Ensure proper documentation for interfaces.

The AccountKeeper and BankKeeper interfaces should have detailed documentation for each method to ensure clarity and maintainability.

type AccountKeeper interface {
+  // GetModuleAddress returns the address of a module account.
	GetModuleAddress(name string) sdk.AccAddress

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
+  // SetModuleAccount sets a module account in the store.
	SetModuleAccount(sdk.Context, types.ModuleAccountI)
+  // GetModuleAccount returns a module account by name.
	GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI
}

type BankKeeper interface {
+  // SendCoinsFromModuleToAccount sends coins from a module to an account.
	SendCoinsFromModuleToAccount(
		ctx sdk.Context,
		senderModule string,
		recipientAddr sdk.AccAddress,
		amt sdk.Coins,
	) error
+  // SendCoinsFromModuleToModule sends coins from one module to another.
	SendCoinsFromModuleToModule(
		ctx sdk.Context,
		senderModule, recipientModule string,
		amt sdk.Coins,
	) error
+  // MintCoins mints new coins.
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

Also applies to: 18-33

modules/internft/interface.go (1)

Line range hint 12-18:
Ensure proper documentation for the AccountKeeper interface.

The AccountKeeper interface should have detailed documentation for each method to ensure clarity and maintainability.

type AccountKeeper interface {
+  // NewAccountWithAddress creates a new account with the given address.
	NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
	// Set an account in the store.
	SetAccount(sdk.Context, authtypes.AccountI)
+  // GetModuleAddress returns the address of a module account.
	GetModuleAddress(name string) sdk.AccAddress
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9abc63f and 648043c.

Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
Files selected for processing (20)
  • app/ante/decorators.go (1 hunks)
  • app/ante/handler_options.go (1 hunks)
  • app/export.go (1 hunks)
  • app/keepers/keepers.go (2 hunks)
  • app/keepers/keys.go (1 hunks)
  • app/modules.go (4 hunks)
  • app/sim_test.go (1 hunks)
  • cmd/iris/cmd/testnet.go (3 hunks)
  • cmd/iris/cmd/util.go (1 hunks)
  • go.mod (3 hunks)
  • modules/internft/interface.go (1 hunks)
  • modules/internft/keeper.go (1 hunks)
  • modules/mint/keeper/migrations.go (1 hunks)
  • modules/mint/migrations/v2/migrate.go (2 hunks)
  • modules/mint/migrations/v2/migrate_test.go (1 hunks)
  • modules/mint/module.go (2 hunks)
  • modules/mint/types/expected_keepers.go (3 hunks)
  • types/runtime.go (1 hunks)
  • wrapper/farm.go (1 hunks)
  • wrapper/token.go (3 hunks)
Files skipped from review due to trivial changes (7)
  • app/ante/handler_options.go
  • app/export.go
  • app/sim_test.go
  • cmd/iris/cmd/util.go
  • modules/internft/keeper.go
  • modules/mint/migrations/v2/migrate_test.go
  • wrapper/farm.go
Additional comments not posted (29)
modules/mint/migrations/v2/migrate.go (1)

Line range hint 15-19:
Ensure the types.Subspace interface is correctly defined.

Verify that the types.Subspace interface properly supports the GetParamSet method.

Verification successful

The types.Subspace interface correctly supports the GetParamSet method.

  • The GetParamSet method is defined within the types.Subspace interface in the modules/mint/types/expected_keepers.go file.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `types.Subspace` interface supports the `GetParamSet` method.

# Test: Search for the definition of `types.Subspace`. Expect: The interface should include `GetParamSet`.
rg --type go --pattern 'type Subspace interface {'

Length of output: 464


Script:

#!/bin/bash
# Description: Verify the `types.Subspace` interface supports the `GetParamSet` method.

# Test: Search for the definition of `types.Subspace`. Expect: The interface should include `GetParamSet`.
rg 'type Subspace interface {'

Length of output: 146


Script:

#!/bin/bash
# Description: Verify the `types.Subspace` interface supports the `GetParamSet` method.

# Test: Search for the definition of `types.Subspace`. Expect: The interface should include `GetParamSet`.
rg 'type Subspace interface \{'

Length of output: 98


Script:

#!/bin/bash
# Description: Verify the `types.Subspace` interface supports the `GetParamSet` method.

# Test: Search for the `GetParamSet` method within the `modules/mint/types/expected_keepers.go` file.
rg 'GetParamSet' modules/mint/types/expected_keepers.go

Length of output: 109

modules/mint/keeper/migrations.go (1)

7-7: Ensure the types.Subspace interface is correctly defined.

Verify that the types.Subspace interface properly supports the GetParamSet method.

Also applies to: 13-13, 17-17

modules/mint/types/expected_keepers.go (1)

35-38: Ensure the Subspace interface is correctly defined.

Verify that the Subspace interface properly supports the GetParamSet method.

modules/internft/interface.go (1)

9-9: Ensure the nfttypes module is correctly updated.

Verify that the nfttypes module has been correctly updated to mods.irisnet.org/modules/nft/types.

Verification successful

The nfttypes module has been correctly updated.

The import path mods.irisnet.org/modules/nft/types is correctly used in multiple files, including modules/internft/interface.go.

  • modules/internft/keeper.go
  • modules/internft/interface.go
  • app/sim_test.go
  • app/modules.go
  • app/keepers/keepers.go
  • app/keepers/keys.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the `nfttypes` module update.

# Test: Search for the import path. Expect: The import path should be `mods.irisnet.org/modules/nft/types`.
rg --type go --pattern 'mods.irisnet.org/modules/nft/types'

Length of output: 471


Script:

#!/bin/bash
# Description: Verify the `nfttypes` module update.

# Test: Search for the import path. Expect: The import path should be `mods.irisnet.org/modules/nft/types`.
rg 'mods.irisnet.org/modules/nft/types' --type go

Length of output: 453

types/runtime.go (1)

17-18: Imports updated correctly.

The import paths for tokentypes and tokenv1 have been updated to mods.irisnet.org/modules/token/types and mods.irisnet.org/modules/token/types/v1, respectively. These changes are consistent with the rebranding effort mentioned in the PR objectives.

wrapper/token.go (3)

21-21: Imports updated correctly.

The import path for tokentypes has been updated to mods.irisnet.org/modules/token/types. This change is consistent with the rebranding effort mentioned in the PR objectives.


42-47: Update in ApplyMessage method is correct.

The ApplyMessage method now uses tokentypes.Result instead of irismodtypes.Result. This change is consistent with the rebranding effort and the new module path.


Line range hint 62-70:
Update in EstimateGas method is correct.

The EstimateGas method now uses tokentypes.EthCallRequest instead of irismodtypes.EthCallRequest. This change is consistent with the rebranding effort and the new module path.

app/ante/decorators.go (1)

11-15: Imports updated correctly.

The import paths for coinswaptypes, servicetypes, tokenkeeper, tokentypesv1, and tokentypesv1beta1 have been updated to mods.irisnet.org/modules/.... These changes are consistent with the rebranding effort mentioned in the PR objectives.

app/keepers/keys.go (1)

28-37: Imports updated correctly.

The import paths for coinswaptypes, farmtypes, htlctypes, mttypes, nfttypes, oracletypes, randomtypes, recordtypes, servicetypes, and tokentypes have been updated to mods.irisnet.org/modules/.... These changes are consistent with the rebranding effort mentioned in the PR objectives.

modules/mint/module.go (1)

94-94: LGTM!

The type change for legacySubspace from exported.Subspace to types.Subspace is appropriate and aligns with the module import path updates.

Also applies to: 101-101

go.mod (2)

7-7: LGTM!

The version update for github.com/bianjieai/tibc-go to v0.5.1-0.20240703054905-6368161b801f is appropriate.


15-24: LGTM!

The import path updates from github.com/irisnet/irismod to mods.irisnet.org for multiple modules are consistent and align with the restructuring or rebranding effort.

Also applies to: 102-103

cmd/iris/cmd/testnet.go (2)

15-15: LGTM!

The import path updates for tokentypes and servicetypes to mods.irisnet.org are consistent and align with the restructuring or rebranding effort.

Also applies to: 44-45


383-383: LGTM!

The function call change from randomtypes.GetSvcDefinition() to servicetypes.GetRandomSvcDefinition() is appropriate and aligns with the import path updates.

app/modules.go (2)

51-70: LGTM!

The import path updates from github.com/irisnet/irismod to mods.irisnet.org for multiple modules are consistent and align with the restructuring or rebranding effort.


140-140: LGTM!

The updates in the appModules and simulationModules functions to reflect the new import paths are consistent and align with the restructuring or rebranding effort.

Also applies to: 285-285, 411-411

app/keepers/keepers.go (12)

85-86: Import path updated to mods.irisnet.org.

The import path for coinswapkeeper and coinswaptypes has been updated correctly.


87-88: Import path updated to mods.irisnet.org.

The import path for farm and farmkeeper has been updated correctly.


89-90: Import path updated to mods.irisnet.org.

The import path for farmtypes and htlckeeper has been updated correctly.


91-92: Import path updated to mods.irisnet.org.

The import path for htlctypes and mtkeeper has been updated correctly.


93-94: Import path updated to mods.irisnet.org.

The import path for mttypes and nftkeeper has been updated correctly.


95-96: Import path updated to mods.irisnet.org.

The import path for nfttypes and oraclekeeper has been updated correctly.


97-98: Import path updated to mods.irisnet.org.

The import path for oracletypes and randomkeeper has been updated correctly.


99-100: Import path updated to mods.irisnet.org.

The import path for randomtypes and recordkeeper has been updated correctly.


101-102: Import path updated to mods.irisnet.org.

The import path for recordtypes and servicekeeper has been updated correctly.


103-104: Import path updated to mods.irisnet.org.

The import path for servicetypes and tokenkeeper has been updated correctly.


105-106: Import path updated to mods.irisnet.org.

The import path for tokentypes and tokenv1 has been updated correctly.


518-518: Handler registration updated.

The proposal handler for farmtypes has been updated to farm.NewProposalHandler. Ensure this new handler is correctly implemented and tested.

@dreamer-zq dreamer-zq marked this pull request as draft August 14, 2024 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant