diff --git a/builder/backend.go b/builder/backend.go index d014a7efb27c..77fdbc2b3123 100644 --- a/builder/backend.go +++ b/builder/backend.go @@ -182,7 +182,12 @@ func (b *Backend) handleRegisterValidator(w http.ResponseWriter, req *http.Reque for _, registerRequest := range payload { pubkeyHex := PubkeyHex(registerRequest.Message.Pubkey.String()) if previousValidatorData, ok := b.validators[pubkeyHex]; ok { - if registerRequest.Message.Timestamp <= previousValidatorData.Timestamp { + if registerRequest.Message.Timestamp < previousValidatorData.Timestamp { + respondError(w, http.StatusBadRequest, "invalid timestamp") + return + } + + if registerRequest.Message.Timestamp == previousValidatorData.Timestamp && (registerRequest.Message.FeeRecipient != previousValidatorData.FeeRecipient || registerRequest.Message.GasLimit != previousValidatorData.GasLimit) { respondError(w, http.StatusBadRequest, "invalid timestamp") return } diff --git a/builder/backend_test.go b/builder/backend_test.go index 1158d06f258e..762903f9237a 100644 --- a/builder/backend_test.go +++ b/builder/backend_test.go @@ -64,8 +64,7 @@ func TestValidatorRegistration(t *testing.T) { require.Equal(t, ValidatorData{FeeRecipient: payload[0].Message.FeeRecipient, GasLimit: payload[0].Message.GasLimit, Timestamp: payload[0].Message.Timestamp}, backend.validators[PubkeyHex(v.Pk.String())]) rr = testRequest(t, backend, "POST", "/eth/v1/builder/validators", payload) - require.Equal(t, http.StatusBadRequest, rr.Code) - require.Equal(t, `{"code":400,"message":"invalid timestamp"}`+"\n", rr.Body.String()) + require.Equal(t, http.StatusOK, rr.Code) payload[0].Message.Timestamp += 1 // Invalid signature