Skip to content

Commit 2771d9f

Browse files
Bump golang.org/x/crypto from 0.20.0 to 0.31.0 (#663)
* Bump golang.org/x/crypto from 0.20.0 to 0.31.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.20.0 to 0.31.0. - [Commits](golang/crypto@v0.20.0...v0.31.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> * linting --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: avalonche <[email protected]>
1 parent 1d4b461 commit 2771d9f

File tree

16 files changed

+60
-68
lines changed

16 files changed

+60
-68
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Go
1515
uses: actions/setup-go@v3
1616
with:
17-
go-version: ^1.21
17+
go-version: ^1.22
1818
id: go
1919

2020
- name: Check out code into the Go module directory
@@ -40,7 +40,7 @@ jobs:
4040
- name: Set up Go
4141
uses: actions/setup-go@v3
4242
with:
43-
go-version: ^1.21
43+
go-version: ^1.22
4444
id: go
4545

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

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

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

5858
- name: Lint
5959
run: make lint

.golangci.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,19 @@ linters:
1414
- gomnd
1515
- lll
1616
- musttag
17+
- mnd
1718
- nestif
1819
- nilnil
1920
- nlreturn
2021
- noctx
2122
- nonamedreturns
22-
- nosnakecase
2323
- paralleltest
2424
- revive
2525
- testpackage
2626
- unparam
2727
- varnamelen
2828
- wrapcheck
2929
- wsl
30-
- deadcode
31-
- varcheck
3230
- interfacebloat
3331
- exhaustruct
3432

@@ -38,18 +36,12 @@ linters:
3836
- contextcheck
3937
- rowserrcheck
4038
- sqlclosecheck
41-
- structcheck
4239
- wastedassign
4340

4441
#
4542
# Disabled because deprecated:
4643
#
47-
- exhaustivestruct
48-
- golint
49-
- ifshort
50-
- interfacer
51-
- maligned
52-
- scopelint
44+
- execinquery
5345

5446
linters-settings:
5547
#

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM golang:1.21 as builder
2+
FROM golang:1.22 as builder
33
ARG VERSION
44
WORKDIR /build
55

beaconclient/beacon_client_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/flashbots/mev-boost-relay/common"
1111
"github.com/gorilla/mux"
12+
"github.com/stretchr/testify/assert"
1213
"github.com/stretchr/testify/require"
1314
)
1415

@@ -33,7 +34,7 @@ type testBackend struct {
3334
func newTestBackend(t require.TestingT, numBeaconNodes int) *testBackend {
3435
mockBeaconInstances := make([]*MockBeaconInstance, numBeaconNodes)
3536
beaconInstancesInterface := make([]IBeaconInstance, numBeaconNodes)
36-
for i := 0; i < numBeaconNodes; i++ {
37+
for i := range numBeaconNodes {
3738
mockBeaconInstances[i] = NewMockBeaconInstance()
3839
beaconInstancesInterface[i] = mockBeaconInstances[i]
3940
}
@@ -72,7 +73,7 @@ func TestBeaconInstance(t *testing.T) {
7273
]
7374
}`)
7475
_, err := w.Write(resp)
75-
require.NoError(t, err)
76+
assert.NoError(t, err)
7677
})
7778

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

101102
backend := newTestBackend(t, 3)
102-
for i := 0; i < len(backend.beaconInstances); i++ {
103+
for i := range backend.beaconInstances {
103104
backend.beaconInstances[i].MockSyncStatus = syncStatuses[i]
104105
backend.beaconInstances[i].ResponseDelay = 10 * time.Millisecond * time.Duration(i)
105106
}
@@ -234,7 +235,7 @@ func TestGetForkSchedule(t *testing.T) {
234235
]
235236
}`)
236237
_, err := w.Write(resp)
237-
require.NoError(t, err)
238+
assert.NoError(t, err)
238239
})
239240

240241
forkSchedule, err := bc.GetForkSchedule()

