refactor!: migrate to core appmodule.AppModule extension interfaces (#13794)
This commit is contained in:
parent
14c582f30e
commit
ec27c5384b
@ -89,6 +89,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* [#13781](https://github.com/cosmos/cosmos-sdk/pull/13781) Remove `client/keys.KeysCdc`.
|
||||
* [#13803](https://github.com/cosmos/cosmos-sdk/pull/13803) Add an error log if iavl set operation failed.
|
||||
* [#13802](https://github.com/cosmos/cosmos-sdk/pull/13802) Add --output-document flag to the export CLI command to allow writing genesis state to a file.
|
||||
* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) `types/module.Manager` now supports the
|
||||
`cosmossdk.io/core/appmodule.AppModule` API via the new `NewManagerFromMap` constructor.
|
||||
|
||||
### State Machine Breaking
|
||||
|
||||
@ -159,7 +161,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/gov) [#13160](https://github.com/cosmos/cosmos-sdk/pull/13160) Remove custom marshaling of proposl and voteoption.
|
||||
* (types) [#13430](https://github.com/cosmos/cosmos-sdk/pull/13430) Remove unused code `ResponseCheckTx` and `ResponseDeliverTx`
|
||||
* (store) [#13529](https://github.com/cosmos/cosmos-sdk/pull/13529) Add method `LatestVersion` to `MultiStore` interface, add method `SetQueryMultiStore` to baesapp to support alternative `MultiStore` implementation for query service.
|
||||
* (pruning) [#13609]](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning pacakge to be under store pacakge
|
||||
* (pruning) [#13609]](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning package to be under store package
|
||||
* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to
|
||||
extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new
|
||||
`cosmossdk.io/core/appmodule.AppModule` API.
|
||||
|
||||
### CLI Breaking Changes
|
||||
|
||||
|
||||
@ -18,7 +18,13 @@ is typically found in `RegisterAPIRoutes`.
|
||||
|
||||
### AppModule Interface
|
||||
|
||||
Remove `Querier`, `Route` and `LegacyQuerier` from the app module interface. This removes and fully deprecates all legacy queriers. All modules no longer support the REST API previously known as the LCD, and the `sdk.Msg#Route` method won't be used anymore.
|
||||
Support for the `AppModule` `Querier`, `Route` and `LegacyQuerier` methods has been entirely removed from the `AppModule`
|
||||
interface. This removes and fully deprecates all legacy queriers. All modules no longer support the REST API previously
|
||||
known as the LCD, and the `sdk.Msg#Route` method won't be used anymore.
|
||||
|
||||
Most other existing `AppModule` methods have been moved to extension interfaces in preparation for the migration
|
||||
to the `cosmossdk.io/core/appmodule` API in the next release. Most `AppModule` implementations should not be broken
|
||||
by this change.
|
||||
|
||||
### SimApp
|
||||
|
||||
|
||||
@ -81,13 +81,7 @@ All methods, structs and their fields must be public for `depinject`.
|
||||
https://github.com/cosmos/cosmos-sdk/blob/main/x/group/module/module.go#L184-L192
|
||||
```
|
||||
|
||||
2. `ProvideModuleBasic` is calls `WrapAppModuleBasic` for wrapping the module `AppModuleBasic`, so that it can be injected and used by the runtime module.
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/main/x/group/module/module.go#L194-L196
|
||||
```
|
||||
|
||||
3. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies):
|
||||
2. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies):
|
||||
* `depinject` provides the right dependencies to the module.
|
||||
* `depinject` also checks that all dependencies are provided.
|
||||
|
||||
@ -99,19 +93,22 @@ All methods, structs and their fields must be public for `depinject`.
|
||||
https://github.com/cosmos/cosmos-sdk/blob/main/x/group/module/module.go#L198-L208
|
||||
```
|
||||
|
||||
4. Define the module outputs with a public struct that inherits `depinject.Out`:
|
||||
3. Define the module outputs with a public struct that inherits `depinject.Out`:
|
||||
The module outputs are the dependencies that the module provides to other modules. It is usually the module itself and its keeper.
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/main/x/group/module/module.go#L210-L215
|
||||
```
|
||||
|
||||
5. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantitating the module outputs.
|
||||
4. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs.
|
||||
|
||||
```go reference
|
||||
https://github.com/cosmos/cosmos-sdk/blob/main/x/group/module/module.go#L217-L227
|
||||
```
|
||||
|
||||
The `ProvideModule` function should return an instance of `cosmossdk.io/core/appmodule.AppModule` which implements
|
||||
one or more app module extension interfaces for initializing the module.
|
||||
|
||||
Following is the complete app wiring configuration for `group`:
|
||||
|
||||
```go reference
|
||||
|
||||
@ -28,7 +28,7 @@ func (b BaseAppOption) IsManyPerContainerType() {}
|
||||
func init() {
|
||||
appmodule.Register(&runtimev1alpha1.Module{},
|
||||
appmodule.Provide(
|
||||
Provide,
|
||||
ProvideApp,
|
||||
ProvideKVStoreKey,
|
||||
ProvideTransientStoreKey,
|
||||
ProvideMemoryStoreKey,
|
||||
@ -38,7 +38,7 @@ func init() {
|
||||
)
|
||||
}
|
||||
|
||||
func Provide(moduleBasics map[string]AppModuleBasicWrapper) (
|
||||
func ProvideApp() (
|
||||
codectypes.InterfaceRegistry,
|
||||
codec.Codec,
|
||||
*codec.LegacyAmino,
|
||||
@ -49,13 +49,6 @@ func Provide(moduleBasics map[string]AppModuleBasicWrapper) (
|
||||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||
amino := codec.NewLegacyAmino()
|
||||
|
||||
// build codecs
|
||||
basicManager := module.BasicManager{}
|
||||
for name, wrapper := range moduleBasics {
|
||||
basicManager[name] = wrapper
|
||||
wrapper.RegisterInterfaces(interfaceRegistry)
|
||||
wrapper.RegisterLegacyAminoCodec(amino)
|
||||
}
|
||||
std.RegisterInterfaces(interfaceRegistry)
|
||||
std.RegisterLegacyAminoCodec(amino)
|
||||
|
||||
@ -67,7 +60,7 @@ func Provide(moduleBasics map[string]AppModuleBasicWrapper) (
|
||||
interfaceRegistry: interfaceRegistry,
|
||||
cdc: cdc,
|
||||
amino: amino,
|
||||
basicManager: basicManager,
|
||||
basicManager: module.BasicManager{},
|
||||
msgServiceRouter: msgServiceRouter,
|
||||
},
|
||||
}
|
||||
@ -78,23 +71,30 @@ func Provide(moduleBasics map[string]AppModuleBasicWrapper) (
|
||||
type AppInputs struct {
|
||||
depinject.In
|
||||
|
||||
AppConfig *appv1alpha1.Config
|
||||
Config *runtimev1alpha1.Module
|
||||
AppBuilder *AppBuilder
|
||||
Modules map[string]AppModuleWrapper
|
||||
BaseAppOptions []BaseAppOption
|
||||
AppConfig *appv1alpha1.Config
|
||||
Config *runtimev1alpha1.Module
|
||||
AppBuilder *AppBuilder
|
||||
Modules map[string]appmodule.AppModule
|
||||
BaseAppOptions []BaseAppOption
|
||||
InterfaceRegistry codectypes.InterfaceRegistry
|
||||
LegacyAmino *codec.LegacyAmino
|
||||
}
|
||||
|
||||
func SetupAppBuilder(inputs AppInputs) {
|
||||
mm := &module.Manager{Modules: map[string]module.AppModule{}}
|
||||
for name, wrapper := range inputs.Modules {
|
||||
mm.Modules[name] = wrapper.AppModule
|
||||
}
|
||||
mm := module.NewManagerFromMap(inputs.Modules)
|
||||
app := inputs.AppBuilder.app
|
||||
app.baseAppOptions = inputs.BaseAppOptions
|
||||
app.config = inputs.Config
|
||||
app.ModuleManager = mm
|
||||
app.appConfig = inputs.AppConfig
|
||||
|
||||
for name, mod := range inputs.Modules {
|
||||
if basicMod, ok := mod.(module.AppModuleBasic); ok {
|
||||
app.basicManager[name] = basicMod
|
||||
basicMod.RegisterInterfaces(inputs.InterfaceRegistry)
|
||||
basicMod.RegisterLegacyAminoCodec(inputs.LegacyAmino)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func registerStoreKey(wrapper *AppBuilder, key storetypes.StoreKey) {
|
||||
|
||||
@ -17,14 +17,14 @@ type AutoCLIQueryService struct {
|
||||
moduleOptions map[string]*autocliv1.ModuleOptions
|
||||
}
|
||||
|
||||
func NewAutoCLIQueryService(appModules map[string]module.AppModule) *AutoCLIQueryService {
|
||||
func NewAutoCLIQueryService(appModules map[string]interface{}) *AutoCLIQueryService {
|
||||
moduleOptions := map[string]*autocliv1.ModuleOptions{}
|
||||
for modName, mod := range appModules {
|
||||
if autoCliMod, ok := mod.(interface {
|
||||
AutoCLIOptions() *autocliv1.ModuleOptions
|
||||
}); ok {
|
||||
moduleOptions[modName] = autoCliMod.AutoCLIOptions()
|
||||
} else {
|
||||
} else if mod, ok := mod.(module.HasServices); ok {
|
||||
// try to auto-discover options based on the last msg and query
|
||||
// services registered for the module
|
||||
cfg := &autocliConfigurator{}
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
package runtime
|
||||
|
||||
import "github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
// AppModuleWrapper is a type used for injecting a module.AppModule into a
|
||||
// container so that it can be used by the runtime module.
|
||||
type AppModuleWrapper struct {
|
||||
module.AppModule
|
||||
}
|
||||
|
||||
// WrapAppModule wraps a module.AppModule so that it can be injected into
|
||||
// a container for use by the runtime module.
|
||||
func WrapAppModule(appModule module.AppModule) AppModuleWrapper {
|
||||
return AppModuleWrapper{AppModule: appModule}
|
||||
}
|
||||
|
||||
// IsOnePerModuleType identifies this type as a depinject.OnePerModuleType.
|
||||
func (AppModuleWrapper) IsOnePerModuleType() {}
|
||||
|
||||
// AppModuleBasicWrapper is a type used for injecting a module.AppModuleBasic
|
||||
// into a container so that it can be used by the runtime module.
|
||||
type AppModuleBasicWrapper struct {
|
||||
module.AppModuleBasic
|
||||
}
|
||||
|
||||
// WrapAppModuleBasic wraps a module.AppModuleBasic so that it can be injected into
|
||||
// a container for use by the runtime module.
|
||||
func WrapAppModuleBasic(basic module.AppModuleBasic) AppModuleBasicWrapper {
|
||||
return AppModuleBasicWrapper{AppModuleBasic: basic}
|
||||
}
|
||||
|
||||
// IsOnePerModuleType identifies this type as a depinject.OnePerModuleType.
|
||||
func (AppModuleBasicWrapper) IsOnePerModuleType() {}
|
||||
@ -4,6 +4,7 @@ mockgen_cmd="mockgen"
|
||||
$mockgen_cmd -source=client/account_retriever.go -package mock -destination testutil/mock/account_retriever.go
|
||||
$mockgen_cmd -package mock -destination testutil/mock/tendermint_tm_db_DB.go github.com/tendermint/tm-db DB
|
||||
$mockgen_cmd -source=types/module/module.go -package mock -destination testutil/mock/types_module_module.go
|
||||
$mockgen_cmd -source=types/module/mock_appmodule_test.go -package mock -destination testutil/mock/types_mock_appmodule.go
|
||||
$mockgen_cmd -source=types/invariant.go -package mock -destination testutil/mock/types_invariant.go
|
||||
$mockgen_cmd -package mock -destination testutil/mock/grpc_server.go github.com/cosmos/gogoproto/grpc Server
|
||||
$mockgen_cmd -package mock -destination testutil/mock/tendermint_tendermint_libs_log_DB.go github.com/tendermint/tendermint/libs/log Logger
|
||||
|
||||
@ -81,12 +81,14 @@ func TestRunMigrations(t *testing.T) {
|
||||
//
|
||||
// The loop below is the same as calling `RegisterServices` on
|
||||
// ModuleManager, except that we skip x/bank.
|
||||
for _, module := range app.ModuleManager.Modules {
|
||||
if module.Name() == banktypes.ModuleName {
|
||||
for name, mod := range app.ModuleManager.Modules {
|
||||
if name == banktypes.ModuleName {
|
||||
continue
|
||||
}
|
||||
|
||||
module.RegisterServices(configurator)
|
||||
if mod, ok := mod.(module.HasServices); ok {
|
||||
mod.RegisterServices(configurator)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the chain
|
||||
@ -206,7 +208,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
|
||||
// adding during a migration.
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
mockModule := mock.NewMockAppModule(mockCtrl)
|
||||
mockModule := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockDefaultGenesis := json.RawMessage(`{"key": "value"}`)
|
||||
mockModule.EXPECT().DefaultGenesis(gomock.Eq(app.appCodec)).Times(1).Return(mockDefaultGenesis)
|
||||
mockModule.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(app.appCodec), gomock.Eq(mockDefaultGenesis)).Times(1).Return(nil)
|
||||
@ -252,7 +254,9 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
|
||||
ctx := app.NewContext(false, tmproto.Header{})
|
||||
vm := app.UpgradeKeeper.GetModuleVersionMap(ctx)
|
||||
for v, i := range app.ModuleManager.Modules {
|
||||
require.Equal(t, vm[v], i.ConsensusVersion())
|
||||
if i, ok := i.(module.HasConsensusVersion); ok {
|
||||
require.Equal(t, vm[v], i.ConsensusVersion())
|
||||
}
|
||||
}
|
||||
|
||||
require.NotNil(t, app.UpgradeKeeper.GetVersionSetter())
|
||||
|
||||
241
testutil/mock/types_mock_appmodule.go
Normal file
241
testutil/mock/types_mock_appmodule.go
Normal file
@ -0,0 +1,241 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: types/module/mock_appmodule_test.go
|
||||
|
||||
// Package mock is a generated GoMock package.
|
||||
package mock
|
||||
|
||||
import (
|
||||
json "encoding/json"
|
||||
reflect "reflect"
|
||||
|
||||
client "github.com/cosmos/cosmos-sdk/client"
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
types0 "github.com/cosmos/cosmos-sdk/types"
|
||||
module "github.com/cosmos/cosmos-sdk/types/module"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
runtime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
cobra "github.com/spf13/cobra"
|
||||
types1 "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
// MockAppModuleWithAllExtensions is a mock of AppModuleWithAllExtensions interface.
|
||||
type MockAppModuleWithAllExtensions struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockAppModuleWithAllExtensionsMockRecorder
|
||||
}
|
||||
|
||||
// MockAppModuleWithAllExtensionsMockRecorder is the mock recorder for MockAppModuleWithAllExtensions.
|
||||
type MockAppModuleWithAllExtensionsMockRecorder struct {
|
||||
mock *MockAppModuleWithAllExtensions
|
||||
}
|
||||
|
||||
// NewMockAppModuleWithAllExtensions creates a new mock instance.
|
||||
func NewMockAppModuleWithAllExtensions(ctrl *gomock.Controller) *MockAppModuleWithAllExtensions {
|
||||
mock := &MockAppModuleWithAllExtensions{ctrl: ctrl}
|
||||
mock.recorder = &MockAppModuleWithAllExtensionsMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockAppModuleWithAllExtensions) EXPECT() *MockAppModuleWithAllExtensionsMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// BeginBlock mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) BeginBlock(arg0 types0.Context, arg1 types1.RequestBeginBlock) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "BeginBlock", arg0, arg1)
|
||||
}
|
||||
|
||||
// BeginBlock indicates an expected call of BeginBlock.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) BeginBlock(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).BeginBlock), arg0, arg1)
|
||||
}
|
||||
|
||||
// ConsensusVersion mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) ConsensusVersion() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConsensusVersion")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConsensusVersion indicates an expected call of ConsensusVersion.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) ConsensusVersion() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ConsensusVersion))
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DefaultGenesis", arg0)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DefaultGenesis indicates an expected call of DefaultGenesis.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).DefaultGenesis), arg0)
|
||||
}
|
||||
|
||||
// EndBlock mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) EndBlock(arg0 types0.Context, arg1 types1.RequestEndBlock) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "EndBlock", arg0, arg1)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// EndBlock indicates an expected call of EndBlock.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) EndBlock(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).EndBlock), arg0, arg1)
|
||||
}
|
||||
|
||||
// ExportGenesis mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) ExportGenesis(arg0 types0.Context, arg1 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ExportGenesis indicates an expected call of ExportGenesis.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ExportGenesis), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetQueryCmd mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) GetQueryCmd() *cobra.Command {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetQueryCmd")
|
||||
ret0, _ := ret[0].(*cobra.Command)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetQueryCmd indicates an expected call of GetQueryCmd.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) GetQueryCmd() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).GetQueryCmd))
|
||||
}
|
||||
|
||||
// GetTxCmd mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) GetTxCmd() *cobra.Command {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetTxCmd")
|
||||
ret0, _ := ret[0].(*cobra.Command)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// GetTxCmd indicates an expected call of GetTxCmd.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) GetTxCmd() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).GetTxCmd))
|
||||
}
|
||||
|
||||
// InitGenesis mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// InitGenesis indicates an expected call of InitGenesis.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).InitGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Name")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Name indicates an expected call of Name.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) Name() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).Name))
|
||||
}
|
||||
|
||||
// RegisterGRPCGatewayRoutes mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) RegisterGRPCGatewayRoutes(arg0 client.Context, arg1 *runtime.ServeMux) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterGRPCGatewayRoutes", arg0, arg1)
|
||||
}
|
||||
|
||||
// RegisterGRPCGatewayRoutes indicates an expected call of RegisterGRPCGatewayRoutes.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterGRPCGatewayRoutes(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterGRPCGatewayRoutes", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterGRPCGatewayRoutes), arg0, arg1)
|
||||
}
|
||||
|
||||
// RegisterInterfaces mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) RegisterInterfaces(arg0 types.InterfaceRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInterfaces", arg0)
|
||||
}
|
||||
|
||||
// RegisterInterfaces indicates an expected call of RegisterInterfaces.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterInterfaces(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterInterfaces), arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) RegisterInvariants(arg0 types0.InvariantRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInvariants", arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants indicates an expected call of RegisterInvariants.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterInvariants), arg0)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterLegacyAminoCodec", arg0)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec indicates an expected call of RegisterLegacyAminoCodec.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterLegacyAminoCodec(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterLegacyAminoCodec), arg0)
|
||||
}
|
||||
|
||||
// RegisterServices mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) RegisterServices(arg0 module.Configurator) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterServices", arg0)
|
||||
}
|
||||
|
||||
// RegisterServices indicates an expected call of RegisterServices.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).RegisterServices), arg0)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockAppModuleWithAllExtensions) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ValidateGenesis indicates an expected call of ValidateGenesis.
|
||||
func (mr *MockAppModuleWithAllExtensionsMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleWithAllExtensions)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
@ -148,6 +148,94 @@ func (mr *MockAppModuleBasicMockRecorder) ValidateGenesis(arg0, arg1, arg2 inter
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleBasic)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// MockHasName is a mock of HasName interface.
|
||||
type MockHasName struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasNameMockRecorder
|
||||
}
|
||||
|
||||
// MockHasNameMockRecorder is the mock recorder for MockHasName.
|
||||
type MockHasNameMockRecorder struct {
|
||||
mock *MockHasName
|
||||
}
|
||||
|
||||
// NewMockHasName creates a new mock instance.
|
||||
func NewMockHasName(ctrl *gomock.Controller) *MockHasName {
|
||||
mock := &MockHasName{ctrl: ctrl}
|
||||
mock.recorder = &MockHasNameMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasName) EXPECT() *MockHasNameMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockHasName) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Name")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Name indicates an expected call of Name.
|
||||
func (mr *MockHasNameMockRecorder) Name() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockHasName)(nil).Name))
|
||||
}
|
||||
|
||||
// MockHasGenesisBasics is a mock of HasGenesisBasics interface.
|
||||
type MockHasGenesisBasics struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasGenesisBasicsMockRecorder
|
||||
}
|
||||
|
||||
// MockHasGenesisBasicsMockRecorder is the mock recorder for MockHasGenesisBasics.
|
||||
type MockHasGenesisBasicsMockRecorder struct {
|
||||
mock *MockHasGenesisBasics
|
||||
}
|
||||
|
||||
// NewMockHasGenesisBasics creates a new mock instance.
|
||||
func NewMockHasGenesisBasics(ctrl *gomock.Controller) *MockHasGenesisBasics {
|
||||
mock := &MockHasGenesisBasics{ctrl: ctrl}
|
||||
mock.recorder = &MockHasGenesisBasicsMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasGenesisBasics) EXPECT() *MockHasGenesisBasicsMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockHasGenesisBasics) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DefaultGenesis", arg0)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DefaultGenesis indicates an expected call of DefaultGenesis.
|
||||
func (mr *MockHasGenesisBasicsMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).DefaultGenesis), arg0)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockHasGenesisBasics) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ValidateGenesis indicates an expected call of ValidateGenesis.
|
||||
func (mr *MockHasGenesisBasicsMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasGenesisBasics)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// MockAppModuleGenesis is a mock of AppModuleGenesis interface.
|
||||
type MockAppModuleGenesis struct {
|
||||
ctrl *gomock.Controller
|
||||
@ -305,6 +393,85 @@ func (mr *MockAppModuleGenesisMockRecorder) ValidateGenesis(arg0, arg1, arg2 int
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleGenesis)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// MockHasGenesis is a mock of HasGenesis interface.
|
||||
type MockHasGenesis struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasGenesisMockRecorder
|
||||
}
|
||||
|
||||
// MockHasGenesisMockRecorder is the mock recorder for MockHasGenesis.
|
||||
type MockHasGenesisMockRecorder struct {
|
||||
mock *MockHasGenesis
|
||||
}
|
||||
|
||||
// NewMockHasGenesis creates a new mock instance.
|
||||
func NewMockHasGenesis(ctrl *gomock.Controller) *MockHasGenesis {
|
||||
mock := &MockHasGenesis{ctrl: ctrl}
|
||||
mock.recorder = &MockHasGenesisMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasGenesis) EXPECT() *MockHasGenesisMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockHasGenesis) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DefaultGenesis", arg0)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DefaultGenesis indicates an expected call of DefaultGenesis.
|
||||
func (mr *MockHasGenesisMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockHasGenesis)(nil).DefaultGenesis), arg0)
|
||||
}
|
||||
|
||||
// ExportGenesis mocks base method.
|
||||
func (m *MockHasGenesis) ExportGenesis(arg0 types0.Context, arg1 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ExportGenesis indicates an expected call of ExportGenesis.
|
||||
func (mr *MockHasGenesisMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockHasGenesis)(nil).ExportGenesis), arg0, arg1)
|
||||
}
|
||||
|
||||
// InitGenesis mocks base method.
|
||||
func (m *MockHasGenesis) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// InitGenesis indicates an expected call of InitGenesis.
|
||||
func (mr *MockHasGenesisMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockHasGenesis)(nil).InitGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockHasGenesis) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ValidateGenesis indicates an expected call of ValidateGenesis.
|
||||
func (mr *MockHasGenesisMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockHasGenesis)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// MockAppModule is a mock of AppModule interface.
|
||||
type MockAppModule struct {
|
||||
ctrl *gomock.Controller
|
||||
@ -328,20 +495,6 @@ func (m *MockAppModule) EXPECT() *MockAppModuleMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ConsensusVersion mocks base method.
|
||||
func (m *MockAppModule) ConsensusVersion() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConsensusVersion")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConsensusVersion indicates an expected call of ConsensusVersion.
|
||||
func (mr *MockAppModuleMockRecorder) ConsensusVersion() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockAppModule)(nil).ConsensusVersion))
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockAppModule) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
@ -356,20 +509,6 @@ func (mr *MockAppModuleMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Ca
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModule)(nil).DefaultGenesis), arg0)
|
||||
}
|
||||
|
||||
// ExportGenesis mocks base method.
|
||||
func (m *MockAppModule) ExportGenesis(arg0 types0.Context, arg1 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ExportGenesis indicates an expected call of ExportGenesis.
|
||||
func (mr *MockAppModuleMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModule)(nil).ExportGenesis), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetQueryCmd mocks base method.
|
||||
func (m *MockAppModule) GetQueryCmd() *cobra.Command {
|
||||
m.ctrl.T.Helper()
|
||||
@ -398,20 +537,6 @@ func (mr *MockAppModuleMockRecorder) GetTxCmd() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModule)(nil).GetTxCmd))
|
||||
}
|
||||
|
||||
// InitGenesis mocks base method.
|
||||
func (m *MockAppModule) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// InitGenesis indicates an expected call of InitGenesis.
|
||||
func (mr *MockAppModuleMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModule)(nil).InitGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockAppModule) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
@ -450,18 +575,6 @@ func (mr *MockAppModuleMockRecorder) RegisterInterfaces(arg0 interface{}) *gomoc
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockAppModule)(nil).RegisterInterfaces), arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants mocks base method.
|
||||
func (m *MockAppModule) RegisterInvariants(arg0 types0.InvariantRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInvariants", arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants indicates an expected call of RegisterInvariants.
|
||||
func (mr *MockAppModuleMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockAppModule)(nil).RegisterInvariants), arg0)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec mocks base method.
|
||||
func (m *MockAppModule) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -474,18 +587,6 @@ func (mr *MockAppModuleMockRecorder) RegisterLegacyAminoCodec(arg0 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockAppModule)(nil).RegisterLegacyAminoCodec), arg0)
|
||||
}
|
||||
|
||||
// RegisterServices mocks base method.
|
||||
func (m *MockAppModule) RegisterServices(arg0 module.Configurator) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterServices", arg0)
|
||||
}
|
||||
|
||||
// RegisterServices indicates an expected call of RegisterServices.
|
||||
func (mr *MockAppModuleMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockAppModule)(nil).RegisterServices), arg0)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockAppModule) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
@ -500,6 +601,113 @@ func (mr *MockAppModuleMockRecorder) ValidateGenesis(arg0, arg1, arg2 interface{
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModule)(nil).ValidateGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// MockHasInvariants is a mock of HasInvariants interface.
|
||||
type MockHasInvariants struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasInvariantsMockRecorder
|
||||
}
|
||||
|
||||
// MockHasInvariantsMockRecorder is the mock recorder for MockHasInvariants.
|
||||
type MockHasInvariantsMockRecorder struct {
|
||||
mock *MockHasInvariants
|
||||
}
|
||||
|
||||
// NewMockHasInvariants creates a new mock instance.
|
||||
func NewMockHasInvariants(ctrl *gomock.Controller) *MockHasInvariants {
|
||||
mock := &MockHasInvariants{ctrl: ctrl}
|
||||
mock.recorder = &MockHasInvariantsMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasInvariants) EXPECT() *MockHasInvariantsMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// RegisterInvariants mocks base method.
|
||||
func (m *MockHasInvariants) RegisterInvariants(arg0 types0.InvariantRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInvariants", arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants indicates an expected call of RegisterInvariants.
|
||||
func (mr *MockHasInvariantsMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockHasInvariants)(nil).RegisterInvariants), arg0)
|
||||
}
|
||||
|
||||
// MockHasServices is a mock of HasServices interface.
|
||||
type MockHasServices struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasServicesMockRecorder
|
||||
}
|
||||
|
||||
// MockHasServicesMockRecorder is the mock recorder for MockHasServices.
|
||||
type MockHasServicesMockRecorder struct {
|
||||
mock *MockHasServices
|
||||
}
|
||||
|
||||
// NewMockHasServices creates a new mock instance.
|
||||
func NewMockHasServices(ctrl *gomock.Controller) *MockHasServices {
|
||||
mock := &MockHasServices{ctrl: ctrl}
|
||||
mock.recorder = &MockHasServicesMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasServices) EXPECT() *MockHasServicesMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// RegisterServices mocks base method.
|
||||
func (m *MockHasServices) RegisterServices(arg0 module.Configurator) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterServices", arg0)
|
||||
}
|
||||
|
||||
// RegisterServices indicates an expected call of RegisterServices.
|
||||
func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockHasServices)(nil).RegisterServices), arg0)
|
||||
}
|
||||
|
||||
// MockHasConsensusVersion is a mock of HasConsensusVersion interface.
|
||||
type MockHasConsensusVersion struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockHasConsensusVersionMockRecorder
|
||||
}
|
||||
|
||||
// MockHasConsensusVersionMockRecorder is the mock recorder for MockHasConsensusVersion.
|
||||
type MockHasConsensusVersionMockRecorder struct {
|
||||
mock *MockHasConsensusVersion
|
||||
}
|
||||
|
||||
// NewMockHasConsensusVersion creates a new mock instance.
|
||||
func NewMockHasConsensusVersion(ctrl *gomock.Controller) *MockHasConsensusVersion {
|
||||
mock := &MockHasConsensusVersion{ctrl: ctrl}
|
||||
mock.recorder = &MockHasConsensusVersionMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockHasConsensusVersion) EXPECT() *MockHasConsensusVersionMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ConsensusVersion mocks base method.
|
||||
func (m *MockHasConsensusVersion) ConsensusVersion() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConsensusVersion")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConsensusVersion indicates an expected call of ConsensusVersion.
|
||||
func (mr *MockHasConsensusVersionMockRecorder) ConsensusVersion() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockHasConsensusVersion)(nil).ConsensusVersion))
|
||||
}
|
||||
|
||||
// MockBeginBlockAppModule is a mock of BeginBlockAppModule interface.
|
||||
type MockBeginBlockAppModule struct {
|
||||
ctrl *gomock.Controller
|
||||
@ -535,20 +743,6 @@ func (mr *MockBeginBlockAppModuleMockRecorder) BeginBlock(arg0, arg1 interface{}
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockBeginBlockAppModule)(nil).BeginBlock), arg0, arg1)
|
||||
}
|
||||
|
||||
// ConsensusVersion mocks base method.
|
||||
func (m *MockBeginBlockAppModule) ConsensusVersion() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConsensusVersion")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConsensusVersion indicates an expected call of ConsensusVersion.
|
||||
func (mr *MockBeginBlockAppModuleMockRecorder) ConsensusVersion() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockBeginBlockAppModule)(nil).ConsensusVersion))
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockBeginBlockAppModule) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
@ -563,20 +757,6 @@ func (mr *MockBeginBlockAppModuleMockRecorder) DefaultGenesis(arg0 interface{})
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockBeginBlockAppModule)(nil).DefaultGenesis), arg0)
|
||||
}
|
||||
|
||||
// ExportGenesis mocks base method.
|
||||
func (m *MockBeginBlockAppModule) ExportGenesis(arg0 types0.Context, arg1 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ExportGenesis indicates an expected call of ExportGenesis.
|
||||
func (mr *MockBeginBlockAppModuleMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockBeginBlockAppModule)(nil).ExportGenesis), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetQueryCmd mocks base method.
|
||||
func (m *MockBeginBlockAppModule) GetQueryCmd() *cobra.Command {
|
||||
m.ctrl.T.Helper()
|
||||
@ -605,20 +785,6 @@ func (mr *MockBeginBlockAppModuleMockRecorder) GetTxCmd() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockBeginBlockAppModule)(nil).GetTxCmd))
|
||||
}
|
||||
|
||||
// InitGenesis mocks base method.
|
||||
func (m *MockBeginBlockAppModule) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// InitGenesis indicates an expected call of InitGenesis.
|
||||
func (mr *MockBeginBlockAppModuleMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockBeginBlockAppModule)(nil).InitGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockBeginBlockAppModule) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
@ -657,18 +823,6 @@ func (mr *MockBeginBlockAppModuleMockRecorder) RegisterInterfaces(arg0 interface
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockBeginBlockAppModule)(nil).RegisterInterfaces), arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants mocks base method.
|
||||
func (m *MockBeginBlockAppModule) RegisterInvariants(arg0 types0.InvariantRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInvariants", arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants indicates an expected call of RegisterInvariants.
|
||||
func (mr *MockBeginBlockAppModuleMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockBeginBlockAppModule)(nil).RegisterInvariants), arg0)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec mocks base method.
|
||||
func (m *MockBeginBlockAppModule) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -681,18 +835,6 @@ func (mr *MockBeginBlockAppModuleMockRecorder) RegisterLegacyAminoCodec(arg0 int
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockBeginBlockAppModule)(nil).RegisterLegacyAminoCodec), arg0)
|
||||
}
|
||||
|
||||
// RegisterServices mocks base method.
|
||||
func (m *MockBeginBlockAppModule) RegisterServices(arg0 module.Configurator) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterServices", arg0)
|
||||
}
|
||||
|
||||
// RegisterServices indicates an expected call of RegisterServices.
|
||||
func (mr *MockBeginBlockAppModuleMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockBeginBlockAppModule)(nil).RegisterServices), arg0)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockBeginBlockAppModule) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
@ -730,20 +872,6 @@ func (m *MockEndBlockAppModule) EXPECT() *MockEndBlockAppModuleMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ConsensusVersion mocks base method.
|
||||
func (m *MockEndBlockAppModule) ConsensusVersion() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ConsensusVersion")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConsensusVersion indicates an expected call of ConsensusVersion.
|
||||
func (mr *MockEndBlockAppModuleMockRecorder) ConsensusVersion() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConsensusVersion", reflect.TypeOf((*MockEndBlockAppModule)(nil).ConsensusVersion))
|
||||
}
|
||||
|
||||
// DefaultGenesis mocks base method.
|
||||
func (m *MockEndBlockAppModule) DefaultGenesis(arg0 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
@ -772,20 +900,6 @@ func (mr *MockEndBlockAppModuleMockRecorder) EndBlock(arg0, arg1 interface{}) *g
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockEndBlockAppModule)(nil).EndBlock), arg0, arg1)
|
||||
}
|
||||
|
||||
// ExportGenesis mocks base method.
|
||||
func (m *MockEndBlockAppModule) ExportGenesis(arg0 types0.Context, arg1 codec.JSONCodec) json.RawMessage {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ExportGenesis", arg0, arg1)
|
||||
ret0, _ := ret[0].(json.RawMessage)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ExportGenesis indicates an expected call of ExportGenesis.
|
||||
func (mr *MockEndBlockAppModuleMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockEndBlockAppModule)(nil).ExportGenesis), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetQueryCmd mocks base method.
|
||||
func (m *MockEndBlockAppModule) GetQueryCmd() *cobra.Command {
|
||||
m.ctrl.T.Helper()
|
||||
@ -814,20 +928,6 @@ func (mr *MockEndBlockAppModuleMockRecorder) GetTxCmd() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockEndBlockAppModule)(nil).GetTxCmd))
|
||||
}
|
||||
|
||||
// InitGenesis mocks base method.
|
||||
func (m *MockEndBlockAppModule) InitGenesis(arg0 types0.Context, arg1 codec.JSONCodec, arg2 json.RawMessage) []types1.ValidatorUpdate {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]types1.ValidatorUpdate)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// InitGenesis indicates an expected call of InitGenesis.
|
||||
func (mr *MockEndBlockAppModuleMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockEndBlockAppModule)(nil).InitGenesis), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockEndBlockAppModule) Name() string {
|
||||
m.ctrl.T.Helper()
|
||||
@ -866,18 +966,6 @@ func (mr *MockEndBlockAppModuleMockRecorder) RegisterInterfaces(arg0 interface{}
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInterfaces", reflect.TypeOf((*MockEndBlockAppModule)(nil).RegisterInterfaces), arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants mocks base method.
|
||||
func (m *MockEndBlockAppModule) RegisterInvariants(arg0 types0.InvariantRegistry) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterInvariants", arg0)
|
||||
}
|
||||
|
||||
// RegisterInvariants indicates an expected call of RegisterInvariants.
|
||||
func (mr *MockEndBlockAppModuleMockRecorder) RegisterInvariants(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterInvariants", reflect.TypeOf((*MockEndBlockAppModule)(nil).RegisterInvariants), arg0)
|
||||
}
|
||||
|
||||
// RegisterLegacyAminoCodec mocks base method.
|
||||
func (m *MockEndBlockAppModule) RegisterLegacyAminoCodec(arg0 *codec.LegacyAmino) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -890,18 +978,6 @@ func (mr *MockEndBlockAppModuleMockRecorder) RegisterLegacyAminoCodec(arg0 inter
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterLegacyAminoCodec", reflect.TypeOf((*MockEndBlockAppModule)(nil).RegisterLegacyAminoCodec), arg0)
|
||||
}
|
||||
|
||||
// RegisterServices mocks base method.
|
||||
func (m *MockEndBlockAppModule) RegisterServices(arg0 module.Configurator) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "RegisterServices", arg0)
|
||||
}
|
||||
|
||||
// RegisterServices indicates an expected call of RegisterServices.
|
||||
func (mr *MockEndBlockAppModuleMockRecorder) RegisterServices(arg0 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockEndBlockAppModule)(nil).RegisterServices), arg0)
|
||||
}
|
||||
|
||||
// ValidateGenesis mocks base method.
|
||||
func (m *MockEndBlockAppModule) ValidateGenesis(arg0 codec.JSONCodec, arg1 client.TxEncodingConfig, arg2 json.RawMessage) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
15
types/module/mock_appmodule_test.go
Normal file
15
types/module/mock_appmodule_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
package module_test
|
||||
|
||||
import "github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
// AppModuleWithAllExtensions is solely here for the purpose of generating
|
||||
// mocks to be used in module tests.
|
||||
type AppModuleWithAllExtensions interface {
|
||||
module.AppModule
|
||||
module.HasServices
|
||||
module.HasGenesis
|
||||
module.HasInvariants
|
||||
module.HasConsensusVersion
|
||||
module.BeginBlockAppModule
|
||||
module.EndBlockAppModule
|
||||
}
|
||||
@ -33,6 +33,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
@ -47,12 +48,11 @@ import (
|
||||
|
||||
// AppModuleBasic is the standard form for basic non-dependant elements of an application module.
|
||||
type AppModuleBasic interface {
|
||||
Name() string
|
||||
HasName
|
||||
RegisterLegacyAminoCodec(*codec.LegacyAmino)
|
||||
RegisterInterfaces(codectypes.InterfaceRegistry)
|
||||
|
||||
DefaultGenesis(codec.JSONCodec) json.RawMessage
|
||||
ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error
|
||||
HasGenesisBasics
|
||||
|
||||
// client functionality
|
||||
RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux)
|
||||
@ -60,6 +60,19 @@ type AppModuleBasic interface {
|
||||
GetQueryCmd() *cobra.Command
|
||||
}
|
||||
|
||||
// HasName allows the module to provide its own name for legacy purposes.
|
||||
// Newer apps should specify the name for their modules using a map
|
||||
// using NewManagerFromMap.
|
||||
type HasName interface {
|
||||
Name() string
|
||||
}
|
||||
|
||||
// HasGenesisBasics is the legacy interface for stateless genesis methods.
|
||||
type HasGenesisBasics interface {
|
||||
DefaultGenesis(codec.JSONCodec) json.RawMessage
|
||||
ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error
|
||||
}
|
||||
|
||||
// BasicManager is a collection of AppModuleBasic
|
||||
type BasicManager map[string]AppModuleBasic
|
||||
|
||||
@ -143,21 +156,36 @@ func (bm BasicManager) AddQueryCommands(rootQueryCmd *cobra.Command) {
|
||||
// AppModuleGenesis is the standard form for an application module genesis functions
|
||||
type AppModuleGenesis interface {
|
||||
AppModuleBasic
|
||||
HasGenesis
|
||||
}
|
||||
|
||||
// HasGenesis is the extension interface for stateful genesis methods.
|
||||
type HasGenesis interface {
|
||||
HasGenesisBasics
|
||||
InitGenesis(sdk.Context, codec.JSONCodec, json.RawMessage) []abci.ValidatorUpdate
|
||||
ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage
|
||||
}
|
||||
|
||||
// AppModule is the standard form for an application module
|
||||
// AppModule is the form for an application module. Most of
|
||||
// its functionality has been moved to extension interfaces.
|
||||
type AppModule interface {
|
||||
AppModuleGenesis
|
||||
AppModuleBasic
|
||||
}
|
||||
|
||||
// registers
|
||||
// HasInvariants is the interface for registering invariants.
|
||||
type HasInvariants interface {
|
||||
// RegisterInvariants registers module invariants.
|
||||
RegisterInvariants(sdk.InvariantRegistry)
|
||||
}
|
||||
|
||||
// RegisterServices allows a module to register services
|
||||
// HasServices is the interface for modules to register services.
|
||||
type HasServices interface {
|
||||
// RegisterServices allows a module to register services.
|
||||
RegisterServices(Configurator)
|
||||
}
|
||||
|
||||
// HasConsensusVersion is the interface for declaring a module consensus version.
|
||||
type HasConsensusVersion interface {
|
||||
// ConsensusVersion is a sequence number for state-breaking change of the
|
||||
// module. It should be incremented on each consensus-breaking change
|
||||
// introduced by the module. To avoid wrong/empty versions, the initial version
|
||||
@ -183,12 +211,18 @@ type GenesisOnlyAppModule struct {
|
||||
}
|
||||
|
||||
// NewGenesisOnlyAppModule creates a new GenesisOnlyAppModule object
|
||||
func NewGenesisOnlyAppModule(amg AppModuleGenesis) AppModule {
|
||||
func NewGenesisOnlyAppModule(amg AppModuleGenesis) GenesisOnlyAppModule {
|
||||
return GenesisOnlyAppModule{
|
||||
AppModuleGenesis: amg,
|
||||
}
|
||||
}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (GenesisOnlyAppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (GenesisOnlyAppModule) IsAppModule() {}
|
||||
|
||||
// RegisterInvariants is a placeholder function register no invariants
|
||||
func (GenesisOnlyAppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
@ -212,7 +246,7 @@ func (GenesisOnlyAppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []ab
|
||||
// Manager defines a module manager that provides the high level utility for managing and executing
|
||||
// operations for a group of modules
|
||||
type Manager struct {
|
||||
Modules map[string]AppModule
|
||||
Modules map[string]interface{} // interface{} is used now to support the legacy AppModule as well as new core appmodule.AppModule.
|
||||
OrderInitGenesis []string
|
||||
OrderExportGenesis []string
|
||||
OrderBeginBlockers []string
|
||||
@ -220,9 +254,9 @@ type Manager struct {
|
||||
OrderMigrations []string
|
||||
}
|
||||
|
||||
// NewManager creates a new Manager object
|
||||
// NewManager creates a new Manager object.
|
||||
func NewManager(modules ...AppModule) *Manager {
|
||||
moduleMap := make(map[string]AppModule)
|
||||
moduleMap := make(map[string]interface{})
|
||||
modulesStr := make([]string, 0, len(modules))
|
||||
for _, module := range modules {
|
||||
moduleMap[module.Name()] = module
|
||||
@ -238,6 +272,25 @@ func NewManager(modules ...AppModule) *Manager {
|
||||
}
|
||||
}
|
||||
|
||||
// NewManagerFromMap creates a new Manager object from a map of module names to module implementations.
|
||||
// This method should be used for apps and modules which have migrated to the cosmossdk.io/core.appmodule.AppModule API.
|
||||
func NewManagerFromMap(moduleMap map[string]appmodule.AppModule) *Manager {
|
||||
simpleModuleMap := make(map[string]interface{})
|
||||
modulesStr := make([]string, 0, len(simpleModuleMap))
|
||||
for name, module := range moduleMap {
|
||||
simpleModuleMap[name] = module
|
||||
modulesStr = append(modulesStr, name)
|
||||
}
|
||||
|
||||
return &Manager{
|
||||
Modules: simpleModuleMap,
|
||||
OrderInitGenesis: modulesStr,
|
||||
OrderExportGenesis: modulesStr,
|
||||
OrderBeginBlockers: modulesStr,
|
||||
OrderEndBlockers: modulesStr,
|
||||
}
|
||||
}
|
||||
|
||||
// SetOrderInitGenesis sets the order of init genesis calls
|
||||
func (m *Manager) SetOrderInitGenesis(moduleNames ...string) {
|
||||
m.assertNoForgottenModules("SetOrderInitGenesis", moduleNames)
|
||||
@ -273,7 +326,9 @@ func (m *Manager) SetOrderMigrations(moduleNames ...string) {
|
||||
func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
modules := maps.Values(m.Modules)
|
||||
for _, module := range modules {
|
||||
module.RegisterInvariants(ir)
|
||||
if module, ok := module.(HasInvariants); ok {
|
||||
module.RegisterInvariants(ir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +336,9 @@ func (m *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
|
||||
func (m *Manager) RegisterServices(cfg Configurator) {
|
||||
modules := maps.Values(m.Modules)
|
||||
for _, module := range modules {
|
||||
module.RegisterServices(cfg)
|
||||
if module, ok := module.(HasServices); ok {
|
||||
module.RegisterServices(cfg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,17 +352,20 @@ func (m *Manager) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, genesisData
|
||||
if genesisData[moduleName] == nil {
|
||||
continue
|
||||
}
|
||||
ctx.Logger().Debug("running initialization for module", "module", moduleName)
|
||||
|
||||
moduleValUpdates := m.Modules[moduleName].InitGenesis(ctx, cdc, genesisData[moduleName])
|
||||
if module, ok := m.Modules[moduleName].(HasGenesis); ok {
|
||||
ctx.Logger().Debug("running initialization for module", "module", moduleName)
|
||||
|
||||
// use these validator updates if provided, the module manager assumes
|
||||
// only one module will update the validator set
|
||||
if len(moduleValUpdates) > 0 {
|
||||
if len(validatorUpdates) > 0 {
|
||||
panic("validator InitGenesis updates already set by a previous module")
|
||||
moduleValUpdates := module.InitGenesis(ctx, cdc, genesisData[moduleName])
|
||||
|
||||
// use these validator updates if provided, the module manager assumes
|
||||
// only one module will update the validator set
|
||||
if len(moduleValUpdates) > 0 {
|
||||
if len(validatorUpdates) > 0 {
|
||||
panic("validator InitGenesis updates already set by a previous module")
|
||||
}
|
||||
validatorUpdates = moduleValUpdates
|
||||
}
|
||||
validatorUpdates = moduleValUpdates
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,7 +389,9 @@ func (m *Manager) ExportGenesisForModules(ctx sdk.Context, cdc codec.JSONCodec,
|
||||
genesisData := make(map[string]json.RawMessage)
|
||||
if len(modulesToExport) == 0 {
|
||||
for _, moduleName := range m.OrderExportGenesis {
|
||||
genesisData[moduleName] = m.Modules[moduleName].ExportGenesis(ctx, cdc)
|
||||
if module, ok := m.Modules[moduleName].(HasGenesis); ok {
|
||||
genesisData[moduleName] = module.ExportGenesis(ctx, cdc)
|
||||
}
|
||||
}
|
||||
|
||||
return genesisData
|
||||
@ -341,7 +403,9 @@ func (m *Manager) ExportGenesisForModules(ctx sdk.Context, cdc codec.JSONCodec,
|
||||
}
|
||||
|
||||
for _, moduleName := range modulesToExport {
|
||||
genesisData[moduleName] = m.Modules[moduleName].ExportGenesis(ctx, cdc)
|
||||
if module, ok := m.Modules[moduleName].(HasGenesis); ok {
|
||||
genesisData[moduleName] = module.ExportGenesis(ctx, cdc)
|
||||
}
|
||||
}
|
||||
|
||||
return genesisData
|
||||
@ -450,7 +514,10 @@ func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, fromVM Version
|
||||
for _, moduleName := range modules {
|
||||
module := m.Modules[moduleName]
|
||||
fromVersion, exists := fromVM[moduleName]
|
||||
toVersion := module.ConsensusVersion()
|
||||
toVersion := uint64(0)
|
||||
if module, ok := module.(HasConsensusVersion); ok {
|
||||
toVersion = module.ConsensusVersion()
|
||||
}
|
||||
|
||||
// We run migration if the module is specified in `fromVM`.
|
||||
// Otherwise we run InitGenesis.
|
||||
@ -467,11 +534,13 @@ func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, fromVM Version
|
||||
}
|
||||
} else {
|
||||
ctx.Logger().Info(fmt.Sprintf("adding a new module: %s", moduleName))
|
||||
moduleValUpdates := module.InitGenesis(ctx, c.cdc, module.DefaultGenesis(c.cdc))
|
||||
// The module manager assumes only one module will update the
|
||||
// validator set, and it can't be a new module.
|
||||
if len(moduleValUpdates) > 0 {
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "validator InitGenesis update is already set by another module")
|
||||
if module, ok := m.Modules[moduleName].(HasGenesis); ok {
|
||||
moduleValUpdates := module.InitGenesis(ctx, c.cdc, module.DefaultGenesis(c.cdc))
|
||||
// The module manager assumes only one module will update the
|
||||
// validator set, and it can't be a new module.
|
||||
if len(moduleValUpdates) > 0 {
|
||||
return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "validator InitGenesis update is already set by another module")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,9 +602,12 @@ func (m *Manager) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
|
||||
// GetVersionMap gets consensus version from all modules
|
||||
func (m *Manager) GetVersionMap() VersionMap {
|
||||
vermap := make(VersionMap)
|
||||
for _, v := range m.Modules {
|
||||
version := v.ConsensusVersion()
|
||||
name := v.Name()
|
||||
for name, v := range m.Modules {
|
||||
version := uint64(0)
|
||||
if v, ok := v.(HasConsensusVersion); ok {
|
||||
version = v.ConsensusVersion()
|
||||
}
|
||||
name := name
|
||||
vermap[name] = version
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ type TestSuite struct {
|
||||
|
||||
func (s TestSuite) TestAssertNoForgottenModules() {
|
||||
m := Manager{
|
||||
Modules: map[string]AppModule{"a": nil, "b": nil},
|
||||
Modules: map[string]interface{}{"a": nil, "b": nil},
|
||||
}
|
||||
tcs := []struct {
|
||||
name string
|
||||
@ -39,7 +39,7 @@ func (s TestSuite) TestAssertNoForgottenModules() {
|
||||
|
||||
func (s TestSuite) TestModuleNames() {
|
||||
m := Manager{
|
||||
Modules: map[string]AppModule{"a": nil, "b": nil},
|
||||
Modules: map[string]interface{}{"a": nil, "b": nil},
|
||||
}
|
||||
ms := m.ModuleNames()
|
||||
sort.Strings(ms)
|
||||
|
||||
@ -107,8 +107,8 @@ func TestManager_RegisterInvariants(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
mockAppModule1 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule1 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||
@ -126,8 +126,8 @@ func TestManager_RegisterQueryServices(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
mockAppModule1 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule1 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||
@ -149,8 +149,8 @@ func TestManager_InitGenesis(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
mockAppModule1 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule1 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||
@ -180,8 +180,8 @@ func TestManager_ExportGenesis(t *testing.T) {
|
||||
mockCtrl := gomock.NewController(t)
|
||||
t.Cleanup(mockCtrl.Finish)
|
||||
|
||||
mockAppModule1 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModule(mockCtrl)
|
||||
mockAppModule1 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule2 := mock.NewMockAppModuleWithAllExtensions(mockCtrl)
|
||||
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
sdkmath "cosmossdk.io/math"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
@ -51,7 +52,7 @@ func NewSimulationManager(modules ...AppModuleSimulation) *SimulationManager {
|
||||
// with the same moduleName.
|
||||
// Then it attempts to cast every provided AppModule into an AppModuleSimulation.
|
||||
// If the cast succeeds, its included, otherwise it is excluded.
|
||||
func NewSimulationManagerFromAppModules(modules map[string]AppModule, overrideModules map[string]AppModuleSimulation) *SimulationManager {
|
||||
func NewSimulationManagerFromAppModules(modules map[string]interface{}, overrideModules map[string]AppModuleSimulation) *SimulationManager {
|
||||
simModules := []AppModuleSimulation{}
|
||||
appModuleNamesSorted := make([]string, 0, len(modules))
|
||||
for moduleName := range modules {
|
||||
|
||||
@ -18,7 +18,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -195,17 +194,10 @@ func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.Weighte
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type AuthInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -224,8 +216,7 @@ type AuthOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
AccountKeeper keeper.AccountKeeper
|
||||
Module runtime.AppModuleWrapper
|
||||
NewAppModule appmodule.AppModule
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in AuthInputs) AuthOutputs {
|
||||
@ -251,5 +242,5 @@ func ProvideModule(in AuthInputs) AuthOutputs {
|
||||
k := keeper.NewAccountKeeper(in.Cdc, in.Key, in.AccountI, maccPerms, in.Config.Bech32Prefix, authority.String())
|
||||
m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn, in.LegacySubspace)
|
||||
|
||||
return AuthOutputs{AccountKeeper: k, Module: runtime.WrapAppModule(m), NewAppModule: m}
|
||||
return AuthOutputs{AccountKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
@ -91,6 +90,14 @@ func NewAppModule(ak keeper.AccountKeeper, bk types.BankKeeper) AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// RegisterInvariants performs a no-op; there are no invariants to enforce.
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
@ -118,14 +125,10 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type VestingInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -136,11 +139,11 @@ type VestingInputs struct {
|
||||
type VestingOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in VestingInputs) VestingOutputs {
|
||||
m := NewAppModule(in.AccountKeeper, in.BankKeeper)
|
||||
|
||||
return VestingOutputs{Module: runtime.WrapAppModule(m)}
|
||||
return VestingOutputs{Module: m}
|
||||
}
|
||||
|
||||
@ -13,11 +13,11 @@ import (
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@ -120,6 +120,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak authz.AccountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the authz module's name.
|
||||
func (AppModule) Name() string {
|
||||
return authz.ModuleName
|
||||
@ -159,17 +167,10 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type AuthzInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -185,13 +186,13 @@ type AuthzOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
AuthzKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in AuthzInputs) AuthzOutputs {
|
||||
k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper)
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.Registry)
|
||||
return AuthzOutputs{AuthzKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return AuthzOutputs{AuthzKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
// ____________________________________________________________________________
|
||||
|
||||
@ -18,7 +18,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -108,6 +107,14 @@ type AppModule struct {
|
||||
legacySubspace exported.Subspace
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// RegisterServices registers module services.
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
@ -196,13 +203,8 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule))
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
type BankInputs struct {
|
||||
@ -222,7 +224,7 @@ type BankOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
BankKeeper keeper.BaseKeeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in BankInputs) BankOutputs {
|
||||
@ -257,5 +259,5 @@ func ProvideModule(in BankInputs) BankOutputs {
|
||||
)
|
||||
m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper, in.LegacySubspace)
|
||||
|
||||
return BankOutputs{BankKeeper: bankKeeper, Module: runtime.WrapAppModule(m)}
|
||||
return BankOutputs{BankKeeper: bankKeeper, Module: m}
|
||||
}
|
||||
|
||||
@ -18,7 +18,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -104,6 +103,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, sealKeeper bool) AppMod
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the capability module's name.
|
||||
func (am AppModule) Name() string {
|
||||
return am.AppModuleBasic.Name()
|
||||
@ -176,14 +183,8 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
))
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
type CapabilityInputs struct {
|
||||
@ -200,7 +201,7 @@ type CapabilityOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
CapabilityKeeper *keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in CapabilityInputs) CapabilityOutputs {
|
||||
@ -209,6 +210,6 @@ func ProvideModule(in CapabilityInputs) CapabilityOutputs {
|
||||
|
||||
return CapabilityOutputs{
|
||||
CapabilityKeeper: k,
|
||||
Module: runtime.WrapAppModule(m),
|
||||
Module: m,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,6 +85,14 @@ type AppModule struct {
|
||||
keeper keeper.Keeper
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// RegisterServices registers module services.
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
@ -123,14 +131,10 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type ConsensusParamInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -143,7 +147,7 @@ type ConsensusParamOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Keeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
BaseAppOption runtime.BaseAppOption
|
||||
}
|
||||
|
||||
@ -162,7 +166,7 @@ func ProvideModule(in ConsensusParamInputs) ConsensusParamOutputs {
|
||||
|
||||
return ConsensusParamOutputs{
|
||||
Keeper: k,
|
||||
Module: runtime.WrapAppModule(m),
|
||||
Module: m,
|
||||
BaseAppOption: baseappOpt,
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
@ -120,6 +119,14 @@ func NewAppModule(keeper *keeper.Keeper, skipGenesisInvariants bool, ss exported
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// AddModuleInitFlags implements servertypes.ModuleInitFlags interface.
|
||||
func AddModuleInitFlags(startCmd *cobra.Command) {
|
||||
startCmd.Flags().Bool(FlagSkipGenesisInvariants, false, "Skip x/crisis invariants check on startup")
|
||||
@ -180,7 +187,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
@ -201,14 +208,10 @@ type CrisisInputs struct {
|
||||
type CrisisOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
CrisisKeeper *keeper.Keeper
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
func ProvideModule(in CrisisInputs) CrisisOutputs {
|
||||
var invalidCheckPeriod uint
|
||||
if in.AppOpts != nil {
|
||||
@ -242,5 +245,5 @@ func ProvideModule(in CrisisInputs) CrisisOutputs {
|
||||
|
||||
m := NewAppModule(k, skipGenesisInvariants, in.LegacySubspace)
|
||||
|
||||
return CrisisOutputs{CrisisKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return CrisisOutputs{CrisisKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ import (
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -121,6 +120,14 @@ func NewAppModule(
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the distribution module's name.
|
||||
func (AppModule) Name() string {
|
||||
return types.ModuleName
|
||||
@ -201,14 +208,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type DistrInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -228,7 +231,7 @@ type DistrOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
DistrKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
Hooks staking.StakingHooksWrapper
|
||||
}
|
||||
|
||||
@ -258,7 +261,7 @@ func ProvideModule(in DistrInputs) DistrOutputs {
|
||||
|
||||
return DistrOutputs{
|
||||
DistrKeeper: k,
|
||||
Module: runtime.WrapAppModule(m),
|
||||
Module: m,
|
||||
Hooks: staking.StakingHooksWrapper{StakingHooks: k.Hooks()},
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -123,6 +122,14 @@ func NewAppModule(keeper keeper.Keeper) AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the evidence module's name.
|
||||
func (am AppModule) Name() string {
|
||||
return am.AppModuleBasic.Name()
|
||||
@ -192,14 +199,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type EvidenceInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -214,12 +217,12 @@ type EvidenceOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
EvidenceKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in EvidenceInputs) EvidenceOutputs {
|
||||
k := keeper.NewKeeper(in.Cdc, in.Key, in.StakingKeeper, in.SlashingKeeper)
|
||||
m := NewAppModule(*k)
|
||||
|
||||
return EvidenceOutputs{EvidenceKeeper: *k, Module: runtime.WrapAppModule(m)}
|
||||
return EvidenceOutputs{EvidenceKeeper: *k, Module: m}
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@ import (
|
||||
modulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1"
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@ -128,6 +128,14 @@ func NewAppModule(cdc codec.Codec, ak feegrant.AccountKeeper, bk feegrant.BankKe
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the feegrant module's name.
|
||||
func (AppModule) Name() string {
|
||||
return feegrant.ModuleName
|
||||
@ -172,14 +180,8 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
))
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
type FeegrantInputs struct {
|
||||
@ -192,10 +194,10 @@ type FeegrantInputs struct {
|
||||
Registry cdctypes.InterfaceRegistry
|
||||
}
|
||||
|
||||
func ProvideModule(in FeegrantInputs) (keeper.Keeper, runtime.AppModuleWrapper) {
|
||||
func ProvideModule(in FeegrantInputs) (keeper.Keeper, appmodule.AppModule) {
|
||||
k := keeper.NewKeeper(in.Cdc, in.Key, in.AccountKeeper)
|
||||
m := NewAppModule(in.Cdc, in.AccountKeeper, in.BankKeeper, k, in.Registry)
|
||||
return k, runtime.WrapAppModule(m)
|
||||
return k, m
|
||||
}
|
||||
|
||||
// AppModuleSimulation functions
|
||||
|
||||
@ -12,10 +12,10 @@ import (
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||
@ -88,7 +88,7 @@ type AppModule struct {
|
||||
func NewAppModule(accountKeeper types.AccountKeeper,
|
||||
stakingKeeper types.StakingKeeper, deliverTx deliverTxfn,
|
||||
txEncodingConfig client.TxEncodingConfig,
|
||||
) module.AppModule {
|
||||
) module.GenesisOnlyAppModule {
|
||||
return module.NewGenesisOnlyAppModule(AppModule{
|
||||
AppModuleBasic: AppModuleBasic{},
|
||||
accountKeeper: accountKeeper,
|
||||
@ -98,6 +98,14 @@ func NewAppModule(accountKeeper types.AccountKeeper,
|
||||
})
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (AppModule) IsAppModule() {}
|
||||
|
||||
// InitGenesis performs genesis initialization for the genutil module.
|
||||
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
|
||||
var genesisState types.GenesisState
|
||||
@ -120,14 +128,10 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type GenutilInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -137,7 +141,7 @@ type GenutilInputs struct {
|
||||
Config client.TxConfig
|
||||
}
|
||||
|
||||
func ProvideModule(in GenutilInputs) runtime.AppModuleWrapper {
|
||||
func ProvideModule(in GenutilInputs) appmodule.AppModule {
|
||||
m := NewAppModule(in.AccountKeeper, in.StakingKeeper, in.DeliverTx, in.Config)
|
||||
return runtime.WrapAppModule(m)
|
||||
return m
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -122,12 +121,6 @@ func (a AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry
|
||||
v1beta1.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// AppModule implements an application module for the gov module.
|
||||
type AppModule struct {
|
||||
AppModuleBasic
|
||||
@ -154,17 +147,21 @@ func NewAppModule(
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule, ProvideKeyTable),
|
||||
appmodule.Provide(ProvideModule, ProvideKeyTable),
|
||||
appmodule.Invoke(InvokeAddRoutes, InvokeSetHooks))
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type GovInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -185,7 +182,7 @@ type GovInputs struct {
|
||||
type GovOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
Keeper *keeper.Keeper
|
||||
HandlerRoute v1beta1.HandlerRoute
|
||||
}
|
||||
@ -215,7 +212,7 @@ func ProvideModule(in GovInputs) GovOutputs {
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.LegacySubspace)
|
||||
hr := v1beta1.HandlerRoute{Handler: v1beta1.ProposalHandler, RouteKey: govtypes.RouterKey}
|
||||
|
||||
return GovOutputs{Module: runtime.WrapAppModule(m), Keeper: k, HandlerRoute: hr}
|
||||
return GovOutputs{Module: m, Keeper: k, HandlerRoute: hr}
|
||||
}
|
||||
|
||||
func ProvideKeyTable() paramtypes.KeyTable {
|
||||
|
||||
@ -13,11 +13,11 @@ import (
|
||||
|
||||
modulev1 "cosmossdk.io/api/cosmos/group/module/v1"
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -53,6 +53,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak group.AccountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
type AppModuleBasic struct {
|
||||
cdc codec.Codec
|
||||
}
|
||||
@ -184,17 +192,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type GroupInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -211,7 +212,7 @@ type GroupOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
GroupKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in GroupInputs) GroupOutputs {
|
||||
@ -223,5 +224,5 @@ func ProvideModule(in GroupInputs) GroupOutputs {
|
||||
|
||||
k := keeper.NewKeeper(in.Key, in.Cdc, in.MsgServiceRouter, in.AccountKeeper, group.Config{MaxExecutionPeriod: in.Config.MaxExecutionPeriod.AsDuration(), MaxMetadataLen: in.Config.MaxMetadataLen})
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.Registry)
|
||||
return GroupOutputs{GroupKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return GroupOutputs{GroupKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ import (
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -129,6 +129,14 @@ func NewAppModule(
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the mint module's name.
|
||||
func (AppModule) Name() string {
|
||||
return types.ModuleName
|
||||
@ -203,14 +211,10 @@ func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.Weighte
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type MintInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -232,7 +236,7 @@ type MintOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
MintKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in MintInputs) MintOutputs {
|
||||
@ -260,5 +264,5 @@ func ProvideModule(in MintInputs) MintOutputs {
|
||||
// when no inflation calculation function is provided it will use the default types.DefaultInflationCalculationFn
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.InflationCalculationFn, in.LegacySubspace)
|
||||
|
||||
return MintOutputs{MintKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return MintOutputs{MintKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -10,10 +10,10 @@ import (
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
@ -21,6 +21,7 @@ import (
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
|
||||
modulev1 "cosmossdk.io/api/cosmos/nft/module/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/nft"
|
||||
"github.com/cosmos/cosmos-sdk/x/nft/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/nft/keeper"
|
||||
@ -112,6 +113,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak nft.AccountKeeper, b
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the nft module's name.
|
||||
func (AppModule) Name() string {
|
||||
return nft.ModuleName
|
||||
@ -178,14 +187,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type NftInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -201,12 +206,12 @@ type NftOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
NFTKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in NftInputs) NftOutputs {
|
||||
k := keeper.NewKeeper(in.Key, in.Cdc, in.AccountKeeper, in.BankKeeper)
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.Registry)
|
||||
|
||||
return NftOutputs{NFTKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return NftOutputs{NFTKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ import (
|
||||
modulev1 "cosmossdk.io/api/cosmos/params/module/v1"
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/depinject"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -90,6 +89,14 @@ func NewAppModule(k keeper.Keeper) AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
// InitGenesis performs a no-op.
|
||||
@ -135,16 +142,11 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
ProvideSubspace,
|
||||
))
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type ParamsInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -158,14 +160,14 @@ type ParamsOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
ParamsKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
GovHandler govv1beta1.HandlerRoute
|
||||
}
|
||||
|
||||
func ProvideModule(in ParamsInputs) ParamsOutputs {
|
||||
k := keeper.NewKeeper(in.Cdc, in.LegacyAmino, in.KvStoreKey, in.TransientStoreKey)
|
||||
|
||||
m := runtime.WrapAppModule(NewAppModule(k))
|
||||
m := NewAppModule(k)
|
||||
govHandler := govv1beta1.HandlerRoute{RouteKey: proposal.RouterKey, Handler: NewParamChangeProposalHandler(k)}
|
||||
|
||||
return ParamsOutputs{ParamsKeeper: k, Module: m, GovHandler: govHandler}
|
||||
|
||||
@ -16,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -120,6 +119,14 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper,
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the slashing module's name.
|
||||
func (AppModule) Name() string {
|
||||
return types.ModuleName
|
||||
@ -199,17 +206,10 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(
|
||||
ProvideModuleBasic,
|
||||
ProvideModule,
|
||||
),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type SlashingInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -230,7 +230,7 @@ type SlashingOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
Keeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
Hooks staking.StakingHooksWrapper
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ func ProvideModule(in SlashingInputs) SlashingOutputs {
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.StakingKeeper, in.LegacySubspace)
|
||||
return SlashingOutputs{
|
||||
Keeper: k,
|
||||
Module: runtime.WrapAppModule(m),
|
||||
Module: m,
|
||||
Hooks: staking.StakingHooksWrapper{StakingHooks: k.Hooks()},
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -128,6 +127,14 @@ func NewAppModule(
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// Name returns the staking module's name.
|
||||
func (AppModule) Name() string {
|
||||
return types.ModuleName
|
||||
@ -188,15 +195,11 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
|
||||
func init() {
|
||||
appmodule.Register(
|
||||
&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
appmodule.Invoke(InvokeSetStakingHooks),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type StakingInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -215,7 +218,7 @@ type StakingOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
StakingKeeper *keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
}
|
||||
|
||||
func ProvideModule(in StakingInputs) StakingOutputs {
|
||||
@ -233,7 +236,7 @@ func ProvideModule(in StakingInputs) StakingOutputs {
|
||||
authority.String(),
|
||||
)
|
||||
m := NewAppModule(in.Cdc, k, in.AccountKeeper, in.BankKeeper, in.LegacySubspace)
|
||||
return StakingOutputs{StakingKeeper: k, Module: runtime.WrapAppModule(m)}
|
||||
return StakingOutputs{StakingKeeper: k, Module: m}
|
||||
}
|
||||
|
||||
func InvokeSetStakingHooks(
|
||||
|
||||
@ -14,11 +14,11 @@ import (
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/depinject"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||
@ -28,6 +28,7 @@ import (
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
|
||||
modulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/upgrade/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||
@ -94,6 +95,14 @@ func NewAppModule(keeper keeper.Keeper) AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
var _ appmodule.AppModule = AppModule{}
|
||||
|
||||
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
|
||||
func (am AppModule) IsOnePerModuleType() {}
|
||||
|
||||
// IsAppModule implements the appmodule.AppModule interface.
|
||||
func (am AppModule) IsAppModule() {}
|
||||
|
||||
// RegisterInvariants does nothing, there are no invariants to enforce
|
||||
func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {}
|
||||
|
||||
@ -145,14 +154,10 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
|
||||
|
||||
func init() {
|
||||
appmodule.Register(&modulev1.Module{},
|
||||
appmodule.Provide(ProvideModuleBasic, ProvideModule),
|
||||
appmodule.Provide(ProvideModule),
|
||||
)
|
||||
}
|
||||
|
||||
func ProvideModuleBasic() runtime.AppModuleBasicWrapper {
|
||||
return runtime.WrapAppModuleBasic(AppModuleBasic{})
|
||||
}
|
||||
|
||||
type UpgradeInputs struct {
|
||||
depinject.In
|
||||
|
||||
@ -167,7 +172,7 @@ type UpgradeOutputs struct {
|
||||
depinject.Out
|
||||
|
||||
UpgradeKeeper keeper.Keeper
|
||||
Module runtime.AppModuleWrapper
|
||||
Module appmodule.AppModule
|
||||
GovHandler govv1beta1.HandlerRoute
|
||||
}
|
||||
|
||||
@ -196,5 +201,5 @@ func ProvideModule(in UpgradeInputs) UpgradeOutputs {
|
||||
m := NewAppModule(k)
|
||||
gh := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewSoftwareUpgradeProposalHandler(k)}
|
||||
|
||||
return UpgradeOutputs{UpgradeKeeper: k, Module: runtime.WrapAppModule(m), GovHandler: gh}
|
||||
return UpgradeOutputs{UpgradeKeeper: k, Module: m, GovHandler: gh}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user