diff --git a/dot/network/mock_block_state_test.go b/dot/network/mock_block_state_test.go index 5c6d10772a5..ff3a593f7a2 100644 --- a/dot/network/mock_block_state_test.go +++ b/dot/network/mock_block_state_test.go @@ -50,21 +50,6 @@ func (mr *MockBlockStateMockRecorder) BestBlockHeader() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestBlockHeader", reflect.TypeOf((*MockBlockState)(nil).BestBlockHeader)) } -// BestBlockNumber mocks base method. -func (m *MockBlockState) BestBlockNumber() (uint, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BestBlockNumber") - ret0, _ := ret[0].(uint) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BestBlockNumber indicates an expected call of BestBlockNumber. -func (mr *MockBlockStateMockRecorder) BestBlockNumber() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestBlockNumber", reflect.TypeOf((*MockBlockState)(nil).BestBlockNumber)) -} - // GenesisHash mocks base method. func (m *MockBlockState) GenesisHash() common.Hash { m.ctrl.T.Helper() @@ -79,21 +64,6 @@ func (mr *MockBlockStateMockRecorder) GenesisHash() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenesisHash", reflect.TypeOf((*MockBlockState)(nil).GenesisHash)) } -// GetHashByNumber mocks base method. -func (m *MockBlockState) GetHashByNumber(arg0 uint) (common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetHashByNumber", arg0) - ret0, _ := ret[0].(common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetHashByNumber indicates an expected call of GetHashByNumber. -func (mr *MockBlockStateMockRecorder) GetHashByNumber(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHashByNumber", reflect.TypeOf((*MockBlockState)(nil).GetHashByNumber), arg0) -} - // GetHighestFinalisedHeader mocks base method. func (m *MockBlockState) GetHighestFinalisedHeader() (*types.Header, error) { m.ctrl.T.Helper() @@ -108,18 +78,3 @@ func (mr *MockBlockStateMockRecorder) GetHighestFinalisedHeader() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHighestFinalisedHeader", reflect.TypeOf((*MockBlockState)(nil).GetHighestFinalisedHeader)) } - -// HasBlockBody mocks base method. -func (m *MockBlockState) HasBlockBody(arg0 common.Hash) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HasBlockBody", arg0) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HasBlockBody indicates an expected call of HasBlockBody. -func (mr *MockBlockStateMockRecorder) HasBlockBody(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasBlockBody", reflect.TypeOf((*MockBlockState)(nil).HasBlockBody), arg0) -} diff --git a/dot/network/service_test.go b/dot/network/service_test.go index ef9b4496982..fc2dd21a596 100644 --- a/dot/network/service_test.go +++ b/dot/network/service_test.go @@ -106,11 +106,6 @@ func createTestService(t *testing.T, cfg *Config) (srvc *Service) { blockstate.EXPECT().BestBlockHeader().Return(header, nil).AnyTimes() blockstate.EXPECT().GetHighestFinalisedHeader().Return(header, nil).AnyTimes() blockstate.EXPECT().GenesisHash().Return(common.NewHash([]byte{})).AnyTimes() - blockstate.EXPECT().BestBlockNumber().Return(uint(1), nil).AnyTimes() - - blockstate.EXPECT().HasBlockBody( - gomock.AssignableToTypeOf(common.Hash([32]byte{}))).Return(false, nil).AnyTimes() - blockstate.EXPECT().GetHashByNumber(gomock.Any()).Return(common.Hash{}, nil).AnyTimes() cfg.BlockState = blockstate } diff --git a/dot/peerset/mock_message_processor_test.go b/dot/peerset/mock_message_processor_test.go deleted file mode 100644 index 91799591faa..00000000000 --- a/dot/peerset/mock_message_processor_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/dot/peerset (interfaces: MessageProcessor) - -// Package peerset is a generated GoMock package. -package peerset - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" -) - -// MockMessageProcessor is a mock of MessageProcessor interface. -type MockMessageProcessor struct { - ctrl *gomock.Controller - recorder *MockMessageProcessorMockRecorder -} - -// MockMessageProcessorMockRecorder is the mock recorder for MockMessageProcessor. -type MockMessageProcessorMockRecorder struct { - mock *MockMessageProcessor -} - -// NewMockMessageProcessor creates a new mock instance. -func NewMockMessageProcessor(ctrl *gomock.Controller) *MockMessageProcessor { - mock := &MockMessageProcessor{ctrl: ctrl} - mock.recorder = &MockMessageProcessorMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockMessageProcessor) EXPECT() *MockMessageProcessorMockRecorder { - return m.recorder -} - -// Process mocks base method. -func (m *MockMessageProcessor) Process(arg0 Message) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Process", arg0) -} - -// Process indicates an expected call of Process. -func (mr *MockMessageProcessorMockRecorder) Process(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*MockMessageProcessor)(nil).Process), arg0) -} diff --git a/dot/peerset/test_helpers.go b/dot/peerset/test_helpers.go index 1100b00ecbb..ba3a8efa5ad 100644 --- a/dot/peerset/test_helpers.go +++ b/dot/peerset/test_helpers.go @@ -27,8 +27,6 @@ const ( const allocTimeDuration = 2 * time.Second -//go:generate mockgen -destination=mock_message_processor_test.go -package $GOPACKAGE . MessageProcessor - func newTestPeerSet(t *testing.T, maxIn, maxOut uint32, bootNodes, reservedPeers []peer.ID, reservedOnly bool) *Handler { t.Helper() diff --git a/dot/sync/chain_processor_test.go b/dot/sync/chain_processor_test.go index bd9658baa6b..4655615468d 100644 --- a/dot/sync/chain_processor_test.go +++ b/dot/sync/chain_processor_test.go @@ -85,7 +85,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) { mockBlockState.EXPECT().GetHeader(common.Hash{}).Return(&types.Header{ StateRoot: testHash, }, nil) - mockInstance := NewMockRuntimeInstance(ctrl) + mockInstance := NewMockInstance(ctrl) mockInstance.EXPECT().SetContextStorage(trieState) mockInstance.EXPECT().ExecuteBlock(&types.Block{Body: types.Body{}}).Return(nil, mockError) mockBlockState.EXPECT().GetRuntime(&testParentHash).Return(mockInstance, nil) @@ -110,7 +110,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) { StateRoot: testHash, }, nil) mockBlock := &types.Block{Body: types.Body{}} - mockInstance := NewMockRuntimeInstance(ctrl) + mockInstance := NewMockInstance(ctrl) mockInstance.EXPECT().SetContextStorage(trieState) mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil) mockBlockState.EXPECT().GetRuntime(&testParentHash).Return(mockInstance, nil) @@ -145,7 +145,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) { mockHeaderHash := mockHeader.Hash() mockBlockState.EXPECT().GetHeader(common.Hash{}).Return(mockHeader, nil) - mockInstance := NewMockRuntimeInstance(ctrl) + mockInstance := NewMockInstance(ctrl) mockInstance.EXPECT().SetContextStorage(trieState) mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil) mockBlockState.EXPECT().GetRuntime(&mockHeaderHash).Return(mockInstance, nil) @@ -681,7 +681,7 @@ func Test_chainProcessor_processBlockData(t *testing.T) { runtimeHash := common.MustHexToHash("0x7db9db5ed9967b80143100189ba69d9e4deab85ac3570e5df25686cabe32964a") mockBlock := &types.Block{Header: types.Header{}, Body: types.Body{}} - mockInstance := NewMockRuntimeInstance(ctrl) + mockInstance := NewMockInstance(ctrl) mockInstance.EXPECT().SetContextStorage(mockTrieState) mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil) mockBlockState := NewMockBlockState(ctrl) @@ -725,7 +725,7 @@ func Test_chainProcessor_processBlockData(t *testing.T) { mockTrieState := storage.NewTrieState(nil) mockBlock := &types.Block{Header: types.Header{}, Body: types.Body{}} - mockInstance := NewMockRuntimeInstance(ctrl) + mockInstance := NewMockInstance(ctrl) mockInstance.EXPECT().SetContextStorage(mockTrieState) mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil) mockBlockState := NewMockBlockState(ctrl) diff --git a/dot/sync/mock_disjoint_block_set_test.go b/dot/sync/mock_disjoint_block_set_test.go index 48e791701ec..07b5578dd9d 100644 --- a/dot/sync/mock_disjoint_block_set_test.go +++ b/dot/sync/mock_disjoint_block_set_test.go @@ -119,20 +119,6 @@ func (mr *MockDisjointBlockSetMockRecorder) getBlocks() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getBlocks", reflect.TypeOf((*MockDisjointBlockSet)(nil).getBlocks)) } -// getChildren mocks base method. -func (m *MockDisjointBlockSet) getChildren(arg0 common.Hash) map[common.Hash]struct{} { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "getChildren", arg0) - ret0, _ := ret[0].(map[common.Hash]struct{}) - return ret0 -} - -// getChildren indicates an expected call of getChildren. -func (mr *MockDisjointBlockSetMockRecorder) getChildren(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getChildren", reflect.TypeOf((*MockDisjointBlockSet)(nil).getChildren), arg0) -} - // getReadyDescendants mocks base method. func (m *MockDisjointBlockSet) getReadyDescendants(arg0 common.Hash, arg1 []*types.BlockData) []*types.BlockData { m.ctrl.T.Helper() @@ -147,20 +133,6 @@ func (mr *MockDisjointBlockSetMockRecorder) getReadyDescendants(arg0, arg1 inter return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getReadyDescendants", reflect.TypeOf((*MockDisjointBlockSet)(nil).getReadyDescendants), arg0, arg1) } -// hasBlock mocks base method. -func (m *MockDisjointBlockSet) hasBlock(arg0 common.Hash) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "hasBlock", arg0) - ret0, _ := ret[0].(bool) - return ret0 -} - -// hasBlock indicates an expected call of hasBlock. -func (mr *MockDisjointBlockSetMockRecorder) hasBlock(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "hasBlock", reflect.TypeOf((*MockDisjointBlockSet)(nil).hasBlock), arg0) -} - // removeBlock mocks base method. func (m *MockDisjointBlockSet) removeBlock(arg0 common.Hash) { m.ctrl.T.Helper() diff --git a/dot/sync/mock_runtime_test.go b/dot/sync/mock_runtime_test.go new file mode 100644 index 00000000000..893be0faae1 --- /dev/null +++ b/dot/sync/mock_runtime_test.go @@ -0,0 +1,388 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/ChainSafe/gossamer/lib/runtime (interfaces: Instance) + +// Package sync is a generated GoMock package. +package sync + +import ( + reflect "reflect" + + types "github.com/ChainSafe/gossamer/dot/types" + common "github.com/ChainSafe/gossamer/lib/common" + keystore "github.com/ChainSafe/gossamer/lib/keystore" + runtime "github.com/ChainSafe/gossamer/lib/runtime" + transaction "github.com/ChainSafe/gossamer/lib/transaction" + gomock "github.com/golang/mock/gomock" +) + +// MockInstance is a mock of Instance interface. +type MockInstance struct { + ctrl *gomock.Controller + recorder *MockInstanceMockRecorder +} + +// MockInstanceMockRecorder is the mock recorder for MockInstance. +type MockInstanceMockRecorder struct { + mock *MockInstance +} + +// NewMockInstance creates a new mock instance. +func NewMockInstance(ctrl *gomock.Controller) *MockInstance { + mock := &MockInstance{ctrl: ctrl} + mock.recorder = &MockInstanceMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockInstance) EXPECT() *MockInstanceMockRecorder { + return m.recorder +} + +// ApplyExtrinsic mocks base method. +func (m *MockInstance) ApplyExtrinsic(arg0 types.Extrinsic) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ApplyExtrinsic", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ApplyExtrinsic indicates an expected call of ApplyExtrinsic. +func (mr *MockInstanceMockRecorder) ApplyExtrinsic(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplyExtrinsic", reflect.TypeOf((*MockInstance)(nil).ApplyExtrinsic), arg0) +} + +// BabeConfiguration mocks base method. +func (m *MockInstance) BabeConfiguration() (*types.BabeConfiguration, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BabeConfiguration") + ret0, _ := ret[0].(*types.BabeConfiguration) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BabeConfiguration indicates an expected call of BabeConfiguration. +func (mr *MockInstanceMockRecorder) BabeConfiguration() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BabeConfiguration", reflect.TypeOf((*MockInstance)(nil).BabeConfiguration)) +} + +// CheckInherents mocks base method. +func (m *MockInstance) CheckInherents() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "CheckInherents") +} + +// CheckInherents indicates an expected call of CheckInherents. +func (mr *MockInstanceMockRecorder) CheckInherents() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckInherents", reflect.TypeOf((*MockInstance)(nil).CheckInherents)) +} + +// DecodeSessionKeys mocks base method. +func (m *MockInstance) DecodeSessionKeys(arg0 []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DecodeSessionKeys", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DecodeSessionKeys indicates an expected call of DecodeSessionKeys. +func (mr *MockInstanceMockRecorder) DecodeSessionKeys(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DecodeSessionKeys", reflect.TypeOf((*MockInstance)(nil).DecodeSessionKeys), arg0) +} + +// Exec mocks base method. +func (m *MockInstance) Exec(arg0 string, arg1 []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Exec", arg0, arg1) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Exec indicates an expected call of Exec. +func (mr *MockInstanceMockRecorder) Exec(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockInstance)(nil).Exec), arg0, arg1) +} + +// ExecuteBlock mocks base method. +func (m *MockInstance) ExecuteBlock(arg0 *types.Block) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ExecuteBlock", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ExecuteBlock indicates an expected call of ExecuteBlock. +func (mr *MockInstanceMockRecorder) ExecuteBlock(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteBlock", reflect.TypeOf((*MockInstance)(nil).ExecuteBlock), arg0) +} + +// FinalizeBlock mocks base method. +func (m *MockInstance) FinalizeBlock() (*types.Header, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FinalizeBlock") + ret0, _ := ret[0].(*types.Header) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FinalizeBlock indicates an expected call of FinalizeBlock. +func (mr *MockInstanceMockRecorder) FinalizeBlock() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeBlock", reflect.TypeOf((*MockInstance)(nil).FinalizeBlock)) +} + +// GenerateSessionKeys mocks base method. +func (m *MockInstance) GenerateSessionKeys() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "GenerateSessionKeys") +} + +// GenerateSessionKeys indicates an expected call of GenerateSessionKeys. +func (mr *MockInstanceMockRecorder) GenerateSessionKeys() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateSessionKeys", reflect.TypeOf((*MockInstance)(nil).GenerateSessionKeys)) +} + +// GetCodeHash mocks base method. +func (m *MockInstance) GetCodeHash() common.Hash { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetCodeHash") + ret0, _ := ret[0].(common.Hash) + return ret0 +} + +// GetCodeHash indicates an expected call of GetCodeHash. +func (mr *MockInstanceMockRecorder) GetCodeHash() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCodeHash", reflect.TypeOf((*MockInstance)(nil).GetCodeHash)) +} + +// GrandpaAuthorities mocks base method. +func (m *MockInstance) GrandpaAuthorities() ([]types.Authority, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GrandpaAuthorities") + ret0, _ := ret[0].([]types.Authority) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GrandpaAuthorities indicates an expected call of GrandpaAuthorities. +func (mr *MockInstanceMockRecorder) GrandpaAuthorities() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrandpaAuthorities", reflect.TypeOf((*MockInstance)(nil).GrandpaAuthorities)) +} + +// InherentExtrinsics mocks base method. +func (m *MockInstance) InherentExtrinsics(arg0 []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InherentExtrinsics", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// InherentExtrinsics indicates an expected call of InherentExtrinsics. +func (mr *MockInstanceMockRecorder) InherentExtrinsics(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InherentExtrinsics", reflect.TypeOf((*MockInstance)(nil).InherentExtrinsics), arg0) +} + +// InitializeBlock mocks base method. +func (m *MockInstance) InitializeBlock(arg0 *types.Header) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InitializeBlock", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// InitializeBlock indicates an expected call of InitializeBlock. +func (mr *MockInstanceMockRecorder) InitializeBlock(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeBlock", reflect.TypeOf((*MockInstance)(nil).InitializeBlock), arg0) +} + +// Keystore mocks base method. +func (m *MockInstance) Keystore() *keystore.GlobalKeystore { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Keystore") + ret0, _ := ret[0].(*keystore.GlobalKeystore) + return ret0 +} + +// Keystore indicates an expected call of Keystore. +func (mr *MockInstanceMockRecorder) Keystore() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keystore", reflect.TypeOf((*MockInstance)(nil).Keystore)) +} + +// Metadata mocks base method. +func (m *MockInstance) Metadata() ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Metadata") + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Metadata indicates an expected call of Metadata. +func (mr *MockInstanceMockRecorder) Metadata() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Metadata", reflect.TypeOf((*MockInstance)(nil).Metadata)) +} + +// NetworkService mocks base method. +func (m *MockInstance) NetworkService() runtime.BasicNetwork { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkService") + ret0, _ := ret[0].(runtime.BasicNetwork) + return ret0 +} + +// NetworkService indicates an expected call of NetworkService. +func (mr *MockInstanceMockRecorder) NetworkService() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkService", reflect.TypeOf((*MockInstance)(nil).NetworkService)) +} + +// NodeStorage mocks base method. +func (m *MockInstance) NodeStorage() runtime.NodeStorage { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeStorage") + ret0, _ := ret[0].(runtime.NodeStorage) + return ret0 +} + +// NodeStorage indicates an expected call of NodeStorage. +func (mr *MockInstanceMockRecorder) NodeStorage() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeStorage", reflect.TypeOf((*MockInstance)(nil).NodeStorage)) +} + +// OffchainWorker mocks base method. +func (m *MockInstance) OffchainWorker() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "OffchainWorker") +} + +// OffchainWorker indicates an expected call of OffchainWorker. +func (mr *MockInstanceMockRecorder) OffchainWorker() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OffchainWorker", reflect.TypeOf((*MockInstance)(nil).OffchainWorker)) +} + +// PaymentQueryInfo mocks base method. +func (m *MockInstance) PaymentQueryInfo(arg0 []byte) (*types.TransactionPaymentQueryInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PaymentQueryInfo", arg0) + ret0, _ := ret[0].(*types.TransactionPaymentQueryInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PaymentQueryInfo indicates an expected call of PaymentQueryInfo. +func (mr *MockInstanceMockRecorder) PaymentQueryInfo(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PaymentQueryInfo", reflect.TypeOf((*MockInstance)(nil).PaymentQueryInfo), arg0) +} + +// RandomSeed mocks base method. +func (m *MockInstance) RandomSeed() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "RandomSeed") +} + +// RandomSeed indicates an expected call of RandomSeed. +func (mr *MockInstanceMockRecorder) RandomSeed() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RandomSeed", reflect.TypeOf((*MockInstance)(nil).RandomSeed)) +} + +// SetContextStorage mocks base method. +func (m *MockInstance) SetContextStorage(arg0 runtime.Storage) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetContextStorage", arg0) +} + +// SetContextStorage indicates an expected call of SetContextStorage. +func (mr *MockInstanceMockRecorder) SetContextStorage(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetContextStorage", reflect.TypeOf((*MockInstance)(nil).SetContextStorage), arg0) +} + +// Stop mocks base method. +func (m *MockInstance) Stop() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Stop") +} + +// Stop indicates an expected call of Stop. +func (mr *MockInstanceMockRecorder) Stop() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*MockInstance)(nil).Stop)) +} + +// UpdateRuntimeCode mocks base method. +func (m *MockInstance) UpdateRuntimeCode(arg0 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRuntimeCode", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateRuntimeCode indicates an expected call of UpdateRuntimeCode. +func (mr *MockInstanceMockRecorder) UpdateRuntimeCode(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRuntimeCode", reflect.TypeOf((*MockInstance)(nil).UpdateRuntimeCode), arg0) +} + +// ValidateTransaction mocks base method. +func (m *MockInstance) ValidateTransaction(arg0 types.Extrinsic) (*transaction.Validity, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ValidateTransaction", arg0) + ret0, _ := ret[0].(*transaction.Validity) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ValidateTransaction indicates an expected call of ValidateTransaction. +func (mr *MockInstanceMockRecorder) ValidateTransaction(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateTransaction", reflect.TypeOf((*MockInstance)(nil).ValidateTransaction), arg0) +} + +// Validator mocks base method. +func (m *MockInstance) Validator() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Validator") + ret0, _ := ret[0].(bool) + return ret0 +} + +// Validator indicates an expected call of Validator. +func (mr *MockInstanceMockRecorder) Validator() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validator", reflect.TypeOf((*MockInstance)(nil).Validator)) +} + +// Version mocks base method. +func (m *MockInstance) Version() runtime.Version { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Version") + ret0, _ := ret[0].(runtime.Version) + return ret0 +} + +// Version indicates an expected call of Version. +func (mr *MockInstanceMockRecorder) Version() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockInstance)(nil).Version)) +} diff --git a/dot/sync/mocks_generate_test.go b/dot/sync/mocks_generate_test.go index 32a40df23c8..0889fd2845a 100644 --- a/dot/sync/mocks_generate_test.go +++ b/dot/sync/mocks_generate_test.go @@ -3,8 +3,9 @@ package sync -//go:generate mockgen -destination=mocks_test.go -package=$GOPACKAGE . BlockState,StorageState,CodeSubstitutedState,TransactionState,BabeVerifier,FinalityGadget,BlockImportHandler,Network,RuntimeInstance +//go:generate mockgen -destination=mocks_test.go -package=$GOPACKAGE . BlockState,StorageState,TransactionState,BabeVerifier,FinalityGadget,BlockImportHandler,Network //go:generate mockgen -destination=mock_telemetry_test.go -package $GOPACKAGE . Telemetry +//go:generate mockgen -destination=mock_runtime_test.go -package $GOPACKAGE github.com/ChainSafe/gossamer/lib/runtime Instance //go:generate mockgen -destination=mock_chain_processor_test.go -package=$GOPACKAGE . ChainProcessor //go:generate mockgen -destination=mock_chain_sync_test.go -package $GOPACKAGE -source chain_sync.go . ChainSync,workHandler //go:generate mockgen -destination=mock_disjoint_block_set_test.go -package=$GOPACKAGE . DisjointBlockSet diff --git a/dot/sync/mocks_test.go b/dot/sync/mocks_test.go index cd9e3cc494d..d925946e1a2 100644 --- a/dot/sync/mocks_test.go +++ b/dot/sync/mocks_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/dot/sync (interfaces: BlockState,StorageState,CodeSubstitutedState,TransactionState,BabeVerifier,FinalityGadget,BlockImportHandler,Network,RuntimeInstance) +// Source: github.com/ChainSafe/gossamer/dot/sync (interfaces: BlockState,StorageState,TransactionState,BabeVerifier,FinalityGadget,BlockImportHandler,Network) // Package sync is a generated GoMock package. package sync @@ -11,10 +11,8 @@ import ( peerset "github.com/ChainSafe/gossamer/dot/peerset" types "github.com/ChainSafe/gossamer/dot/types" common "github.com/ChainSafe/gossamer/lib/common" - keystore "github.com/ChainSafe/gossamer/lib/keystore" runtime "github.com/ChainSafe/gossamer/lib/runtime" storage "github.com/ChainSafe/gossamer/lib/runtime/storage" - transaction "github.com/ChainSafe/gossamer/lib/transaction" gomock "github.com/golang/mock/gomock" peer "github.com/libp2p/go-libp2p-core/peer" ) @@ -42,20 +40,6 @@ func (m *MockBlockState) EXPECT() *MockBlockStateMockRecorder { return m.recorder } -// AddBlock mocks base method. -func (m *MockBlockState) AddBlock(arg0 *types.Block) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlock", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlock indicates an expected call of AddBlock. -func (mr *MockBlockStateMockRecorder) AddBlock(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlock", reflect.TypeOf((*MockBlockState)(nil).AddBlock), arg0) -} - // AddBlockToBlockTree mocks base method. func (m *MockBlockState) AddBlockToBlockTree(arg0 *types.Block) error { m.ctrl.T.Helper() @@ -70,20 +54,6 @@ func (mr *MockBlockStateMockRecorder) AddBlockToBlockTree(arg0 interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlockToBlockTree", reflect.TypeOf((*MockBlockState)(nil).AddBlockToBlockTree), arg0) } -// BestBlockHash mocks base method. -func (m *MockBlockState) BestBlockHash() common.Hash { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BestBlockHash") - ret0, _ := ret[0].(common.Hash) - return ret0 -} - -// BestBlockHash indicates an expected call of BestBlockHash. -func (mr *MockBlockStateMockRecorder) BestBlockHash() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BestBlockHash", reflect.TypeOf((*MockBlockState)(nil).BestBlockHash)) -} - // BestBlockHeader mocks base method. func (m *MockBlockState) BestBlockHeader() (*types.Header, error) { m.ctrl.T.Helper() @@ -173,21 +143,6 @@ func (mr *MockBlockStateMockRecorder) GetBlockByHash(arg0 interface{}) *gomock.C return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockByHash", reflect.TypeOf((*MockBlockState)(nil).GetBlockByHash), arg0) } -// GetBlockByNumber mocks base method. -func (m *MockBlockState) GetBlockByNumber(arg0 uint) (*types.Block, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockByNumber", arg0) - ret0, _ := ret[0].(*types.Block) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBlockByNumber indicates an expected call of GetBlockByNumber. -func (mr *MockBlockStateMockRecorder) GetBlockByNumber(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockByNumber", reflect.TypeOf((*MockBlockState)(nil).GetBlockByNumber), arg0) -} - // GetFinalisedNotifierChannel mocks base method. func (m *MockBlockState) GetFinalisedNotifierChannel() chan *types.FinalisationInfo { m.ctrl.T.Helper() @@ -367,34 +322,6 @@ func (mr *MockBlockStateMockRecorder) IsDescendantOf(arg0, arg1 interface{}) *go return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDescendantOf", reflect.TypeOf((*MockBlockState)(nil).IsDescendantOf), arg0, arg1) } -// SetFinalisedHash mocks base method. -func (m *MockBlockState) SetFinalisedHash(arg0 common.Hash, arg1, arg2 uint64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetFinalisedHash", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetFinalisedHash indicates an expected call of SetFinalisedHash. -func (mr *MockBlockStateMockRecorder) SetFinalisedHash(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFinalisedHash", reflect.TypeOf((*MockBlockState)(nil).SetFinalisedHash), arg0, arg1, arg2) -} - -// SetHeader mocks base method. -func (m *MockBlockState) SetHeader(arg0 *types.Header) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetHeader", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetHeader indicates an expected call of SetHeader. -func (mr *MockBlockStateMockRecorder) SetHeader(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockBlockState)(nil).SetHeader), arg0) -} - // SetJustification mocks base method. func (m *MockBlockState) SetJustification(arg0 common.Hash, arg1 []byte) error { m.ctrl.T.Helper() @@ -409,18 +336,6 @@ func (mr *MockBlockStateMockRecorder) SetJustification(arg0, arg1 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetJustification", reflect.TypeOf((*MockBlockState)(nil).SetJustification), arg0, arg1) } -// StoreRuntime mocks base method. -func (m *MockBlockState) StoreRuntime(arg0 common.Hash, arg1 runtime.Instance) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "StoreRuntime", arg0, arg1) -} - -// StoreRuntime indicates an expected call of StoreRuntime. -func (mr *MockBlockStateMockRecorder) StoreRuntime(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreRuntime", reflect.TypeOf((*MockBlockState)(nil).StoreRuntime), arg0, arg1) -} - // SubChain mocks base method. func (m *MockBlockState) SubChain(arg0, arg1 common.Hash) ([]common.Hash, error) { m.ctrl.T.Helper() @@ -459,21 +374,6 @@ func (m *MockStorageState) EXPECT() *MockStorageStateMockRecorder { return m.recorder } -// LoadCodeHash mocks base method. -func (m *MockStorageState) LoadCodeHash(arg0 *common.Hash) (common.Hash, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LoadCodeHash", arg0) - ret0, _ := ret[0].(common.Hash) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// LoadCodeHash indicates an expected call of LoadCodeHash. -func (mr *MockStorageStateMockRecorder) LoadCodeHash(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadCodeHash", reflect.TypeOf((*MockStorageState)(nil).LoadCodeHash), arg0) -} - // Lock mocks base method. func (m *MockStorageState) Lock() { m.ctrl.T.Helper() @@ -513,57 +413,6 @@ func (mr *MockStorageStateMockRecorder) Unlock() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockStorageState)(nil).Unlock)) } -// MockCodeSubstitutedState is a mock of CodeSubstitutedState interface. -type MockCodeSubstitutedState struct { - ctrl *gomock.Controller - recorder *MockCodeSubstitutedStateMockRecorder -} - -// MockCodeSubstitutedStateMockRecorder is the mock recorder for MockCodeSubstitutedState. -type MockCodeSubstitutedStateMockRecorder struct { - mock *MockCodeSubstitutedState -} - -// NewMockCodeSubstitutedState creates a new mock instance. -func NewMockCodeSubstitutedState(ctrl *gomock.Controller) *MockCodeSubstitutedState { - mock := &MockCodeSubstitutedState{ctrl: ctrl} - mock.recorder = &MockCodeSubstitutedStateMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockCodeSubstitutedState) EXPECT() *MockCodeSubstitutedStateMockRecorder { - return m.recorder -} - -// LoadCodeSubstitutedBlockHash mocks base method. -func (m *MockCodeSubstitutedState) LoadCodeSubstitutedBlockHash() common.Hash { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LoadCodeSubstitutedBlockHash") - ret0, _ := ret[0].(common.Hash) - return ret0 -} - -// LoadCodeSubstitutedBlockHash indicates an expected call of LoadCodeSubstitutedBlockHash. -func (mr *MockCodeSubstitutedStateMockRecorder) LoadCodeSubstitutedBlockHash() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LoadCodeSubstitutedBlockHash", reflect.TypeOf((*MockCodeSubstitutedState)(nil).LoadCodeSubstitutedBlockHash)) -} - -// StoreCodeSubstitutedBlockHash mocks base method. -func (m *MockCodeSubstitutedState) StoreCodeSubstitutedBlockHash(arg0 common.Hash) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StoreCodeSubstitutedBlockHash", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// StoreCodeSubstitutedBlockHash indicates an expected call of StoreCodeSubstitutedBlockHash. -func (mr *MockCodeSubstitutedStateMockRecorder) StoreCodeSubstitutedBlockHash(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreCodeSubstitutedBlockHash", reflect.TypeOf((*MockCodeSubstitutedState)(nil).StoreCodeSubstitutedBlockHash), arg0) -} - // MockTransactionState is a mock of TransactionState interface. type MockTransactionState struct { ctrl *gomock.Controller @@ -774,375 +623,3 @@ func (mr *MockNetworkMockRecorder) ReportPeer(arg0, arg1 interface{}) *gomock.Ca mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReportPeer", reflect.TypeOf((*MockNetwork)(nil).ReportPeer), arg0, arg1) } - -// MockRuntimeInstance is a mock of RuntimeInstance interface. -type MockRuntimeInstance struct { - ctrl *gomock.Controller - recorder *MockRuntimeInstanceMockRecorder -} - -// MockRuntimeInstanceMockRecorder is the mock recorder for MockRuntimeInstance. -type MockRuntimeInstanceMockRecorder struct { - mock *MockRuntimeInstance -} - -// NewMockRuntimeInstance creates a new mock instance. -func NewMockRuntimeInstance(ctrl *gomock.Controller) *MockRuntimeInstance { - mock := &MockRuntimeInstance{ctrl: ctrl} - mock.recorder = &MockRuntimeInstanceMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockRuntimeInstance) EXPECT() *MockRuntimeInstanceMockRecorder { - return m.recorder -} - -// ApplyExtrinsic mocks base method. -func (m *MockRuntimeInstance) ApplyExtrinsic(arg0 types.Extrinsic) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ApplyExtrinsic", arg0) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ApplyExtrinsic indicates an expected call of ApplyExtrinsic. -func (mr *MockRuntimeInstanceMockRecorder) ApplyExtrinsic(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ApplyExtrinsic", reflect.TypeOf((*MockRuntimeInstance)(nil).ApplyExtrinsic), arg0) -} - -// BabeConfiguration mocks base method. -func (m *MockRuntimeInstance) BabeConfiguration() (*types.BabeConfiguration, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BabeConfiguration") - ret0, _ := ret[0].(*types.BabeConfiguration) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// BabeConfiguration indicates an expected call of BabeConfiguration. -func (mr *MockRuntimeInstanceMockRecorder) BabeConfiguration() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BabeConfiguration", reflect.TypeOf((*MockRuntimeInstance)(nil).BabeConfiguration)) -} - -// CheckInherents mocks base method. -func (m *MockRuntimeInstance) CheckInherents() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "CheckInherents") -} - -// CheckInherents indicates an expected call of CheckInherents. -func (mr *MockRuntimeInstanceMockRecorder) CheckInherents() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckInherents", reflect.TypeOf((*MockRuntimeInstance)(nil).CheckInherents)) -} - -// DecodeSessionKeys mocks base method. -func (m *MockRuntimeInstance) DecodeSessionKeys(arg0 []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DecodeSessionKeys", arg0) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// DecodeSessionKeys indicates an expected call of DecodeSessionKeys. -func (mr *MockRuntimeInstanceMockRecorder) DecodeSessionKeys(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DecodeSessionKeys", reflect.TypeOf((*MockRuntimeInstance)(nil).DecodeSessionKeys), arg0) -} - -// Exec mocks base method. -func (m *MockRuntimeInstance) Exec(arg0 string, arg1 []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Exec", arg0, arg1) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Exec indicates an expected call of Exec. -func (mr *MockRuntimeInstanceMockRecorder) Exec(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockRuntimeInstance)(nil).Exec), arg0, arg1) -} - -// ExecuteBlock mocks base method. -func (m *MockRuntimeInstance) ExecuteBlock(arg0 *types.Block) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExecuteBlock", arg0) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ExecuteBlock indicates an expected call of ExecuteBlock. -func (mr *MockRuntimeInstanceMockRecorder) ExecuteBlock(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteBlock", reflect.TypeOf((*MockRuntimeInstance)(nil).ExecuteBlock), arg0) -} - -// FinalizeBlock mocks base method. -func (m *MockRuntimeInstance) FinalizeBlock() (*types.Header, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FinalizeBlock") - ret0, _ := ret[0].(*types.Header) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// FinalizeBlock indicates an expected call of FinalizeBlock. -func (mr *MockRuntimeInstanceMockRecorder) FinalizeBlock() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinalizeBlock", reflect.TypeOf((*MockRuntimeInstance)(nil).FinalizeBlock)) -} - -// GenerateSessionKeys mocks base method. -func (m *MockRuntimeInstance) GenerateSessionKeys() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "GenerateSessionKeys") -} - -// GenerateSessionKeys indicates an expected call of GenerateSessionKeys. -func (mr *MockRuntimeInstanceMockRecorder) GenerateSessionKeys() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateSessionKeys", reflect.TypeOf((*MockRuntimeInstance)(nil).GenerateSessionKeys)) -} - -// GetCodeHash mocks base method. -func (m *MockRuntimeInstance) GetCodeHash() common.Hash { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCodeHash") - ret0, _ := ret[0].(common.Hash) - return ret0 -} - -// GetCodeHash indicates an expected call of GetCodeHash. -func (mr *MockRuntimeInstanceMockRecorder) GetCodeHash() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCodeHash", reflect.TypeOf((*MockRuntimeInstance)(nil).GetCodeHash)) -} - -// GrandpaAuthorities mocks base method. -func (m *MockRuntimeInstance) GrandpaAuthorities() ([]types.Authority, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GrandpaAuthorities") - ret0, _ := ret[0].([]types.Authority) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GrandpaAuthorities indicates an expected call of GrandpaAuthorities. -func (mr *MockRuntimeInstanceMockRecorder) GrandpaAuthorities() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrandpaAuthorities", reflect.TypeOf((*MockRuntimeInstance)(nil).GrandpaAuthorities)) -} - -// InherentExtrinsics mocks base method. -func (m *MockRuntimeInstance) InherentExtrinsics(arg0 []byte) ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InherentExtrinsics", arg0) - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// InherentExtrinsics indicates an expected call of InherentExtrinsics. -func (mr *MockRuntimeInstanceMockRecorder) InherentExtrinsics(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InherentExtrinsics", reflect.TypeOf((*MockRuntimeInstance)(nil).InherentExtrinsics), arg0) -} - -// InitializeBlock mocks base method. -func (m *MockRuntimeInstance) InitializeBlock(arg0 *types.Header) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitializeBlock", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// InitializeBlock indicates an expected call of InitializeBlock. -func (mr *MockRuntimeInstanceMockRecorder) InitializeBlock(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeBlock", reflect.TypeOf((*MockRuntimeInstance)(nil).InitializeBlock), arg0) -} - -// Keystore mocks base method. -func (m *MockRuntimeInstance) Keystore() *keystore.GlobalKeystore { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Keystore") - ret0, _ := ret[0].(*keystore.GlobalKeystore) - return ret0 -} - -// Keystore indicates an expected call of Keystore. -func (mr *MockRuntimeInstanceMockRecorder) Keystore() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keystore", reflect.TypeOf((*MockRuntimeInstance)(nil).Keystore)) -} - -// Metadata mocks base method. -func (m *MockRuntimeInstance) Metadata() ([]byte, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Metadata") - ret0, _ := ret[0].([]byte) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Metadata indicates an expected call of Metadata. -func (mr *MockRuntimeInstanceMockRecorder) Metadata() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Metadata", reflect.TypeOf((*MockRuntimeInstance)(nil).Metadata)) -} - -// NetworkService mocks base method. -func (m *MockRuntimeInstance) NetworkService() runtime.BasicNetwork { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NetworkService") - ret0, _ := ret[0].(runtime.BasicNetwork) - return ret0 -} - -// NetworkService indicates an expected call of NetworkService. -func (mr *MockRuntimeInstanceMockRecorder) NetworkService() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkService", reflect.TypeOf((*MockRuntimeInstance)(nil).NetworkService)) -} - -// NodeStorage mocks base method. -func (m *MockRuntimeInstance) NodeStorage() runtime.NodeStorage { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NodeStorage") - ret0, _ := ret[0].(runtime.NodeStorage) - return ret0 -} - -// NodeStorage indicates an expected call of NodeStorage. -func (mr *MockRuntimeInstanceMockRecorder) NodeStorage() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeStorage", reflect.TypeOf((*MockRuntimeInstance)(nil).NodeStorage)) -} - -// OffchainWorker mocks base method. -func (m *MockRuntimeInstance) OffchainWorker() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "OffchainWorker") -} - -// OffchainWorker indicates an expected call of OffchainWorker. -func (mr *MockRuntimeInstanceMockRecorder) OffchainWorker() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OffchainWorker", reflect.TypeOf((*MockRuntimeInstance)(nil).OffchainWorker)) -} - -// PaymentQueryInfo mocks base method. -func (m *MockRuntimeInstance) PaymentQueryInfo(arg0 []byte) (*types.TransactionPaymentQueryInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PaymentQueryInfo", arg0) - ret0, _ := ret[0].(*types.TransactionPaymentQueryInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PaymentQueryInfo indicates an expected call of PaymentQueryInfo. -func (mr *MockRuntimeInstanceMockRecorder) PaymentQueryInfo(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PaymentQueryInfo", reflect.TypeOf((*MockRuntimeInstance)(nil).PaymentQueryInfo), arg0) -} - -// RandomSeed mocks base method. -func (m *MockRuntimeInstance) RandomSeed() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "RandomSeed") -} - -// RandomSeed indicates an expected call of RandomSeed. -func (mr *MockRuntimeInstanceMockRecorder) RandomSeed() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RandomSeed", reflect.TypeOf((*MockRuntimeInstance)(nil).RandomSeed)) -} - -// SetContextStorage mocks base method. -func (m *MockRuntimeInstance) SetContextStorage(arg0 runtime.Storage) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "SetContextStorage", arg0) -} - -// SetContextStorage indicates an expected call of SetContextStorage. -func (mr *MockRuntimeInstanceMockRecorder) SetContextStorage(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetContextStorage", reflect.TypeOf((*MockRuntimeInstance)(nil).SetContextStorage), arg0) -} - -// Stop mocks base method. -func (m *MockRuntimeInstance) Stop() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Stop") -} - -// Stop indicates an expected call of Stop. -func (mr *MockRuntimeInstanceMockRecorder) Stop() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stop", reflect.TypeOf((*MockRuntimeInstance)(nil).Stop)) -} - -// UpdateRuntimeCode mocks base method. -func (m *MockRuntimeInstance) UpdateRuntimeCode(arg0 []byte) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateRuntimeCode", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// UpdateRuntimeCode indicates an expected call of UpdateRuntimeCode. -func (mr *MockRuntimeInstanceMockRecorder) UpdateRuntimeCode(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRuntimeCode", reflect.TypeOf((*MockRuntimeInstance)(nil).UpdateRuntimeCode), arg0) -} - -// ValidateTransaction mocks base method. -func (m *MockRuntimeInstance) ValidateTransaction(arg0 types.Extrinsic) (*transaction.Validity, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ValidateTransaction", arg0) - ret0, _ := ret[0].(*transaction.Validity) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ValidateTransaction indicates an expected call of ValidateTransaction. -func (mr *MockRuntimeInstanceMockRecorder) ValidateTransaction(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateTransaction", reflect.TypeOf((*MockRuntimeInstance)(nil).ValidateTransaction), arg0) -} - -// Validator mocks base method. -func (m *MockRuntimeInstance) Validator() bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Validator") - ret0, _ := ret[0].(bool) - return ret0 -} - -// Validator indicates an expected call of Validator. -func (mr *MockRuntimeInstanceMockRecorder) Validator() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validator", reflect.TypeOf((*MockRuntimeInstance)(nil).Validator)) -} - -// Version mocks base method. -func (m *MockRuntimeInstance) Version() runtime.Version { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Version") - ret0, _ := ret[0].(runtime.Version) - return ret0 -} - -// Version indicates an expected call of Version. -func (mr *MockRuntimeInstanceMockRecorder) Version() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockRuntimeInstance)(nil).Version)) -} diff --git a/internal/pprof/interfaces.go b/internal/pprof/interfaces.go index 89f7e5aa081..6d2dd33b2eb 100644 --- a/internal/pprof/interfaces.go +++ b/internal/pprof/interfaces.go @@ -12,6 +12,7 @@ type Logger interface { Error(msg string) } -type runner interface { +// Runner runs in a blocking manner. +type Runner interface { Run(ctx context.Context, ready chan<- struct{}, done chan<- error) } diff --git a/internal/pprof/runner_mock_test.go b/internal/pprof/runner_mock_test.go index 556715c5c6e..c837520209f 100644 --- a/internal/pprof/runner_mock_test.go +++ b/internal/pprof/runner_mock_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/internal/httpserver (interfaces: Runner) +// Source: github.com/ChainSafe/gossamer/internal/pprof (interfaces: Runner) // Package pprof is a generated GoMock package. package pprof diff --git a/internal/pprof/service.go b/internal/pprof/service.go index 36f2b12ca43..1387f9fcf79 100644 --- a/internal/pprof/service.go +++ b/internal/pprof/service.go @@ -13,7 +13,7 @@ import ( // dot/service.go interface. type Service struct { settings Settings - server runner + server Runner cancel context.CancelFunc done chan error } diff --git a/internal/pprof/service_test.go b/internal/pprof/service_test.go index 30a927705bc..c1d3ecce354 100644 --- a/internal/pprof/service_test.go +++ b/internal/pprof/service_test.go @@ -30,7 +30,7 @@ func Test_NewService(t *testing.T) { assert.NotNil(t, service.done) } -//go:generate mockgen -destination=runner_mock_test.go -package $GOPACKAGE github.com/ChainSafe/gossamer/internal/httpserver Runner +//go:generate mockgen -destination=runner_mock_test.go -package $GOPACKAGE . Runner func Test_Service_StartStop_success(t *testing.T) { t.Parallel() diff --git a/lib/babe/mock_telemetry_test.go b/lib/babe/mock_telemetry_test.go index 2d48a69e410..7c86455b0e6 100644 --- a/lib/babe/mock_telemetry_test.go +++ b/lib/babe/mock_telemetry_test.go @@ -1,47 +1,47 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/dot/telemetry (interfaces: Client) +// Source: github.com/ChainSafe/gossamer/lib/babe (interfaces: Telemetry) // Package babe is a generated GoMock package. package babe import ( - "encoding/json" + json "encoding/json" reflect "reflect" gomock "github.com/golang/mock/gomock" ) -// MockClient is a mock of Client interface. -type MockClient struct { +// MockTelemetry is a mock of Telemetry interface. +type MockTelemetry struct { ctrl *gomock.Controller - recorder *MockClientMockRecorder + recorder *MockTelemetryMockRecorder } -// MockClientMockRecorder is the mock recorder for MockClient. -type MockClientMockRecorder struct { - mock *MockClient +// MockTelemetryMockRecorder is the mock recorder for MockTelemetry. +type MockTelemetryMockRecorder struct { + mock *MockTelemetry } -// NewMockClient creates a new mock instance. -func NewMockTelemetry(ctrl *gomock.Controller) *MockClient { - mock := &MockClient{ctrl: ctrl} - mock.recorder = &MockClientMockRecorder{mock} +// NewMockTelemetry creates a new mock instance. +func NewMockTelemetry(ctrl *gomock.Controller) *MockTelemetry { + mock := &MockTelemetry{ctrl: ctrl} + mock.recorder = &MockTelemetryMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockClient) EXPECT() *MockClientMockRecorder { +func (m *MockTelemetry) EXPECT() *MockTelemetryMockRecorder { return m.recorder } // SendMessage mocks base method. -func (m *MockClient) SendMessage(arg0 json.Marshaler) { +func (m *MockTelemetry) SendMessage(arg0 json.Marshaler) { m.ctrl.T.Helper() m.ctrl.Call(m, "SendMessage", arg0) } // SendMessage indicates an expected call of SendMessage. -func (mr *MockClientMockRecorder) SendMessage(arg0 interface{}) *gomock.Call { +func (mr *MockTelemetryMockRecorder) SendMessage(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockClient)(nil).SendMessage), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockTelemetry)(nil).SendMessage), arg0) }