From 510868fae59b41eaac2e8dea2d1e102aa7ff0baa Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Sun, 24 Sep 2023 23:13:26 +0100 Subject: [PATCH] Remove unused parameter. --- main.go | 1 - services/blockrelay/standard/parameters.go | 12 ------- .../standard/proposerconfig_test.go | 3 -- services/blockrelay/standard/service.go | 3 -- services/blockrelay/standard/service_test.go | 35 ------------------- 5 files changed, 54 deletions(-) diff --git a/main.go b/main.go index 6546dada..5e8eabd2 100644 --- a/main.go +++ b/main.go @@ -1643,7 +1643,6 @@ func startBlockRelay(ctx context.Context, standardblockrelay.WithValidatingAccountsProvider(accountManager.(accountmanager.ValidatingAccountsProvider)), standardblockrelay.WithListenAddress(viper.GetString("blockrelay.listen-address")), standardblockrelay.WithValidatorRegistrationSigner(signerSvc.(signer.ValidatorRegistrationSigner)), - standardblockrelay.WithTimeout(util.Timeout("blockrelay")), standardblockrelay.WithSecondaryValidatorRegistrationsSubmitters(secondaryValidatorRegistrationsSubmitters), standardblockrelay.WithLogResults(viper.GetBool("blockrelay.log-results")), standardblockrelay.WithReleaseVersion(ReleaseVersion), diff --git a/services/blockrelay/standard/parameters.go b/services/blockrelay/standard/parameters.go index 752353c1..b5bf6670 100644 --- a/services/blockrelay/standard/parameters.go +++ b/services/blockrelay/standard/parameters.go @@ -16,7 +16,6 @@ package standard import ( "bytes" "net" - "time" consensusclient "github.com/attestantio/go-eth2-client" "github.com/attestantio/go-eth2-client/spec/bellatrix" @@ -49,7 +48,6 @@ type parameters struct { validatorRegistrationSigner signer.ValidatorRegistrationSigner secondaryValidatorRegistrationsSubmitters []consensusclient.ValidatorRegistrationsSubmitter logResults bool - timeout time.Duration releaseVersion string builderBidProvider builderbid.Provider } @@ -170,13 +168,6 @@ func WithValidatorRegistrationSigner(signer signer.ValidatorRegistrationSigner) }) } -// WithTimeout sets the timeout for requests. -func WithTimeout(timeout time.Duration) Parameter { - return parameterFunc(func(p *parameters) { - p.timeout = timeout - }) -} - // WithSecondaryValidatorRegistrationsSubmitters sets the secondary validator registrations submitters. func WithSecondaryValidatorRegistrationsSubmitters(submitters []consensusclient.ValidatorRegistrationsSubmitter) Parameter { return parameterFunc(func(p *parameters) { @@ -244,9 +235,6 @@ func parseAndCheckParameters(params ...Parameter) (*parameters, error) { if parameters.validatorRegistrationSigner == nil { return nil, errors.New("no validator registration signer specified") } - if parameters.timeout == 0 { - return nil, errors.New("no timeout specified") - } if parameters.listenAddress == "" { return nil, errors.New("no listen address specified") } diff --git a/services/blockrelay/standard/proposerconfig_test.go b/services/blockrelay/standard/proposerconfig_test.go index 977fd2b1..d451bd9d 100644 --- a/services/blockrelay/standard/proposerconfig_test.go +++ b/services/blockrelay/standard/proposerconfig_test.go @@ -116,7 +116,6 @@ func TestProposerConfig(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(nullmetrics.New(ctx)), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -135,7 +134,6 @@ func TestProposerConfig(t *testing.T) { name: "File", params: []standard.Parameter{ standard.WithMonitor(nullmetrics.New(ctx)), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -160,7 +158,6 @@ func TestProposerConfig(t *testing.T) { name: "BadFile", params: []standard.Parameter{ standard.WithMonitor(nullmetrics.New(ctx)), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), diff --git a/services/blockrelay/standard/service.go b/services/blockrelay/standard/service.go index 658557f1..601bd638 100644 --- a/services/blockrelay/standard/service.go +++ b/services/blockrelay/standard/service.go @@ -16,7 +16,6 @@ package standard import ( "context" "sync" - "time" restdaemon "github.com/attestantio/go-block-relay/services/daemon/rest" apiv1 "github.com/attestantio/go-builder-client/api/v1" @@ -54,7 +53,6 @@ type Service struct { validatorRegistrationSigner signer.ValidatorRegistrationSigner builderBidsCache map[string]map[string]*builderspec.VersionedSignedBuilderBid builderBidsCacheMu sync.RWMutex - timeout time.Duration signedValidatorRegistrations map[phase0.Root]*apiv1.SignedValidatorRegistration signedValidatorRegistrationsMu sync.RWMutex secondaryValidatorRegistrationsSubmitters []consensusclient.ValidatorRegistrationsSubmitter @@ -101,7 +99,6 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) { accountsProvider: parameters.accountsProvider, validatingAccountsProvider: parameters.validatingAccountsProvider, validatorRegistrationSigner: parameters.validatorRegistrationSigner, - timeout: parameters.timeout, signedValidatorRegistrations: make(map[phase0.Root]*apiv1.SignedValidatorRegistration), secondaryValidatorRegistrationsSubmitters: parameters.secondaryValidatorRegistrationsSubmitters, logResults: parameters.logResults, diff --git a/services/blockrelay/standard/service_test.go b/services/blockrelay/standard/service_test.go index d6c74859..4eb93f0d 100644 --- a/services/blockrelay/standard/service_test.go +++ b/services/blockrelay/standard/service_test.go @@ -89,7 +89,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(nil), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -105,33 +104,11 @@ func TestService(t *testing.T) { }, err: "problem with parameters: no monitor specified", }, - { - name: "TimeoutZero", - params: []standard.Parameter{ - standard.WithLogLevel(zerolog.Disabled), - standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(0), - standard.WithMajordomo(majordomoSvc), - standard.WithScheduler(mockScheduler), - standard.WithListenAddress(listenAddress), - standard.WithChainTime(chainTime), - standard.WithConfigURL(configURL), - standard.WithFallbackFeeRecipient(fallbackFeeRecipient), - standard.WithFallbackGasLimit(fallbackGasLimit), - standard.WithAccountsProvider(mockAccountsProvider), - standard.WithValidatingAccountsProvider(mockValidatingAccountsProvider), - standard.WithValidatorRegistrationSigner(mockSigner), - standard.WithReleaseVersion("test"), - standard.WithBuilderBidProvider(builderBidProvider), - }, - err: "problem with parameters: no timeout specified", - }, { name: "MajordomoMissing", params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(nil), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -152,7 +129,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(nil), standard.WithListenAddress(listenAddress), @@ -173,7 +149,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(""), @@ -194,7 +169,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress("abc"), @@ -215,7 +189,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -236,7 +209,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -257,7 +229,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -278,7 +249,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -298,7 +268,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -319,7 +288,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -340,7 +308,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -361,7 +328,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress), @@ -382,7 +348,6 @@ func TestService(t *testing.T) { params: []standard.Parameter{ standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(prometheusMetrics), - standard.WithTimeout(time.Second), standard.WithMajordomo(majordomoSvc), standard.WithScheduler(mockScheduler), standard.WithListenAddress(listenAddress),