Skip to content

Commit

Permalink
update to go v1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Feb 28, 2024
1 parent 54e45da commit e42adde
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21.0
go-version: ^1.22.0
id: go

- name: Ensure go mod tidy runs without changes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
go-version: ^1.22
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
go-version: ^1.22
- name: Make directories
run: |
mkdir -p ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
go-version: ^1.22
id: go

- name: Checkout sources
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ linters:
- ireturn
- noctx
- tagliatelle
- perfsprint

#
# Disabled because of generics:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM golang:1.21 as builder
FROM golang:1.22 as builder
ARG VERSION
WORKDIR /build

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ v:

.PHONY: build
build:
@go version
CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o mev-boost

.PHONY: build-testcli
Expand Down
1 change: 0 additions & 1 deletion cmd/test-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func doRegisterValidator(v validatorPrivateData, boostEndpoint string, builderSi
log.WithError(err).Fatal("Could not prepare registration message")
}
_, err = server.SendHTTPRequest(context.TODO(), *http.DefaultClient, http.MethodPost, boostEndpoint+"/eth/v1/builder/validators", "test-cli", nil, message, nil)

if err != nil {
log.WithError(err).Fatal("Validator registration not successful")
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/flashbots/mev-boost

go 1.21
go 1.22

require (
github.com/ethereum/go-ethereum v1.13.10
Expand Down
6 changes: 3 additions & 3 deletions server/errors.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package server

import "fmt"
import "errors"

// ErrMissingRelayPubkey is returned if a new RelayEntry URL has no public key.
var ErrMissingRelayPubkey = fmt.Errorf("missing relay public key")
var ErrMissingRelayPubkey = errors.New("missing relay public key")

// ErrPointAtInfinityPubkey is returned if a new RelayEntry URL has an all-zero public key.
var ErrPointAtInfinityPubkey = fmt.Errorf("relay public key cannot be the point-at-infinity")
var ErrPointAtInfinityPubkey = errors.New("relay public key cannot be the point-at-infinity")
10 changes: 5 additions & 5 deletions server/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func TestWebserverMaxHeaderSize(t *testing.T) {
backend.boost.listenAddr = addr
go func() {
err := backend.boost.StartHTTPServer()
require.NoError(t, err)
require.NoError(t, err) //nolint:testifylint

Check failure on line 210 in server/service_test.go

View workflow job for this annotation

GitHub Actions / Lint

directive `//nolint:testifylint` is unused for linter "testifylint" (nolintlint)
}()
time.Sleep(time.Millisecond * 100)
path := "http://" + addr + "?" + strings.Repeat("abc", 4000) // path with characters of size over 4kb
Expand Down Expand Up @@ -275,7 +275,7 @@ func TestRegisterValidator(t *testing.T) {
require.Equal(t, 1, backend.relays[1].GetRequestCount(path))

// Now make one relay return an error
backend.relays[0].overrideHandleRegisterValidator(func(w http.ResponseWriter, r *http.Request) {
backend.relays[0].overrideHandleRegisterValidator(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusBadRequest)
})
rr = backend.request(t, http.MethodPost, path, payload)
Expand All @@ -284,7 +284,7 @@ func TestRegisterValidator(t *testing.T) {
require.Equal(t, 2, backend.relays[1].GetRequestCount(path))

// Now make both relays return an error - which should cause the request to fail
backend.relays[1].overrideHandleRegisterValidator(func(w http.ResponseWriter, r *http.Request) {
backend.relays[1].overrideHandleRegisterValidator(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusBadRequest)
})
rr = backend.request(t, http.MethodPost, path, payload)
Expand Down Expand Up @@ -688,7 +688,7 @@ func TestGetPayload(t *testing.T) {
backend := newTestBackend(t, 1, 2*time.Second)

count := 0
backend.relays[0].handlerOverrideGetPayload = func(w http.ResponseWriter, r *http.Request) {
backend.relays[0].handlerOverrideGetPayload = func(w http.ResponseWriter, _ *http.Request) {
if count > 0 {
// success response on the second attempt
backend.relays[0].defaultHandleGetPayload(w)
Expand All @@ -709,7 +709,7 @@ func TestGetPayload(t *testing.T) {
count := 0
maxRetries := 5

backend.relays[0].handlerOverrideGetPayload = func(w http.ResponseWriter, r *http.Request) {
backend.relays[0].handlerOverrideGetPayload = func(w http.ResponseWriter, _ *http.Request) {
count++
if count > maxRetries {
// success response after max retry attempts
Expand Down
4 changes: 2 additions & 2 deletions server/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestSendHTTPRequestUserAgent(t *testing.T) {
// Test with custom UA
customUA := "test-user-agent"
expectedUA := fmt.Sprintf("mev-boost/%s %s", config.Version, customUA)
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, expectedUA, r.Header.Get("User-Agent"))
done <- true
}))
Expand All @@ -58,7 +58,7 @@ func TestSendHTTPRequestUserAgent(t *testing.T) {

// Test without custom UA
expectedUA = fmt.Sprintf("mev-boost/%s", config.Version)
ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ts = httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, expectedUA, r.Header.Get("User-Agent"))
done <- true
}))
Expand Down

0 comments on commit e42adde

Please sign in to comment.