Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golang.org/x/crypto from 0.20.0 to 0.31.0 #663

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/checks.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: Check out code into the Go module directory
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
go-version: ^1.22
id: go

- name: Check out code into the Go module directory
Expand All @@ -50,10 +50,10 @@ jobs:
run: go install mvdan.cc/[email protected]

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
run: go install honnef.co/go/tools/cmd/staticcheck@v0.5.1

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1

- name: Lint
run: make lint
Expand Down
12 changes: 2 additions & 10 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ linters:
- gomnd
- lll
- musttag
- mnd
- nestif
- nilnil
- nlreturn
- noctx
- nonamedreturns
- nosnakecase
- paralleltest
- revive
- testpackage
- unparam
- varnamelen
- wrapcheck
- wsl
- deadcode
- varcheck
- interfacebloat
- exhaustruct

Expand All @@ -38,18 +36,12 @@ linters:
- contextcheck
- rowserrcheck
- sqlclosecheck
- structcheck
- wastedassign

#
# Disabled because deprecated:
#
- exhaustivestruct
- golint
- ifshort
- interfacer
- maligned
- scopelint
- execinquery

linters-settings:
#
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
9 changes: 5 additions & 4 deletions beaconclient/beacon_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/flashbots/mev-boost-relay/common"
"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand All @@ -33,7 +34,7 @@ type testBackend struct {
func newTestBackend(t require.TestingT, numBeaconNodes int) *testBackend {
mockBeaconInstances := make([]*MockBeaconInstance, numBeaconNodes)
beaconInstancesInterface := make([]IBeaconInstance, numBeaconNodes)
for i := 0; i < numBeaconNodes; i++ {
for i := range numBeaconNodes {
mockBeaconInstances[i] = NewMockBeaconInstance()
beaconInstancesInterface[i] = mockBeaconInstances[i]
}
Expand Down Expand Up @@ -72,7 +73,7 @@ func TestBeaconInstance(t *testing.T) {
]
}`)
_, err := w.Write(resp)
require.NoError(t, err)
assert.NoError(t, err)
})

vals, err := bc.GetStateValidators("1")
Expand All @@ -99,7 +100,7 @@ func TestGetSyncStatus(t *testing.T) {
}

backend := newTestBackend(t, 3)
for i := 0; i < len(backend.beaconInstances); i++ {
for i := range backend.beaconInstances {
backend.beaconInstances[i].MockSyncStatus = syncStatuses[i]
backend.beaconInstances[i].ResponseDelay = 10 * time.Millisecond * time.Duration(i)
}
Expand Down Expand Up @@ -234,7 +235,7 @@ func TestGetForkSchedule(t *testing.T) {
]
}`)
_, err := w.Write(resp)
require.NoError(t, err)
assert.NoError(t, err)
})

