diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e4b00858f..e95cbd905a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking +* (testing)[\#2028](https://github.com/cosmos/ibc-go/pull/2028) New interface `ibctestingtypes.StakingKeeper` added and set for the testing app `StakingKeeper` setup. * (core/04-channel) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `NewPacketId` has been renamed to `NewPacketID` to comply with go linting rules. * (core/ante) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `AnteDecorator` has been renamed to `RedundancyDecorator` to comply with go linting rules and to give more clarity to the purpose of the Decorator. * (core/ante) [\#1820](https://github.com/cosmos/ibc-go/pull/1418) `RedundancyDecorator` has been renamed to `RedundantRelayDecorator` to make the name for explicit. diff --git a/testing/README.md b/testing/README.md index a488ffa42f1..01e164e120b 100644 --- a/testing/README.md +++ b/testing/README.md @@ -48,7 +48,7 @@ type TestingApp interface { // ibc-go additions GetBaseApp() *baseapp.BaseApp - GetStakingKeeper() stakingkeeper.Keeper + GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig diff --git a/testing/app.go b/testing/app.go index 7cd218e010a..2c41021f504 100644 --- a/testing/app.go +++ b/testing/app.go @@ -16,7 +16,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -27,6 +26,7 @@ import ( "github.com/cosmos/ibc-go/v5/modules/core/keeper" "github.com/cosmos/ibc-go/v5/testing/simapp" + ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types" ) var DefaultTestingAppInit = SetupTestingApp @@ -36,7 +36,7 @@ type TestingApp interface { // ibc-go additions GetBaseApp() *baseapp.BaseApp - GetStakingKeeper() stakingkeeper.Keeper + GetStakingKeeper() ibctestingtypes.StakingKeeper GetIBCKeeper() *keeper.Keeper GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper GetTxConfig() client.TxConfig diff --git a/testing/chain_test.go b/testing/chain_test.go index 6d2d32684fb..5ea1aec4aaa 100644 --- a/testing/chain_test.go +++ b/testing/chain_test.go @@ -23,11 +23,11 @@ func TestChangeValSet(t *testing.T) { amount2, ok := sdk.NewIntFromString("30000000000000000000") require.True(t, ok) - val := chainA.App.GetStakingKeeper().GetValidators(chainA.GetContext(), 4) + val := chainA.GetSimApp().StakingKeeper.GetValidators(chainA.GetContext(), 4) - chainA.App.GetStakingKeeper().Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(), + chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(), amount, types.Unbonded, val[1], true) - chainA.App.GetStakingKeeper().Delegate(chainA.GetContext(), chainA.SenderAccounts[3].SenderAccount.GetAddress(), + chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[3].SenderAccount.GetAddress(), amount2, types.Unbonded, val[3], true) coord.CommitBlock(chainA) diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 5b7d3fb8b53..d060ecdc092 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -108,6 +108,7 @@ import ( ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" ibcmock "github.com/cosmos/ibc-go/v5/testing/mock" simappparams "github.com/cosmos/ibc-go/v5/testing/simapp/params" + ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types" ) const appName = "SimApp" @@ -748,7 +749,7 @@ func (app *SimApp) GetBaseApp() *baseapp.BaseApp { } // GetStakingKeeper implements the TestingApp interface. -func (app *SimApp) GetStakingKeeper() stakingkeeper.Keeper { +func (app *SimApp) GetStakingKeeper() ibctestingtypes.StakingKeeper { return app.StakingKeeper } diff --git a/testing/types/expected_keepers.go b/testing/types/expected_keepers.go new file mode 100644 index 00000000000..07034b57a25 --- /dev/null +++ b/testing/types/expected_keepers.go @@ -0,0 +1,12 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// StakingKeeper defines the expected staking keeper interface used in the +// IBC testing package +type StakingKeeper interface { + GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool) +}