-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: cosmos-sdk 0.46 is not used #828
Changes from 3 commits
7834930
d213eb2
2e3ddda
c9c7578
6e199b8
4ed8dc8
2b52324
e1e921a
567cfa3
aa6e445
126228a
ae5613e
055edb5
7729321
93d4346
720c5cd
cf37877
9d3ec19
a7d1c44
62d73b0
bf99a30
5c96dab
9e26bbc
1651de4
b48e949
f884d9f
d1cf1c5
4adfb00
93dee51
dd02033
8cf0f04
a026553
30cbacc
4f0cf37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ import ( | |
"github.com/cosmos/cosmos-sdk/baseapp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should x/group (https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0) be added in this PR or a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a different PR with corresponding integration test together? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes + upgrade handler |
||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice" | ||
"github.com/cosmos/cosmos-sdk/client/rpc" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/codec/types" | ||
"github.com/cosmos/cosmos-sdk/server/api" | ||
|
@@ -33,7 +32,6 @@ import ( | |
"github.com/cosmos/cosmos-sdk/version" | ||
"github.com/cosmos/cosmos-sdk/x/auth" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" | ||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" | ||
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" | ||
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" | ||
|
@@ -58,24 +56,26 @@ import ( | |
"github.com/cosmos/cosmos-sdk/x/gov" | ||
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" | ||
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts" | ||
icacontroller "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller" | ||
icacontrollerkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/keeper" | ||
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types" | ||
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host" | ||
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper" | ||
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" | ||
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" | ||
transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer" | ||
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" | ||
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" | ||
ibc "github.com/cosmos/ibc-go/v4/modules/core" | ||
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client" | ||
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client" | ||
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" | ||
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" | ||
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" | ||
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" | ||
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" | ||
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" | ||
ica "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts" | ||
icacontroller "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller" | ||
icacontrollerkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper" | ||
icacontrollertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" | ||
icahost "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host" | ||
icahostkeeper "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/keeper" | ||
icahosttypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/host/types" | ||
icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types" | ||
transfer "github.com/cosmos/ibc-go/v5/modules/apps/transfer" | ||
ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper" | ||
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" | ||
ibc "github.com/cosmos/ibc-go/v5/modules/core" | ||
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client" | ||
ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client" | ||
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" | ||
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" | ||
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host" | ||
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" | ||
|
||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/cosmos/cosmos-sdk/x/mint" | ||
|
@@ -115,9 +115,9 @@ import ( | |
feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" | ||
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" | ||
|
||
ibcfee "github.com/cosmos/ibc-go/v4/modules/apps/29-fee" | ||
ibcfeekeeper "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/keeper" | ||
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types" | ||
ibcfee "github.com/cosmos/ibc-go/v5/modules/apps/29-fee" | ||
ibcfeekeeper "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/keeper" | ||
ibcfeetypes "github.com/cosmos/ibc-go/v5/modules/apps/29-fee/types" | ||
|
||
icaauthmodule "github.com/crypto-org-chain/chain-main/v4/x/icaauth" | ||
icaauthmodulekeeper "github.com/crypto-org-chain/chain-main/v4/x/icaauth/keeper" | ||
|
@@ -181,11 +181,11 @@ var ( | |
wasmclient.ProposalHandlers, | ||
paramsclient.ProposalHandler, | ||
distrclient.ProposalHandler, | ||
upgradeclient.ProposalHandler, | ||
upgradeclient.CancelProposalHandler, | ||
upgradeclient.LegacyProposalHandler, | ||
upgradeclient.LegacyCancelProposalHandler, | ||
ibcclientclient.UpdateClientProposalHandler, | ||
ibcclientclient.UpgradeProposalHandler, | ||
)..., | ||
), | ||
), | ||
params.AppModuleBasic{}, | ||
slashing.AppModuleBasic{}, | ||
|
@@ -239,9 +239,9 @@ type ChainApp struct { | |
invCheckPeriod uint | ||
|
||
// keys to access the substores | ||
keys map[string]*sdk.KVStoreKey | ||
tkeys map[string]*sdk.TransientStoreKey | ||
memKeys map[string]*sdk.MemoryStoreKey | ||
keys map[string]*storetypes.KVStoreKey | ||
tkeys map[string]*storetypes.TransientStoreKey | ||
memKeys map[string]*storetypes.MemoryStoreKey | ||
|
||
// keepers | ||
AccountKeeper authkeeper.AccountKeeper | ||
|
@@ -337,7 +337,7 @@ func New( | |
app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) | ||
|
||
// set the BaseApp's parameter store | ||
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) | ||
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())) | ||
|
||
// add capability keeper and ScopeToModule for ibc module | ||
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) | ||
|
@@ -351,7 +351,7 @@ func New( | |
|
||
// add keepers | ||
app.AccountKeeper = authkeeper.NewAccountKeeper( | ||
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, | ||
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), | ||
) | ||
app.BankKeeper = bankkeeper.NewBaseKeeper( | ||
appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), | ||
|
@@ -365,21 +365,21 @@ func New( | |
) | ||
app.DistrKeeper = distrkeeper.NewKeeper( | ||
appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper, | ||
&stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), | ||
&stakingKeeper, authtypes.FeeCollectorName, | ||
) | ||
app.SlashingKeeper = slashingkeeper.NewKeeper( | ||
appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), | ||
) | ||
app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) | ||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) | ||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) | ||
|
||
// register the staking hooks | ||
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks | ||
app.StakingKeeper = *stakingKeeper.SetHooks( | ||
stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), | ||
) | ||
|
||
app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter()) | ||
app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), app.AccountKeeper) | ||
|
||
app.chainmainKeeper = *chainmainkeeper.NewKeeper( | ||
appCodec, keys[chainmaintypes.StoreKey], keys[chainmaintypes.MemStoreKey], | ||
|
@@ -395,8 +395,8 @@ func New( | |
) | ||
|
||
// register the proposal types | ||
govRouter := govtypes.NewRouter() | ||
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). | ||
govRouter := govv1beta1.NewRouter() | ||
govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). | ||
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). | ||
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). | ||
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). | ||
|
@@ -501,9 +501,14 @@ func New( | |
govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) | ||
} | ||
|
||
govConfig := govtypes.DefaultConfig() | ||
/* | ||
Example of setting gov params: | ||
govConfig.MaxMetadataLen = 10000 | ||
*/ | ||
govKeeper := govkeeper.NewKeeper( | ||
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, | ||
&stakingKeeper, govRouter, | ||
&stakingKeeper, govRouter, app.MsgServiceRouter(), govConfig, | ||
) | ||
app.GovKeeper = *govKeeper.SetHooks( | ||
govtypes.NewMultiGovHooks( | ||
|
@@ -533,7 +538,7 @@ func New( | |
capability.NewAppModule(appCodec, *app.CapabilityKeeper), | ||
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), | ||
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), | ||
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), | ||
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), | ||
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), | ||
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), | ||
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), | ||
|
@@ -602,7 +607,7 @@ func New( | |
capability.NewAppModule(appCodec, *app.CapabilityKeeper), | ||
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), | ||
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), | ||
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), | ||
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), | ||
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), | ||
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), | ||
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), | ||
|
@@ -828,21 +833,21 @@ func (app *ChainApp) InterfaceRegistry() types.InterfaceRegistry { | |
// GetKey returns the KVStoreKey for the provided store key. | ||
// | ||
// NOTE: This is solely to be used for testing purposes. | ||
func (app *ChainApp) GetKey(storeKey string) *sdk.KVStoreKey { | ||
func (app *ChainApp) GetKey(storeKey string) *storetypes.KVStoreKey { | ||
return app.keys[storeKey] | ||
} | ||
|
||
// GetTKey returns the TransientStoreKey for the provided store key. | ||
// | ||
// NOTE: This is solely to be used for testing purposes. | ||
func (app *ChainApp) GetTKey(storeKey string) *sdk.TransientStoreKey { | ||
func (app *ChainApp) GetTKey(storeKey string) *storetypes.TransientStoreKey { | ||
return app.tkeys[storeKey] | ||
} | ||
|
||
// GetMemKey returns the MemStoreKey for the provided mem key. | ||
// | ||
// NOTE: This is solely used for testing purposes. | ||
func (app *ChainApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey { | ||
func (app *ChainApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { | ||
return app.memKeys[storeKey] | ||
} | ||
|
||
|
@@ -863,16 +868,12 @@ func (app *ChainApp) SimulationManager() *module.SimulationManager { | |
// API server. | ||
func (app *ChainApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { | ||
clientCtx := apiSvr.ClientCtx | ||
rpc.RegisterRoutes(clientCtx, apiSvr.Router) | ||
// Register legacy tx routes. | ||
authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) | ||
// Register new tx routes from grpc-gateway. | ||
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) | ||
// Register new tendermint queries routes from grpc-gateway. | ||
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) | ||
|
||
// Register legacy and grpc-gateway routes for all modules. | ||
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) | ||
// Register grpc-gateway routes for all modules. | ||
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) | ||
|
||
// register swagger API from root so that other applications can override easily | ||
|
@@ -888,7 +889,7 @@ func (app *ChainApp) RegisterTxService(clientCtx client.Context) { | |
|
||
// RegisterTendermintService implements the Application.RegisterTendermintService method. | ||
func (app *ChainApp) RegisterTendermintService(clientCtx client.Context) { | ||
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) | ||
tmservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query) | ||
} | ||
|
||
// RegisterSwaggerAPI registers swagger route with API Server | ||
|
@@ -914,7 +915,7 @@ func GetMaccPerms() map[string][]string { | |
// initParamsKeeper init params keeper and its subspaces | ||
// (Amino is still needed for Ledger at the moment) | ||
// nolint: staticcheck | ||
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { | ||
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { | ||
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) | ||
|
||
paramsKeeper.Subspace(authtypes.ModuleName) | ||
|
@@ -923,7 +924,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino | |
paramsKeeper.Subspace(minttypes.ModuleName) | ||
paramsKeeper.Subspace(distrtypes.ModuleName) | ||
paramsKeeper.Subspace(slashingtypes.ModuleName) | ||
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) | ||
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) | ||
paramsKeeper.Subspace(ibctransfertypes.ModuleName) | ||
paramsKeeper.Subspace(ibchost.ModuleName) | ||
paramsKeeper.Subspace(icacontrollertypes.SubModuleName) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may no need to exclude globally, but just on the relevant places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done