Skip to content

Commit

Permalink
Remove unused parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Sep 24, 2023
1 parent 17e648a commit 510868f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 54 deletions.
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 0 additions & 12 deletions services/blockrelay/standard/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -49,7 +48,6 @@ type parameters struct {
validatorRegistrationSigner signer.ValidatorRegistrationSigner
secondaryValidatorRegistrationsSubmitters []consensusclient.ValidatorRegistrationsSubmitter
logResults bool
timeout time.Duration
releaseVersion string
builderBidProvider builderbid.Provider
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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")
}
Expand Down
3 changes: 0 additions & 3 deletions services/blockrelay/standard/proposerconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down
3 changes: 0 additions & 3 deletions services/blockrelay/standard/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
35 changes: 0 additions & 35 deletions services/blockrelay/standard/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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(""),
Expand All @@ -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"),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down

0 comments on commit 510868f

Please sign in to comment.