Skip to content

Commit 7fe3c73

Browse files
authored
Update go to 1.24 (#577)
* Update go to 1.24 * Update goscale
1 parent b1cabf8 commit 7fe3c73

23 files changed

+602
-314
lines changed

.golangci.yml

Lines changed: 419 additions & 119 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23-alpine AS build
1+
FROM golang:1.24-alpine AS build
22
RUN apk add libc6-compat gcc musl-dev make
33
WORKDIR /build/
44

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ VERSION ?= $(shell git describe --tags)
88
# Flags appended to `go test` command in `make test`
99
TEST_FLAGS ?=
1010

11-
GOLANGCI_LINT_VERSION := v1.61.0
11+
GOLANGCI_LINT_VERSION := v1.64.6
1212
GOTESTSUM_VERSION := v1.12.0
13-
GOSCALE_VERSION := v1.2.0
13+
GOSCALE_VERSION := v1.3.0
1414
MOCKGEN_VERSION := v0.5.0
1515

1616
BUF_VERSION := 1.30.0

db/migrate_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package db_test
22

33
import (
4-
"context"
54
"os"
65
"path/filepath"
76
"testing"
@@ -31,7 +30,7 @@ func TestMigrateDb(t *testing.T) {
3130

3231
// migrate the database
3332
newDbPath := t.TempDir()
34-
require.NoError(t, db.Migrate(context.Background(), newDbPath, oldDbPath))
33+
require.NoError(t, db.Migrate(t.Context(), newDbPath, oldDbPath))
3534

3635
// open the new database and check that the data was copied
3736
newDb, err := leveldb.OpenFile(newDbPath, nil)
@@ -61,7 +60,7 @@ func TestSkipMigrateInPlace(t *testing.T) {
6160
database.Close()
6261

6362
// migrate the database
64-
require.NoError(t, db.Migrate(context.Background(), dbPath, dbPath))
63+
require.NoError(t, db.Migrate(t.Context(), dbPath, dbPath))
6564

6665
// open the new database and check that the data was copied
6766
database, err = leveldb.OpenFile(dbPath, nil)
@@ -76,7 +75,7 @@ func TestSkipMigrateInPlace(t *testing.T) {
7675
}
7776

7877
func TestSkipMigrateSrcDoesntExist(t *testing.T) {
79-
require.NoError(t, db.Migrate(context.Background(), t.TempDir(), filepath.Join(t.TempDir(), "i-dont-exist")))
78+
require.NoError(t, db.Migrate(t.Context(), t.TempDir(), filepath.Join(t.TempDir(), "i-dont-exist")))
8079
}
8180

8281
func TestDontMigrateIfTargetExists(t *testing.T) {
@@ -92,7 +91,7 @@ func TestDontMigrateIfTargetExists(t *testing.T) {
9291
targetDb.Close()
9392

9493
// migrate the database
95-
err = db.Migrate(context.Background(), targetPath, sourcePath)
94+
err = db.Migrate(t.Context(), targetPath, sourcePath)
9695
require.Error(t, err)
9796
require.ErrorContains(t, err, "already exists")
9897
}

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/spacemeshos/poet
22

3-
go 1.23.4
3+
go 1.24.1
44

55
require (
66
github.com/c0mm4nd/go-ripemd v0.0.0-20200326052756-bd1759ad7d10
@@ -12,15 +12,15 @@ require (
1212
github.com/natefinch/atomic v1.0.1
1313
github.com/nullstyle/go-xdr v0.0.0-20180726165426-f4c839f75077
1414
github.com/prometheus/client_golang v1.21.1
15-
github.com/spacemeshos/go-scale v1.2.1
15+
github.com/spacemeshos/go-scale v1.3.0
1616
github.com/spacemeshos/merkle-tree v0.2.6
1717
github.com/spacemeshos/sha256-simd v0.1.0
1818
github.com/stretchr/testify v1.10.0
1919
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
2020
github.com/zeebo/blake3 v0.2.4
2121
go.uber.org/mock v0.5.0
2222
go.uber.org/zap v1.27.0
23-
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d
23+
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394
2424
golang.org/x/sync v0.12.0
2525
golang.org/x/sys v0.31.0
2626
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
121121
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
122122
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
123123
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
124-
github.com/spacemeshos/go-scale v1.2.1 h1:+IJ6KmFl9tF1Om8B1NvEwilGpBG1ebr4Se8A0Fe4puE=
125-
github.com/spacemeshos/go-scale v1.2.1/go.mod h1:fpO6tCoKdUmvF6o9zkUtq2erSOH5t4ik02Zwdm31qOs=
124+
github.com/spacemeshos/go-scale v1.3.0 h1:J3rbksTxInnM86T8GnMGqD3iZOQJja7YIrfjMsQ8tUk=
125+
github.com/spacemeshos/go-scale v1.3.0/go.mod h1:cYK6xEozIptppvOybr3naxr9hrSVvXG/LInC/DrJofA=
126126
github.com/spacemeshos/merkle-tree v0.2.6 h1:PJ4LBx0vBbYVIHwApyjLy/yqUGEK35ggGTo05oiPhwg=
127127
github.com/spacemeshos/merkle-tree v0.2.6/go.mod h1:lxMuC/C2qhN6wdH6iSXW0HM8FS6fnKnyLWjCAKsCtr8=
128128
github.com/spacemeshos/sha256-simd v0.1.0 h1:G7Mfu5RYdQiuE+wu4ZyJ7I0TI74uqLhFnKblEnSpjYI=
@@ -174,8 +174,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
174174
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
175175
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
176176
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
177-
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d h1:0olWaB5pg3+oychR51GUVCEsGkeCU/2JxjBgIo4f3M0=
178-
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
177+
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
178+
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
179179
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
180180
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
181181
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=

migrations/00_dbdir_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package migrations
22

33
import (
4-
"context"
54
"path/filepath"
65
"strconv"
76
"testing"
@@ -28,7 +27,7 @@ func TestMigrateRoundsDb(t *testing.T) {
2827
oldDb.Close()
2928
}
3029
// Act
31-
require.NoError(t, migrateRoundsDbs(context.Background(), &cfg))
30+
require.NoError(t, migrateRoundsDbs(t.Context(), &cfg))
3231

3332
// Verify
3433
for i := 0; i < 5; i++ {
@@ -54,5 +53,5 @@ func TestMigrateRoundsDb_NothingToMigrate(t *testing.T) {
5453
DataDir: t.TempDir(),
5554
DbDir: t.TempDir(),
5655
}
57-
require.NoError(t, migrateRoundsDbs(context.Background(), &cfg))
56+
require.NoError(t, migrateRoundsDbs(t.Context(), &cfg))
5857
}

migrations/migrations_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package migrations_test
22

33
import (
4-
"context"
54
"testing"
65

76
"github.com/stretchr/testify/require"
@@ -15,5 +14,5 @@ func TestMigrate(t *testing.T) {
1514
cfg.PoetDir = t.TempDir()
1615
cfg.DataDir = t.TempDir()
1716
cfg.DbDir = t.TempDir()
18-
require.NoError(t, migrations.Migrate(context.Background(), cfg))
17+
require.NoError(t, migrations.Migrate(t.Context(), cfg))
1918
}

poetcore_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"context"
54
"crypto/rand"
65
"fmt"
76
"testing"
@@ -27,7 +26,7 @@ func BenchmarkProverAndVerifierBig(b *testing.B) {
2726
b.Log("Computing dag...")
2827
t1 := time.Now()
2928
numLeaves, merkleProof, err := prover.GenerateProofWithoutPersistency(
30-
context.Background(),
29+
b.Context(),
3130
prover.TreeConfig{Datadir: b.TempDir()},
3231
hash.GenLabelHashFunc(challenge),
3332
hash.GenMerkleHashFunc(challenge),
@@ -59,7 +58,7 @@ func TestNip(t *testing.T) {
5958
securityParam := shared.T
6059

6160
numLeaves, merkleProof, err := prover.GenerateProofWithoutPersistency(
62-
context.Background(),
61+
t.Context(),
6362
prover.TreeConfig{Datadir: t.TempDir()},
6463
hash.GenLabelHashFunc(challenge),
6564
hash.GenMerkleHashFunc(challenge),
@@ -89,7 +88,7 @@ func BenchmarkProofEx(t *testing.B) {
8988
securityParam := shared.T
9089

9190
numLeaves, merkleProof, err := prover.GenerateProofWithoutPersistency(
92-
context.Background(),
91+
t.Context(),
9392
prover.TreeConfig{Datadir: t.TempDir()},
9493
hash.GenLabelHashFunc(challenge),
9594
hash.GenMerkleHashFunc(challenge),

prover/prover_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestGetProof(t *testing.T) {
2020

2121
challenge := []byte("challenge this")
2222
leafs, merkleProof, err := GenerateProofWithoutPersistency(
23-
context.Background(),
23+
t.Context(),
2424
TreeConfig{Datadir: t.TempDir()},
2525
hash.GenLabelHashFunc(challenge),
2626
hash.GenMerkleHashFunc(challenge),
@@ -41,7 +41,7 @@ func BenchmarkGetProof(b *testing.B) {
4141
securityParam := shared.T
4242
duration := time.Second * 30
4343
leafs, _, err := GenerateProofWithoutPersistency(
44-
context.Background(),
44+
b.Context(),
4545
TreeConfig{Datadir: b.TempDir()},
4646
hash.GenLabelHashFunc(challenge),
4747
hash.GenMerkleHashFunc(challenge),
@@ -62,7 +62,7 @@ func TestRecoverParkedNodes(t *testing.T) {
6262
challenge := []byte("challenge this")
6363
leavesCounter := prometheus.NewCounter(prometheus.CounterOpts{})
6464

65-
ctx, cancel := context.WithDeadline(context.Background(), time.Now())
65+
ctx, cancel := context.WithDeadline(t.Context(), time.Now())
6666
defer cancel()
6767

6868
persist := func(ctx context.Context, treeCache *cache.Writer, _ uint64) error {
@@ -87,7 +87,7 @@ func TestRecoverParkedNodes(t *testing.T) {
8787

8888
// recover without parked nodes
8989
leafs, merkleProof, err := GenerateProofRecovery(
90-
context.Background(),
90+
t.Context(),
9191
leavesCounter,
9292
treeCfg,
9393
hash.GenLabelHashFunc(challenge),
@@ -131,7 +131,7 @@ func TestTreeRecovery(t *testing.T) {
131131
treeCache.Close()
132132

133133
// recover the tree
134-
treeCache, recoveredTree, err := makeRecoveryProofTree(context.Background(), treeCfg, merklehashFuncFunc, leafs)
134+
treeCache, recoveredTree, err := makeRecoveryProofTree(t.Context(), treeCfg, merklehashFuncFunc, leafs)
135135
r.NoError(err)
136136
defer treeCache.Close()
137137
// compare the trees by examining their roots and parked nodes

0 commit comments

Comments
 (0)