forkSchedule, err := bc.GetForkSchedule()
Expand Down
4 changes: 2 additions & 2 deletions beaconclient/multi_beacon_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (c *MultiBeaconClient) beaconInstancesByLastResponse() []IBeaconInstance {
func (c *MultiBeaconClient) beaconInstancesByLeastUsed() []IBeaconInstance {
beaconInstances := c.beaconInstancesByLastResponse()
instances := make([]IBeaconInstance, len(c.beaconInstances))
for i := 0; i < len(beaconInstances); i++ {
for i := range beaconInstances {
instances[i] = beaconInstances[len(beaconInstances)-i-1]
}
return instances
Expand Down Expand Up @@ -285,7 +285,7 @@ func (c *MultiBeaconClient) PublishBlock(block *common.VersionedSignedProposal)
}

var lastErrPublishResp publishResp
for i := 0; i < len(clients); i++ {
for range clients {
res := <-resChans
log = log.WithField("beacon", clients[res.index].GetPublishURI())
if res.err != nil {
Expand Down
14 changes: 7 additions & 7 deletions beaconclient/prod_beacon_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type PayloadAttributes struct {
}

func (c *ProdBeaconInstance) SubscribeToHeadEvents(slotC chan HeadEventData) {
eventsURL := fmt.Sprintf("%s/eth/v1/events?topics=head", c.beaconURI)
eventsURL := c.beaconURI + "/eth/v1/events?topics=head"
log := c.log.WithField("url", eventsURL)
log.Info("subscribing to head events")

Expand All @@ -109,7 +109,7 @@ func (c *ProdBeaconInstance) SubscribeToHeadEvents(slotC chan HeadEventData) {
}

func (c *ProdBeaconInstance) SubscribeToPayloadAttributesEvents(payloadAttributesC chan PayloadAttributesEvent) {
eventsURL := fmt.Sprintf("%s/eth/v1/events?topics=payload_attributes", c.beaconURI)
eventsURL := c.beaconURI + "/eth/v1/events?topics=payload_attributes"
log := c.log.WithField("url", eventsURL)
log.Info("subscribing to payload_attributes events")

Expand Down Expand Up @@ -235,7 +235,7 @@ type GetHeaderResponseMessage struct {

// GetHeader returns the latest header - https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockHeader
func (c *ProdBeaconInstance) GetHeader() (*GetHeaderResponse, error) {
uri := fmt.Sprintf("%s/eth/v1/beacon/headers/head", c.beaconURI)
uri := c.beaconURI + "/eth/v1/beacon/headers/head"
resp := new(GetHeaderResponse)
_, err := fetchBeacon(http.MethodGet, uri, nil, resp, nil, http.Header{}, false)
return resp, err
Expand All @@ -260,7 +260,7 @@ func (c *ProdBeaconInstance) GetPublishURI() string {
func (c *ProdBeaconInstance) PublishBlock(block *common.VersionedSignedProposal, broadcastMode BroadcastMode) (code int, err error) {
var uri string
if c.ffUseV1PublishBlockEndpoint {
uri = fmt.Sprintf("%s/eth/v1/beacon/blocks", c.beaconPublishURI)
uri = c.beaconPublishURI + "/eth/v1/beacon/blocks"
} else {
uri = fmt.Sprintf("%s/eth/v2/beacon/blocks?broadcast_validation=%s", c.beaconPublishURI, broadcastMode)
}
Expand Down Expand Up @@ -311,7 +311,7 @@ type GetGenesisResponseData struct {

// GetGenesis returns the genesis info - https://ethereum.github.io/beacon-APIs/#/Beacon/getGenesis
func (c *ProdBeaconInstance) GetGenesis() (*GetGenesisResponse, error) {
uri := fmt.Sprintf("%s/eth/v1/beacon/genesis", c.beaconURI)
uri := c.beaconURI + "/eth/v1/beacon/genesis"
resp := new(GetGenesisResponse)
_, err := fetchBeacon(http.MethodGet, uri, nil, resp, nil, http.Header{}, false)
return resp, err
Expand All @@ -328,7 +328,7 @@ type GetSpecResponse struct {

// GetSpec - https://ethereum.github.io/beacon-APIs/#/Config/getSpec
func (c *ProdBeaconInstance) GetSpec() (spec *GetSpecResponse, err error) {
uri := fmt.Sprintf("%s/eth/v1/config/spec", c.beaconURI)
uri := c.beaconURI + "/eth/v1/config/spec"
resp := new(GetSpecResponse)
_, err = fetchBeacon(http.MethodGet, uri, nil, resp, nil, http.Header{}, false)
return resp, err
Expand All @@ -344,7 +344,7 @@ type GetForkScheduleResponse struct {

// GetForkSchedule - https://ethereum.github.io/beacon-APIs/#/Config/getForkSchedule
func (c *ProdBeaconInstance) GetForkSchedule() (spec *GetForkScheduleResponse, err error) {
uri := fmt.Sprintf("%s/eth/v1/config/fork_schedule", c.beaconURI)
uri := c.beaconURI + "/eth/v1/config/fork_schedule"
resp := new(GetForkScheduleResponse)
_, err = fetchBeacon(http.MethodGet, uri, nil, resp, nil, http.Header{}, false)
return resp, err
Expand Down
2 changes: 1 addition & 1 deletion beaconclient/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func fetchBeacon(method, url string, payload []byte, dst any, httpClient *http.C
for k, v := range headers {
req.Header.Add(k, v[0])
}
req.Header.Set("accept", "application/json")
req.Header.Set("Accept", "application/json")

client := http.DefaultClient
if httpClient != nil {
Expand Down
9 changes: 4 additions & 5 deletions common/ssz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package common
import (
"bytes"
"encoding/json"
"fmt"
"os"
"testing"

Expand Down Expand Up @@ -36,7 +35,7 @@ func TestSSZBuilderSubmission(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
// json matches marshalled SSZ
jsonBytes := LoadGzippedBytes(t, fmt.Sprintf("%s.json.gz", testCase.filepath))
jsonBytes := LoadGzippedBytes(t, testCase.filepath+".json.gz")

submitBlockData := new(VersionedSubmitBlockRequest)
err := json.Unmarshal(jsonBytes, &submitBlockData)
Expand All @@ -46,7 +45,7 @@ func TestSSZBuilderSubmission(t *testing.T) {
marshalledSszBytes, err := submitBlockData.MarshalSSZ()
require.NoError(t, err)

sszBytes := LoadGzippedBytes(t, fmt.Sprintf("%s.ssz.gz", testCase.filepath))
sszBytes := LoadGzippedBytes(t, testCase.filepath+".ssz.gz")
require.Equal(t, sszBytes, marshalledSszBytes)

htr, err := submitBlockData.HashTreeRoot()
Expand Down Expand Up @@ -91,7 +90,7 @@ func TestSSZGetHeaderResponse(t *testing.T) {
// json -> marshalled ssz -> matches expected ssz
payload := new(builderSpec.VersionedSignedBuilderBid)

jsonBytes, err := os.ReadFile(fmt.Sprintf("%s.json", testCase.filepath))
jsonBytes, err := os.ReadFile(testCase.filepath + ".json")
require.NoError(t, err)

err = json.Unmarshal(jsonBytes, &payload)
Expand All @@ -109,7 +108,7 @@ func TestSSZGetHeaderResponse(t *testing.T) {
require.Fail(t, "unknown version")
}

sszExpectedBytes, err := os.ReadFile(fmt.Sprintf("%s.ssz", testCase.filepath))
sszExpectedBytes, err := os.ReadFile(testCase.filepath + ".ssz")
require.NoError(t, err)
require.Equal(t, sszExpectedBytes, ssz)

Expand Down
12 changes: 6 additions & 6 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ func (s *SubmitBlockRequestV2Optimistic) UnmarshalSSZ(buf []byte) error {
return err
}
s.Withdrawals = make([]*capella.Withdrawal, num)
for ii := 0; ii < num; ii++ {
for ii := range num {
if s.Withdrawals[ii] == nil {
s.Withdrawals[ii] = new(capella.Withdrawal)
}
Expand Down Expand Up @@ -615,7 +615,7 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e

// Offset (3) 'Transactions'
dst = ssz.WriteOffset(dst, offset)
for ii := 0; ii < len(s.Transactions); ii++ {
for ii := range s.Transactions {
offset += 4
offset += len(s.Transactions[ii])
}
Expand All @@ -635,12 +635,12 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e
}
{
offset = 4 * len(s.Transactions)
for ii := 0; ii < len(s.Transactions); ii++ {
for ii := range s.Transactions {
dst = ssz.WriteOffset(dst, offset)
offset += len(s.Transactions[ii])
}
}
for ii := 0; ii < len(s.Transactions); ii++ {
for ii := range s.Transactions {
if size := len(s.Transactions[ii]); size > 1073741824 {
err = ssz.ErrBytesLengthFn("SubmitBlockRequestV2Optimistic.Transactions[ii]", size, 1073741824)
return nil, err
Expand All @@ -653,7 +653,7 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e
err = ssz.ErrListTooBigFn("SubmitBlockRequestV2Optimistic.Withdrawals", size, 16)
return nil, err
}
for ii := 0; ii < len(s.Withdrawals); ii++ {
for ii := range s.Withdrawals {
if dst, err = s.Withdrawals[ii].MarshalSSZTo(dst); err != nil {
return nil, err
}
Expand All @@ -672,7 +672,7 @@ func (s *SubmitBlockRequestV2Optimistic) SizeSSZ() (size int) {
size += s.ExecutionPayloadHeader.SizeSSZ()

// Field (3) 'Transactions'
for ii := 0; ii < len(s.Transactions); ii++ {
for ii := range s.Transactions {
size += 4
size += len(s.Transactions[ii])
}
Expand Down
4 changes: 2 additions & 2 deletions common/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func compareV2RequestEquality(t *testing.T, src, targ *SubmitBlockRequestV2Optim
require.Equal(t, src.Message.String(), targ.Message.String())
require.Equal(t, src.ExecutionPayloadHeader.String(), targ.ExecutionPayloadHeader.String())
require.Equal(t, src.Signature, targ.Signature)
for i := 0; i < len(src.Transactions); i++ {
for i := range src.Transactions {
require.Equal(t, src.Transactions[i], targ.Transactions[i])
}
for i := 0; i < len(src.Withdrawals); i++ {
for i := range src.Withdrawals {
require.Equal(t, src.Withdrawals[i].String(), targ.Withdrawals[i].String())
}
}
Expand Down
4 changes: 2 additions & 2 deletions database/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package database

import (
"database/sql"
"fmt"
"errors"
"os"
"strconv"
"testing"
Expand Down Expand Up @@ -48,7 +48,7 @@ var (
RedisUpdate: 45,
Total: 46,
}
errFoo = fmt.Errorf("fake simulation error")
errFoo = errors.New("fake simulation error")
)

func createValidatorRegistration(pubKey string) ValidatorRegistrationEntry {
Expand Down
2 changes: 1 addition & 1 deletion datastore/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func Test_CheckAndSetLastSlotAndHashDeliveredForTesting(t *testing.T) {
syncWG := sync.WaitGroup{}

// Kick off goroutines, that will all try to set the same slot
for i := 0; i < n; i++ {
for range n {
syncWG.Add(1)
go func() {
errC <- _CheckAndSetLastSlotAndHashDeliveredForTesting(cache, waitC, &syncWG, newSlot, hash)
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/flashbots/mev-boost-relay

go 1.21
go 1.22

require (
github.com/NYTimes/gziphandler v1.1.1
Expand Down Expand Up @@ -32,7 +32,7 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.25.0
go.uber.org/atomic v1.11.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/text v0.14.0
golang.org/x/text v0.21.0
)

require (
Expand Down Expand Up @@ -80,7 +80,7 @@ require (
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/protobuf v1.33.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand Down Expand Up @@ -111,9 +111,9 @@ require (
github.com/yuin/gopher-lua v1.1.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.28.0 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading