Skip to content

Commit ef832ed

Browse files
committed
Bump starport version to v0.18.0
Signed-off-by: Hariom Verma <[email protected]>
1 parent 57ab6c3 commit ef832ed

30 files changed

Lines changed: 798 additions & 1375 deletions

app/app.go

Lines changed: 80 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ import (
55
"os"
66
"path/filepath"
77

8-
"github.com/cosmos/cosmos-sdk/client"
9-
"github.com/cosmos/cosmos-sdk/codec/types"
10-
"github.com/spf13/cast"
11-
abci "github.com/tendermint/tendermint/abci/types"
12-
"github.com/tendermint/tendermint/libs/log"
13-
tmos "github.com/tendermint/tendermint/libs/os"
14-
dbm "github.com/tendermint/tm-db"
15-
168
"github.com/cosmos/cosmos-sdk/baseapp"
9+
"github.com/cosmos/cosmos-sdk/client"
1710
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
1811
"github.com/cosmos/cosmos-sdk/client/rpc"
1912
"github.com/cosmos/cosmos-sdk/codec"
13+
"github.com/cosmos/cosmos-sdk/codec/types"
2014
"github.com/cosmos/cosmos-sdk/server/api"
2115
"github.com/cosmos/cosmos-sdk/server/config"
2216
servertypes "github.com/cosmos/cosmos-sdk/server/types"
@@ -46,20 +40,15 @@ import (
4640
"github.com/cosmos/cosmos-sdk/x/evidence"
4741
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
4842
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
43+
"github.com/cosmos/cosmos-sdk/x/feegrant"
44+
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
45+
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
4946
"github.com/cosmos/cosmos-sdk/x/genutil"
5047
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
5148
"github.com/cosmos/cosmos-sdk/x/gov"
5249
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
5350
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
5451
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
55-
transfer "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer"
56-
ibctransferkeeper "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/keeper"
57-
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
58-
ibc "github.com/cosmos/cosmos-sdk/x/ibc/core"
59-
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/core/02-client"
60-
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/core/05-port/types"
61-
ibchost "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host"
62-
ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/core/keeper"
6352
"github.com/cosmos/cosmos-sdk/x/mint"
6453
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
6554
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
@@ -78,17 +67,32 @@ import (
7867
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
7968
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
8069
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
81-
appparams "github.com/gitopia/gitopia/app/params"
82-
tmjson "github.com/tendermint/tendermint/libs/json"
83-
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
84-
85-
// this line is used by starport scaffolding # stargate/app/moduleImport
70+
"github.com/cosmos/ibc-go/modules/apps/transfer"
71+
ibctransferkeeper "github.com/cosmos/ibc-go/modules/apps/transfer/keeper"
72+
ibctransfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
73+
ibc "github.com/cosmos/ibc-go/modules/core"
74+
ibcclient "github.com/cosmos/ibc-go/modules/core/02-client"
75+
ibcporttypes "github.com/cosmos/ibc-go/modules/core/05-port/types"
76+
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
77+
ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper"
8678
"github.com/gitopia/gitopia/x/gitopia"
8779
gitopiakeeper "github.com/gitopia/gitopia/x/gitopia/keeper"
8880
gitopiatypes "github.com/gitopia/gitopia/x/gitopia/types"
81+
"github.com/spf13/cast"
82+
abci "github.com/tendermint/tendermint/abci/types"
83+
tmjson "github.com/tendermint/tendermint/libs/json"
84+
"github.com/tendermint/tendermint/libs/log"
85+
tmos "github.com/tendermint/tendermint/libs/os"
86+
dbm "github.com/tendermint/tm-db"
87+
88+
"github.com/tendermint/spm/cosmoscmd"
89+
// this line is used by starport scaffolding # stargate/app/moduleImport
8990
)
9091

91-
const Name = "gitopia"
92+
const (
93+
AccountAddressPrefix = "gitopia"
94+
Name = "gitopia"
95+
)
9296

9397
// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
9498

@@ -126,13 +130,14 @@ var (
126130
params.AppModuleBasic{},
127131
crisis.AppModuleBasic{},
128132
slashing.AppModuleBasic{},
133+
feegrantmodule.AppModuleBasic{},
129134
ibc.AppModuleBasic{},
130135
upgrade.AppModuleBasic{},
131136
evidence.AppModuleBasic{},
132137
transfer.AppModuleBasic{},
133138
vesting.AppModuleBasic{},
134-
// this line is used by starport scaffolding # stargate/app/moduleBasic
135139
gitopia.AppModuleBasic{},
140+
// this line is used by starport scaffolding # stargate/app/moduleBasic
136141
)
137142

138143
// module account permissions
@@ -144,11 +149,12 @@ var (
144149
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
145150
govtypes.ModuleName: {authtypes.Burner},
146151
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
152+
// this line is used by starport scaffolding # stargate/app/maccPerms
147153
}
148154
)
149155

150156
var (
151-
_ CosmosApp = (*App)(nil)
157+
_ cosmoscmd.CosmosApp = (*App)(nil)
152158
_ servertypes.Application = (*App)(nil)
153159
)
154160

@@ -168,7 +174,7 @@ type App struct {
168174
*baseapp.BaseApp
169175

170176
cdc *codec.LegacyAmino
171-
appCodec codec.Marshaler
177+
appCodec codec.Codec
172178
interfaceRegistry types.InterfaceRegistry
173179

174180
invCheckPeriod uint
@@ -193,44 +199,48 @@ type App struct {
193199
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
194200
EvidenceKeeper evidencekeeper.Keeper
195201
TransferKeeper ibctransferkeeper.Keeper
202+
FeeGrantKeeper feegrantkeeper.Keeper
196203

197204
// make scoped keepers public for test purposes
198205
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
199206
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
200207

201-
// this line is used by starport scaffolding # stargate/app/keeperDeclaration
202-
203208
GitopiaKeeper gitopiakeeper.Keeper
209+
// this line is used by starport scaffolding # stargate/app/keeperDeclaration
204210

205211
// the module manager
206212
mm *module.Manager
207213
}
208214

209215
// New returns a reference to an initialized Gaia.
210-
// NewSimApp returns a reference to an initialized SimApp.
211216
func New(
212-
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
213-
homePath string, invCheckPeriod uint, encodingConfig appparams.EncodingConfig,
214-
// this line is used by starport scaffolding # stargate/app/newArgument
215-
appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
216-
) *App {
217-
217+
logger log.Logger,
218+
db dbm.DB,
219+
traceStore io.Writer,
220+
loadLatest bool,
221+
skipUpgradeHeights map[int64]bool,
222+
homePath string,
223+
invCheckPeriod uint,
224+
encodingConfig cosmoscmd.EncodingConfig,
225+
appOpts servertypes.AppOptions,
226+
baseAppOptions ...func(*baseapp.BaseApp),
227+
) cosmoscmd.App {
218228
appCodec := encodingConfig.Marshaler
219229
cdc := encodingConfig.Amino
220230
interfaceRegistry := encodingConfig.InterfaceRegistry
221231

222232
bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
223233
bApp.SetCommitMultiStoreTracer(traceStore)
224-
bApp.SetAppVersion(version.Version)
234+
bApp.SetVersion(version.Version)
225235
bApp.SetInterfaceRegistry(interfaceRegistry)
226236

227237
keys := sdk.NewKVStoreKeys(
228238
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
229239
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
230-
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
240+
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
231241
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
232-
// this line is used by starport scaffolding # stargate/app/storeKey
233242
gitopiatypes.StoreKey,
243+
// this line is used by starport scaffolding # stargate/app/storeKey
234244
)
235245
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
236246
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
@@ -283,7 +293,9 @@ func New(
283293
app.CrisisKeeper = crisiskeeper.NewKeeper(
284294
app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName,
285295
)
286-
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath)
296+
297+
app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper)
298+
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp)
287299

288300
// register the staking hooks
289301
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
@@ -295,7 +307,7 @@ func New(
295307

296308
// Create IBC Keeper
297309
app.IBCKeeper = ibckeeper.NewKeeper(
298-
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, scopedIBCKeeper,
310+
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper,
299311
)
300312

301313
// register the proposal types
@@ -304,7 +316,7 @@ func New(
304316
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
305317
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
306318
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
307-
AddRoute(ibchost.RouterKey, ibcclient.NewClientUpdateProposalHandler(app.IBCKeeper.ClientKeeper))
319+
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
308320

309321
// Create Transfer Keepers
310322
app.TransferKeeper = ibctransferkeeper.NewKeeper(
@@ -336,8 +348,10 @@ func New(
336348
&stakingKeeper, govRouter,
337349
)
338350

351+
// this line is used by starport scaffolding # stargate/app/keeperDefinition
352+
339353
// Create static IBC router, add transfer route, then set and seal it
340-
ibcRouter := porttypes.NewRouter()
354+
ibcRouter := ibcporttypes.NewRouter()
341355
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule)
342356
// this line is used by starport scaffolding # ibc/app/router
343357
app.IBCKeeper.SetRouter(ibcRouter)
@@ -360,6 +374,7 @@ func New(
360374
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
361375
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
362376
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
377+
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
363378
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants),
364379
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
365380
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
@@ -371,17 +386,18 @@ func New(
371386
ibc.NewAppModule(app.IBCKeeper),
372387
params.NewAppModule(app.ParamsKeeper),
373388
transferModule,
374-
// this line is used by starport scaffolding # stargate/app/appModule
375389
gitopiaModule,
390+
// this line is used by starport scaffolding # stargate/app/appModule
376391
)
377392

378393
// During begin block slashing happens after distr.BeginBlocker so that
379394
// there is nothing left over in the validator fee pool, so as to keep the
380395
// CanWithdrawInvariant invariant.
381396
// NOTE: staking module is required if HistoricalEntries param > 0
382397
app.mm.SetOrderBeginBlockers(
383-
upgradetypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
398+
upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
384399
evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName,
400+
feegrant.ModuleName,
385401
)
386402

387403
app.mm.SetOrderEndBlockers(crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName)
@@ -405,13 +421,13 @@ func New(
405421
genutiltypes.ModuleName,
406422
evidencetypes.ModuleName,
407423
ibctransfertypes.ModuleName,
408-
// this line is used by starport scaffolding # stargate/app/initGenesis
409424
gitopiatypes.ModuleName,
425+
// this line is used by starport scaffolding # stargate/app/initGenesis
410426
)
411427

412428
app.mm.RegisterInvariants(&app.CrisisKeeper)
413429
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
414-
app.mm.RegisterServices(module.NewConfigurator(app.MsgServiceRouter(), app.GRPCQueryRouter()))
430+
app.mm.RegisterServices(module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()))
415431

416432
// initialize stores
417433
app.MountKVStores(keys)
@@ -421,28 +437,27 @@ func New(
421437
// initialize BaseApp
422438
app.SetInitChainer(app.InitChainer)
423439
app.SetBeginBlocker(app.BeginBlocker)
424-
app.SetAnteHandler(
425-
ante.NewAnteHandler(
426-
app.AccountKeeper, app.BankKeeper, ante.DefaultSigVerificationGasConsumer,
427-
encodingConfig.TxConfig.SignModeHandler(),
428-
),
440+
441+
anteHandler, err := ante.NewAnteHandler(
442+
ante.HandlerOptions{
443+
AccountKeeper: app.AccountKeeper,
444+
BankKeeper: app.BankKeeper,
445+
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
446+
FeegrantKeeper: app.FeeGrantKeeper,
447+
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
448+
},
429449
)
450+
if err != nil {
451+
panic(err)
452+
}
453+
454+
app.SetAnteHandler(anteHandler)
430455
app.SetEndBlocker(app.EndBlocker)
431456

432457
if loadLatest {
433458
if err := app.LoadLatestVersion(); err != nil {
434459
tmos.Exit(err.Error())
435460
}
436-
437-
// Initialize and seal the capability keeper so all persistent capabilities
438-
// are loaded in-memory and prevent any further modules from creating scoped
439-
// sub-keepers.
440-
// This must be done during creation of baseapp rather than in InitChain so
441-
// that in-memory capabilities get regenerated on app restart.
442-
// Note that since this reads from the store, we can only perform it when
443-
// `loadLatest` is set to true.
444-
ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{})
445-
app.CapabilityKeeper.InitializeAndSeal(ctx)
446461
}
447462

448463
app.ScopedIBCKeeper = scopedIBCKeeper
@@ -471,6 +486,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
471486
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
472487
panic(err)
473488
}
489+
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
474490
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
475491
}
476492

@@ -501,7 +517,7 @@ func (app *App) LegacyAmino() *codec.LegacyAmino {
501517
//
502518
// NOTE: This is solely to be used for testing purposes as it may be desirable
503519
// for modules to register their own custom testing types.
504-
func (app *App) AppCodec() codec.Marshaler {
520+
func (app *App) AppCodec() codec.Codec {
505521
return app.appCodec
506522
}
507523

@@ -554,6 +570,7 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig
554570
// Register legacy and grpc-gateway routes for all modules.
555571
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
556572
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
573+
557574
}
558575

559576
// RegisterTxService implements the Application.RegisterTxService method.
@@ -576,7 +593,7 @@ func GetMaccPerms() map[string][]string {
576593
}
577594

578595
// initParamsKeeper init params keeper and its subspaces
579-
func initParamsKeeper(appCodec codec.BinaryMarshaler, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
596+
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper {
580597
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
581598

582599
paramsKeeper.Subspace(authtypes.ModuleName)
@@ -589,8 +606,8 @@ func initParamsKeeper(appCodec codec.BinaryMarshaler, legacyAmino *codec.LegacyA
589606
paramsKeeper.Subspace(crisistypes.ModuleName)
590607
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
591608
paramsKeeper.Subspace(ibchost.ModuleName)
592-
// this line is used by starport scaffolding # stargate/app/paramSubspace
593609
paramsKeeper.Subspace(gitopiatypes.ModuleName)
610+
// this line is used by starport scaffolding # stargate/app/paramSubspace
594611

595612
return paramsKeeper
596613
}

app/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ import (
1616
type GenesisState map[string]json.RawMessage
1717

1818
// NewDefaultGenesisState generates the default state for the application.
19-
func NewDefaultGenesisState(cdc codec.JSONMarshaler) GenesisState {
19+
func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState {
2020
return ModuleBasics.DefaultGenesis(cdc)
2121
}

app/params/encoding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// This is provided for compatibility between protobuf and amino implementations.
1111
type EncodingConfig struct {
1212
InterfaceRegistry types.InterfaceRegistry
13-
Marshaler codec.Marshaler
13+
Marshaler codec.Codec
1414
TxConfig client.TxConfig
1515
Amino *codec.LegacyAmino
1616
}

app/prefix.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import (
44
sdk "github.com/cosmos/cosmos-sdk/types"
55
)
66

7-
const (
8-
AccountAddressPrefix = "gitopia"
9-
)
10-
117
var (
128
AccountPubKeyPrefix = AccountAddressPrefix + "pub"
139
ValidatorAddressPrefix = AccountAddressPrefix + "valoper"

0 commit comments

Comments
 (0)