Skip to content

Commit b677740

Browse files
committed
feat: network upgrade v0.38.0
refs akash-network/AEP#4 Signed-off-by: Artur Troian <[email protected]>
1 parent 42debb1 commit b677740

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3637
-1327
lines changed

.github/.repo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github.com/akash-network/node

.goreleaser-docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
version: 2
33
project_name: node
4+
dist: ./.cache/goreleaser/docker
45
env:
56
- GO111MODULE=on
67
- CGO_ENABLED=1

.goreleaser.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ archives:
115115
- akash-windows-amd64
116116
name_template: "akash_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
117117
wrap_in_directory: false
118-
format: zip
118+
formats:
119+
- zip
119120
files:
120121
- none*
121122
- id: wo/version
@@ -126,7 +127,8 @@ archives:
126127
- akash-windows-amd64
127128
name_template: "akash_{{ .Os }}_{{ .Arch }}"
128129
wrap_in_directory: false
129-
format: zip
130+
formats:
131+
- zip
130132
files:
131133
- none*
132134

app/app.go

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"path/filepath"
99
"time"
1010

11+
"github.com/cosmos/cosmos-sdk/x/authz"
1112
"github.com/cosmos/cosmos-sdk/x/feegrant"
1213
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
1314
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
@@ -113,6 +114,10 @@ var (
113114
allowedReceivingModAcc = map[string]bool{}
114115
)
115116

