Skip to content

Commit

Permalink
fixing more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kishansagathiya committed May 3, 2022
1 parent 8046eb0 commit 6ff8bd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dot/core/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (s *Service) HandleSubmittedExtrinsic(ext types.Extrinsic) error {

ts, err := s.storageState.TrieState(stateRoot)
if err != nil {
return fmt.Errorf("could not get trie state: %w", err)
return err
}

rt, err := s.blockState.GetRuntime(&bestBlockHash)
Expand Down
8 changes: 7 additions & 1 deletion dot/core/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,11 @@ func TestServiceHandleSubmittedExtrinsic(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
mockStorageState := NewMockStorageState(ctrl)
mockStorageState.EXPECT().TrieState(&common.Hash{}).Return(nil, errDummyErr)
mockStorageState.EXPECT().GetStateRootFromBlock(&common.Hash{}).Return(&common.Hash{}, nil)

mockBlockState := NewMockBlockState(ctrl)
mockBlockState.EXPECT().BestBlockHash().Return(common.Hash{})
mockStorageState.EXPECT().TrieState(&common.Hash{}).Return(nil, errDummyErr)
mockTxnState := NewMockTransactionState(ctrl)
mockTxnState.EXPECT().Exists(nil)
service := &Service{
Expand All @@ -1092,6 +1094,7 @@ func TestServiceHandleSubmittedExtrinsic(t *testing.T) {

mockStorageState := NewMockStorageState(ctrl)
mockStorageState.EXPECT().TrieState(&common.Hash{}).Return(&rtstorage.TrieState{}, nil)
mockStorageState.EXPECT().GetStateRootFromBlock(&common.Hash{}).Return(&common.Hash{}, nil)

mockTxnState := NewMockTransactionState(ctrl)
mockTxnState.EXPECT().Exists(nil).MaxTimes(2)
Expand All @@ -1114,6 +1117,8 @@ func TestServiceHandleSubmittedExtrinsic(t *testing.T) {

mockStorageState := NewMockStorageState(ctrl)
mockStorageState.EXPECT().TrieState(&common.Hash{}).Return(&rtstorage.TrieState{}, nil)
mockStorageState.EXPECT().GetStateRootFromBlock(&common.Hash{}).Return(&common.Hash{}, nil)

mockTxnState := NewMockTransactionState(ctrl)
mockTxnState.EXPECT().Exists(types.Extrinsic{})

Expand Down Expand Up @@ -1142,6 +1147,7 @@ func TestServiceHandleSubmittedExtrinsic(t *testing.T) {

mockStorageState := NewMockStorageState(ctrl)
mockStorageState.EXPECT().TrieState(&common.Hash{}).Return(&rtstorage.TrieState{}, nil)
mockStorageState.EXPECT().GetStateRootFromBlock(&common.Hash{}).Return(&common.Hash{}, nil)

mockTxnState := NewMockTransactionState(ctrl)
mockTxnState.EXPECT().Exists(types.Extrinsic{}).MaxTimes(2)
Expand Down

0 comments on commit 6ff8bd0

Please sign in to comment.