Skip to content

Commit 5cf47bf

Browse files
committed
feat: upgrade ibc to v10
Signed-off-by: Artur Troian <[email protected]>
1 parent 14110ca commit 5cf47bf

File tree

10 files changed

+117
-157
lines changed

10 files changed

+117
-157
lines changed

app/app.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ import (
5555
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
5656
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
5757
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
58-
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
59-
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
60-
ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported"
61-
"github.com/cosmos/ibc-go/v8/testing/simapp"
58+
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
59+
ibchost "github.com/cosmos/ibc-go/v10/modules/core/exported"
60+
"github.com/cosmos/ibc-go/v10/testing/simapp"
6261

6362
cflags "pkg.akt.dev/go/cli/flags"
6463
audittypes "pkg.akt.dev/go/node/audit/v1"
@@ -219,7 +218,6 @@ func NewApp(
219218
// initialize stores
220219
app.MountKVStores(app.GetKVStoreKey())
221220
app.MountTransientStores(app.GetTransientStoreKey())
222-
app.MountMemoryStores(app.GetMemoryStoreKey())
223221

224222
anteOpts := HandlerOptions{
225223
HandlerOptions: ante.HandlerOptions{
@@ -267,7 +265,6 @@ func NewApp(
267265
func orderBeginBlockers(_ []string) []string {
268266
return []string{
269267
upgradetypes.ModuleName,
270-
capabilitytypes.ModuleName,
271268
banktypes.ModuleName,
272269
paramstypes.ModuleName,
273270
deploymenttypes.ModuleName,
@@ -299,7 +296,6 @@ func OrderEndBlockers(_ []string) []string {
299296
govtypes.ModuleName,
300297
stakingtypes.ModuleName,
301298
upgradetypes.ModuleName,
302-
capabilitytypes.ModuleName,
303299
banktypes.ModuleName,
304300
paramstypes.ModuleName,
305301
deploymenttypes.ModuleName,

app/app_configure.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import (
1818
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
1919
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
2020
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
21-
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
22-
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
23-
ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported"
21+
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
22+
ibchost "github.com/cosmos/ibc-go/v10/modules/core/exported"
2423

2524
audittypes "pkg.akt.dev/go/node/audit/v1"
2625
taketypes "pkg.akt.dev/go/node/take/v1"
@@ -54,7 +53,6 @@ func akashModuleBasics() []module.AppModuleBasic {
5453
// can do so safely.
5554
func OrderInitGenesis(_ []string) []string {
5655
return []string{
57-
capabilitytypes.ModuleName,
5856
authtypes.ModuleName,
5957
authz.ModuleName,
6058
banktypes.ModuleName,

app/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"github.com/cosmos/cosmos-sdk/x/slashing"
2323
"github.com/cosmos/cosmos-sdk/x/staking"
2424
"github.com/cosmos/ibc-go/modules/capability"
25-
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
26-
ibc "github.com/cosmos/ibc-go/v8/modules/core"
27-
ibclightclient "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
25+
"github.com/cosmos/ibc-go/v10/modules/apps/transfer"
26+
ibc "github.com/cosmos/ibc-go/v10/modules/core"
27+
ibclightclient "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
2828
)
2929

3030
var mbasics = module.NewBasicManager(

app/mac.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
77
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
88
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
9-
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
9+
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
1010

1111
escrowtypes "pkg.akt.dev/go/node/escrow/v1"
1212
)

app/modules.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ import (
2626
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
2727
"github.com/cosmos/cosmos-sdk/x/staking"
2828
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
29-
"github.com/cosmos/ibc-go/modules/capability"
30-
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
31-
ibc "github.com/cosmos/ibc-go/v8/modules/core"
32-
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
29+
"github.com/cosmos/ibc-go/v10/modules/apps/transfer"
30+
ibc "github.com/cosmos/ibc-go/v10/modules/core"
31+
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
3332

3433
"pkg.akt.dev/go/sdkutil"
3534

@@ -71,11 +70,6 @@ func appModules(
7170
app.Keepers.Cosmos.Acct,
7271
app.GetSubspace(banktypes.ModuleName),
7372
),
74-
capability.NewAppModule(
75-
cdc,
76-
*app.Keepers.Cosmos.Cap,
77-
false,
78-
),
7973
gov.NewAppModule(
8074
cdc,
8175
app.Keepers.Cosmos.Gov,
@@ -140,7 +134,9 @@ func appModules(
140134
transfer.NewAppModule(
141135
app.Keepers.Cosmos.Transfer,
142136
),
143-
ibctm.NewAppModule(),
137+
ibctm.NewAppModule(
138+
app.Keepers.Modules.TMLight,
139+
),
144140
params.NewAppModule( //nolint: staticcheck
145141
app.Keepers.Cosmos.Params,
146142
),
@@ -225,11 +221,6 @@ func appSimModules(
225221
app.Keepers.Cosmos.FeeGrant,
226222
app.interfaceRegistry,
227223
),
228-
capability.NewAppModule(
229-
app.cdc,
230-
*app.Keepers.Cosmos.Cap,
231-
false,
232-
),
233224
authzmodule.NewAppModule(
234225
app.cdc,
235226
app.Keepers.Cosmos.Authz,

app/sim_test.go

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@ import (
77
"os"
88
"testing"
99

10+
"github.com/spf13/viper"
11+
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
13+
14+
abci "github.com/cometbft/cometbft/abci/types"
15+
1016
"cosmossdk.io/log"
17+
"cosmossdk.io/store"
18+
storetypes "cosmossdk.io/store/types"
1119
evidencetypes "cosmossdk.io/x/evidence/types"
1220
"cosmossdk.io/x/feegrant"
1321
upgradetypes "cosmossdk.io/x/upgrade/types"
22+
dbm "github.com/cosmos/cosmos-db"
23+
"github.com/cosmos/cosmos-sdk/baseapp"
24+
sdksim "github.com/cosmos/cosmos-sdk/types/simulation"
1425
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
1526
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
1627
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@@ -19,13 +30,12 @@ import (
1930
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
2031
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
2132
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
33+
"github.com/cosmos/cosmos-sdk/x/simulation"
2234
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
2335
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
24-
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
25-
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
26-
"github.com/spf13/viper"
27-
"github.com/stretchr/testify/assert"
28-
"github.com/stretchr/testify/require"
36+
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
37+
ibchost "github.com/cosmos/ibc-go/v10/modules/core/exported"
38+
2939
atypes "pkg.akt.dev/go/node/audit/v1"
3040
ctypes "pkg.akt.dev/go/node/cert/v1"
3141
dtypes "pkg.akt.dev/go/node/deployment/v1"
@@ -34,15 +44,6 @@ import (
3444
taketypes "pkg.akt.dev/go/node/take/v1"
3545
"pkg.akt.dev/go/sdkutil"
3646

37-
abci "github.com/cometbft/cometbft/abci/types"
38-
39-
"cosmossdk.io/store"
40-
storetypes "cosmossdk.io/store/types"
41-
dbm "github.com/cosmos/cosmos-db"
42-
"github.com/cosmos/cosmos-sdk/baseapp"
43-
sdksim "github.com/cosmos/cosmos-sdk/types/simulation"
44-
"github.com/cosmos/cosmos-sdk/x/simulation"
45-
4647
akash "pkg.akt.dev/node/app"
4748
"pkg.akt.dev/node/app/sim"
4849
simtestutil "pkg.akt.dev/node/testutil/sims"
@@ -236,6 +237,7 @@ func TestAppImportExport(t *testing.T) {
236237
appB,
237238
[][]byte{
238239
authzkeeper.GrantQueuePrefix,
240+
authzkeeper.GranteeKey,
239241
},
240242
},
241243
{
@@ -291,12 +293,12 @@ func TestAppImportExport(t *testing.T) {
291293
appB,
292294
[][]byte{},
293295
},
294-
// {
295-
// ibchost.StoreKey,
296-
// appA,
297-
// appB,
298-
// [][]byte{},
299-
// },
296+
{
297+
ibchost.StoreKey,
298+
appA,
299+
appB,
300+
[][]byte{},
301+
},
300302
{
301303
ibctransfertypes.StoreKey,
302304
appA,
@@ -319,12 +321,6 @@ func TestAppImportExport(t *testing.T) {
319321
appB,
320322
[][]byte{},
321323
},
322-
{
323-
capabilitytypes.StoreKey,
324-
appA,
325-
appB,
326-
[][]byte{},
327-
},
328324
{
329325
atypes.StoreKey,
330326
appA,

app/types/app.go

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,17 @@ import (
4545
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
4646
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
4747
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
48-
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
49-
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
50-
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
51-
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
52-
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
53-
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
54-
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
55-
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
56-
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
57-
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
58-
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
59-
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
48+
icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"
49+
icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"
50+
"github.com/cosmos/ibc-go/v10/modules/apps/transfer"
51+
ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper"
52+
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
53+
ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
54+
ibcconnectiontypes "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"
55+
porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
56+
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
57+
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"
58+
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
6059

6160
atypes "pkg.akt.dev/go/node/audit/v1"
6261
ctypes "pkg.akt.dev/go/node/cert/v1"
@@ -88,25 +87,22 @@ var ErrEmptyFieldName = errors.New("empty field name")
8887

8988
type AppKeepers struct {
9089
Cosmos struct {
91-
Acct authkeeper.AccountKeeper
92-
Authz authzkeeper.Keeper
93-
FeeGrant feegrantkeeper.Keeper
94-
Bank bankkeeper.Keeper
95-
Cap *capabilitykeeper.Keeper
96-
Staking *stakingkeeper.Keeper
97-
Slashing slashingkeeper.Keeper
98-
Mint mintkeeper.Keeper
99-
Distr distrkeeper.Keeper
100-
Gov *govkeeper.Keeper
101-
Upgrade *upgradekeeper.Keeper
102-
Crisis *crisiskeeper.Keeper //nolint: staticcheck
103-
Params paramskeeper.Keeper //nolint: staticcheck
104-
ConsensusParams *consensusparamkeeper.Keeper
105-
IBC *ibckeeper.Keeper
106-
Evidence *evidencekeeper.Keeper
107-
Transfer ibctransferkeeper.Keeper
108-
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
109-
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
90+
Acct authkeeper.AccountKeeper
91+
Authz authzkeeper.Keeper
92+
FeeGrant feegrantkeeper.Keeper
93+
Bank bankkeeper.Keeper
94+
Staking *stakingkeeper.Keeper
95+
Slashing slashingkeeper.Keeper
96+
Mint mintkeeper.Keeper
97+
Distr distrkeeper.Keeper
98+
Gov *govkeeper.Keeper
99+
Upgrade *upgradekeeper.Keeper
100+
Crisis *crisiskeeper.Keeper //nolint: staticcheck
101+
Params paramskeeper.Keeper //nolint: staticcheck
102+
ConsensusParams *consensusparamkeeper.Keeper
103+
IBC *ibckeeper.Keeper
104+
Evidence *evidencekeeper.Keeper
105+
Transfer ibctransferkeeper.Keeper
110106
}
111107

112108
Akash struct {
@@ -118,6 +114,10 @@ type AppKeepers struct {
118114
Audit akeeper.Keeper
119115
Cert ckeeper.Keeper
120116
}
117+
118+
Modules struct {
119+
TMLight ibctm.LightClientModule
120+
}
121121
}
122122

123123
type App struct {
@@ -224,20 +224,6 @@ func (app *App) InitSpecialKeepers(
224224

225225
bApp.SetParamStore(app.Keepers.Cosmos.ConsensusParams.ParamsStore)
226226

227-
// add capability keeper and ScopeToModule for ibc module
228-
app.Keepers.Cosmos.Cap = capabilitykeeper.NewKeeper(
229-
cdc,
230-
app.keys[capabilitytypes.StoreKey],
231-
app.memKeys[capabilitytypes.MemStoreKey],
232-
)
233-
234-
app.Keepers.Cosmos.ScopedIBCKeeper = app.Keepers.Cosmos.Cap.ScopeToModule(ibcexported.ModuleName)
235-
app.Keepers.Cosmos.ScopedTransferKeeper = app.Keepers.Cosmos.Cap.ScopeToModule(ibctransfertypes.ModuleName)
236-
237-
// seal the capability keeper so all persistent capabilities are loaded in-memory and prevent
238-
// any further modules from creating scoped sub-keepers.
239-
app.Keepers.Cosmos.Cap.Seal()
240-
241227
app.Keepers.Cosmos.Crisis = crisiskeeper.NewKeeper( //nolint: staticcheck
242228
cdc, runtime.NewKVStoreService(app.keys[crisistypes.StoreKey]),
243229
invCheckPeriod,
@@ -324,11 +310,9 @@ func (app *App) InitNormalKeepers(
324310
// register IBC Keeper
325311
app.Keepers.Cosmos.IBC = ibckeeper.NewKeeper(
326312
cdc,
327-
app.keys[ibcexported.StoreKey],
313+
runtime.NewKVStoreService(app.keys[ibcexported.StoreKey]),
328314
app.GetSubspace(ibcexported.ModuleName),
329-
app.Keepers.Cosmos.Staking,
330315
app.Keepers.Cosmos.Upgrade,
331-
app.Keepers.Cosmos.ScopedIBCKeeper,
332316
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
333317
)
334318

@@ -391,14 +375,13 @@ func (app *App) InitNormalKeepers(
391375
// register Transfer Keepers
392376
app.Keepers.Cosmos.Transfer = ibctransferkeeper.NewKeeper(
393377
cdc,
394-
app.keys[ibctransfertypes.StoreKey],
378+
runtime.NewKVStoreService(app.keys[ibctransfertypes.StoreKey]),
395379
app.GetSubspace(ibctransfertypes.ModuleName),
396380
app.Keepers.Cosmos.IBC.ChannelKeeper,
397381
app.Keepers.Cosmos.IBC.ChannelKeeper,
398-
app.Keepers.Cosmos.IBC.PortKeeper,
382+
bApp.MsgServiceRouter(),
399383
app.Keepers.Cosmos.Acct,
400384
app.Keepers.Cosmos.Bank,
401-
app.Keepers.Cosmos.ScopedTransferKeeper,
402385
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
403386
)
404387

@@ -410,6 +393,13 @@ func (app *App) InitNormalKeepers(
410393

411394
app.Keepers.Cosmos.IBC.SetRouter(ibcRouter)
412395

396+
/// Light client modules
397+
clientKeeper := app.Keepers.Cosmos.IBC.ClientKeeper
398+
storeProvider := app.Keepers.Cosmos.IBC.ClientKeeper.GetStoreProvider()
399+
app.Keepers.Modules.TMLight = ibctm.NewLightClientModule(cdc, storeProvider)
400+
401+
clientKeeper.AddRoute(ibctm.ModuleName, &app.Keepers.Modules.TMLight)
402+
413403
app.Keepers.Akash.Take = tkeeper.NewKeeper(
414404
cdc,
415405
app.keys[ttypes.StoreKey],
@@ -526,7 +516,6 @@ func kvStoreKeys() []string {
526516
upgradetypes.StoreKey,
527517
evidencetypes.StoreKey,
528518
ibctransfertypes.StoreKey,
529-
capabilitytypes.StoreKey,
530519
}
531520

532521
keys = append(keys, akashKVStoreKeys()...,
@@ -554,9 +543,7 @@ func transientStoreKeys() []string {
554543
}
555544

556545
func memStoreKeys() []string {
557-
return []string{
558-
capabilitytypes.MemStoreKey,
559-
}
546+
return []string{}
560547
}
561548

562549
// FindStructField if an interface is either a struct or a pointer to a struct

0 commit comments

Comments
 (0)