117+
type ModulesStoreKeys map[string]*sdk.KVStoreKey
118+
type ModulesTransientKeys map[string]*sdk.TransientStoreKey
119+
type ModulesMemoryKeys map[string]*sdk.MemoryStoreKey
120+
116121
// AkashApp extends ABCI application
117122
type AkashApp struct {
118123
*bam.BaseApp
@@ -123,9 +128,9 @@ type AkashApp struct {
123128

124129
invCheckPeriod uint
125130

126-
keys map[string]*sdk.KVStoreKey
127-
tkeys map[string]*sdk.TransientStoreKey
128-
memkeys map[string]*sdk.MemoryStoreKey
131+
skeys ModulesStoreKeys
132+
tkeys ModulesTransientKeys
133+
memkeys ModulesMemoryKeys
129134

130135
// simulation manager
131136
sm *module.SimulationManager
@@ -145,9 +150,6 @@ func NewApp(
145150
appOpts servertypes.AppOptions,
146151
options ...func(*bam.BaseApp),
147152
) *AkashApp {
148-
// find out the genesis time, to be used later in inflation calculation
149-
// genesisTime := getGenesisTime(appOpts, homePath)
150-
151153
// TODO: Remove cdc in favor of appCodec once all modules are migrated.
152154
encodingConfig := MakeEncodingConfig()
153155
appCodec := encodingConfig.Marshaler
@@ -159,32 +161,32 @@ func NewApp(
159161
bapp.SetVersion(version.Version)
160162
bapp.SetInterfaceRegistry(interfaceRegistry)
161163

162-
keys := kvStoreKeys()
163-
tkeys := transientStoreKeys()
164-
memkeys := memStoreKeys()
164+
skeys := modulesStoreKeys()
165+
tkeys := modulesTransientKeys()
166+
memkeys := modulesMemoryKeys()
165167

166168
app := &AkashApp{
167169
BaseApp: bapp,
168170
cdc: cdc,
169171
appCodec: appCodec,
170172
interfaceRegistry: interfaceRegistry,
171173
invCheckPeriod: invCheckPeriod,
172-
keys: keys,
174+
skeys: skeys,
173175
tkeys: tkeys,
174176
memkeys: memkeys,
175177
}
176178
app.Configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
177179

178-
app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey])
180+
app.Keepers.Cosmos.Params = initParamsKeeper(appCodec, cdc, app.skeys[paramstypes.ModuleName], tkeys[paramstypes.ModuleName])
179181

180182
// set the BaseApp's parameter store
181183
bapp.SetParamStore(app.Keepers.Cosmos.Params.Subspace(bam.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))
182184

183185
// add capability keeper and ScopeToModule for ibc module
184186
app.Keepers.Cosmos.Cap = capabilitykeeper.NewKeeper(
185187
appCodec,
186-
app.keys[capabilitytypes.StoreKey],
187-
app.memkeys[capabilitytypes.MemStoreKey],
188+
app.skeys[capabilitytypes.ModuleName],
189+
app.memkeys[capabilitytypes.ModuleName],
188190
)
189191

190192
scopedIBCKeeper := app.Keepers.Cosmos.Cap.ScopeToModule(ibchost.ModuleName)
@@ -196,24 +198,24 @@ func NewApp(
196198

197199
app.Keepers.Cosmos.Acct = authkeeper.NewAccountKeeper(
198200
appCodec,
199-
app.keys[authtypes.StoreKey],
201+
app.skeys[authtypes.ModuleName],
200202
app.GetSubspace(authtypes.ModuleName),
201203
authtypes.ProtoBaseAccount,
202204
MacPerms(),
203205
)
204206

205207
// add authz keeper
206-
app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper(app.keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter())
208+
app.Keepers.Cosmos.Authz = authzkeeper.NewKeeper(app.skeys[authz.ModuleName], appCodec, app.MsgServiceRouter())
207209

208210
app.Keepers.Cosmos.FeeGrant = feegrantkeeper.NewKeeper(
209211
appCodec,
210-
keys[feegrant.StoreKey],
212+
skeys[feegrant.ModuleName],
211213
app.Keepers.Cosmos.Acct,
212214
)
213215

214216
app.Keepers.Cosmos.Bank = bankkeeper.NewBaseKeeper(
215217
appCodec,
216-
app.keys[banktypes.StoreKey],
218+
app.skeys[banktypes.ModuleName],
217219
app.Keepers.Cosmos.Acct,
218220
app.GetSubspace(banktypes.ModuleName),
219221
app.BlockedAddrs(),
@@ -224,7 +226,7 @@ func NewApp(
224226
{
225227
skeeper := stakingkeeper.NewKeeper(
226228
appCodec,
227-
app.keys[stakingtypes.StoreKey],
229+
app.skeys[stakingtypes.ModuleName],
228230
app.Keepers.Cosmos.Acct,
229231
app.Keepers.Cosmos.Bank,
230232
app.GetSubspace(stakingtypes.ModuleName),
@@ -234,7 +236,7 @@ func NewApp(
234236

235237
app.Keepers.Cosmos.Mint = mintkeeper.NewKeeper(
236238
appCodec,
237-
app.keys[minttypes.StoreKey],
239+
app.skeys[minttypes.ModuleName],
238240
app.GetSubspace(minttypes.ModuleName),
239241
app.Keepers.Cosmos.Staking,
240242
app.Keepers.Cosmos.Acct,
@@ -244,7 +246,7 @@ func NewApp(
244246

245247
app.Keepers.Cosmos.Distr = distrkeeper.NewKeeper(
246248
appCodec,
247-
app.keys[distrtypes.StoreKey],
249+
app.skeys[distrtypes.ModuleName],
248250
app.GetSubspace(distrtypes.ModuleName),
249251
app.Keepers.Cosmos.Acct,
250252
app.Keepers.Cosmos.Bank,
@@ -255,7 +257,7 @@ func NewApp(
255257

256258
app.Keepers.Cosmos.Slashing = slashingkeeper.NewKeeper(
257259
appCodec,
258-
app.keys[slashingtypes.StoreKey],
260+
app.skeys[slashingtypes.ModuleName],
259261
app.Keepers.Cosmos.Staking,
260262
app.GetSubspace(slashingtypes.ModuleName),
261263
)
@@ -278,7 +280,7 @@ func NewApp(
278280

279281
app.Keepers.Cosmos.Upgrade = upgradekeeper.NewKeeper(
280282
skipUpgradeHeights,
281-
app.keys[upgradetypes.StoreKey],
283+
app.skeys[upgradetypes.ModuleName],
282284
appCodec,
283285
homePath,
284286
app.BaseApp,
@@ -287,7 +289,7 @@ func NewApp(
287289
// register IBC Keeper
288290
app.Keepers.Cosmos.IBC = ibckeeper.NewKeeper(
289291
appCodec,
290-
app.keys[ibchost.StoreKey],
292+
app.skeys[ibchost.ModuleName],
291293
app.GetSubspace(ibchost.ModuleName),
292294
app.Keepers.Cosmos.Staking,
293295
app.Keepers.Cosmos.Upgrade,
@@ -316,7 +318,7 @@ func NewApp(
316318

317319
app.Keepers.Cosmos.Gov = govkeeper.NewKeeper(
318320
appCodec,
319-
app.keys[govtypes.StoreKey],
321+
app.skeys[govtypes.ModuleName],
320322
app.GetSubspace(govtypes.ModuleName),
321323
app.Keepers.Cosmos.Acct,
322324
app.Keepers.Cosmos.Bank,
@@ -327,7 +329,7 @@ func NewApp(
327329
// register Transfer Keepers
328330
app.Keepers.Cosmos.Transfer = ibctransferkeeper.NewKeeper(
329331
appCodec,
330-
app.keys[ibctransfertypes.StoreKey],
332+
app.skeys[ibctransfertypes.ModuleName],
331333
app.GetSubspace(ibctransfertypes.ModuleName),
332334
app.Keepers.Cosmos.IBC.ChannelKeeper,
333335
app.Keepers.Cosmos.IBC.ChannelKeeper,
@@ -349,7 +351,7 @@ func NewApp(
349351
// create evidence keeper with evidence router
350352
evidenceKeeper := evidencekeeper.NewKeeper(
351353
appCodec,
352-
app.keys[evidencetypes.StoreKey],
354+
app.skeys[evidencetypes.ModuleName],
353355
app.Keepers.Cosmos.Staking,
354356
app.Keepers.Cosmos.Slashing,
355357
)
@@ -411,6 +413,13 @@ func NewApp(
411413
app.MM.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
412414
app.MM.RegisterServices(app.Configurator)
413415

416+
utypes.IterateMigrations(func(module string, version uint64, initfn utypes.NewMigrationFn) {
417+
migrator := initfn(utypes.NewMigrator(app.appCodec, app.skeys[module]))
418+
if err := app.Configurator.RegisterMigration(module, version, migrator.GetHandler()); err != nil {
419+
panic(err)
420+
}
421+
})
422+
414423
// add test gRPC service for testing gRPC queries in isolation
415424
testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{})
416425

@@ -440,7 +449,7 @@ func NewApp(
440449
app.sm.RegisterStoreDecoders()
441450

442451
// initialize stores
443-
app.MountKVStores(keys)
452+
app.MountKVStores(app.skeys.Keys())
444453
app.MountTransientStores(tkeys)
445454
app.MountMemoryStores(memkeys)
446455

@@ -577,13 +586,13 @@ func (app *AkashApp) InterfaceRegistry() codectypes.InterfaceRegistry {
577586
}
578587

579588
// GetKey returns the KVStoreKey for the provided store key.
580-
func (app *AkashApp) GetKey(storeKey string) *sdk.KVStoreKey {
581-
return app.keys[storeKey]
589+
func (app *AkashApp) GetKey(module string) *sdk.KVStoreKey {
590+
return app.skeys[module]
582591
}
583592

584593
// GetTKey returns the TransientStoreKey for the provided store key.
585-
func (app *AkashApp) GetTKey(storeKey string) *sdk.TransientStoreKey {
586-
return app.tkeys[storeKey]
594+
func (app *AkashApp) GetTKey(module string) *sdk.TransientStoreKey {
595+
return app.tkeys[module]
587596
}
588597

589598
// GetSubspace returns a param subspace for a given module name.

app/app_configure.go

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,41 +67,27 @@ func akashModuleBasics() []module.AppModuleBasic {
6767
}
6868
}
6969

70-
func akashKVStoreKeys() []string {
71-
return []string{
72-
take.StoreKey,
73-
escrow.StoreKey,
74-
deployment.StoreKey,
75-
market.StoreKey,
76-
provider.StoreKey,
77-
audit.StoreKey,
78-
cert.StoreKey,
79-
inflation.StoreKey,
80-
astaking.StoreKey,
81-
agov.StoreKey,
82-
}
83-
}
84-
8570
func akashSubspaces(k paramskeeper.Keeper) paramskeeper.Keeper {
8671
k.Subspace(deployment.ModuleName)
8772
k.Subspace(market.ModuleName)
8873
k.Subspace(inflation.ModuleName)
8974
k.Subspace(astaking.ModuleName)
9075
k.Subspace(agov.ModuleName)
9176
k.Subspace(take.ModuleName)
77+
9278
return k
9379
}
9480

9581
func (app *AkashApp) setAkashKeepers() {
9682
app.Keepers.Akash.Take = tkeeper.NewKeeper(
9783
app.appCodec,
98-
app.keys[take.StoreKey],
84+
app.skeys[take.ModuleName],
9985
app.GetSubspace(take.ModuleName),
10086
)
10187

10288
app.Keepers.Akash.Escrow = ekeeper.NewKeeper(
10389
app.appCodec,
104-
app.keys[escrow.StoreKey],
90+
app.skeys[escrow.ModuleName],
10591
app.Keepers.Cosmos.Bank,
10692
app.Keepers.Akash.Take,
10793
app.Keepers.Cosmos.Distr,
@@ -110,14 +96,14 @@ func (app *AkashApp) setAkashKeepers() {
11096

11197
app.Keepers.Akash.Deployment = deployment.NewKeeper(
11298
app.appCodec,
113-
app.keys[deployment.StoreKey],
99+
app.skeys[deployment.ModuleName],
114100
app.GetSubspace(deployment.ModuleName),
115101
app.Keepers.Akash.Escrow,
116102
)
117103

118104
app.Keepers.Akash.Market = market.NewKeeper(
119105
app.appCodec,
120-
app.keys[market.StoreKey],
106+
app.skeys[market.ModuleName],
121107
app.GetSubspace(market.ModuleName),
122108
app.Keepers.Akash.Escrow,
123109
)
@@ -132,34 +118,34 @@ func (app *AkashApp) setAkashKeepers() {
132118

133119
app.Keepers.Akash.Provider = provider.NewKeeper(
134120
app.appCodec,
135-
app.keys[provider.StoreKey],
121+
app.skeys[provider.ModuleName],
136122
)
137123

138124
app.Keepers.Akash.Audit = akeeper.NewKeeper(
139125
app.appCodec,
140-
app.keys[audit.StoreKey],
126+
app.skeys[audit.ModuleName],
141127
)
142128

143129
app.Keepers.Akash.Cert = ckeeper.NewKeeper(
144130
app.appCodec,
145-
app.keys[cert.StoreKey],
131+
app.skeys[cert.ModuleName],
146132
)
147133

148134
app.Keepers.Akash.Inflation = ikeeper.NewKeeper(
149135
app.appCodec,
150-
app.keys[inflation.StoreKey],
136+
app.skeys[inflation.ModuleName],
151137
app.GetSubspace(inflation.ModuleName),
152138
)
153139

154140
app.Keepers.Akash.Staking = astakingkeeper.NewKeeper(
155141
app.appCodec,
156-
app.keys[astaking.StoreKey],
142+
app.skeys[astaking.ModuleName],
157143
app.GetSubspace(astaking.ModuleName),
158144
)
159145

160146
app.Keepers.Akash.Gov = agovkeeper.NewKeeper(
161147
app.appCodec,
162-
app.keys[agov.StoreKey],
148+
app.skeys[agov.ModuleName],
163149
app.GetSubspace(agov.ModuleName),
164150
)
165151
}

0 commit comments

Comments
 (0)