beaconclient/multi_beacon_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (c *MultiBeaconClient) beaconInstancesByLastResponse() []IBeaconInstance {
237237
func (c *MultiBeaconClient) beaconInstancesByLeastUsed() []IBeaconInstance {
238238
beaconInstances := c.beaconInstancesByLastResponse()
239239
instances := make([]IBeaconInstance, len(c.beaconInstances))
240-
for i := 0; i < len(beaconInstances); i++ {
240+
for i := range beaconInstances {
241241
instances[i] = beaconInstances[len(beaconInstances)-i-1]
242242
}
243243
return instances
@@ -285,7 +285,7 @@ func (c *MultiBeaconClient) PublishBlock(block *common.VersionedSignedProposal)
285285
}
286286

287287
var lastErrPublishResp publishResp
288-
for i := 0; i < len(clients); i++ {
288+
for range clients {
289289
res := <-resChans
290290
log = log.WithField("beacon", clients[res.index].GetPublishURI())
291291
if res.err != nil {

beaconclient/prod_beacon_instance.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type PayloadAttributes struct {
8383
}
8484

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

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

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

@@ -235,7 +235,7 @@ type GetHeaderResponseMessage struct {
235235

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

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

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

345345
// GetForkSchedule - https://ethereum.github.io/beacon-APIs/#/Config/getForkSchedule
346346
func (c *ProdBeaconInstance) GetForkSchedule() (spec *GetForkScheduleResponse, err error) {
347-
uri := fmt.Sprintf("%s/eth/v1/config/fork_schedule", c.beaconURI)
347+
uri := c.beaconURI + "/eth/v1/config/fork_schedule"
348348
resp := new(GetForkScheduleResponse)
349349
_, err = fetchBeacon(http.MethodGet, uri, nil, resp, nil, http.Header{}, false)
350350
return resp, err

beaconclient/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func fetchBeacon(method, url string, payload []byte, dst any, httpClient *http.C
5252
for k, v := range headers {
5353
req.Header.Add(k, v[0])
5454
}
55-
req.Header.Set("accept", "application/json")
55+
req.Header.Set("Accept", "application/json")
5656

5757
client := http.DefaultClient
5858
if httpClient != nil {

common/ssz_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package common
33
import (
44
"bytes"
55
"encoding/json"
6-
"fmt"
76
"os"
87
"testing"
98

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

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

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

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

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

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

112-
sszExpectedBytes, err := os.ReadFile(fmt.Sprintf("%s.ssz", testCase.filepath))
111+
sszExpectedBytes, err := os.ReadFile(testCase.filepath + ".ssz")
113112
require.NoError(t, err)
114113
require.Equal(t, sszExpectedBytes, ssz)
115114

common/types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ func (s *SubmitBlockRequestV2Optimistic) UnmarshalSSZ(buf []byte) error {
529529
return err
530530
}
531531
s.Withdrawals = make([]*capella.Withdrawal, num)
532-
for ii := 0; ii < num; ii++ {
532+
for ii := range num {
533533
if s.Withdrawals[ii] == nil {
534534
s.Withdrawals[ii] = new(capella.Withdrawal)
535535
}
@@ -615,7 +615,7 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e
615615

616616
// Offset (3) 'Transactions'
617617
dst = ssz.WriteOffset(dst, offset)
618-
for ii := 0; ii < len(s.Transactions); ii++ {
618+
for ii := range s.Transactions {
619619
offset += 4
620620
offset += len(s.Transactions[ii])
621621
}
@@ -635,12 +635,12 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e
635635
}
636636
{
637637
offset = 4 * len(s.Transactions)
638-
for ii := 0; ii < len(s.Transactions); ii++ {
638+
for ii := range s.Transactions {
639639
dst = ssz.WriteOffset(dst, offset)
640640
offset += len(s.Transactions[ii])
641641
}
642642
}
643-
for ii := 0; ii < len(s.Transactions); ii++ {
643+
for ii := range s.Transactions {
644644
if size := len(s.Transactions[ii]); size > 1073741824 {
645645
err = ssz.ErrBytesLengthFn("SubmitBlockRequestV2Optimistic.Transactions[ii]", size, 1073741824)
646646
return nil, err
@@ -653,7 +653,7 @@ func (s *SubmitBlockRequestV2Optimistic) MarshalSSZTo(buf []byte) (dst []byte, e
653653
err = ssz.ErrListTooBigFn("SubmitBlockRequestV2Optimistic.Withdrawals", size, 16)
654654
return nil, err
655655
}
656-
for ii := 0; ii < len(s.Withdrawals); ii++ {
656+
for ii := range s.Withdrawals {
657657
if dst, err = s.Withdrawals[ii].MarshalSSZTo(dst); err != nil {
658658
return nil, err
659659
}
@@ -672,7 +672,7 @@ func (s *SubmitBlockRequestV2Optimistic) SizeSSZ() (size int) {
672672
size += s.ExecutionPayloadHeader.SizeSSZ()
673673

674674
// Field (3) 'Transactions'
675-
for ii := 0; ii < len(s.Transactions); ii++ {
675+
for ii := range s.Transactions {
676676
size += 4
677677
size += len(s.Transactions[ii])
678678
}

common/types_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ func compareV2RequestEquality(t *testing.T, src, targ *SubmitBlockRequestV2Optim
9595
require.Equal(t, src.Message.String(), targ.Message.String())
9696
require.Equal(t, src.ExecutionPayloadHeader.String(), targ.ExecutionPayloadHeader.String())
9797
require.Equal(t, src.Signature, targ.Signature)
98-
for i := 0; i < len(src.Transactions); i++ {
98+
for i := range src.Transactions {
9999
require.Equal(t, src.Transactions[i], targ.Transactions[i])
100100
}
101-
for i := 0; i < len(src.Withdrawals); i++ {
101+
for i := range src.Withdrawals {
102102
require.Equal(t, src.Withdrawals[i].String(), targ.Withdrawals[i].String())
103103
}
104104
}

0 commit comments

Comments
 (0)