Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20' # The Go version to download (if necessary) and use.
go-version: '1.24' # The Go version to download (if necessary) and use.
- name: run benchmarks
run: make bench
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21" # The Go version to download (if necessary) and use.
go-version: "1.24" # The Go version to download (if necessary) and use.

# Some tests, notably TestRandomOperations, are extremely slow in CI
# with the race detector enabled, so we use -short when -race is
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.20.0"
go-version: "1.24"
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.55.2
version: v1.57.0
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linters:
- bodyclose
- dogsled
- errcheck
- exportloopref
- copyloopvar
- goconst
- gocritic
- gofumpt
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ format:

# look into .golangci.yml for enabling / disabling linters
golangci_lint_cmd=golangci-lint
golangci_version=v1.55.2
golangci_version=v1.57.0

lint:
@echo "--> Running linter"
Expand Down
1 change: 0 additions & 1 deletion benchmarks/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ func runBenchmarks(b *testing.B, benchmarks []benchmark) {
)
if bb.dbType != "nodb" {
d, err = dbm.NewDB("test", bb.dbType, dirName)

if err != nil {
if strings.Contains(err.Error(), "unknown db_backend") {
// As an exception to run benchmarks: if the error is about cleveldb, or rocksdb,
Expand Down
4 changes: 3 additions & 1 deletion cmd/legacydump/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cosmos/iavl/cmd/legacydump

go 1.20
go 1.24

require (
github.com/cometbft/cometbft-db v0.7.0
Expand Down Expand Up @@ -29,3 +29,5 @@ require (
golang.org/x/sys v0.13.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

toolchain go1.24.4
Binary file modified cmd/legacydump/legacydump
Binary file not shown.
Binary file added cmd/legacydump/legacydump.macos
Binary file not shown.
5 changes: 5 additions & 0 deletions db/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
dbm.DB
}

var _ DB = (*Wrapper)(nil)

Check failure on line 10 in db/wrapper.go

View workflow job for this annotation

GitHub Actions / golangci-lint

cannot use (*Wrapper)(nil) (value of type *Wrapper) as DB value in variable declaration: *Wrapper does not implement DB (missing method Get) (typecheck)

// NewWrapper returns a new Wrapper.
func NewWrapper(db dbm.DB) *Wrapper {
Expand All @@ -34,6 +34,11 @@
return db.DB.NewBatchWithSize(size)
}

// Close implements DB.
func (db *Wrapper) Close() error {
return db.DB.Close()
}

// NewDB returns a new Wrapper.
func NewDB(name, backendType, dir string) (*Wrapper, error) {
db, err := dbm.NewDB(name, dbm.BackendType(backendType), dir)
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/cosmos/iavl

go 1.21
go 1.24

toolchain go1.24.4

require (
cosmossdk.io/log v1.3.1
Expand Down
4 changes: 2 additions & 2 deletions internal/bytes/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func (bz HexBytes) String() string {
func (bz HexBytes) Format(s fmt.State, verb rune) {
switch verb {
case 'p':
s.Write([]byte(fmt.Sprintf("%p", bz)))
_, _ = s.Write([]byte(fmt.Sprintf("%p", bz)))
default:
s.Write([]byte(fmt.Sprintf("%X", []byte(bz))))
_, _ = s.Write([]byte(fmt.Sprintf("%X", []byte(bz))))
}
}

Expand Down
11 changes: 9 additions & 2 deletions migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path"
"runtime"
"testing"
"time"

Expand All @@ -30,7 +31,12 @@ func createLegacyTree(t *testing.T, dbDir string, version int) (string, error) {
}
}

cmd := exec.Command("sh", "-c", fmt.Sprintf("./cmd/legacydump/legacydump %s %s random %d %d", dbType, relateDir, version, version/2)) //nolint:gosec
// Use platform-specific binary
binaryPath := "./cmd/legacydump/legacydump" // Linux binary for CI
if runtime.GOOS == "darwin" {
binaryPath = "./cmd/legacydump/legacydump.macos" // macOS binary for local development
}
cmd := exec.Command(binaryPath, dbType, relateDir, "random", fmt.Sprintf("%d", version), fmt.Sprintf("%d", version/2)) //nolint:gosec
var out bytes.Buffer
var stderr bytes.Buffer
cmd.Stdout = &out
Expand Down Expand Up @@ -340,6 +346,7 @@ func TestRandomSet(t *testing.T) {
require.NoError(t, err)
}

err = tree.DeleteVersionsTo(int64(legacyVersion + postVersions - 1))
// Delete versions but keep the legacy version
err = tree.DeleteVersionsTo(int64(legacyVersion + postVersions - 2))
require.NoError(t, err)
}
2 changes: 0 additions & 2 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ func (ndb *nodeDB) DeleteVersionsFrom(fromVersion int64) error {
err = ndb.traverseRange(nodeKeyPrefixFormat.KeyInt64(fromVersion), nodeKeyPrefixFormat.KeyInt64(latest+1), func(k, v []byte) error {
return ndb.batch.Delete(k)
})

if err != nil {
return err
}
Expand Down Expand Up @@ -1213,7 +1212,6 @@ func (ndb *nodeDB) String() (string, error) {
index++
return nil
})

if err != nil {
return "", err
}
Expand Down
Loading