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

added backward compatible interface #27

Merged
merged 1 commit into from
Jan 5, 2023
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
15 changes: 14 additions & 1 deletion modules/core/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"

ibcdmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/01-dymint/types"

clientkeeper "github.com/cosmos/ibc-go/v3/modules/core/02-client/keeper"
clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
connectionkeeper "github.com/cosmos/ibc-go/v3/modules/core/03-connection/keeper"
Expand Down Expand Up @@ -36,8 +38,19 @@ type Keeper struct {
Router *porttypes.Router
}

// NewKeeper creates a new ibc Keeper
//IBCKeeper initialized in wasm code (in [email protected]/x/wasm/keeper/test_common.go:354)
//We need to maintain backward comptabile interface
func NewKeeper(
cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
stakingKeeper clienttypes.StakingKeeper, upgradeKeeper clienttypes.UpgradeKeeper,
scopedKeeper capabilitykeeper.ScopedKeeper,
) *Keeper {
//Using dymint and nil as default. we can panic instead
return NewKeeperWithSelfClient(cdc, key, paramSpace, stakingKeeper, upgradeKeeper, scopedKeeper, ibcdmtypes.NewSelfClient(), nil)
}

// NewKeeper creates a new ibc Keeper
func NewKeeperWithSelfClient(
cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
stakingKeeper clienttypes.StakingKeeper, upgradeKeeper clienttypes.UpgradeKeeper,
scopedKeeper capabilitykeeper.ScopedKeeper, selfClient exported.SelfClient, clientHooks exported.ClientHooks,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestNewKeeper() {
upgradeKeeper clienttypes.UpgradeKeeper
scopedKeeper capabilitykeeper.ScopedKeeper
newIBCKeeper = func() {
ibckeeper.NewKeeper(
ibckeeper.NewKeeperWithSelfClient(
suite.chainA.GetSimApp().AppCodec(),
suite.chainA.GetSimApp().GetKey(ibchost.StoreKey),
suite.chainA.GetSimApp().GetSubspace(ibchost.ModuleName),
Expand Down
2 changes: 1 addition & 1 deletion testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func NewSimAppWithConsensusType(
panic(fmt.Sprintf("client type %s is not supported", chainConsensusType))
}
// Create IBC Keeper
app.IBCKeeper = ibckeeper.NewKeeper(
app.IBCKeeper = ibckeeper.NewKeeperWithSelfClient(
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, selfClient, nil,
)

Expand Down