Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 14f5b0f

Browse files
charleenfeimergify[bot]
authored andcommittedOct 6, 2022
chore: set up IBCTestStakingKeeper interface (#2028)
* initial interface definition * update simapp * update godocs (cherry picked from commit 4d4dbcf) # Conflicts: # CHANGELOG.md # testing/app.go # testing/simapp/app.go
1 parent cbf86ff commit 14f5b0f

File tree

6 files changed

+72
-7
lines changed

6 files changed

+72
-7
lines changed
 

‎CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,28 @@ Ref: https://keepachangelog.com/en/1.0.0/
4242

4343
### API Breaking
4444

45+
<<<<<<< HEAD
4546
* (apps/27-interchain-accounts) [\#2133](https://github.com/cosmos/ibc-go/pull/2133) Generates genesis protos in a separate directory to avoid circular import errors. The protobuf package name has changed for the genesis types.
47+
=======
48+
* (testing)[\#2028](https://github.com/cosmos/ibc-go/pull/2028) New interface `ibctestingtypes.StakingKeeper` added and set for the testing app `StakingKeeper` setup.
49+
* (core/04-channel) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `NewPacketId` has been renamed to `NewPacketID` to comply with go linting rules.
50+
* (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.
51+
* (core/ante) [\#1820](https://github.com/cosmos/ibc-go/pull/1418) `RedundancyDecorator` has been renamed to `RedundantRelayDecorator` to make the name for explicit.
52+
* (testing) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `MockIBCApp` has been renamed to `IBCApp` and `MockEmptyAcknowledgement` has been renamed to `EmptyAcknowledgement` to comply with go linting rules.
53+
* (light-clients/tendermint)[\#1768](https://github.com/cosmos/ibc-go/pull/1768) Removed `AllowUpdateAfterExpiry`, `AllowUpdateAfterMisbehaviour` booleans as they are deprecated (see ADR026)
54+
* (06-solomachine) [\#1679](https://github.com/cosmos/ibc-go/pull/1679) Remove `types` sub-package from `06-solomachine` lightclient directory.
55+
* (07-tendermint) [\#1677](https://github.com/cosmos/ibc-go/pull/1677) Remove `types` sub-package from `07-tendermint` lightclient directory.
56+
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Bump `06-solomachine` protobuf version from `v2` to `v3`.
57+
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Removed `DataType` enum and associated message types from `06-solomachine`. `DataType` has been removed from `SignBytes` and `SignatureAndData` in favour of `path`.
58+
* (02-client) [\#598](https://github.com/cosmos/ibc-go/pull/598) The client state and consensus state return value has been removed from `VerifyUpgradeAndUpdateState`. Light client implementations must update the client state and consensus state after verifying a valid client upgrade.
59+
* (06-solomachine) [\#1100](https://github.com/cosmos/ibc-go/pull/1100) Remove `GetClientID` function from 06-solomachine `Misbehaviour` type.
60+
* (06-solomachine) [\#1100](https://github.com/cosmos/ibc-go/pull/1100) Deprecate `ClientId` field in 06-solomachine `Misbehaviour` type.
61+
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Remove `GetClientID` function from 07-tendermint `Misbehaviour` type.
62+
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Deprecate `ClientId` field in 07-tendermint `Misbehaviour` type.
63+
* (modules/core/exported) [\#1107](https://github.com/cosmos/ibc-go/pull/1107) Merging the `Header` and `Misbehaviour` interfaces into a single `ClientMessage` type.
64+
* (06-solomachine)[\#1906](https://github.com/cosmos/ibc-go/pull/1906/files) Removed `AllowUpdateAfterProposal` boolean as it has been deprecated (see 01_concepts of the solo machine spec for more details).
65+
* (07-tendermint) [\#1896](https://github.com/cosmos/ibc-go/pull/1896) Remove error return from `IterateConsensusStateAscending` in `07-tendermint`.
66+
>>>>>>> 4d4dbcf (chore: set up IBCTestStakingKeeper interface (#2028))
4667
* (apps/27-interchain-accounts) [\#2035](https://github.com/cosmos/ibc-go/pull/2035) Interchain accounts host and controller Keepers now expects a keeper which fulfills the expected `ScopedKeeper` interface for the capability keeper.
4768
* (transfer) [\#2034](https://github.com/cosmos/ibc-go/pull/2034) Transfer Keeper now expects a keeper which fulfills the expected `ScopedKeeper` interface for the capability keeper.
4869
* (05-port) [\#2025](https://github.com/cosmos/ibc-go/pull/2025) Port Keeper now expects a keeper which fulfills the expected `ScopedKeeper` interface for the capability keeper.

‎testing/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type TestingApp interface {
4848

4949
// ibc-go additions
5050
GetBaseApp() *baseapp.BaseApp
51-
GetStakingKeeper() stakingkeeper.Keeper
51+
GetStakingKeeper() ibctestingtypes.StakingKeeper
5252
GetIBCKeeper() *keeper.Keeper
5353
GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
5454
GetTxConfig() client.TxConfig

‎testing/app.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
1717
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
1818
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
19-
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
2019
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
2120
"github.com/stretchr/testify/require"
2221
abci "github.com/tendermint/tendermint/abci/types"
@@ -25,8 +24,14 @@ import (
2524
tmtypes "github.com/tendermint/tendermint/types"
2625
dbm "github.com/tendermint/tm-db"
2726

27+
<<<<<<< HEAD
2828
"github.com/cosmos/ibc-go/v6/modules/core/keeper"
2929
"github.com/cosmos/ibc-go/v6/testing/simapp"
30+
=======
31+
"github.com/cosmos/ibc-go/v5/modules/core/keeper"
32+
"github.com/cosmos/ibc-go/v5/testing/simapp"
33+
ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types"
34+
>>>>>>> 4d4dbcf (chore: set up IBCTestStakingKeeper interface (#2028))
3035
)
3136

3237
var DefaultTestingAppInit = SetupTestingApp
@@ -36,7 +41,7 @@ type TestingApp interface {
3641

3742
// ibc-go additions
3843
GetBaseApp() *baseapp.BaseApp
39-
GetStakingKeeper() stakingkeeper.Keeper
44+
GetStakingKeeper() ibctestingtypes.StakingKeeper
4045
GetIBCKeeper() *keeper.Keeper
4146
GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
4247
GetTxConfig() client.TxConfig

‎testing/chain_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ func TestChangeValSet(t *testing.T) {
2323
amount2, ok := sdk.NewIntFromString("30000000000000000000")
2424
require.True(t, ok)
2525

26-
val := chainA.App.GetStakingKeeper().GetValidators(chainA.GetContext(), 4)
26+
val := chainA.GetSimApp().StakingKeeper.GetValidators(chainA.GetContext(), 4)
2727

28-
chainA.App.GetStakingKeeper().Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(),
28+
chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[1].SenderAccount.GetAddress(),
2929
amount, types.Unbonded, val[1], true)
30-
chainA.App.GetStakingKeeper().Delegate(chainA.GetContext(), chainA.SenderAccounts[3].SenderAccount.GetAddress(),
30+
chainA.GetSimApp().StakingKeeper.Delegate(chainA.GetContext(), chainA.SenderAccounts[3].SenderAccount.GetAddress(),
3131
amount2, types.Unbonded, val[3], true)
3232

3333
coord.CommitBlock(chainA)

‎testing/simapp/app.go

+28-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ import (
8888
tmos "github.com/tendermint/tendermint/libs/os"
8989
dbm "github.com/tendermint/tm-db"
9090

91+
<<<<<<< HEAD
9192
ica "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts"
9293
icacontroller "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller"
9394
icacontrollerkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/controller/keeper"
@@ -113,6 +114,32 @@ import (
113114
simappparams "github.com/cosmos/ibc-go/v6/testing/simapp/params"
114115
simappupgrades "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades"
115116
v6 "github.com/cosmos/ibc-go/v6/testing/simapp/upgrades/v6"
117+
=======
118+
ica "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts"
119+
icacontroller "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller"
120+
icacontrollerkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper"
121+
icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types"
122+
icahost "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host"
123+
icahostkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/keeper"
124+
icahosttypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/types"
125+
icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types"
126+
ibcfee "github.com/cosmos/ibc-go/v5/modules/apps/29-fee"
127+
ibcfeekeeper "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/keeper"
128+
ibcfeetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types"
129+
transfer "github.com/cosmos/ibc-go/v5/modules/apps/transfer"
130+
ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper"
131+
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
132+
ibc "github.com/cosmos/ibc-go/v5/modules/core"
133+
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
134+
ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client"
135+
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
136+
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types"
137+
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
138+
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
139+
ibcmock "github.com/cosmos/ibc-go/v5/testing/mock"
140+
simappparams "github.com/cosmos/ibc-go/v5/testing/simapp/params"
141+
ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types"
142+
>>>>>>> 4d4dbcf (chore: set up IBCTestStakingKeeper interface (#2028))
116143
)
117144

118145
const appName = "SimApp"
@@ -768,7 +795,7 @@ func (app *SimApp) GetBaseApp() *baseapp.BaseApp {
768795
}
769796

770797
// GetStakingKeeper implements the TestingApp interface.
771-
func (app *SimApp) GetStakingKeeper() stakingkeeper.Keeper {
798+
func (app *SimApp) GetStakingKeeper() ibctestingtypes.StakingKeeper {
772799
return app.StakingKeeper
773800
}
774801

‎testing/types/expected_keepers.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package types
2+
3+
import (
4+
sdk "github.com/cosmos/cosmos-sdk/types"
5+
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
6+
)
7+
8+
// StakingKeeper defines the expected staking keeper interface used in the
9+
// IBC testing package
10+
type StakingKeeper interface {
11+
GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)
12+
}

0 commit comments

Comments
 (0)
Please sign in to comment.