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

Merged
merged 2 commits into from
Oct 30, 2024
Merged

refactor: bump up irismod #2950

merged 2 commits into from
Oct 30, 2024

Conversation

dreamer-zq
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • Updated dependencies to enhance functionality and performance.
    • Introduced new modules for improved features including coinswap, farm, and NFT capabilities.
  • Bug Fixes

    • Removed outdated dependency to streamline operations and reduce potential issues.

Copy link

coderabbitai bot commented Jul 5, 2024

Walkthrough

The changes involve significant updates to the go.mod file, including the upgrade of the github.com/bianjieai/tibc-go dependency to a newer version. The previous dependency on github.com/irisnet/irismod has been removed and replaced with multiple new modules from mods.irisnet.org, covering various functionalities such as coinswap, farm, and NFT. Additionally, two new indirect dependencies have been added, and the indirect dependencies section has been updated with various modules.

Changes

File Change Summary
go.mod - Updated github.com/bianjieai/tibc-go from v0.5.0 to v0.5.1-0.20240703054905-6368161b801f
- Removed github.com/irisnet/irismod v1.9.0
- Added new dependencies: mods.irisnet.org/modules/coinswap, farm, htlc, mt, nft, oracle, random, record, service, token (all v0.0.0-20240705013837-55f906fb239e)
- Added new indirect dependencies: mods.irisnet.org/api, mods.irisnet.org/simapp (both v0.0.0-20240628054110-4cb043e0238a)

Poem

In the meadow where the code does flow,
New modules sprout, watch them grow!
From coinswap to oracles bright,
Dependencies dance in the soft moonlight.
With each update, we hop with glee,
For a better tomorrow, come code with me! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod (2 hunks)
🔇 Additional comments (3)
go.mod (3)

Line range hint 1-250: Verify codebase adaptation to modular structure

The migration from a monolithic irisnet/irismod to multiple specialized modules under mods.irisnet.org is a significant architectural change. This improves modularity but requires careful verification of:

  1. All import statements are updated to use the new module paths
  2. Any shared types or interfaces are properly handled across module boundaries
  3. Cross-module dependencies are correctly managed

Let's verify the codebase adaptation:

#!/bin/bash
# Check for any remaining old imports
echo "Checking for old irismod imports..."
rg -l "github.com/irisnet/irismod"

# Check for new module imports
echo "Checking usage of new modules..."
for module in $(rg -o 'mods\.irisnet\.org/modules/[a-z]+' go.mod | cut -d'/' -f4 | sort -u); do
  echo "Usage of $module module:"
  rg -l "mods.irisnet.org/modules/$module"
done

102-103: Verify compatibility between different module versions

The indirect dependencies (api, simapp) use an older version (20240628054110) compared to the direct module dependencies (20240705013837). While this might be intentional, it's worth verifying that these versions are compatible.

Let's check for any compatibility issues between these versions:

#!/bin/bash
# Compare the changes between these versions to identify potential breaking changes
echo "Checking changes between versions..."
for repo in api simapp; do
  echo "Changes in $repo between versions:"
  gh api repos/mods.irisnet.org/$repo/compare/$(rg -o '20240628054110[^"]+' | head -1)...$(rg -o '20240705013837[^"]+' | head -1)
done

7-7: Verify stability of unreleased dependency versions

The changes introduce multiple dependencies using unreleased versions:

  • tibc-go is pinned to a specific commit (v0.5.1-0.20240703054905-6368161b801f)
  • All new mods.irisnet.org modules use pseudo-versions (v0.0.0-20240705013837-55f906fb239e)

While this allows for faster iteration during development, it's important to ensure these versions are stable for production use.

Let's verify if these are the latest versions and if there are any released versions available:

Also applies to: 15-24


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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
@dreamer-zq dreamer-zq marked this pull request as ready for review October 29, 2024 13:12
@mitch1024 mitch1024 merged commit d10f84b into master Oct 30, 2024
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 17, 2024
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.

2 participants