Repository: scionproto/scion
Pull request #3748 (2020-05-06 09:28:55)

Remove dead code related to segment requests
* Remove code for segment request validation
  This segment request validation appears to never have been activated.

  This will be solved differently in the future, by having a separate segment request handler for local requests (TCP only) and, in core ASes only, a simpler handler for requests from other path servers (over SCION/QUIC). This will simplify the validation of the requests, so the existing code would not help a lot.

* Remove unused `RetrySleep` and `IsParamsLocal` from segreq. These have become unused by removing the request holding feature in #3604.
  Replace use of now unneeded `segreq.LocalInfo` interface with `segfetcher.LocalInfo`


<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/scionproto/scion/3748)
<!-- Reviewable:end -->



Patch:
diff --git a/go/cs/segreq/BUILD.bazel b/go/cs/segreq/BUILD.bazel
index 0cbd6553c..1f5a2fa2d 100644
--- a/go/cs/segreq/BUILD.bazel
+++ b/go/cs/segreq/BUILD.bazel
@@ -41,16 +41,15 @@ go_test(
         "helpers_test.go",
         "provider_test.go",
         "splitter_test.go",
-        "validator_test.go",
     ],
     embed = [":go_default_library"],
     deps = [
-        "//go/cs/segreq/mock_segreq:go_default_library",
         "//go/lib/addr:go_default_library",
         "//go/lib/ctrl/path_mgmt:go_default_library",
         "//go/lib/ctrl/seg:go_default_library",
         "//go/lib/infra/mock_infra:go_default_library",
         "//go/lib/infra/modules/segfetcher:go_default_library",
+        "//go/lib/infra/modules/segfetcher/mock_segfetcher:go_default_library",
         "//go/lib/pathdb/mock_pathdb:go_default_library",
         "//go/lib/pathdb/query:go_default_library",
         "//go/lib/revcache:go_default_library",
diff --git a/go/cs/segreq/db.go b/go/cs/segreq/db.go
index ba31f5b4c..bb78443fc 100644
--- a/go/cs/segreq/db.go
+++ b/go/cs/segreq/db.go
@@ -19,23 +19,15 @@ import (
 	"time"
 
 	"github.com/scionproto/scion/go/lib/addr"
+	"github.com/scionproto/scion/go/lib/infra/modules/segfetcher"
 	"github.com/scionproto/scion/go/lib/pathdb"
-	"github.com/scionproto/scion/go/lib/pathdb/query"
-	"github.com/scionproto/scion/go/proto"
 )
 
-// LocalInfo indicates whether something is always local.
-type LocalInfo interface {
-	IsSegLocal(ctx context.Context, src, dst addr.IA) (bool, error)
-	IsParamsLocal(*query.Params) bool
-}
-
-// PathDB is a wrapper around the path db that handles retries and changes
-// GetNextQuery behavior for usage in segfetcher.
+// PathDB is a wrapper around the path db that changes GetNextQuery behavior
+// for usage in segfetcher.
 type PathDB struct {
 	pathdb.PathDB
-	LocalInfo  LocalInfo
-	RetrySleep time.Duration
+	LocalInfo segfetcher.LocalInfo
 }
 
 func (db *PathDB) GetNextQuery(ctx context.Context, src, dst addr.IA,
@@ -69,30 +61,6 @@ func (i *CoreLocalInfo) IsSegLocal(ctx context.Context, src, dst addr.IA) (bool,
 	return isCore, nil
 }
 
-// IsParamsLocal returns whether params is a core segment request.
-func (i *CoreLocalInfo) IsParamsLocal(params *query.Params) bool {
-	if len(params.SegTypes) != 1 {
-		return false
-	}
-	if params.SegTypes[0] == proto.PathSegType_core {
-		return true
-	}
-	if params.SegTypes[0] == proto.PathSegType_down {
-		for _, ia := range params.StartsAt {
-			if ia.I != i.LocalIA.I {
-				return false
-			}
-		}
-		for _, ia := range params.EndsAt {
-			if ia.I != i.LocalIA.I {
-				return false
-			}
-		}
-		return true
-	}
-	return false
-}
-
 // NonCoreLocalInfo is the local info for non core PSes.
 type NonCoreLocalInfo struct {
 	LocalIA addr.IA
@@ -105,8 +73,3 @@ func (i *NonCoreLocalInfo) IsSegLocal(ctx context.Context, src, dst addr.IA) (bo
 	// be an up segment.
 	return i.LocalIA.Equal(src), nil
 }
-
-// IsParamsLocal returns whether params is a up segments request.
-func (i *NonCoreLocalInfo) IsParamsLocal(params *query.Params) bool {
-	return len(params.SegTypes) == 1 && params.SegTypes[0] == proto.PathSegType_up
-}
diff --git a/go/cs/segreq/handler.go b/go/cs/segreq/handler.go
index c4bea9ce3..b7b8d9f16 100644
--- a/go/cs/segreq/handler.go
+++ b/go/cs/segreq/handler.go
@@ -15,8 +15,6 @@
 package segreq
 
 import (
-	"time"
-
 	"github.com/scionproto/scion/go/cs/handlers"
 	"github.com/scionproto/scion/go/cs/metrics"
 	"github.com/scionproto/scion/go/lib/common"
@@ -116,18 +114,8 @@ func (h *handler) Handle(request *infra.Request) *infra.HandlerResult {
 	return infra.MetricsResultOk
 }
 
-func createValidator(args handlers.HandlerArgs, core bool) segfetcher.Validator {
-	base := BaseValidator{
-		CoreChecker: CoreChecker{Inspector: args.ASInspector},
-	}
-	if !core {
-		return &base
-	}
-	return &CoreValidator{BaseValidator: base}
-}
-
 // CreateLocalInfo creates the local info oracle.
-func CreateLocalInfo(args handlers.HandlerArgs, core bool) LocalInfo {
+func CreateLocalInfo(args handlers.HandlerArgs, core bool) segfetcher.LocalInfo {
 	if core {
 		return &CoreLocalInfo{
 			CoreChecker: CoreChecker{Inspector: args.ASInspector},
@@ -139,11 +127,10 @@ func CreateLocalInfo(args handlers.HandlerArgs, core bool) LocalInfo {
 	}
 }
 
-func createPathDB(db pathdb.PathDB, localInfo LocalInfo) pathdb.PathDB {
+func createPathDB(db pathdb.PathDB, localInfo segfetcher.LocalInfo) pathdb.PathDB {
 	return &PathDB{
-		PathDB:     db,
-		LocalInfo:  localInfo,
-		RetrySleep: 500 * time.Millisecond,
+		PathDB:    db,
+		LocalInfo: localInfo,
 	}
 }
 
diff --git a/go/cs/segreq/mock_segreq/BUILD.bazel b/go/cs/segreq/mock_segreq/BUILD.bazel
deleted file mode 100644
index c4e35f882..000000000
--- a/go/cs/segreq/mock_segreq/BUILD.bazel
+++ /dev/null
@@ -1,13 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library")
-
-go_library(
-    name = "go_default_library",
-    srcs = ["segreq.go"],
-    importpath = "github.com/scionproto/scion/go/cs/segreq/mock_segreq",
-    visibility = ["//visibility:public"],
-    deps = [
-        "//go/lib/addr:go_default_library",
-        "//go/lib/pathdb/query:go_default_library",
-        "@com_github_golang_mock//gomock:go_default_library",
-    ],
-)
diff --git a/go/cs/segreq/mock_segreq/segreq.go b/go/cs/segreq/mock_segreq/segreq.go
deleted file mode 100644
index a78cc2a96..000000000
--- a/go/cs/segreq/mock_segreq/segreq.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Code generated by MockGen. DO NOT EDIT.
-// Source: github.com/scionproto/scion/go/cs/segreq (interfaces: LocalInfo)
-
-// Package mock_segreq is a generated GoMock package.
-package mock_segreq
-
-import (
-	context "context"
-	gomock "github.com/golang/mock/gomock"
-	addr "github.com/scionproto/scion/go/lib/addr"
-	query "github.com/scionproto/scion/go/lib/pathdb/query"
-	reflect "reflect"
-)
-
-// MockLocalInfo is a mock of LocalInfo interface
-type MockLocalInfo struct {
-	ctrl     *gomock.Controller
-	recorder *MockLocalInfoMockRecorder
-}
-
-// MockLocalInfoMockRecorder is the mock recorder for MockLocalInfo
-type MockLocalInfoMockRecorder struct {
-	mock *MockLocalInfo
-}
-
-// NewMockLocalInfo creates a new mock instance
-func NewMockLocalInfo(ctrl *gomock.Controller) *MockLocalInfo {
-	mock := &MockLocalInfo{ctrl: ctrl}
-	mock.recorder = &MockLocalInfoMockRecorder{mock}
-	return mock
-}
-
-// EXPECT returns an object that allows the caller to indicate expected use
-func (m *MockLocalInfo) EXPECT() *MockLocalInfoMockRecorder {
-	return m.recorder
-}
-
-// IsParamsLocal mocks base method
-func (m *MockLocalInfo) IsParamsLocal(arg0 *query.Params) bool {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IsParamsLocal", arg0)
-	ret0, _ := ret[0].(bool)
-	return ret0
-}
-
-// IsParamsLocal indicates an expected call of IsParamsLocal
-func (mr *MockLocalInfoMockRecorder) IsParamsLocal(arg0 interface{}) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsParamsLocal", reflect.TypeOf((*MockLocalInfo)(nil).IsParamsLocal), arg0)
-}
-
-// IsSegLocal mocks base method
-func (m *MockLocalInfo) IsSegLocal(arg0 context.Context, arg1, arg2 addr.IA) (bool, error) {
-	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "IsSegLocal", arg0, arg1, arg2)
-	ret0, _ := ret[0].(bool)
-	ret1, _ := ret[1].(error)
-	return ret0, ret1
-}
-
-// IsSegLocal indicates an expected call of IsSegLocal
-func (mr *MockLocalInfoMockRecorder) IsSegLocal(arg0, arg1, arg2 interface{}) *gomock.Call {
-	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSegLocal", reflect.TypeOf((*MockLocalInfo)(nil).IsSegLocal), arg0, arg1, arg2)
-}
diff --git a/go/lib/infra/modules/segfetcher/BUILD.bazel b/go/lib/infra/modules/segfetcher/BUILD.bazel
index facd67db3..2d3be48b8 100644
--- a/go/lib/infra/modules/segfetcher/BUILD.bazel
+++ b/go/lib/infra/modules/segfetcher/BUILD.bazel
@@ -13,7 +13,6 @@ go_library(
         "revocation.go",
         "segs.go",
         "splitter.go",
-        "validator.go",
     ],
     importpath = "github.com/scionproto/scion/go/lib/infra/modules/segfetcher",
     visibility = ["//visibility:public"],
diff --git a/go/lib/infra/modules/segfetcher/fetcher.go b/go/lib/infra/modules/segfetcher/fetcher.go
index e871203ec..0ce4d01c6 100644
--- a/go/lib/infra/modules/segfetcher/fetcher.go
+++ b/go/lib/infra/modules/segfetcher/fetcher.go
@@ -66,8 +66,6 @@ type FetcherConfig struct {
 	RequestAPI RequestAPI
 	// DstProvider provides destinations to fetch segments from
 	DstProvider DstProvider
-	// Validator is used to validate requests.
-	Validator Validator
 	// Splitter is used to split requests.
 	Splitter Splitter
 	// SciondMode enables sciond mode, this means it uses the local CS to fetch
@@ -82,7 +80,6 @@ type FetcherConfig struct {
 // New creates a new fetcher from the configuration.
 func (cfg FetcherConfig) New() *Fetcher {
 	return &Fetcher{
-		Validator: cfg.Validator,
 		Splitter:  cfg.Splitter,
 		Resolver:  NewResolver(cfg.PathDB, cfg.RevCache, cfg.LocalInfo),
 		Requester: &DefaultRequester{API: cfg.RequestAPI, DstProvider: cfg.DstProvider},
@@ -100,7 +97,6 @@ func (cfg FetcherConfig) New() *Fetcher {
 
 // Fetcher fetches, verifies and stores segments for a given path request.
 type Fetcher struct {
-	Validator             Validator
 	Splitter              Splitter
 	Resolver              Resolver
 	Requester             Requester
@@ -116,11 +112,6 @@ type Fetcher struct {
 // of the request. First the request is validated and then depending on the
 // cache the segments are fetched from the remote server.
 func (f *Fetcher) FetchSegs(ctx context.Context, req Request) (Segments, error) {
-	if f.Validator != nil {
-		if err := f.Validator.Validate(ctx, req); err != nil {
-			return Segments{}, serrors.Wrap(errValidate, err)
-		}
-	}
 	reqSet, err := f.Splitter.Split(ctx, req)
 	if err != nil {
 		return Segments{}, err
diff --git a/go/lib/infra/modules/segfetcher/mock_segfetcher/BUILD.bazel b/go/lib/infra/modules/segfetcher/mock_segfetcher/BUILD.bazel
index ecc17cb44..d3cd80c86 100644
--- a/go/lib/infra/modules/segfetcher/mock_segfetcher/BUILD.bazel
+++ b/go/lib/infra/modules/segfetcher/mock_segfetcher/BUILD.bazel
@@ -6,6 +6,7 @@ go_library(
     importpath = "github.com/scionproto/scion/go/lib/infra/modules/segfetcher/mock_segfetcher",
     visibility = ["//visibility:public"],
     deps = [
+        "//go/lib/addr:go_default_library",
         "//go/lib/ctrl/path_mgmt:go_default_library",
         "//go/lib/infra/modules/segfetcher:go_default_library",
         "//go/lib/infra/modules/seghandler:go_default_library",
diff --git a/go/lib/infra/modules/segfetcher/mock_segfetcher/segfetcher.go b/go/lib/infra/modules/segfetcher/mock_segfetcher/segfetcher.go
index b1f2db69f..4f5e7d6d6 100644
--- a/go/lib/infra/modules/segfetcher/mock_segfetcher/segfetcher.go
+++ b/go/lib/infra/modules/segfetcher/mock_segfetcher/segfetcher.go
@@ -1,5 +1,5 @@
 // Code generated by MockGen. DO NOT EDIT.
-// Source: github.com/scionproto/scion/go/lib/infra/modules/segfetcher (interfaces: DstProvider,ReplyHandler,Requester,RequestAPI,Resolver,Splitter,Validator)
+// Source: github.com/scionproto/scion/go/lib/infra/modules/segfetcher (interfaces: DstProvider,ReplyHandler,Requester,RequestAPI,Resolver,Splitter,LocalInfo)
 
 // Package mock_segfetcher is a generated GoMock package.
 package mock_segfetcher
@@ -7,6 +7,7 @@ package mock_segfetcher
 import (
 	context "context"
 	gomock "github.com/golang/mock/gomock"
+	addr "github.com/scionproto/scion/go/lib/addr"
 	path_mgmt "github.com/scionproto/scion/go/lib/ctrl/path_mgmt"
 	segfetcher "github.com/scionproto/scion/go/lib/infra/modules/segfetcher"
 	seghandler "github.com/scionproto/scion/go/lib/infra/modules/seghandler"
@@ -241,39 +242,40 @@ func (mr *MockSplitterMockRecorder) Split(arg0, arg1 interface{}) *gomock.Call {
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Split", reflect.TypeOf((*MockSplitter)(nil).Split), arg0, arg1)
 }
 
-// MockValidator is a mock of Validator interface
-type MockValidator struct {
+// MockLocalInfo is a mock of LocalInfo interface
+type MockLocalInfo struct {
 	ctrl     *gomock.Controller
-	recorder *MockValidatorMockRecorder
+	recorder *MockLocalInfoMockRecorder
 }
 
-// MockValidatorMockRecorder is the mock recorder for MockValidator
-type MockValidatorMockRecorder struct {
-	mock *MockValidator
+// MockLocalInfoMockRecorder is the mock recorder for MockLocalInfo
+type MockLocalInfoMockRecorder struct {
+	mock *MockLocalInfo
 }
 
-// NewMockValidator creates a new mock instance
-func NewMockValidator(ctrl *gomock.Controller) *MockValidator {
-	mock := &MockValidator{ctrl: ctrl}
-	mock.recorder = &MockValidatorMockRecorder{mock}
+// NewMockLocalInfo creates a new mock instance
+func NewMockLocalInfo(ctrl *gomock.Controller) *MockLocalInfo {
+	mock := &MockLocalInfo{ctrl: ctrl}
+	mock.recorder = &MockLocalInfoMockRecorder{mock}
 	return mock
 }
 
 // EXPECT returns an object that allows the caller to indicate expected use
-func (m *MockValidator) EXPECT() *MockValidatorMockRecorder {
+func (m *MockLocalInfo) EXPECT() *MockLocalInfoMockRecorder {
 	return m.recorder
 }
 
-// Validate mocks base method
-func (m *MockValidator) Validate(arg0 context.Context, arg1 segfetcher.Request) error {
+// IsSegLocal mocks base method
+func (m *MockLocalInfo) IsSegLocal(arg0 context.Context, arg1, arg2 addr.IA) (bool, error) {
 	m.ctrl.T.Helper()
-	ret := m.ctrl.Call(m, "Validate", arg0, arg1)
-	ret0, _ := ret[0].(error)
-	return ret0
+	ret := m.ctrl.Call(m, "IsSegLocal", arg0, arg1, arg2)
+	ret0, _ := ret[0].(bool)
+	ret1, _ := ret[1].(error)
+	return ret0, ret1
 }
 
-// Validate indicates an expected call of Validate
-func (mr *MockValidatorMockRecorder) Validate(arg0, arg1 interface{}) *gomock.Call {
+// IsSegLocal indicates an expected call of IsSegLocal
+func (mr *MockLocalInfoMockRecorder) IsSegLocal(arg0, arg1, arg2 interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
-	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Validate", reflect.TypeOf((*MockValidator)(nil).Validate), arg0, arg1)
+	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSegLocal", reflect.TypeOf((*MockLocalInfo)(nil).IsSegLocal), arg0, arg1, arg2)
 }
diff --git a/go/lib/infra/modules/segfetcher/validator.go b/go/lib/infra/modules/segfetcher/validator.go
deleted file mode 100644
index 1c62c5c1d..000000000
--- a/go/lib/infra/modules/segfetcher/validator.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2019 Anapaya Systems
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package segfetcher
-
-import "context"
-
-// Validator validates a request.
-type Validator interface {
-	// Validate should return an error if the given request is not valid.
-	Validate(ctx context.Context, r Request) error
-}
diff --git a/tools/gomocks b/tools/gomocks
index 7469f0836..fd66b871c 100755
--- a/tools/gomocks
+++ b/tools/gomocks
@@ -37,7 +37,6 @@ MOCK_TARGETS = [
             "BeaconInserter,BeaconProvider,SegmentProvider,SegmentStore"),
         (SCION_PACKAGE_PREFIX + "/go/cs/keepalive", "IfStatePusher,RevDropper"),
         (SCION_PACKAGE_PREFIX + "/go/cs/revocation", "Store"),
-        (SCION_PACKAGE_PREFIX + "/go/cs/segreq", "LocalInfo"),
         (SCION_PACKAGE_PREFIX + "/go/cs/segutil", "Policy"),
         (SCION_PACKAGE_PREFIX + "/go/hidden_path_srv/internal/registration", "Validator"),
         (SCION_PACKAGE_PREFIX + "/go/hidden_path_srv/internal/hpsegreq", "Fetcher"),
@@ -46,8 +45,7 @@ MOCK_TARGETS = [
             "ASInspector,Messenger,ResponseWriter,TrustStore,Verifier"),
         (SCION_PACKAGE_PREFIX + "/go/lib/infra/messenger", "LocalSVCRouter,Resolver"),
         (SCION_PACKAGE_PREFIX + "/go/lib/infra/modules/segfetcher",
-            "DstProvider,ReplyHandler,Requester,RequestAPI,Resolver," +
-            "Splitter,Validator"),
+            "DstProvider,ReplyHandler,Requester,RequestAPI,Resolver,Splitter,LocalInfo"),
         (SCION_PACKAGE_PREFIX + "/go/lib/infra/modules/seghandler", "Storage,Verifier"),
         (SCION_PACKAGE_PREFIX + "/go/lib/infra/modules/trust",
             "CryptoProvider,DB,KeyRing,Inserter,Recurser,Resolver,Router,RPC"),


Test patch:
diff --git a/go/cs/segreq/db_test.go b/go/cs/segreq/db_test.go
index e2ac093a5..dce516343 100644
--- a/go/cs/segreq/db_test.go
+++ b/go/cs/segreq/db_test.go
@@ -25,8 +25,8 @@ import (
 	"github.com/stretchr/testify/require"
 
 	"github.com/scionproto/scion/go/cs/segreq"
-	"github.com/scionproto/scion/go/cs/segreq/mock_segreq"
 	"github.com/scionproto/scion/go/lib/addr"
+	"github.com/scionproto/scion/go/lib/infra/modules/segfetcher/mock_segfetcher"
 	"github.com/scionproto/scion/go/lib/pathdb/mock_pathdb"
 	"github.com/scionproto/scion/go/lib/xtest"
 )
@@ -36,7 +36,7 @@ func TestPSPathDBGetNextQuery(t *testing.T) {
 		Src                     addr.IA
 		Dst                     addr.IA
 		PreparePathDB           func(db *mock_pathdb.MockPathDB, src, dst addr.IA)
-		PrepareLocalInfo        func(i *mock_segreq.MockLocalInfo, src, dst addr.IA)
+		PrepareLocalInfo        func(i *mock_segfetcher.MockLocalInfo, src, dst addr.IA)
 		ErrorAssertion          require.ErrorAssertionFunc
 		AssertNextQueryAfterNow assert.BoolAssertionFunc
 	}{
@@ -44,7 +44,7 @@ func TestPSPathDBGetNextQuery(t *testing.T) {
 			Src:           xtest.MustParseIA("1-ff00:0:111"),
 			Dst:           xtest.MustParseIA("1-ff00:0:120"),
 			PreparePathDB: func(db *mock_pathdb.MockPathDB, src, dst addr.IA) {},
-			PrepareLocalInfo: func(i *mock_segreq.MockLocalInfo, src, dst addr.IA) {
+			PrepareLocalInfo: func(i *mock_segfetcher.MockLocalInfo, src, dst addr.IA) {
 				i.EXPECT().IsSegLocal(gomock.Any(), src, dst).
 					Return(false, errors.New("test err"))
 			},
@@ -55,7 +55,7 @@ func TestPSPathDBGetNextQuery(t *testing.T) {
 			Src:           xtest.MustParseIA("1-ff00:0:111"),
 			Dst:           xtest.MustParseIA("1-ff00:0:120"),
 			PreparePathDB: func(db *mock_pathdb.MockPathDB, src, dst addr.IA) {},
-			PrepareLocalInfo: func(i *mock_segreq.MockLocalInfo, src, dst addr.IA) {
+			PrepareLocalInfo: func(i *mock_segfetcher.MockLocalInfo, src, dst addr.IA) {
 				i.EXPECT().IsSegLocal(gomock.Any(), src, dst).
 					Return(true, nil)
 			},
@@ -69,7 +69,7 @@ func TestPSPathDBGetNextQuery(t *testing.T) {
 				db.EXPECT().GetNextQuery(gomock.Any(), src, dst, gomock.Any()).
 					Return(time.Now().Add(time.Hour), nil)
 			},
-			PrepareLocalInfo: func(i *mock_segreq.MockLocalInfo, src, dst addr.IA) {
+			PrepareLocalInfo: func(i *mock_segfetcher.MockLocalInfo, src, dst addr.IA) {
 				i.EXPECT().IsSegLocal(gomock.Any(), src, dst).
 					Return(false, nil)
 			},
@@ -82,7 +82,7 @@ func TestPSPathDBGetNextQuery(t *testing.T) {
 			ctrl := gomock.NewController(t)
 			defer ctrl.Finish()
 			pdb := mock_pathdb.NewMockPathDB(ctrl)
-			li := mock_segreq.NewMockLocalInfo(ctrl)
+			li := mock_segfetcher.NewMockLocalInfo(ctrl)
 			test.PreparePathDB(pdb, test.Src, test.Dst)
 			test.PrepareLocalInfo(li, test.Src, test.Dst)
 			db := &segreq.PathDB{
diff --git a/go/cs/segreq/validator_test.go b/go/cs/segreq/validator_test.go
deleted file mode 100644
index c5bdbd8ef..000000000
--- a/go/cs/segreq/validator_test.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2019 Anapaya Systems
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package segreq_test
-
-import (
-	"context"
-	"errors"
-	"testing"
-
-	"github.com/golang/mock/gomock"
-	"github.com/stretchr/testify/assert"
-	"github.com/stretchr/testify/require"
-
-	"github.com/scionproto/scion/go/cs/segreq"
-	"github.com/scionproto/scion/go/lib/addr"
-	"github.com/scionproto/scion/go/lib/infra/mock_infra"
-	"github.com/scionproto/scion/go/lib/infra/modules/segfetcher"
-	"github.com/scionproto/scion/go/lib/xtest"
-)
-
-type validatorTest struct {
-	Request        segfetcher.Request
-	PrepareMock    func(i *mock_infra.MockASInspector)
-	ErrorAssertion assert.ErrorAssertionFunc
-}
-
-var (
-	ia110 = xtest.MustParseIA("1-ff00:0:110")
-	ia111 = xtest.MustParseIA("1-ff00:0:111")
-	ia120 = xtest.MustParseIA("1-ff00:0:120")
-	isd1  = addr.IA{I: 1}
-	isd2  = addr.IA{I: 2}
-)
-
-func TestBaseValidator(t *testing.T) {
-	tests := map[string]validatorTest{
-		"zero req": {
-			Request:        segfetcher.Request{},
-			PrepareMock:    func(i *mock_infra.MockASInspector) {},
-			ErrorAssertion: assert.Error,
-		},
-		"non-core to wildcard": {
-			Request: segfetcher.Request{Src: ia111, Dst: isd1},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil)
-			},
-			ErrorAssertion: assert.NoError,
-		},
-		"non-core to non-local wildcard": {
-			Request: segfetcher.Request{Src: ia111, Dst: isd2},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil)
-			},
-			ErrorAssertion: assert.Error,
-		},
-		"non-core to core": {
-			Request: segfetcher.Request{Src: ia111, Dst: ia120},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil)
-				i.EXPECT().HasAttributes(gomock.Any(), ia120, gomock.Any()).
-					Return(true, nil)
-			},
-			ErrorAssertion: assert.NoError,
-		},
-	}
-	addCommonTests(t, tests)
-	for name, test := range tests {
-		t.Run(name, func(t *testing.T) {
-			ctrl := gomock.NewController(t)
-			defer ctrl.Finish()
-			i := mock_infra.NewMockASInspector(ctrl)
-			test.PrepareMock(i)
-			v := segreq.BaseValidator{CoreChecker: segreq.CoreChecker{Inspector: i}}
-			test.ErrorAssertion(t, v.Validate(context.Background(), test.Request))
-		})
-	}
-}
-
-func TestCoreValidator(t *testing.T) {
-	tests := map[string]validatorTest{
-		"non-core to core": {
-			Request: segfetcher.Request{Src: ia111, Dst: ia120},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil).Times(2)
-				i.EXPECT().HasAttributes(gomock.Any(), ia120, gomock.Any()).
-					Return(true, nil)
-			},
-			ErrorAssertion: assert.Error,
-		},
-	}
-	addCommonTests(t, tests)
-	for name, test := range tests {
-		t.Run(name, func(t *testing.T) {
-			ctrl := gomock.NewController(t)
-			defer ctrl.Finish()
-			i := mock_infra.NewMockASInspector(ctrl)
-			test.PrepareMock(i)
-			v := segreq.CoreValidator{
-				BaseValidator: segreq.BaseValidator{CoreChecker: segreq.CoreChecker{Inspector: i}},
-			}
-			test.ErrorAssertion(t, v.Validate(context.Background(), test.Request))
-		})
-	}
-}
-
-func addCommonTests(t *testing.T, tests map[string]validatorTest) {
-	commonTests := map[string]validatorTest{
-		"Core to core": {
-			Request: segfetcher.Request{Src: ia110, Dst: ia120},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia110, gomock.Any()).
-					Return(true, nil).MaxTimes(2)
-				i.EXPECT().HasAttributes(gomock.Any(), ia120, gomock.Any()).
-					Return(true, nil)
-			},
-			ErrorAssertion: assert.NoError,
-		},
-		"Wildcard to wildcard": {
-			Request:        segfetcher.Request{Src: isd1, Dst: isd2},
-			PrepareMock:    func(i *mock_infra.MockASInspector) {},
-			ErrorAssertion: assert.Error,
-		},
-		"Wildcard to non-core": {
-			Request: segfetcher.Request{Src: isd1, Dst: ia111},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil).MaxTimes(2)
-			},
-			ErrorAssertion: assert.NoError,
-		},
-		"non-local wildcard to non-core": {
-			Request: segfetcher.Request{Src: isd2, Dst: ia111},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil).MaxTimes(2)
-			},
-			ErrorAssertion: assert.Error,
-		},
-		"core to non-core": {
-			Request: segfetcher.Request{Src: ia120, Dst: ia111},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, nil)
-				i.EXPECT().HasAttributes(gomock.Any(), ia120, gomock.Any()).
-					Return(true, nil).MaxTimes(2)
-			},
-			ErrorAssertion: assert.NoError,
-		},
-		"inspector error": {
-			Request: segfetcher.Request{Src: ia111, Dst: ia120},
-			PrepareMock: func(i *mock_infra.MockASInspector) {
-				i.EXPECT().HasAttributes(gomock.Any(), ia111, gomock.Any()).
-					Return(false, errors.New("Test error")).MaxTimes(2)
-			},
-			ErrorAssertion: assert.Error,
-		},
-	}
-	for name, test := range commonTests {
-		_, ok := tests[name]
-		require.False(t, ok, "Double registration for test %s", name)
-		tests[name] = test
-	}
-}
diff --git a/go/lib/infra/modules/segfetcher/fetcher_test.go b/go/lib/infra/modules/segfetcher/fetcher_test.go
index ba9212e4f..0fea68936 100644
--- a/go/lib/infra/modules/segfetcher/fetcher_test.go
+++ b/go/lib/infra/modules/segfetcher/fetcher_test.go
@@ -31,7 +31,6 @@ import (
 )
 
 type TestableFetcher struct {
-	Validator     *mock_segfetcher.MockValidator
 	Splitter      *mock_segfetcher.MockSplitter
 	Resolver      *mock_segfetcher.MockResolver
 	Requester     *mock_segfetcher.MockRequester
@@ -42,7 +41,6 @@ type TestableFetcher struct {
 
 func NewTestFetcher(ctrl *gomock.Controller) *TestableFetcher {
 	return &TestableFetcher{
-		Validator:     mock_segfetcher.NewMockValidator(ctrl),
 		Splitter:      mock_segfetcher.NewMockSplitter(ctrl),
 		Resolver:      mock_segfetcher.NewMockResolver(ctrl),
 		Requester:     mock_segfetcher.NewMockRequester(ctrl),
@@ -54,7 +52,6 @@ func NewTestFetcher(ctrl *gomock.Controller) *TestableFetcher {
 
 func (f *TestableFetcher) Fetcher() *segfetcher.Fetcher {
 	return &segfetcher.Fetcher{
-		Validator:     f.Validator,
 		Splitter:      f.Splitter,
 		Resolver:      f.Resolver,
 		Requester:     f.Requester,
@@ -76,15 +73,8 @@ func TestFetcher(t *testing.T) {
 		ErrorAssertion require.ErrorAssertionFunc
 		ExpectedSegs   segfetcher.Segments
 	}{
-		"Invalid request": {
-			PrepareFetcher: func(f *TestableFetcher) {
-				f.Validator.EXPECT().Validate(gomock.Any(), gomock.Any()).Return(testErr)
-			},
-			ErrorAssertion: require.Error,
-		},
 		"Splitter error": {
 			PrepareFetcher: func(f *TestableFetcher) {
-				f.Validator.EXPECT().Validate(gomock.Any(), gomock.Any())
 				f.Splitter.EXPECT().Split(gomock.Any(), gomock.Any()).
 					Return(segfetcher.RequestSet{}, testErr)
 			},
@@ -92,7 +82,6 @@ func TestFetcher(t *testing.T) {
 		},
 		"Resolver error": {
 			PrepareFetcher: func(f *TestableFetcher) {
-				f.Validator.EXPECT().Validate(gomock.Any(), gomock.Any())
 				f.Splitter.EXPECT().Split(gomock.Any(), gomock.Any())
 				f.Resolver.EXPECT().Resolve(gomock.Any(), gomock.Any(), gomock.Any()).
 					Return(segfetcher.Segments{}, segfetcher.RequestSet{}, testErr)
@@ -101,7 +90,6 @@ func TestFetcher(t *testing.T) {
 		},
 		"Immediately resolved": {
 			PrepareFetcher: func(f *TestableFetcher) {
-				f.Validator.EXPECT().Validate(gomock.Any(), gomock.Any())
 				reqSet := segfetcher.RequestSet{
 					Up: segfetcher.Request{Src: non_core_111, Dst: core_130},
 				}