Skip to content

Commit a958e13

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 a958e13

Some content is hidden

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

64 files changed

+3750
-1354
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-test-bins.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
project_name: node
3+
version: 2
4+
dist: ./.cache/goreleaser/test-bins
5+
env:
6+
- GO111MODULE=on
7+
- CGO_ENABLED=1
8+
builds:
9+
- id: akash-darwin-amd64
10+
binary: akash
11+
main: ./cmd/akash
12+
goarch:
13+
- amd64
14+
goos:
15+
- darwin
16+
env:
17+
- CC=o64-clang
18+
- CXX=o64-clang++
19+
flags:
20+
- "-mod={{ .Env.MOD }}"
21+
- "-tags={{ .Env.BUILD_TAGS }}"
22+
- -trimpath
23+
ldflags:
24+
- "{{ .Env.BUILD_VARS }}"
25+
- "{{ .Env.STRIP_FLAGS }}"
26+
- "-linkmode={{ .Env.LINKMODE }}"
27+
- id: akash-darwin-arm64
28+
binary: akash
29+
main: ./cmd/akash
30+
goarch:
31+
- arm64
32+
goos:
33+
- darwin
34+
env:
35+
- CC=oa64-clang
36+
- CXX=oa64-clang++
37+
flags:
38+
- "-mod={{ .Env.MOD }}"
39+
- "-tags={{ .Env.BUILD_TAGS }}"
40+
- -trimpath
41+
ldflags:
42+
- "{{ .Env.BUILD_VARS }}"
43+
- "{{ .Env.STRIP_FLAGS }}"
44+
- "-linkmode={{ .Env.LINKMODE }}"
45+
- id: akash-linux-amd64
46+
binary: akash
47+
main: ./cmd/akash
48+
env:
49+
- CC=x86_64-linux-gnu-gcc
50+
- CXX=x86_64-linux-gnu-g++
51+
goarch:
52+
- amd64
53+
goos:
54+
- linux
55+
flags:
56+
- "-mod={{ .Env.MOD }}"
57+
- "-tags={{ .Env.BUILD_TAGS }}"
58+
- -trimpath
59+
ldflags:
60+
- "{{ .Env.BUILD_VARS }}"
61+
- "{{ .Env.STRIP_FLAGS }}"
62+
- "-linkmode={{ .Env.LINKMODE }}"
63+
- -extldflags "-lc -lrt -lpthread --static"
64+
- id: akash-linux-arm64
65+
binary: akash
66+
main: ./cmd/akash
67+
goarch:
68+
- arm64
69+
goos:
70+
- linux
71+
env:
72+
- CC=aarch64-linux-gnu-gcc
73+
- CXX=aarch64-linux-gnu-g++
74+
flags:
75+
- "-mod={{ .Env.MOD }}"
76+
- "-tags={{ .Env.BUILD_TAGS }}"
77+
- -trimpath
78+
ldflags:
79+
- "{{ .Env.BUILD_VARS }}"
80+
- "{{ .Env.STRIP_FLAGS }}"
81+
- "-linkmode={{ .Env.LINKMODE }}"
82+
- -extldflags "-lc -lrt -lpthread --static"
83+
universal_binaries:
84+
- id: akash-darwin-universal
85+
ids:
86+
- akash-darwin-amd64
87+
- akash-darwin-arm64
88+
replace: true
89+
name_template: "akash"
90+
91+
archives:
92+
- id: wo/version
93+
builds:
94+
- akash-darwin-universal
95+
- akash-linux-amd64
96+
- akash-linux-arm64
97+
name_template: "akash_{{ .Os }}_{{ .Arch }}"
98+
wrap_in_directory: false
99+
formats:
100+
- zip
101+
files:
102+
- none*

.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.

0 commit comments

Comments
 (0)