diff --git a/validator/accounts/testing/mock.go b/validator/accounts/testing/mock.go index f1e9560e37..e98a0592a1 100644 --- a/validator/accounts/testing/mock.go +++ b/validator/accounts/testing/mock.go @@ -204,7 +204,7 @@ func (*Validator) HasProposerSettings() bool { } // PushProposerSettings for mocking -func (_ *Validator) PushProposerSettings(_ context.Context, _ keymanager.IKeymanager, _ primitives.Slot, _ time.Time) error { +func (_ *Validator) PushProposerSettings(_ context.Context, _ keymanager.IKeymanager, _ primitives.Slot) error { panic("implement me") } diff --git a/validator/client/iface/validator.go b/validator/client/iface/validator.go index 60757e7487..647ef06a2f 100644 --- a/validator/client/iface/validator.go +++ b/validator/client/iface/validator.go @@ -57,7 +57,7 @@ type Validator interface { Keymanager() (keymanager.IKeymanager, error) HandleKeyReload(ctx context.Context, currentKeys [][fieldparams.BLSPubkeyLength]byte) (bool, error) CheckDoppelGanger(ctx context.Context) error - PushProposerSettings(ctx context.Context, km keymanager.IKeymanager, slot primitives.Slot, deadline time.Time) error + PushProposerSettings(ctx context.Context, km keymanager.IKeymanager, slot primitives.Slot) error SignValidatorRegistrationRequest(ctx context.Context, signer SigningFunc, newValidatorRegistration *ethpb.ValidatorRegistrationV1) (*ethpb.SignedValidatorRegistrationV1, error) StartEventStream(ctx context.Context, topics []string, eventsChan chan<- *event.Event) EventStreamIsRunning() bool diff --git a/validator/client/runner.go b/validator/client/runner.go index c07e6cb2db..34bc827349 100644 --- a/validator/client/runner.go +++ b/validator/client/runner.go @@ -61,9 +61,8 @@ func run(ctx context.Context, v iface.Validator) { log.Warn("Validator client started without proposer settings such as fee recipient" + " and will continue to use settings provided in the beacon node.") } - deadline := time.Now().Add(5 * time.Minute) - if err := v.PushProposerSettings(ctx, km, headSlot, deadline); err != nil { - log.WithError(err).Fatal("Failed to update proposer settings") // allow fatal. skipcq + if err := v.PushProposerSettings(ctx, km, headSlot); err != nil { + log.WithError(err).Fatal("Failed to update proposer settings") } for { ctx, span := trace.StartSpan(ctx, "validator.processSlot") @@ -97,7 +96,7 @@ func run(ctx context.Context, v iface.Validator) { // call push proposer settings often to account for the following edge cases: // proposer is activated at the start of epoch and tries to propose immediately // account has changed in the middle of an epoch - if err := v.PushProposerSettings(ctx, km, slot, deadline); err != nil { + if err := v.PushProposerSettings(ctx, km, slot); err != nil { log.WithError(err).Warn("Failed to update proposer settings") } @@ -316,8 +315,7 @@ func runHealthCheckRoutine(ctx context.Context, v iface.Validator, eventsChan ch log.WithError(err).Error("Could not get canonical head slot") return } - deadline := time.Now().Add(5 * time.Minute) // Should consider changing to a constant - if err := v.PushProposerSettings(ctx, km, slot, deadline); err != nil { + if err := v.PushProposerSettings(ctx, km, slot); err != nil { log.WithError(err).Warn("Failed to update proposer settings") } } diff --git a/validator/client/testutil/mock_validator.go b/validator/client/testutil/mock_validator.go index 883206d8ea..0e462c1c62 100644 --- a/validator/client/testutil/mock_validator.go +++ b/validator/client/testutil/mock_validator.go @@ -254,10 +254,7 @@ func (*FakeValidator) HasProposerSettings() bool { } // PushProposerSettings for mocking -func (fv *FakeValidator) PushProposerSettings(ctx context.Context, _ keymanager.IKeymanager, _ primitives.Slot, deadline time.Time) error { - nctx, cancel := context.WithDeadline(ctx, deadline) - ctx = nctx - defer cancel() +func (fv *FakeValidator) PushProposerSettings(ctx context.Context, _ keymanager.IKeymanager, _ primitives.Slot) error { time.Sleep(fv.ProposerSettingWait) if errors.Is(ctx.Err(), context.DeadlineExceeded) { log.Error("deadline exceeded") diff --git a/validator/client/validator.go b/validator/client/validator.go index 9423cfaad9..b89c9e88fc 100644 --- a/validator/client/validator.go +++ b/validator/client/validator.go @@ -1102,16 +1102,13 @@ func (v *validator) SetProposerSettings(ctx context.Context, settings *proposer. } // PushProposerSettings calls the prepareBeaconProposer RPC to set the fee recipient and also the register validator API if using a custom builder. -func (v *validator) PushProposerSettings(ctx context.Context, km keymanager.IKeymanager, slot primitives.Slot, deadline time.Time) error { +func (v *validator) PushProposerSettings(ctx context.Context, km keymanager.IKeymanager, slot primitives.Slot) error { ctx, span := trace.StartSpan(ctx, "validator.PushProposerSettings") defer span.End() if km == nil { return errors.New("keymanager is nil when calling PrepareBeaconProposer") } - nctx, cancel := context.WithDeadline(ctx, deadline) - ctx = nctx - defer cancel() pubkeys, err := km.FetchValidatingPublicKeys(ctx) if err != nil { diff --git a/validator/client/validator_test.go b/validator/client/validator_test.go index 69af50cf72..2d9eca2ff3 100644 --- a/validator/client/validator_test.go +++ b/validator/client/validator_test.go @@ -2027,8 +2027,7 @@ func TestValidator_PushSettings(t *testing.T) { require.Equal(t, len(tt.mockExpectedRequests), len(signedRegisterValidatorRequests)) require.Equal(t, len(signedRegisterValidatorRequests), len(v.signedValidatorRegistrations)) } - deadline := time.Now().Add(time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second) - if err := v.PushProposerSettings(ctx, km, 0, deadline); tt.err != "" { + if err := v.PushProposerSettings(ctx, km, 0); tt.err != "" { assert.ErrorContains(t, tt.err, err) } if len(tt.logMessages) > 0 {