Skip to content

Commit 2499be1

Browse files
committed
v3 action
1 parent 4281689 commit 2499be1

File tree

8 files changed

+51
-19
lines changed

8 files changed

+51
-19
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@v3
25-
- uses: actions/setup-go@v4
25+
- uses: actions/setup-go@v3
2626
with:
2727
go-version: '1.22'
2828
- name: Install RELIC dependencies

.github/workflows/golangci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
name: lint
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/setup-go@v4
18+
- uses: actions/setup-go@v3
1919
with:
2020
go-version: '1.22'
2121
- uses: actions/checkout@v3
@@ -40,7 +40,7 @@ jobs:
4040
echo "CGO_CFLAGS=-I/usr/local/include/relic -DRLC_NO_CORE" >> $GITHUB_ENV
4141
echo "CGO_LDFLAGS=-L/usr/local/lib -lrelic_s" >> $GITHUB_ENV
4242
echo "LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
43-
- uses: golangci/golangci-lint-action@v4
43+
- uses: golangci/golangci-lint-action@v3
4444
with:
4545
version: v1.61
4646
args: --config=.golangci.yml --timeout=10m

.github/workflows/unit_tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
tests:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/setup-go@v4
16+
- uses: actions/setup-go@v3
1717
with:
1818
go-version: '1.22'
1919
- uses: actions/checkout@v3
@@ -41,7 +41,7 @@ jobs:
4141
- name: Run Go Tests
4242
run: |
4343
make test-all
44-
- uses: actions/upload-artifact@v4
44+
- uses: actions/upload-artifact@v3
4545
with:
4646
name: "${{ github.sha }}-coverage"
4747
path: ./profile.out
@@ -51,13 +51,13 @@ jobs:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- uses: actions/checkout@v3
54-
- uses: actions/setup-go@v4
54+
- uses: actions/setup-go@v3
5555
with:
5656
go-version: '1.22'
5757

5858
# Download all coverage reports from the 'tests' job
5959
- name: Download coverage reports
60-
uses: actions/download-artifact@v4
60+
uses: actions/download-artifact@v3
6161

6262
- name: Set GOPATH
6363
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ linters:
1010
enable:
1111
- bodyclose
1212
- dogsled
13-
- exportloopref
13+
- copyloopvar
1414
- errcheck
1515
- goconst
1616
- gocritic
@@ -38,6 +38,9 @@ issues:
3838
- text: "Use of weak random number generator"
3939
linters:
4040
- gosec
41+
- text: "G115:" # Exclude integer overflow conversion warnings
42+
linters:
43+
- gosec
4144
- text: "ST1003:"
4245
linters:
4346
- stylecheck

sc/memiavl/filelock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package memiavl
33
import (
44
"path/filepath"
55

6-
"github.com/zbiljic/go-filelock"
6+
filelock "github.com/zbiljic/go-filelock"
77
)
88

99
type FileLock interface {

ss/pebbledb/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sync"
1111
"time"
1212

13-
"github.com/armon/go-metrics"
13+
metrics "github.com/armon/go-metrics"
1414
"github.com/cockroachdb/pebble"
1515
"github.com/cockroachdb/pebble/bloom"
1616
errorutils "github.com/sei-protocol/sei-db/common/errors"

ss/pebbledb/hash_test.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,18 @@ func TestAsyncComputeMissingRanges(t *testing.T) {
339339
err := db.ApplyChangesetAsync(31, changesets)
340340
require.NoError(t, err)
341341

342-
// Wait a bit for the async computation to complete
343-
time.Sleep(200 * time.Millisecond)
342+
// Wait for the async computation to complete with retries
343+
var lastHashed int64
344+
for retries := 0; retries < 50; retries++ {
345+
lastHashed, err = db.GetLastRangeHashed()
346+
require.NoError(t, err)
347+
if lastHashed >= 30 {
348+
break
349+
}
350+
time.Sleep(20 * time.Millisecond)
351+
}
344352

345353
// We should now have hashed up to version 30 (3 complete ranges)
346-
lastHashed, err := db.GetLastRangeHashed()
347-
require.NoError(t, err)
348354
assert.Equal(t, int64(30), lastHashed)
349355

350356
// Apply more changesets to get to version 40
@@ -353,12 +359,17 @@ func TestAsyncComputeMissingRanges(t *testing.T) {
353359
require.NoError(t, err)
354360
}
355361

356-
// Wait a bit for async computation
357-
time.Sleep(500 * time.Millisecond)
362+
// Wait for async computation to complete with retries
363+
for retries := 0; retries < 50; retries++ {
364+
lastHashed, err = db.GetLastRangeHashed()
365+
require.NoError(t, err)
366+
if lastHashed >= 40 {
367+
break
368+
}
369+
time.Sleep(20 * time.Millisecond)
370+
}
358371

359372
// We should now have hashed up to version 40
360-
lastHashed, err = db.GetLastRangeHashed()
361-
require.NoError(t, err)
362373
assert.Equal(t, int64(40), lastHashed)
363374
}
364375

ss/store_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"path/filepath"
77
"testing"
8+
"time"
89

910
"github.com/cosmos/iavl"
1011
"github.com/sei-protocol/sei-db/common/logger"
@@ -42,7 +43,24 @@ func TestNewStateStore(t *testing.T) {
4243
err := stateStore.ApplyChangesetAsync(int64(i), changesets)
4344
require.NoError(t, err)
4445
}
45-
// Closing the state store without waiting for data to be fully flushed
46+
47+
// Wait for all async operations to complete by checking latest version
48+
// This ensures data is flushed before closing
49+
var finalVersion int64
50+
for retries := 0; retries < 50; retries++ {
51+
finalVersion, err = stateStore.GetLatestVersion()
52+
if err == nil && finalVersion >= 19 {
53+
break
54+
}
55+
// Small sleep to allow async writes to complete
56+
time.Sleep(10 * time.Millisecond)
57+
if retries == 49 {
58+
require.NoError(t, err)
59+
}
60+
}
61+
require.Equal(t, int64(19), finalVersion, "Expected latest version to be 19 after async writes complete")
62+
63+
// Closing the state store after ensuring data is fully flushed
4664
err = stateStore.Close()
4765
require.NoError(t, err)
4866

0 commit comments

Comments
 (0)