Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: [ '1.24', '1.25']
go: [ '1.25', '1.26']
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
# Only latest Go version for Windows and MacOS.
- os: windows-latest
go: '1.24'
go: '1.25'
- os: macos-latest
go: '1.24'
go: '1.25'
# Exclude latest Go version for Ubuntu as Coverage uses it.
- os: ubuntu-latest
go: '1.25'
go: '1.26'
steps:

- name: Setup go
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.25
go-version: 1.26

- name: Check out
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ New features:
Behaviour changes:

Improvements:
* minimum required Go version is 1.24 (#144)
* minimum required Go version is 1.25 (#144, #156)
* `go.uber.org/zap` dependency upgrade from v1.27.0 to v1.27.1 (#156)

Bugs fixed:

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/nspcc-dev/dbft

go 1.24
go 1.25

require (
github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.0
go.uber.org/zap v1.27.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
6 changes: 3 additions & 3 deletions internal/consensus/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestPayload_EncodeDecode(t *testing.T) {

t.Run("Commit", func(t *testing.T) {
var cc commit
fillRandom(t, cc.signature[:])
fillRandom(cc.signature[:])
m := generateMessage(dbft.CommitType, &cc)

testEncodeDecode(t, m, new(Payload))
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestCompact_EncodeDecode(t *testing.T) {
ValidatorIndex: 10,
ViewNumber: 77,
}
fillRandom(t, p.Signature[:])
fillRandom(p.Signature[:])

testEncodeDecode(t, p, new(commitCompact))
})
Expand Down Expand Up @@ -201,6 +201,6 @@ func testMarshalUnmarshal(t *testing.T, expected, actual *Payload) {
require.Equal(t, expected.Hash(), actual.Hash())
}

func fillRandom(t *testing.T, arr []byte) {
func fillRandom(arr []byte) {
_, _ = rand.Read(arr)
}
8 changes: 2 additions & 6 deletions internal/simulation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,10 @@ func main() {
defer cancel()

wg := new(sync.WaitGroup)
wg.Add(len(nodes))

for i := range nodes {
go func(i int) {
defer wg.Done()

wg.Go(func() {
nodes[i].Run(ctx)
}(i)
})
}

wg.Wait()
Expand Down
48 changes: 29 additions & 19 deletions timer/timer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,47 @@ package timer

import (
"testing"
"testing/synctest"
"time"

"github.com/stretchr/testify/require"
)

func TestTimer_Reset(t *testing.T) {
tt := New()
synctest.Test(t, func(t *testing.T) {
tt := New()

tt.Reset(1, 2, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
shouldReceive(t, tt, 1, 2, "no value in timer")
tt.Reset(1, 2, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
synctest.Wait()
shouldReceive(t, tt, 1, 2, "no value in timer")

tt.Reset(1, 2, time.Second)
tt.Reset(2, 3, 0)
shouldReceive(t, tt, 2, 3, "no value in timer after reset(0)")
tt.Reset(1, 2, time.Second)
tt.Reset(2, 3, 0)
synctest.Wait()
shouldReceive(t, tt, 2, 3, "no value in timer after reset(0)")

tt.Reset(1, 2, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
tt.Reset(1, 3, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
shouldReceive(t, tt, 1, 3, "invalid value after reset")
tt.Reset(1, 2, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
synctest.Wait()
tt.Reset(1, 3, time.Millisecond*100)
time.Sleep(time.Millisecond * 200)
synctest.Wait()
shouldReceive(t, tt, 1, 3, "invalid value after reset")

tt.Reset(3, 1, time.Millisecond*100)
shouldNotReceive(t, tt, "value arrived too early")
tt.Reset(3, 1, time.Millisecond*100)
synctest.Wait()
shouldNotReceive(t, tt, "value arrived too early")

tt.Extend(time.Millisecond * 300)
time.Sleep(time.Millisecond * 200)
shouldNotReceive(t, tt, "value arrived too early after extend")
tt.Extend(time.Millisecond * 300)
time.Sleep(time.Millisecond * 200)
synctest.Wait()
shouldNotReceive(t, tt, "value arrived too early after extend")

time.Sleep(time.Millisecond * 300)
shouldReceive(t, tt, 3, 1, "no value in timer after extend")
time.Sleep(time.Millisecond * 300)
synctest.Wait()
shouldReceive(t, tt, 3, 1, "no value in timer after extend")
})
}

func shouldReceive(t *testing.T, tt *Timer, height uint32, view byte, msg string) {
Expand Down
Loading