Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.

Commit f8269cc

Browse files
build: bump go and golangci (#241)
AvalancheGo recently bumped both of these versions -- we're behind on Go and the version of golangci we use is ancient -- not even V2. This PR bumps both of those and fixes the below linter error: - **QF1005**: Replaced `math.Pow(math.E, N)` -> `math.Exp(N)` --------- Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> Co-authored-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
1 parent 9b8ba9c commit f8269cc

9 files changed

Lines changed: 85 additions & 94 deletions

File tree

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
with:
3434
go-version-file: "go.mod"
3535
- name: golangci-lint
36-
uses: golangci/golangci-lint-action@v6
36+
uses: golangci/golangci-lint-action@v7
3737
with:
38-
version: v1.64.8
38+
version: v2.9.0
3939

4040
yamllint:
4141
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 62 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
# This file configures github.com/golangci/golangci-lint.
22

3+
version: "2"
4+
35
run:
4-
timeout: 20m
56
tests: true
67

8+
formatters:
9+
enable:
10+
- gci
11+
- gofmt
12+
- goimports
13+
settings:
14+
gci:
15+
custom-order: true
16+
sections:
17+
- standard
18+
- default
19+
- prefix(github.com/ava-labs/strevm)
20+
# The rest of these break developer expections, in increasing order of
21+
# divergence, so are at the end to increase the chance of being seen.
22+
- dot
23+
- blank
24+
exclusions:
25+
generated: lax
26+
727
linters:
28+
default: none
829
enable:
930
# Every available linter at the time of writing was considered (quickly) and
1031
# inclusion was liberal. Linters are good at detecting code smells, but if
@@ -13,16 +34,14 @@ linters:
1334
- containedctx
1435
- errcheck
1536
- forcetypeassert
16-
- gci
1737
- gocheckcompilerdirectives
18-
- gofmt
1938
- goheader
20-
- goimports
2139
- gomodguard
40+
- gocritic
41+
- godoclint
2242
- gosec
2343
- govet
2444
- ineffassign
25-
# TODO(arr4n): investigate ireturn
2645
- misspell
2746
- nakedret
2847
- nestif
@@ -38,68 +57,43 @@ linters:
3857
- thelper
3958
- tparallel
4059
- unconvert
41-
- usestdlibvars
4260
- unused
61+
- usestdlibvars
4362
- whitespace
44-
45-
linters-settings:
46-
gci:
47-
custom-order: true
48-
sections:
49-
- standard
50-
- default
51-
- prefix(github.com/ava-labs/strevm)
52-
# The rest of these break developer expections, in increasing order of
53-
# divergence, so are at the end to increase the chance of being seen.
54-
- dot
55-
- blank
56-
goheader:
57-
template-path: .license-header
58-
59-
gomodguard:
60-
blocked:
61-
modules:
62-
- github.com/ethereum/go-ethereum:
63-
reason: "Use ava-labs/libevm instead"
64-
- github.com/ava-labs/coreth:
65-
reason: "Avoid dependency loop"
66-
- github.com/ava-labs/subnet-evm:
67-
reason: "Avoid dependency loop"
68-
revive:
69-
rules:
70-
- name: unused-parameter
71-
# Method parameters may be required by interfaces and forcing them to be
72-
# named _ is of questionable benefit.
73-
disabled: true
74-
- name: exported
75-
severity: error
76-
disabled: false
77-
exclude: [""]
78-
arguments:
79-
- "sayRepetitiveInsteadOfStutters"
80-
- name: package-comments
81-
severity: warning
82-
disabled: false
83-
84-
testifylint:
85-
enable-all: true
86-
disable:
87-
- require-error # Blanket usage of require over assert is an anti-pattern
88-
89-
issues:
90-
include:
91-
# Many of the default exclusions are because, verbatim "Annoying issue",
92-
# which defeats the point of a linter.
93-
- EXC0002
94-
- EXC0004
95-
- EXC0005
96-
- EXC0006
97-
- EXC0007
98-
- EXC0008
99-
- EXC0009
100-
- EXC0010
101-
- EXC0011
102-
- EXC0012
103-
- EXC0013
104-
- EXC0014
105-
- EXC0015
63+
settings:
64+
goheader:
65+
template-path: .license-header
66+
gomodguard:
67+
blocked:
68+
modules:
69+
- github.com/ethereum/go-ethereum:
70+
reason: "Use ava-labs/libevm instead"
71+
- github.com/ava-labs/avalanchego/graft/coreth:
72+
reason: "Avoid dependency loop"
73+
- github.com/ava-labs/avalanchego/graft/evm:
74+
reason: "Avoid dependency loop"
75+
- github.com/ava-labs/avalanchego/graft/subnet-evm:
76+
reason: "Avoid dependency loop"
77+
staticcheck:
78+
checks:
79+
- "all"
80+
- "-QF1008" # Explicit embedded field selectors improve readability.
81+
revive:
82+
rules:
83+
- name: unused-parameter
84+
# Method parameters may be required by interfaces and forcing them to be
85+
# named _ is of questionable benefit.
86+
disabled: true
87+
- name: exported
88+
severity: error
89+
disabled: false
90+
exclude: [""]
91+
arguments:
92+
- "sayRepetitiveInsteadOfStutters"
93+
- name: package-comments
94+
severity: warning
95+
disabled: false
96+
testifylint:
97+
enable-all: true
98+
disable:
99+
- require-error # Blanket usage of require over assert is an anti-pattern

blocks/blockstest/chain.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// Copyright (C) 2025-2026, Ava Labs, Inc. All rights reserved.
22
// See the file LICENSE for licensing terms.
33

4-
// Package blockstest provides test helpers for constructing [Streaming
5-
// Asynchronous Execution] (SAE) blocks.
6-
//
7-
// [Streaming Asynchronous Execution]: https://github.com/avalanche-foundation/ACPs/tree/main/ACPs/194-streaming-asynchronous-execution
84
package blockstest
95

106
import (

blocks/time.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func PreciseTime(hooks hook.Points, hdr *types.Header) time.Time {
2121
return preciseTime(hdr, hooks.SubSecondBlockTime(hdr))
2222
}
2323

24-
func preciseTime(hdr *types.Header, subSec time.Duration) time.Time {
24+
func preciseTime(hdr *types.Header, subSec time.Duration) time.Time { //nolint:staticcheck // subSec intentionally communicates that the value is < time.Second
2525
return time.Unix(
2626
int64(hdr.Time), //nolint:gosec // Won't overflow for a few millennia
2727
subSec.Nanoseconds(),

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ava-labs/strevm
22

3-
go 1.24.12
3+
go 1.25.7
44

55
tool github.com/go-task/task/v3/cmd/task
66

sae/rpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ type ethAPIBackend struct {
324324

325325
var _ APIBackend = (*ethAPIBackend)(nil)
326326

327-
func (b *ethAPIBackend) ChainDb() ethdb.Database {
327+
func (b *ethAPIBackend) ChainDb() ethdb.Database { //nolint:staticcheck // this name required by ethapi.Backend interface
328328
return b.vm.db
329329
}
330330

sae/rpc_receipts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestImmediateReceipts(t *testing.T) {
2929
}
3030
notBlocked := txs[0]
3131

32-
b := sut.runConsensusLoop(t, txs[:]...)
32+
b := sut.runConsensusLoop(t, txs...)
3333
sut.testRPC(ctx, t, rpcTest{
3434
method: "eth_getTransactionReceipt",
3535
args: []any{notBlocked.Hash()},

sae/rpc_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,11 +1127,11 @@ func TestDebugGetRawTransaction(t *testing.T) {
11271127
}...)
11281128
}
11291129

1130-
func (sut *SUT) testGetByHash(ctx context.Context, t *testing.T, want *types.Block) {
1130+
func (s *SUT) testGetByHash(ctx context.Context, t *testing.T, want *types.Block) {
11311131
t.Helper()
11321132

1133-
testRPCGetter(ctx, t, "eth_getBlockByHash", sut.BlockByHash, want.Hash(), want)
1134-
sut.testRPC(ctx, t, []rpcTest{
1133+
testRPCGetter(ctx, t, "eth_getBlockByHash", s.BlockByHash, want.Hash(), want)
1134+
s.testRPC(ctx, t, []rpcTest{
11351135
{
11361136
method: "eth_getBlockByHash",
11371137
args: []any{want.Hash(), false},
@@ -1159,7 +1159,7 @@ func (sut *SUT) testGetByHash(ctx context.Context, t *testing.T, want *types.Blo
11591159
marshaled, err := wantTx.MarshalBinary()
11601160
require.NoErrorf(t, err, "%T.MarshalBinary()", wantTx)
11611161

1162-
sut.testRPC(ctx, t, []rpcTest{
1162+
s.testRPC(ctx, t, []rpcTest{
11631163
{
11641164
method: "eth_getTransactionByHash",
11651165
args: []any{wantTx.Hash()},
@@ -1184,7 +1184,7 @@ func (sut *SUT) testGetByHash(ctx context.Context, t *testing.T, want *types.Blo
11841184
}
11851185

11861186
outOfBoundsIndex := hexutil.Uint(len(want.Transactions()) + 1) //nolint:gosec // Known to not overflow
1187-
sut.testRPC(ctx, t, []rpcTest{
1187+
s.testRPC(ctx, t, []rpcTest{
11881188
{
11891189
method: "eth_getTransactionByBlockHashAndIndex",
11901190
args: []any{want.Hash(), outOfBoundsIndex},
@@ -1198,10 +1198,10 @@ func (sut *SUT) testGetByHash(ctx context.Context, t *testing.T, want *types.Blo
11981198
}...)
11991199
}
12001200

1201-
func (sut *SUT) testGetByUnknownHash(ctx context.Context, t *testing.T) {
1201+
func (s *SUT) testGetByUnknownHash(ctx context.Context, t *testing.T) {
12021202
t.Helper()
12031203

1204-
sut.testRPC(ctx, t, []rpcTest{
1204+
s.testRPC(ctx, t, []rpcTest{
12051205
{
12061206
method: "eth_getBlockByHash",
12071207
args: []any{common.Hash{}, true},
@@ -1243,11 +1243,11 @@ func (sut *SUT) testGetByUnknownHash(ctx context.Context, t *testing.T) {
12431243
// testGetByNumber accepts a block-number override to allow testing via named
12441244
// blocks, e.g. [rpc.LatestBlockNumber], not only via the specific number
12451245
// carried by the [types.Block].
1246-
func (sut *SUT) testGetByNumber(ctx context.Context, t *testing.T, want *types.Block, n rpc.BlockNumber) {
1246+
func (s *SUT) testGetByNumber(ctx context.Context, t *testing.T, want *types.Block, n rpc.BlockNumber) {
12471247
t.Helper()
1248-
testRPCGetter(ctx, t, "eth_getBlockByNumber", sut.BlockByNumber, big.NewInt(n.Int64()), want)
1248+
testRPCGetter(ctx, t, "eth_getBlockByNumber", s.BlockByNumber, big.NewInt(n.Int64()), want)
12491249

1250-
sut.testRPC(ctx, t, []rpcTest{
1250+
s.testRPC(ctx, t, []rpcTest{
12511251
{
12521252
method: "eth_getBlockByNumber",
12531253
args: []any{n, false},
@@ -1275,7 +1275,7 @@ func (sut *SUT) testGetByNumber(ctx context.Context, t *testing.T, want *types.B
12751275
marshaled, err := wantTx.MarshalBinary()
12761276
require.NoErrorf(t, err, "%T.MarshalBinary()", wantTx)
12771277

1278-
sut.testRPC(ctx, t, []rpcTest{
1278+
s.testRPC(ctx, t, []rpcTest{
12791279
{
12801280
method: "eth_getTransactionByBlockNumberAndIndex",
12811281
args: []any{n, txIdx},
@@ -1290,7 +1290,7 @@ func (sut *SUT) testGetByNumber(ctx context.Context, t *testing.T, want *types.B
12901290
}
12911291

12921292
outOfBoundsIndex := hexutil.Uint(len(want.Transactions()) + 1) //nolint:gosec // Known to not overflow
1293-
sut.testRPC(ctx, t, []rpcTest{
1293+
s.testRPC(ctx, t, []rpcTest{
12941294
{
12951295
method: "eth_getTransactionByBlockNumberAndIndex",
12961296
args: []any{n, outOfBoundsIndex},
@@ -1304,11 +1304,11 @@ func (sut *SUT) testGetByNumber(ctx context.Context, t *testing.T, want *types.B
13041304
}...)
13051305
}
13061306

1307-
func (sut *SUT) testGetByUnknownNumber(ctx context.Context, t *testing.T) {
1307+
func (s *SUT) testGetByUnknownNumber(ctx context.Context, t *testing.T) {
13081308
t.Helper()
13091309

13101310
const n rpc.BlockNumber = math.MaxInt64
1311-
sut.testRPC(ctx, t, []rpcTest{
1311+
s.testRPC(ctx, t, []rpcTest{
13121312
{
13131313
method: "eth_getBlockByNumber",
13141314
args: []any{n, true},

saexec/saexec_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ func TestGasAccounting(t *testing.T) {
511511
wantExecutedBy: at(21, 30*gastime.TargetToExcessScaling, 10*gasPerTx),
512512
wantExcessAfter: 3 * ((5 * gasPerTx /*T*/) * gastime.TargetToExcessScaling /* == K */),
513513
// Excess is now 3·K so the price is e^3
514-
wantPriceAfter: gas.Price(math.Floor(math.Pow(math.E, 3 /* <----- NB */))),
514+
wantPriceAfter: gas.Price(math.Floor(math.Exp(3 /* <----- NB */))),
515515
},
516516
{
517517
blockTime: 22, // no fast-forward
@@ -520,7 +520,7 @@ func TestGasAccounting(t *testing.T) {
520520
targetAfter: 5 * gasPerTx,
521521
wantExecutedBy: at(21, 40*gastime.TargetToExcessScaling, 10*gasPerTx),
522522
wantExcessAfter: 4 * ((5 * gasPerTx /*T*/) * gastime.TargetToExcessScaling /* == K */),
523-
wantPriceAfter: gas.Price(math.Floor(math.Pow(math.E, 4 /* <----- NB */))),
523+
wantPriceAfter: gas.Price(math.Floor(math.Exp(4 /* <----- NB */))),
524524
},
525525
}
526526

@@ -652,6 +652,7 @@ func FuzzOpCodes(f *testing.F) {
652652

653653
// Ensure that the SUT [logging.Logger] remains of this type so >=WARN
654654
// logs become failures.
655+
//nolint:staticcheck
655656
var logger *saetest.TBLogger = sut.logger
656657
// Errors in execution (i.e. reverts) are fine, but we don't want them
657658
// bubbling up any further.

0 commit comments

Comments
 (0)