1+ //go:build !app_v2
2+
13package app
24
35import (
@@ -42,8 +44,6 @@ import (
4244 authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
4345 authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
4446 "github.com/cosmos/cosmos-sdk/x/auth/vesting"
45- vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
46- "github.com/cosmos/cosmos-sdk/x/authz"
4747 authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
4848 authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
4949 "github.com/cosmos/cosmos-sdk/x/bank"
@@ -68,7 +68,6 @@ import (
6868 feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper"
6969 feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
7070 "github.com/cosmos/cosmos-sdk/x/genutil"
71- genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
7271 "github.com/cosmos/cosmos-sdk/x/gov"
7372 govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
7473 govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
@@ -79,11 +78,9 @@ import (
7978 "github.com/cosmos/cosmos-sdk/x/mint"
8079 mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
8180 minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
82- "github.com/cosmos/cosmos-sdk/x/nft"
8381 nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper"
8482 nftmodule "github.com/cosmos/cosmos-sdk/x/nft/module"
8583 "github.com/cosmos/cosmos-sdk/x/params"
86- paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
8784 paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
8885 paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
8986 paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
@@ -94,7 +91,6 @@ import (
9491 stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
9592 stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
9693 "github.com/cosmos/cosmos-sdk/x/upgrade"
97- upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
9894 upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
9995 upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
10096 ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
@@ -104,7 +100,6 @@ import (
104100 icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
105101 icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
106102 icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
107- icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
108103 ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee"
109104 ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper"
110105 ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
@@ -113,16 +108,13 @@ import (
113108 ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
114109 ibc "github.com/cosmos/ibc-go/v7/modules/core"
115110 ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
116- ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
117111 ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
118112 porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
119113 ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
120114 ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
121- ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
122115 "github.com/spf13/cast"
123116
124117 "github.com/CosmWasm/wasmd/x/wasm"
125- wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
126118 wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
127119 wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
128120)
@@ -181,64 +173,6 @@ var (
181173 Bech32PrefixConsPub = Bech32Prefix + sdk .PrefixValidator + sdk .PrefixConsensus + sdk .PrefixPublic
182174)
183175
184- var (
185- // ModuleBasics defines the module BasicManager is in charge of setting up basic,
186- // non-dependant module elements, such as codec registration
187- // and genesis verification.
188- ModuleBasics = module .NewBasicManager (
189- auth.AppModuleBasic {},
190- genutil .NewAppModuleBasic (genutiltypes .DefaultMessageValidator ),
191- bank.AppModuleBasic {},
192- capability.AppModuleBasic {},
193- staking.AppModuleBasic {},
194- mint.AppModuleBasic {},
195- distr.AppModuleBasic {},
196- gov .NewAppModuleBasic (
197- append (
198- wasmclient .ProposalHandlers ,
199- paramsclient .ProposalHandler ,
200- upgradeclient .LegacyProposalHandler ,
201- upgradeclient .LegacyCancelProposalHandler ,
202- ibcclientclient .UpdateClientProposalHandler ,
203- ibcclientclient .UpgradeProposalHandler ,
204- ),
205- ),
206- params.AppModuleBasic {},
207- crisis.AppModuleBasic {},
208- slashing.AppModuleBasic {},
209- feegrantmodule.AppModuleBasic {},
210- upgrade.AppModuleBasic {},
211- evidence.AppModuleBasic {},
212- authzmodule.AppModuleBasic {},
213- groupmodule.AppModuleBasic {},
214- vesting.AppModuleBasic {},
215- nftmodule.AppModuleBasic {},
216- consensus.AppModuleBasic {},
217- // non sdk modules
218- wasm.AppModuleBasic {},
219- ibc.AppModuleBasic {},
220- ibctm.AppModuleBasic {},
221- transfer.AppModuleBasic {},
222- ica.AppModuleBasic {},
223- ibcfee.AppModuleBasic {},
224- )
225-
226- // module account permissions
227- maccPerms = map [string ][]string {
228- authtypes .FeeCollectorName : nil ,
229- distrtypes .ModuleName : nil ,
230- minttypes .ModuleName : {authtypes .Minter },
231- stakingtypes .BondedPoolName : {authtypes .Burner , authtypes .Staking },
232- stakingtypes .NotBondedPoolName : {authtypes .Burner , authtypes .Staking },
233- govtypes .ModuleName : {authtypes .Burner },
234- nft .ModuleName : nil ,
235- ibctransfertypes .ModuleName : {authtypes .Minter , authtypes .Burner },
236- ibcfeetypes .ModuleName : nil ,
237- icatypes .ModuleName : nil ,
238- wasm .ModuleName : {authtypes .Burner },
239- }
240- )
241-
242176var (
243177 _ runtime.AppI = (* WasmApp )(nil )
244178 _ servertypes.Application = (* WasmApp )(nil )
@@ -385,7 +319,7 @@ func NewWasmApp(
385319 appCodec ,
386320 keys [authtypes .StoreKey ],
387321 authtypes .ProtoBaseAccount ,
388- maccPerms ,
322+ GetMaccPerms () ,
389323 Bech32Prefix ,
390324 authtypes .NewModuleAddress (govtypes .ModuleName ).String (),
391325 )
@@ -686,62 +620,9 @@ func NewWasmApp(
686620 crisis .NewAppModule (app .CrisisKeeper , skipGenesisInvariants , app .GetSubspace (crisistypes .ModuleName )), // always be last to make sure that it checks for all invariants and not only part of them
687621 )
688622
689- // During begin block slashing happens after distr.BeginBlocker so that
690- // there is nothing left over in the validator fee pool, so as to keep the
691- // CanWithdrawInvariant invariant.
692- // NOTE: staking module is required if HistoricalEntries param > 0
693- // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
694- app .ModuleManager .SetOrderBeginBlockers (
695- upgradetypes .ModuleName , capabilitytypes .ModuleName , minttypes .ModuleName , distrtypes .ModuleName , slashingtypes .ModuleName ,
696- evidencetypes .ModuleName , stakingtypes .ModuleName ,
697- authtypes .ModuleName , banktypes .ModuleName , govtypes .ModuleName , crisistypes .ModuleName , genutiltypes .ModuleName ,
698- authz .ModuleName , feegrant .ModuleName , nft .ModuleName , group .ModuleName ,
699- paramstypes .ModuleName , vestingtypes .ModuleName , consensusparamtypes .ModuleName ,
700- // additional non simd modules
701- ibctransfertypes .ModuleName ,
702- ibcexported .ModuleName ,
703- icatypes .ModuleName ,
704- ibcfeetypes .ModuleName ,
705- wasm .ModuleName ,
706- )
707-
708- app .ModuleManager .SetOrderEndBlockers (
709- crisistypes .ModuleName , govtypes .ModuleName , stakingtypes .ModuleName ,
710- capabilitytypes .ModuleName , authtypes .ModuleName , banktypes .ModuleName , distrtypes .ModuleName ,
711- slashingtypes .ModuleName , minttypes .ModuleName ,
712- genutiltypes .ModuleName , evidencetypes .ModuleName , authz .ModuleName ,
713- feegrant .ModuleName , nft .ModuleName , group .ModuleName ,
714- paramstypes .ModuleName , upgradetypes .ModuleName , vestingtypes .ModuleName , consensusparamtypes .ModuleName ,
715- // additional non simd modules
716- ibctransfertypes .ModuleName ,
717- ibcexported .ModuleName ,
718- icatypes .ModuleName ,
719- ibcfeetypes .ModuleName ,
720- wasm .ModuleName ,
721- )
623+ app .ModuleManager .SetOrderBeginBlockers (beginBlocker ... )
624+ app .ModuleManager .SetOrderEndBlockers (endBlocker ... )
722625
723- // NOTE: The genutils module must occur after staking so that pools are
724- // properly initialized with tokens from genesis accounts.
725- // NOTE: The genutils module must also occur after auth so that it can access the params from auth.
726- // NOTE: Capability module must occur first so that it can initialize any capabilities
727- // so that other modules that want to create or claim capabilities afterwards in InitChain
728- // can do so safely.
729- // NOTE: wasm module should be at the end as it can call other module functionality direct or via message dispatching during
730- // genesis phase. For example bank transfer, auth account check, staking, ...
731- genesisModuleOrder := []string {
732- capabilitytypes .ModuleName , authtypes .ModuleName , banktypes .ModuleName ,
733- distrtypes .ModuleName , stakingtypes .ModuleName , slashingtypes .ModuleName , govtypes .ModuleName ,
734- minttypes .ModuleName , crisistypes .ModuleName , genutiltypes .ModuleName , evidencetypes .ModuleName , authz .ModuleName ,
735- feegrant .ModuleName , nft .ModuleName , group .ModuleName , paramstypes .ModuleName , upgradetypes .ModuleName ,
736- vestingtypes .ModuleName , consensusparamtypes .ModuleName ,
737- // additional non simd modules
738- ibctransfertypes .ModuleName ,
739- ibcexported .ModuleName ,
740- icatypes .ModuleName ,
741- ibcfeetypes .ModuleName ,
742- // wasm after ibc transfer
743- wasm .ModuleName ,
744- }
745626 app .ModuleManager .SetOrderInitGenesis (genesisModuleOrder ... )
746627 app .ModuleManager .SetOrderExportGenesis (genesisModuleOrder ... )
747628
@@ -1017,12 +898,12 @@ func (app *WasmApp) RegisterNodeService(clientCtx client.Context) {
1017898//
1018899// NOTE: This is solely to be used for testing purposes.
1019900func GetMaccPerms () map [string ][]string {
1020- dupMaccPerms := make (map [string ][]string )
1021- for k , v := range maccPerms {
1022- dupMaccPerms [ k ] = v
901+ dup := make (map [string ][]string )
902+ for _ , perms := range moduleAccPerms {
903+ dup [ perms . Account ] = perms . Permissions
1023904 }
1024905
1025- return dupMaccPerms
906+ return dup
1026907}
1027908
1028909// BlockedAddresses returns all the app's blocked account addresses.
0 commit comments