Skip to content

Commit

Permalink
fix ibc v8 migration (#177)
Browse files Browse the repository at this point in the history
* fix ibc v8 migration

* fix lint
  • Loading branch information
harish551 authored Aug 14, 2024
1 parent f2e03f1 commit 9b29c95
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
14 changes: 10 additions & 4 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"fmt"
"path/filepath"

ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"

addresscodec "github.com/cosmos/cosmos-sdk/codec/address"

"cosmossdk.io/log"
Expand Down Expand Up @@ -631,11 +634,14 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
// register the key tables for legacy param subspaces
keyTable := ibcclienttypes.ParamKeyTable()
keyTable.RegisterParamSet(&ibcconnectiontypes.Params{})
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())
paramsKeeper.Subspace(icqtypes.ModuleName)
paramsKeeper.Subspace(packetforwardtypes.ModuleName)
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v5/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4
package v5

import (
store "cosmossdk.io/store/types"
Expand Down
3 changes: 2 additions & 1 deletion app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4
package v5

import (
"context"
Expand Down Expand Up @@ -27,6 +27,7 @@ func CreateV5UpgradeHandler(
if err != nil {
return nil, err
}

// Set Gov Params
govParams, err := keepers.GovKeeper.Params.Get(ctx)
if err != nil {
Expand Down
23 changes: 11 additions & 12 deletions x/marketplace/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
"fmt"
"time"

"cosmossdk.io/store/prefix"
Expand All @@ -26,7 +25,7 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types

func (k Keeper) Listing(goCtx context.Context, req *types.QueryListingRequest) (*types.QueryListingResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -40,7 +39,7 @@ func (k Keeper) Listing(goCtx context.Context, req *types.QueryListingRequest) (

func (k Keeper) Listings(goCtx context.Context, req *types.QueryListingsRequest) (*types.QueryListingsResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -53,7 +52,7 @@ func (k Keeper) Listings(goCtx context.Context, req *types.QueryListingsRequest)
if len(req.Owner) > 0 {
owner, err = sdk.AccAddressFromBech32(req.Owner)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid owner address (%s)", err))
return nil, status.Errorf(codes.InvalidArgument, "invalid owner address (%s)", err)
}
listingStore := prefix.NewStore(store, append(types.PrefixListingOwner, owner.Bytes()...))
pageRes, err = query.Paginate(listingStore, req.Pagination, func(key []byte, value []byte) error {
Expand Down Expand Up @@ -105,7 +104,7 @@ func (k Keeper) ListingsByOwner(goCtx context.Context, req *types.QueryListingsB
if len(req.Owner) > 0 {
owner, err = sdk.AccAddressFromBech32(req.Owner)
if err != nil || owner == nil {
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid owner address (%s)", err))
return nil, status.Errorf(codes.InvalidArgument, "invalid owner address (%s)", err)
}
}

Expand Down Expand Up @@ -266,7 +265,7 @@ func (k Keeper) AuctionsByOwner(goCtx context.Context, req *types.QueryAuctionsB
if len(req.Owner) > 0 {
owner, err = sdk.AccAddressFromBech32(req.Owner)
if err != nil || owner == nil {
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid owner address (%s)", err))
return nil, status.Errorf(codes.InvalidArgument, "invalid owner address (%s)", err)
}
}

Expand All @@ -293,7 +292,7 @@ func (k Keeper) AuctionsByOwner(goCtx context.Context, req *types.QueryAuctionsB

func (k Keeper) AuctionsByPriceDenom(goCtx context.Context, req *types.QueryAuctionsByPriceDenomRequest) (*types.QueryAuctionsResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down Expand Up @@ -322,10 +321,10 @@ func (k Keeper) AuctionsByPriceDenom(goCtx context.Context, req *types.QueryAuct

func (k Keeper) AuctionByNftId(goCtx context.Context, req *types.QueryAuctionByNFTIDRequest) (*types.QueryAuctionResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}
if req.NftId == "" {
return nil, status.Errorf(codes.InvalidArgument, "need nft id to request")
return nil, status.Error(codes.InvalidArgument, "need nft id to request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -339,12 +338,12 @@ func (k Keeper) AuctionByNftId(goCtx context.Context, req *types.QueryAuctionByN
}
return auction, nil
}
return nil, status.Errorf(codes.NotFound, "auction not found with given nft id")
return nil, status.Error(codes.NotFound, "auction not found with given nft id")
}

func (k Keeper) Bid(goCtx context.Context, req *types.QueryBidRequest) (*types.QueryBidResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -357,7 +356,7 @@ func (k Keeper) Bid(goCtx context.Context, req *types.QueryBidRequest) (*types.Q

func (k Keeper) Bids(goCtx context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
return nil, status.Error(codes.InvalidArgument, "empty request")
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down

0 comments on commit 9b29c95

Please sign in to comment.