@@ -47,7 +47,7 @@ import (
47
47
"github.com/cosmos/cosmos-sdk/x/crisis"
48
48
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
49
49
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
50
- distr "github.com/cosmos/cosmos-sdk/x/distribution"
50
+ "github.com/cosmos/cosmos-sdk/x/distribution"
51
51
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
52
52
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
53
53
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
@@ -104,9 +104,11 @@ import (
104
104
const Name = "fetchd"
105
105
106
106
var (
107
+ // ProposalsEnabled controls x/wasm Proposals
107
108
// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
108
109
// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
109
110
ProposalsEnabled = "false"
111
+ // EnableSpecificProposals allows to enable only specific x/wasm proposals
110
112
// If set to non-empty string it must be comma-separated list of values that are all a subset
111
113
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
112
114
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
@@ -144,7 +146,7 @@ var (
144
146
capability.AppModuleBasic {},
145
147
staking.AppModuleBasic {},
146
148
mint.AppModuleBasic {},
147
- distr .AppModuleBasic {},
149
+ distribution .AppModuleBasic {},
148
150
gov .NewAppModuleBasic (
149
151
append (
150
152
wasmclient .ProposalHandlers ,
@@ -239,8 +241,6 @@ type App struct {
239
241
240
242
// the module manager
241
243
mm * module.Manager
242
-
243
- configurator module.Configurator
244
244
}
245
245
246
246
// New returns a reference to an initialized Gaia.
@@ -343,7 +343,7 @@ func New(
343
343
govRouter := govtypes .NewRouter ()
344
344
govRouter .AddRoute (govtypes .RouterKey , govtypes .ProposalHandler ).
345
345
AddRoute (paramproposal .RouterKey , params .NewParamChangeProposalHandler (app .ParamsKeeper )).
346
- AddRoute (distrtypes .RouterKey , distr .NewCommunityPoolSpendProposalHandler (app .DistrKeeper )).
346
+ AddRoute (distrtypes .RouterKey , distribution .NewCommunityPoolSpendProposalHandler (app .DistrKeeper )).
347
347
AddRoute (upgradetypes .RouterKey , upgrade .NewSoftwareUpgradeProposalHandler (app .UpgradeKeeper )).
348
348
AddRoute (ibcclienttypes .RouterKey , ibcclient .NewClientProposalHandler (app .IBCKeeper .ClientKeeper ))
349
349
@@ -434,7 +434,7 @@ func New(
434
434
gov .NewAppModule (appCodec , app .GovKeeper , app .AccountKeeper , app .BankKeeper ),
435
435
mint .NewAppModule (appCodec , app .MintKeeper , app .AccountKeeper ),
436
436
slashing .NewAppModule (appCodec , app .SlashingKeeper , app .AccountKeeper , app .BankKeeper , app .StakingKeeper ),
437
- distr .NewAppModule (appCodec , app .DistrKeeper , app .AccountKeeper , app .BankKeeper , app .StakingKeeper ),
437
+ distribution .NewAppModule (appCodec , app .DistrKeeper , app .AccountKeeper , app .BankKeeper , app .StakingKeeper ),
438
438
staking .NewAppModule (appCodec , app .StakingKeeper , app .AccountKeeper , app .BankKeeper ),
439
439
upgrade .NewAppModule (app .UpgradeKeeper ),
440
440
evidence .NewAppModule (app .EvidenceKeeper ),
@@ -446,7 +446,7 @@ func New(
446
446
wasm .NewAppModule (appCodec , & app .WasmKeeper , app .StakingKeeper ),
447
447
)
448
448
449
- // During begin block slashing happens after distr .BeginBlocker so that
449
+ // During begin block slashing happens after distribution .BeginBlocker so that
450
450
// there is nothing left over in the validator fee pool, so as to keep the
451
451
// CanWithdrawInvariant invariant.
452
452
// NOTE: staking module is required if HistoricalEntries param > 0
@@ -523,8 +523,10 @@ func New(
523
523
524
524
app .mm .RegisterInvariants (& app .CrisisKeeper )
525
525
app .mm .RegisterRoutes (app .Router (), app .QueryRouter (), encodingConfig .Amino )
526
- app .configurator = module .NewConfigurator (app .appCodec , app .MsgServiceRouter (), app .GRPCQueryRouter ())
527
- app .mm .RegisterServices (app .configurator )
526
+ cfg := module .NewConfigurator (app .appCodec , app .MsgServiceRouter (), app .GRPCQueryRouter ())
527
+
528
+ app .RegisterUpgradeHandlers (cfg )
529
+ app .mm .RegisterServices (cfg )
528
530
529
531
// initialize stores
530
532
app .MountKVStores (keys )
@@ -599,6 +601,7 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res
599
601
if err := tmjson .Unmarshal (req .AppStateBytes , & genesisState ); err != nil {
600
602
panic (err )
601
603
}
604
+ app .UpgradeKeeper .SetModuleVersionMap (ctx , app .mm .GetVersionMap ())
602
605
return app .mm .InitGenesis (ctx , app .appCodec , genesisState )
603
606
}
604
607
@@ -667,6 +670,32 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace {
667
670
return subspace
668
671
}
669
672
673
+ func (app * App ) RegisterUpgradeHandlers (cfg module.Configurator ) {
674
+ app .UpgradeKeeper .SetUpgradeHandler ("fetchd-v0.10.4" , func (ctx sdk.Context , plan upgradetypes.Plan , fromVM module.VersionMap ) (module.VersionMap , error ) {
675
+ // manually add every existing modules to prevent the migration calling InitGenesis on them
676
+ fromVM [authz .ModuleName ] = authzmodule.AppModule {}.ConsensusVersion ()
677
+ fromVM [banktypes .ModuleName ] = bank.AppModule {}.ConsensusVersion ()
678
+ fromVM [capabilitytypes .ModuleName ] = capability.AppModule {}.ConsensusVersion ()
679
+ fromVM [crisistypes .ModuleName ] = crisis.AppModule {}.ConsensusVersion ()
680
+ fromVM [distrtypes .ModuleName ] = distribution.AppModule {}.ConsensusVersion ()
681
+ fromVM [stakingtypes .ModuleName ] = staking.AppModule {}.ConsensusVersion ()
682
+ fromVM [evidencetypes .ModuleName ] = evidence.AppModule {}.ConsensusVersion ()
683
+ fromVM [feegrant .ModuleName ] = feegrantmodule.AppModule {}.ConsensusVersion ()
684
+ fromVM [genutiltypes .ModuleName ] = genutil.AppModule {}.ConsensusVersion ()
685
+ fromVM [govtypes .ModuleName ] = gov.AppModule {}.ConsensusVersion ()
686
+ fromVM [ibchost .ModuleName ] = ibc.AppModule {}.ConsensusVersion ()
687
+ fromVM [minttypes .ModuleName ] = mint.AppModule {}.ConsensusVersion ()
688
+ fromVM [paramstypes .ModuleName ] = params.AppModule {}.ConsensusVersion ()
689
+ fromVM [slashingtypes .ModuleName ] = slashing.AppModule {}.ConsensusVersion ()
690
+ fromVM [ibctransfertypes .ModuleName ] = transfer.AppModule {}.ConsensusVersion ()
691
+ fromVM [authtypes .ModuleName ] = auth.AppModule {}.ConsensusVersion ()
692
+ fromVM [upgradetypes .ModuleName ] = upgrade.AppModule {}.ConsensusVersion ()
693
+ fromVM [vestingtypes .ModuleName ] = vesting.AppModule {}.ConsensusVersion ()
694
+ fromVM [wasm .ModuleName ] = wasm.AppModule {}.ConsensusVersion ()
695
+ return app .mm .RunMigrations (ctx , cfg , fromVM )
696
+ })
697
+ }
698
+
670
699
// RegisterAPIRoutes registers all application module routes with the provided
671
700
// API server.
672
701
func (app * App ) RegisterAPIRoutes (apiSvr * api.Server , apiConfig config.APIConfig ) {
0 commit comments