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

bump up mods.irisnet.org/modules/htlc to cosmos-sdk v0.50.10 #458

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 60 additions & 66 deletions api/irismod/htlc/htlc.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion modules/htlc/abci.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package htlc

import (
"context"
"fmt"

tmbytes "github.com/cometbft/cometbft/libs/bytes"
Expand All @@ -11,7 +12,8 @@ import (
)

// BeginBlocker handles block beginning logic for HTLC
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
func BeginBlocker(c context.Context, k keeper.Keeper) {
ctx := sdk.UnwrapSDKContext(c)
ctx = ctx.WithLogger(ctx.Logger().With("handler", "beginBlock").With("module", "irismod/htlc"))

currentBlockHeight := uint64(ctx.BlockHeight())
Expand Down
4 changes: 2 additions & 2 deletions modules/htlc/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package htlc
import (
"cosmossdk.io/core/appmodule"
"cosmossdk.io/depinject"
storetypes "cosmossdk.io/store/types"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

The import path cosmossdk.io/store/types needs to be updated consistently across the codebase

Several files are still using the old import path github.com/cosmos/cosmos-sdk/store/types which needs to be updated to cosmossdk.io/store/types for consistency with Cosmos SDK v0.50.10:

  • modules/token/depinject.go
  • e2e/sim_test.go
  • modules/token/keeper/keeper.go
  • modules/oracle/depinject.go
  • modules/oracle/keeper/keeper.go
  • modules/coinswap/depinject.go
  • modules/farm/depinject.go
  • modules/farm/keeper/keeper.go
  • modules/coinswap/keeper/keeper.go
🔗 Analysis chain

LGTM: Import path update aligns with Cosmos SDK v0.50.10

The change from github.com/cosmos/cosmos-sdk/store/types to cosmossdk.io/store/types is correct and consistent with the Cosmos SDK v0.50.10 module structure.

Let's verify this change is consistent across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old store types imports that need updating
# Expected: No results from old import path

rg "github.com/cosmos/cosmos-sdk/store/types" --type go

Length of output: 882

"github.com/cosmos/cosmos-sdk/codec"
store "github.com/cosmos/cosmos-sdk/store/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

Expand Down Expand Up @@ -42,7 +42,7 @@ type Inputs struct {

Config *modulev1.Module
Cdc codec.Codec
Key *store.KVStoreKey
Key *storetypes.KVStoreKey
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistent KVStoreKey type usage across modules

The search results show that while modules/htlc and modules/mt use *storetypes.KVStoreKey, other modules like token, random, service, record, oracle, coinswap, and farm are still using *store.KVStoreKey. This indicates an inconsistency in the type usage across the codebase.

  • modules/htlc/depinject.go: Uses *storetypes.KVStoreKey
  • modules/mt/depinject.go: Uses *storetypes.KVStoreKey
  • modules/token/depinject.go: Uses *store.KVStoreKey
  • modules/random/depinject.go: Uses *store.KVStoreKey
  • modules/service/depinject.go: Uses *store.KVStoreKey
  • modules/record/depinject.go: Uses *store.KVStoreKey
  • modules/oracle/depinject.go: Uses *store.KVStoreKey
  • modules/coinswap/depinject.go: Uses *store.KVStoreKey
  • modules/farm/depinject.go: Uses *store.KVStoreKey
🔗 Analysis chain

LGTM: KVStoreKey type update matches the new import

The type change from *store.KVStoreKey to *storetypes.KVStoreKey correctly reflects the updated import path and maintains the same functionality.

Let's verify the keeper initialization still works with this type:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check keeper initialization patterns to ensure consistent type usage
# Expected: All keeper initializations should use storetypes.KVStoreKey

ast-grep --pattern 'NewKeeper($$$, $key, $$$)' 

Length of output: 48


Script:

#!/bin/bash
# Let's try a different approach to find keeper initialization patterns
# First, let's find the NewKeeper function definition
ast-grep --pattern 'func NewKeeper($$$) $$ {'

# Also search for any direct usage of KVStoreKey type
rg "KVStoreKey" -A 2 -B 2

Length of output: 3152


AccountKeeper types.AccountKeeper
BankKeeper types.BankKeeper
Expand Down
Loading
Loading