Merge branch 'master' into jonathan/4875-slashing-use-simapp
This commit is contained in:
commit
e96ef63b61
|
@ -47,6 +47,8 @@ ignore:
|
||||||
- "*.md"
|
- "*.md"
|
||||||
- "*.rst"
|
- "*.rst"
|
||||||
- "**/*.pb.go"
|
- "**/*.pb.go"
|
||||||
|
- "tests/*"
|
||||||
|
- "tests/**/*"
|
||||||
- "x/**/*.pb.go"
|
- "x/**/*.pb.go"
|
||||||
- "x/**/test_common.go"
|
- "x/**/test_common.go"
|
||||||
- "scripts/"
|
- "scripts/"
|
||||||
|
|
|
@ -152,6 +152,7 @@ Buffers for state serialization instead of Amino.
|
||||||
* Add `tx.maxheight` key to filter transaction with an inclusive maximum block height
|
* Add `tx.maxheight` key to filter transaction with an inclusive maximum block height
|
||||||
* (server) [\#5709](https://github.com/cosmos/cosmos-sdk/pull/5709) There are two new flags for pruning, `--pruning-keep-every`
|
* (server) [\#5709](https://github.com/cosmos/cosmos-sdk/pull/5709) There are two new flags for pruning, `--pruning-keep-every`
|
||||||
and `--pruning-snapshot-every` as an alternative to `--pruning`. They allow to fine tune the strategy for pruning the state.
|
and `--pruning-snapshot-every` as an alternative to `--pruning`. They allow to fine tune the strategy for pruning the state.
|
||||||
|
* (crypto/keys) [\#5739](https://github.com/cosmos/cosmos-sdk/pull/5739) Print an error message if the password input failed.
|
||||||
|
|
||||||
## [v0.38.1] - 2020-02-11
|
## [v0.38.1] - 2020-02-11
|
||||||
|
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -27,6 +27,10 @@ build: go.sum
|
||||||
mocks: $(MOCKS_DIR)
|
mocks: $(MOCKS_DIR)
|
||||||
mockgen -source=x/auth/types/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
|
mockgen -source=x/auth/types/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
|
||||||
mockgen -package mocks -destination tests/mocks/tendermint_tm_db_DB.go github.com/tendermint/tm-db DB
|
mockgen -package mocks -destination tests/mocks/tendermint_tm_db_DB.go github.com/tendermint/tm-db DB
|
||||||
|
mockgen -source=types/module/module.go -package mocks -destination tests/mocks/types_module_module.go
|
||||||
|
mockgen -source=types/invariant.go -package mocks -destination tests/mocks/types_invariant.go
|
||||||
|
mockgen -source=types/router.go -package mocks -destination tests/mocks/types_router.go
|
||||||
|
mockgen -source=types/handler.go -package mocks -destination tests/mocks/types_handler.go
|
||||||
.PHONY: mocks
|
.PHONY: mocks
|
||||||
|
|
||||||
$(MOCKS_DIR):
|
$(MOCKS_DIR):
|
||||||
|
|
|
@ -546,6 +546,7 @@ func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) {
|
||||||
buf := bufio.NewReader(buf)
|
buf := bufio.NewReader(buf)
|
||||||
pass, err := input.GetPassword("Enter keyring passphrase:", buf)
|
pass, err := input.GetPassword("Enter keyring passphrase:", buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
|
// Source: types/handler.go
|
||||||
|
|
||||||
|
// Package mocks is a generated GoMock package.
|
||||||
|
package mocks
|
||||||
|
|
||||||
|
import (
|
||||||
|
types "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MockAnteDecorator is a mock of AnteDecorator interface
|
||||||
|
type MockAnteDecorator struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockAnteDecoratorMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAnteDecoratorMockRecorder is the mock recorder for MockAnteDecorator
|
||||||
|
type MockAnteDecoratorMockRecorder struct {
|
||||||
|
mock *MockAnteDecorator
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockAnteDecorator creates a new mock instance
|
||||||
|
func NewMockAnteDecorator(ctrl *gomock.Controller) *MockAnteDecorator {
|
||||||
|
mock := &MockAnteDecorator{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockAnteDecoratorMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockAnteDecorator) EXPECT() *MockAnteDecoratorMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnteHandle mocks base method
|
||||||
|
func (m *MockAnteDecorator) AnteHandle(ctx types.Context, tx types.Tx, simulate bool, next types.AnteHandler) (types.Context, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "AnteHandle", ctx, tx, simulate, next)
|
||||||
|
ret0, _ := ret[0].(types.Context)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnteHandle indicates an expected call of AnteHandle
|
||||||
|
func (mr *MockAnteDecoratorMockRecorder) AnteHandle(ctx, tx, simulate, next interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AnteHandle", reflect.TypeOf((*MockAnteDecorator)(nil).AnteHandle), ctx, tx, simulate, next)
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
|
// Source: types/invariant.go
|
||||||
|
|
||||||
|
// Package mocks is a generated GoMock package.
|
||||||
|
package mocks
|
||||||
|
|
||||||
|
import (
|
||||||
|
types "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MockInvariantRegistry is a mock of InvariantRegistry interface
|
||||||
|
type MockInvariantRegistry struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockInvariantRegistryMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockInvariantRegistryMockRecorder is the mock recorder for MockInvariantRegistry
|
||||||
|
type MockInvariantRegistryMockRecorder struct {
|
||||||
|
mock *MockInvariantRegistry
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockInvariantRegistry creates a new mock instance
|
||||||
|
func NewMockInvariantRegistry(ctrl *gomock.Controller) *MockInvariantRegistry {
|
||||||
|
mock := &MockInvariantRegistry{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockInvariantRegistryMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockInvariantRegistry) EXPECT() *MockInvariantRegistryMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRoute mocks base method
|
||||||
|
func (m *MockInvariantRegistry) RegisterRoute(moduleName, route string, invar types.Invariant) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterRoute", moduleName, route, invar)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRoute indicates an expected call of RegisterRoute
|
||||||
|
func (mr *MockInvariantRegistryMockRecorder) RegisterRoute(moduleName, route, invar interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRoute", reflect.TypeOf((*MockInvariantRegistry)(nil).RegisterRoute), moduleName, route, invar)
|
||||||
|
}
|
|
@ -0,0 +1,518 @@
|
||||||
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
|
// Source: types/module/module.go
|
||||||
|
|
||||||
|
// Package mocks is a generated GoMock package.
|
||||||
|
package mocks
|
||||||
|
|
||||||
|
import (
|
||||||
|
json "encoding/json"
|
||||||
|
context "github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
types "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
mux "github.com/gorilla/mux"
|
||||||
|
cobra "github.com/spf13/cobra"
|
||||||
|
types0 "github.com/tendermint/tendermint/abci/types"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MockAppModuleBasic is a mock of AppModuleBasic interface
|
||||||
|
type MockAppModuleBasic struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockAppModuleBasicMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAppModuleBasicMockRecorder is the mock recorder for MockAppModuleBasic
|
||||||
|
type MockAppModuleBasicMockRecorder struct {
|
||||||
|
mock *MockAppModuleBasic
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockAppModuleBasic creates a new mock instance
|
||||||
|
func NewMockAppModuleBasic(ctrl *gomock.Controller) *MockAppModuleBasic {
|
||||||
|
mock := &MockAppModuleBasic{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockAppModuleBasicMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockAppModuleBasic) EXPECT() *MockAppModuleBasicMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name mocks base method
|
||||||
|
func (m *MockAppModuleBasic) 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 *MockAppModuleBasicMockRecorder) Name() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModuleBasic)(nil).Name))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec mocks base method
|
||||||
|
func (m *MockAppModuleBasic) RegisterCodec(arg0 *codec.Codec) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterCodec", arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec indicates an expected call of RegisterCodec
|
||||||
|
func (mr *MockAppModuleBasicMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterCodec), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGenesis mocks base method
|
||||||
|
func (m *MockAppModuleBasic) DefaultGenesis(arg0 codec.JSONMarshaler) 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 *MockAppModuleBasicMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleBasic)(nil).DefaultGenesis), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis mocks base method
|
||||||
|
func (m *MockAppModuleBasic) ValidateGenesis(arg0 codec.JSONMarshaler, arg1 json.RawMessage) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis indicates an expected call of ValidateGenesis
|
||||||
|
func (mr *MockAppModuleBasicMockRecorder) ValidateGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleBasic)(nil).ValidateGenesis), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes mocks base method
|
||||||
|
func (m *MockAppModuleBasic) RegisterRESTRoutes(arg0 context.CLIContext, arg1 *mux.Router) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes
|
||||||
|
func (mr *MockAppModuleBasicMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModuleBasic)(nil).RegisterRESTRoutes), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd mocks base method
|
||||||
|
func (m *MockAppModuleBasic) GetTxCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetTxCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd indicates an expected call of GetTxCmd
|
||||||
|
func (mr *MockAppModuleBasicMockRecorder) GetTxCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetTxCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd mocks base method
|
||||||
|
func (m *MockAppModuleBasic) GetQueryCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetQueryCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd indicates an expected call of GetQueryCmd
|
||||||
|
func (mr *MockAppModuleBasicMockRecorder) GetQueryCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleBasic)(nil).GetQueryCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAppModuleGenesis is a mock of AppModuleGenesis interface
|
||||||
|
type MockAppModuleGenesis struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockAppModuleGenesisMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAppModuleGenesisMockRecorder is the mock recorder for MockAppModuleGenesis
|
||||||
|
type MockAppModuleGenesisMockRecorder struct {
|
||||||
|
mock *MockAppModuleGenesis
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockAppModuleGenesis creates a new mock instance
|
||||||
|
func NewMockAppModuleGenesis(ctrl *gomock.Controller) *MockAppModuleGenesis {
|
||||||
|
mock := &MockAppModuleGenesis{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockAppModuleGenesisMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockAppModuleGenesis) EXPECT() *MockAppModuleGenesisMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) 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 *MockAppModuleGenesisMockRecorder) Name() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModuleGenesis)(nil).Name))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) RegisterCodec(arg0 *codec.Codec) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterCodec", arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec indicates an expected call of RegisterCodec
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterCodec), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGenesis mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) DefaultGenesis(arg0 codec.JSONMarshaler) 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 *MockAppModuleGenesisMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModuleGenesis)(nil).DefaultGenesis), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) ValidateGenesis(arg0 codec.JSONMarshaler, arg1 json.RawMessage) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis indicates an expected call of ValidateGenesis
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) ValidateGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModuleGenesis)(nil).ValidateGenesis), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) RegisterRESTRoutes(arg0 context.CLIContext, arg1 *mux.Router) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModuleGenesis)(nil).RegisterRESTRoutes), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) GetTxCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetTxCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd indicates an expected call of GetTxCmd
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) GetTxCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetTxCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) GetQueryCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetQueryCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd indicates an expected call of GetQueryCmd
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) GetQueryCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModuleGenesis)(nil).GetQueryCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitGenesis mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) InitGenesis(arg0 types.Context, arg1 codec.JSONMarshaler, arg2 json.RawMessage) []types0.ValidatorUpdate {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||||
|
ret0, _ := ret[0].([]types0.ValidatorUpdate)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitGenesis indicates an expected call of InitGenesis
|
||||||
|
func (mr *MockAppModuleGenesisMockRecorder) InitGenesis(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitGenesis", reflect.TypeOf((*MockAppModuleGenesis)(nil).InitGenesis), arg0, arg1, arg2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportGenesis mocks base method
|
||||||
|
func (m *MockAppModuleGenesis) ExportGenesis(arg0 types.Context, arg1 codec.JSONMarshaler) 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 *MockAppModuleGenesisMockRecorder) ExportGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExportGenesis", reflect.TypeOf((*MockAppModuleGenesis)(nil).ExportGenesis), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAppModule is a mock of AppModule interface
|
||||||
|
type MockAppModule struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockAppModuleMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAppModuleMockRecorder is the mock recorder for MockAppModule
|
||||||
|
type MockAppModuleMockRecorder struct {
|
||||||
|
mock *MockAppModule
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockAppModule creates a new mock instance
|
||||||
|
func NewMockAppModule(ctrl *gomock.Controller) *MockAppModule {
|
||||||
|
mock := &MockAppModule{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockAppModuleMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockAppModule) EXPECT() *MockAppModuleMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name mocks base method
|
||||||
|
func (m *MockAppModule) 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 *MockAppModuleMockRecorder) Name() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAppModule)(nil).Name))
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec mocks base method
|
||||||
|
func (m *MockAppModule) RegisterCodec(arg0 *codec.Codec) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterCodec", arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCodec indicates an expected call of RegisterCodec
|
||||||
|
func (mr *MockAppModuleMockRecorder) RegisterCodec(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterCodec", reflect.TypeOf((*MockAppModule)(nil).RegisterCodec), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DefaultGenesis mocks base method
|
||||||
|
func (m *MockAppModule) DefaultGenesis(arg0 codec.JSONMarshaler) 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 *MockAppModuleMockRecorder) DefaultGenesis(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DefaultGenesis", reflect.TypeOf((*MockAppModule)(nil).DefaultGenesis), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis mocks base method
|
||||||
|
func (m *MockAppModule) ValidateGenesis(arg0 codec.JSONMarshaler, arg1 json.RawMessage) error {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "ValidateGenesis", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].(error)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateGenesis indicates an expected call of ValidateGenesis
|
||||||
|
func (mr *MockAppModuleMockRecorder) ValidateGenesis(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateGenesis", reflect.TypeOf((*MockAppModule)(nil).ValidateGenesis), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes mocks base method
|
||||||
|
func (m *MockAppModule) RegisterRESTRoutes(arg0 context.CLIContext, arg1 *mux.Router) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "RegisterRESTRoutes", arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterRESTRoutes indicates an expected call of RegisterRESTRoutes
|
||||||
|
func (mr *MockAppModuleMockRecorder) RegisterRESTRoutes(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterRESTRoutes", reflect.TypeOf((*MockAppModule)(nil).RegisterRESTRoutes), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd mocks base method
|
||||||
|
func (m *MockAppModule) GetTxCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetTxCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTxCmd indicates an expected call of GetTxCmd
|
||||||
|
func (mr *MockAppModuleMockRecorder) GetTxCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTxCmd", reflect.TypeOf((*MockAppModule)(nil).GetTxCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd mocks base method
|
||||||
|
func (m *MockAppModule) GetQueryCmd(arg0 *codec.Codec) *cobra.Command {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetQueryCmd", arg0)
|
||||||
|
ret0, _ := ret[0].(*cobra.Command)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetQueryCmd indicates an expected call of GetQueryCmd
|
||||||
|
func (mr *MockAppModuleMockRecorder) GetQueryCmd(arg0 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueryCmd", reflect.TypeOf((*MockAppModule)(nil).GetQueryCmd), arg0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitGenesis mocks base method
|
||||||
|
func (m *MockAppModule) InitGenesis(arg0 types.Context, arg1 codec.JSONMarshaler, arg2 json.RawMessage) []types0.ValidatorUpdate {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "InitGenesis", arg0, arg1, arg2)
|
||||||
|
ret0, _ := ret[0].([]types0.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExportGenesis mocks base method
|
||||||
|
func (m *MockAppModule) ExportGenesis(arg0 types.Context, arg1 codec.JSONMarshaler) 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterInvariants mocks base method
|
||||||
|
func (m *MockAppModule) RegisterInvariants(arg0 types.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route mocks base method
|
||||||
|
func (m *MockAppModule) Route() string {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Route")
|
||||||
|
ret0, _ := ret[0].(string)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route indicates an expected call of Route
|
||||||
|
func (mr *MockAppModuleMockRecorder) Route() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Route", reflect.TypeOf((*MockAppModule)(nil).Route))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHandler mocks base method
|
||||||
|
func (m *MockAppModule) NewHandler() types.Handler {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "NewHandler")
|
||||||
|
ret0, _ := ret[0].(types.Handler)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHandler indicates an expected call of NewHandler
|
||||||
|
func (mr *MockAppModuleMockRecorder) NewHandler() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewHandler", reflect.TypeOf((*MockAppModule)(nil).NewHandler))
|
||||||
|
}
|
||||||
|
|
||||||
|
// QuerierRoute mocks base method
|
||||||
|
func (m *MockAppModule) QuerierRoute() string {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "QuerierRoute")
|
||||||
|
ret0, _ := ret[0].(string)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// QuerierRoute indicates an expected call of QuerierRoute
|
||||||
|
func (mr *MockAppModuleMockRecorder) QuerierRoute() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QuerierRoute", reflect.TypeOf((*MockAppModule)(nil).QuerierRoute))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewQuerierHandler mocks base method
|
||||||
|
func (m *MockAppModule) NewQuerierHandler() types.Querier {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "NewQuerierHandler")
|
||||||
|
ret0, _ := ret[0].(types.Querier)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewQuerierHandler indicates an expected call of NewQuerierHandler
|
||||||
|
func (mr *MockAppModuleMockRecorder) NewQuerierHandler() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewQuerierHandler", reflect.TypeOf((*MockAppModule)(nil).NewQuerierHandler))
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeginBlock mocks base method
|
||||||
|
func (m *MockAppModule) BeginBlock(arg0 types.Context, arg1 types0.RequestBeginBlock) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
m.ctrl.Call(m, "BeginBlock", arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BeginBlock indicates an expected call of BeginBlock
|
||||||
|
func (mr *MockAppModuleMockRecorder) BeginBlock(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BeginBlock", reflect.TypeOf((*MockAppModule)(nil).BeginBlock), arg0, arg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EndBlock mocks base method
|
||||||
|
func (m *MockAppModule) EndBlock(arg0 types.Context, arg1 types0.RequestEndBlock) []types0.ValidatorUpdate {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "EndBlock", arg0, arg1)
|
||||||
|
ret0, _ := ret[0].([]types0.ValidatorUpdate)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// EndBlock indicates an expected call of EndBlock
|
||||||
|
func (mr *MockAppModuleMockRecorder) EndBlock(arg0, arg1 interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndBlock", reflect.TypeOf((*MockAppModule)(nil).EndBlock), arg0, arg1)
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
|
// Source: types/router.go
|
||||||
|
|
||||||
|
// Package mocks is a generated GoMock package.
|
||||||
|
package mocks
|
||||||
|
|
||||||
|
import (
|
||||||
|
types "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MockRouter is a mock of Router interface
|
||||||
|
type MockRouter struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockRouterMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockRouterMockRecorder is the mock recorder for MockRouter
|
||||||
|
type MockRouterMockRecorder struct {
|
||||||
|
mock *MockRouter
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockRouter creates a new mock instance
|
||||||
|
func NewMockRouter(ctrl *gomock.Controller) *MockRouter {
|
||||||
|
mock := &MockRouter{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockRouterMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockRouter) EXPECT() *MockRouterMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddRoute mocks base method
|
||||||
|
func (m *MockRouter) AddRoute(r string, h types.Handler) types.Router {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "AddRoute", r, h)
|
||||||
|
ret0, _ := ret[0].(types.Router)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddRoute indicates an expected call of AddRoute
|
||||||
|
func (mr *MockRouterMockRecorder) AddRoute(r, h interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoute", reflect.TypeOf((*MockRouter)(nil).AddRoute), r, h)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route mocks base method
|
||||||
|
func (m *MockRouter) Route(ctx types.Context, path string) types.Handler {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Route", ctx, path)
|
||||||
|
ret0, _ := ret[0].(types.Handler)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route indicates an expected call of Route
|
||||||
|
func (mr *MockRouterMockRecorder) Route(ctx, path interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Route", reflect.TypeOf((*MockRouter)(nil).Route), ctx, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockQueryRouter is a mock of QueryRouter interface
|
||||||
|
type MockQueryRouter struct {
|
||||||
|
ctrl *gomock.Controller
|
||||||
|
recorder *MockQueryRouterMockRecorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockQueryRouterMockRecorder is the mock recorder for MockQueryRouter
|
||||||
|
type MockQueryRouterMockRecorder struct {
|
||||||
|
mock *MockQueryRouter
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockQueryRouter creates a new mock instance
|
||||||
|
func NewMockQueryRouter(ctrl *gomock.Controller) *MockQueryRouter {
|
||||||
|
mock := &MockQueryRouter{ctrl: ctrl}
|
||||||
|
mock.recorder = &MockQueryRouterMockRecorder{mock}
|
||||||
|
return mock
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXPECT returns an object that allows the caller to indicate expected use
|
||||||
|
func (m *MockQueryRouter) EXPECT() *MockQueryRouterMockRecorder {
|
||||||
|
return m.recorder
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddRoute mocks base method
|
||||||
|
func (m *MockQueryRouter) AddRoute(r string, h types.Querier) types.QueryRouter {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "AddRoute", r, h)
|
||||||
|
ret0, _ := ret[0].(types.QueryRouter)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddRoute indicates an expected call of AddRoute
|
||||||
|
func (mr *MockQueryRouterMockRecorder) AddRoute(r, h interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoute", reflect.TypeOf((*MockQueryRouter)(nil).AddRoute), r, h)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route mocks base method
|
||||||
|
func (m *MockQueryRouter) Route(path string) types.Querier {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "Route", path)
|
||||||
|
ret0, _ := ret[0].(types.Querier)
|
||||||
|
return ret0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route indicates an expected call of Route
|
||||||
|
func (mr *MockQueryRouterMockRecorder) Route(path interface{}) *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Route", reflect.TypeOf((*MockQueryRouter)(nil).Route), path)
|
||||||
|
}
|
|
@ -1,16 +1,272 @@
|
||||||
package module
|
package module_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/golang/mock/gomock"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
"github.com/cosmos/cosmos-sdk/tests/mocks"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSetOrderBeginBlockers(t *testing.T) {
|
var errFoo = errors.New("dummy")
|
||||||
mm := NewManager()
|
|
||||||
mm.SetOrderBeginBlockers("a", "b", "c")
|
func TestBasicManager(t *testing.T) {
|
||||||
obb := mm.OrderBeginBlockers
|
t.Parallel()
|
||||||
require.Equal(t, 3, len(obb))
|
mockCtrl := gomock.NewController(t)
|
||||||
assert.Equal(t, []string{"a", "b", "c"}, obb)
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModuleBasic1 := mocks.NewMockAppModuleBasic(mockCtrl)
|
||||||
|
mockAppModuleBasic2 := mocks.NewMockAppModuleBasic(mockCtrl)
|
||||||
|
|
||||||
|
mockAppModuleBasic1.EXPECT().Name().Times(1).Return("mockAppModuleBasic1")
|
||||||
|
mockAppModuleBasic2.EXPECT().Name().Times(1).Return("mockAppModuleBasic2")
|
||||||
|
|
||||||
|
mm := module.NewBasicManager(mockAppModuleBasic1, mockAppModuleBasic2)
|
||||||
|
require.Equal(t, mm["mockAppModuleBasic1"], mockAppModuleBasic1)
|
||||||
|
|
||||||
|
cdc := codec.New()
|
||||||
|
mockAppModuleBasic1.EXPECT().RegisterCodec(gomock.Eq(cdc)).Times(1)
|
||||||
|
mockAppModuleBasic2.EXPECT().RegisterCodec(gomock.Eq(cdc)).Times(1)
|
||||||
|
mm.RegisterCodec(cdc)
|
||||||
|
|
||||||
|
mockAppModuleBasic1.EXPECT().Name().Times(1).Return("mockAppModuleBasic1")
|
||||||
|
mockAppModuleBasic2.EXPECT().Name().Times(1).Return("mockAppModuleBasic2")
|
||||||
|
mockAppModuleBasic1.EXPECT().DefaultGenesis(gomock.Eq(cdc)).Times(1).Return(json.RawMessage(``))
|
||||||
|
mockAppModuleBasic2.EXPECT().DefaultGenesis(gomock.Eq(cdc)).Times(1).Return(json.RawMessage(`{"key":"value"}`))
|
||||||
|
defaultGenesis := mm.DefaultGenesis(cdc)
|
||||||
|
require.Equal(t, 2, len(defaultGenesis))
|
||||||
|
require.Equal(t, json.RawMessage(``), defaultGenesis["mockAppModuleBasic1"])
|
||||||
|
|
||||||
|
var data map[string]string
|
||||||
|
require.NoError(t, json.Unmarshal(defaultGenesis["mockAppModuleBasic2"], &data))
|
||||||
|
require.Equal(t, map[string]string{"key": "value"}, data)
|
||||||
|
|
||||||
|
mockAppModuleBasic1.EXPECT().Name().Times(1).Return("mockAppModuleBasic1")
|
||||||
|
mockAppModuleBasic1.EXPECT().ValidateGenesis(gomock.Eq(cdc), gomock.Eq(defaultGenesis["mockAppModuleBasic1"])).Times(1).Return(errFoo)
|
||||||
|
require.True(t, errors.Is(errFoo, mm.ValidateGenesis(cdc, defaultGenesis)))
|
||||||
|
|
||||||
|
mockAppModuleBasic1.EXPECT().RegisterRESTRoutes(gomock.Eq(context.CLIContext{}), gomock.Eq(&mux.Router{})).Times(1)
|
||||||
|
mockAppModuleBasic2.EXPECT().RegisterRESTRoutes(gomock.Eq(context.CLIContext{}), gomock.Eq(&mux.Router{})).Times(1)
|
||||||
|
mm.RegisterRESTRoutes(context.CLIContext{}, &mux.Router{})
|
||||||
|
|
||||||
|
mockCmd := &cobra.Command{Use: "root"}
|
||||||
|
mockAppModuleBasic1.EXPECT().GetTxCmd(cdc).Times(1).Return(nil)
|
||||||
|
mockAppModuleBasic2.EXPECT().GetTxCmd(cdc).Times(1).Return(&cobra.Command{})
|
||||||
|
mm.AddTxCommands(mockCmd, cdc)
|
||||||
|
|
||||||
|
mockAppModuleBasic1.EXPECT().GetQueryCmd(cdc).Times(1).Return(nil)
|
||||||
|
mockAppModuleBasic2.EXPECT().GetQueryCmd(cdc).Times(1).Return(&cobra.Command{})
|
||||||
|
mm.AddQueryCommands(mockCmd, cdc)
|
||||||
|
|
||||||
|
// validate genesis returns nil
|
||||||
|
require.Nil(t, module.NewBasicManager().ValidateGenesis(cdc, defaultGenesis))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGenesisOnlyAppModule(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockModule := mocks.NewMockAppModuleGenesis(mockCtrl)
|
||||||
|
mockInvariantRegistry := mocks.NewMockInvariantRegistry(mockCtrl)
|
||||||
|
goam := module.NewGenesisOnlyAppModule(mockModule)
|
||||||
|
|
||||||
|
require.Empty(t, goam.Route())
|
||||||
|
require.Empty(t, goam.QuerierRoute())
|
||||||
|
require.Nil(t, goam.NewHandler())
|
||||||
|
require.Nil(t, goam.NewQuerierHandler())
|
||||||
|
|
||||||
|
// no-op
|
||||||
|
goam.RegisterInvariants(mockInvariantRegistry)
|
||||||
|
goam.BeginBlock(sdk.Context{}, abci.RequestBeginBlock{})
|
||||||
|
require.Equal(t, []abci.ValidatorUpdate{}, goam.EndBlock(sdk.Context{}, abci.RequestEndBlock{}))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManagerOrderSetters(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
require.Equal(t, []string{"module1", "module2"}, mm.OrderInitGenesis)
|
||||||
|
mm.SetOrderInitGenesis("module2", "module1")
|
||||||
|
require.Equal(t, []string{"module2", "module1"}, mm.OrderInitGenesis)
|
||||||
|
|
||||||
|
require.Equal(t, []string{"module1", "module2"}, mm.OrderExportGenesis)
|
||||||
|
mm.SetOrderExportGenesis("module2", "module1")
|
||||||
|
require.Equal(t, []string{"module2", "module1"}, mm.OrderExportGenesis)
|
||||||
|
|
||||||
|
require.Equal(t, []string{"module1", "module2"}, mm.OrderBeginBlockers)
|
||||||
|
mm.SetOrderBeginBlockers("module2", "module1")
|
||||||
|
require.Equal(t, []string{"module2", "module1"}, mm.OrderBeginBlockers)
|
||||||
|
|
||||||
|
require.Equal(t, []string{"module1", "module2"}, mm.OrderEndBlockers)
|
||||||
|
mm.SetOrderEndBlockers("module2", "module1")
|
||||||
|
require.Equal(t, []string{"module2", "module1"}, mm.OrderEndBlockers)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_RegisterInvariants(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
// test RegisterInvariants
|
||||||
|
mockInvariantRegistry := mocks.NewMockInvariantRegistry(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().RegisterInvariants(gomock.Eq(mockInvariantRegistry)).Times(1)
|
||||||
|
mockAppModule2.EXPECT().RegisterInvariants(gomock.Eq(mockInvariantRegistry)).Times(1)
|
||||||
|
mm.RegisterInvariants(mockInvariantRegistry)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_RegisterRoutes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
router := mocks.NewMockRouter(mockCtrl)
|
||||||
|
handler1, handler2 := sdk.Handler(nil), sdk.Handler(nil)
|
||||||
|
mockAppModule1.EXPECT().Route().Times(2).Return("route1")
|
||||||
|
mockAppModule2.EXPECT().Route().Times(2).Return("route2")
|
||||||
|
mockAppModule1.EXPECT().NewHandler().Times(1).Return(handler1)
|
||||||
|
mockAppModule2.EXPECT().NewHandler().Times(1).Return(handler2)
|
||||||
|
router.EXPECT().AddRoute(gomock.Eq("route1"), gomock.Eq(handler1)).Times(1)
|
||||||
|
router.EXPECT().AddRoute(gomock.Eq("route2"), gomock.Eq(handler2)).Times(1)
|
||||||
|
|
||||||
|
queryRouter := mocks.NewMockQueryRouter(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().QuerierRoute().Times(2).Return("querierRoute1")
|
||||||
|
mockAppModule2.EXPECT().QuerierRoute().Times(1).Return("")
|
||||||
|
handler3 := sdk.Querier(nil)
|
||||||
|
mockAppModule1.EXPECT().NewQuerierHandler().Times(1).Return(handler3)
|
||||||
|
queryRouter.EXPECT().AddRoute(gomock.Eq("querierRoute1"), gomock.Eq(handler3)).Times(1)
|
||||||
|
|
||||||
|
mm.RegisterRoutes(router, queryRouter)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_InitGenesis(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
cdc, ctx := codec.New(), sdk.Context{}
|
||||||
|
genesisData := map[string]json.RawMessage{"module1": json.RawMessage(`{"key": "value"}`)}
|
||||||
|
|
||||||
|
mockAppModule1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module1"])).Times(1).Return(nil)
|
||||||
|
require.Equal(t, abci.ResponseInitChain{Validators: []abci.ValidatorUpdate(nil)}, mm.InitGenesis(ctx, cdc, genesisData))
|
||||||
|
|
||||||
|
// test panic
|
||||||
|
genesisData = map[string]json.RawMessage{
|
||||||
|
"module1": json.RawMessage(`{"key": "value"}`),
|
||||||
|
"module2": json.RawMessage(`{"key": "value"}`)}
|
||||||
|
mockAppModule1.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module1"])).Times(1).Return([]abci.ValidatorUpdate{abci.ValidatorUpdate{}})
|
||||||
|
mockAppModule2.EXPECT().InitGenesis(gomock.Eq(ctx), gomock.Eq(cdc), gomock.Eq(genesisData["module2"])).Times(1).Return([]abci.ValidatorUpdate{abci.ValidatorUpdate{}})
|
||||||
|
require.Panics(t, func() { mm.InitGenesis(ctx, cdc, genesisData) })
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_ExportGenesis(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
cdc, ctx := codec.New(), sdk.Context{}
|
||||||
|
mockAppModule1.EXPECT().ExportGenesis(gomock.Eq(ctx), gomock.Eq(cdc)).Times(1).Return(json.RawMessage(`{"key1": "value1"}`))
|
||||||
|
mockAppModule2.EXPECT().ExportGenesis(gomock.Eq(ctx), gomock.Eq(cdc)).Times(1).Return(json.RawMessage(`{"key2": "value2"}`))
|
||||||
|
|
||||||
|
want := map[string]json.RawMessage{
|
||||||
|
"module1": json.RawMessage(`{"key1": "value1"}`),
|
||||||
|
"module2": json.RawMessage(`{"key2": "value2"}`)}
|
||||||
|
require.Equal(t, want, mm.ExportGenesis(ctx, cdc))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_BeginBlock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
req := abci.RequestBeginBlock{Hash: []byte("test")}
|
||||||
|
|
||||||
|
mockAppModule1.EXPECT().BeginBlock(gomock.Any(), gomock.Eq(req)).Times(1)
|
||||||
|
mockAppModule2.EXPECT().BeginBlock(gomock.Any(), gomock.Eq(req)).Times(1)
|
||||||
|
mm.BeginBlock(sdk.Context{}, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestManager_EndBlock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
t.Cleanup(mockCtrl.Finish)
|
||||||
|
|
||||||
|
mockAppModule1 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule2 := mocks.NewMockAppModule(mockCtrl)
|
||||||
|
mockAppModule1.EXPECT().Name().Times(2).Return("module1")
|
||||||
|
mockAppModule2.EXPECT().Name().Times(2).Return("module2")
|
||||||
|
mm := module.NewManager(mockAppModule1, mockAppModule2)
|
||||||
|
require.NotNil(t, mm)
|
||||||
|
require.Equal(t, 2, len(mm.Modules))
|
||||||
|
|
||||||
|
req := abci.RequestEndBlock{Height: 10}
|
||||||
|
|
||||||
|
mockAppModule1.EXPECT().EndBlock(gomock.Any(), gomock.Eq(req)).Times(1).Return([]abci.ValidatorUpdate{abci.ValidatorUpdate{}})
|
||||||
|
mockAppModule2.EXPECT().EndBlock(gomock.Any(), gomock.Eq(req)).Times(1)
|
||||||
|
ret := mm.EndBlock(sdk.Context{}, req)
|
||||||
|
require.Equal(t, []abci.ValidatorUpdate{abci.ValidatorUpdate{}}, ret.ValidatorUpdates)
|
||||||
|
|
||||||
|
// test panic
|
||||||
|
mockAppModule1.EXPECT().EndBlock(gomock.Any(), gomock.Eq(req)).Times(1).Return([]abci.ValidatorUpdate{abci.ValidatorUpdate{}})
|
||||||
|
mockAppModule2.EXPECT().EndBlock(gomock.Any(), gomock.Eq(req)).Times(1).Return([]abci.ValidatorUpdate{abci.ValidatorUpdate{}})
|
||||||
|
require.Panics(t, func() { mm.EndBlock(sdk.Context{}, req) })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue