Skip to content

Commit 147850f

Browse files
authored
Merge pull request #586 from dedis/dkg/synctest
Use synctest instead of fakeclock in tests
2 parents 3a8877a + b7e95fa commit 147850f

4 files changed

Lines changed: 493 additions & 468 deletions

File tree

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module go.dedis.ch/kyber/v4
22

3-
go 1.25.0
3+
go 1.25
44

55
require (
66
github.com/cloudflare/circl v1.6.1
77
github.com/consensys/gnark-crypto v0.19.2
8-
github.com/jonboulle/clockwork v0.5.0
98
github.com/kilic/bls12-381 v0.1.0
109
github.com/stretchr/testify v1.11.1
1110
go.dedis.ch/fixbuf v1.0.3

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ github.com/consensys/gnark-crypto v0.19.2/go.mod h1:rT23F0XSZqE0mUA0+pRtnL56IbPx
77
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
88
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
99
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10-
github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I=
11-
github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60=
1210
github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4=
1311
github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig=
1412
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=

share/dkg/pedersen/dkg_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package dkg
33
import (
44
"errors"
55
"fmt"
6-
"math/rand"
6+
"math/rand/v2"
77
"testing"
88

9-
clock "github.com/jonboulle/clockwork"
109
"github.com/stretchr/testify/require"
10+
1111
"go.dedis.ch/kyber/v4"
1212
"go.dedis.ch/kyber/v4/group/edwards25519"
1313
"go.dedis.ch/kyber/v4/share"
@@ -24,7 +24,6 @@ type TestNode struct {
2424
proto *Protocol
2525
phaser *TimePhaser
2626
board *TestBoard
27-
clock *clock.FakeClock
2827
}
2928

3029
func NewTestNode(s Suite, index uint32) *TestNode {
@@ -212,7 +211,7 @@ func TestSelfEvictionDealer(t *testing.T) {
212211
thr := uint32(3)
213212
suite := edwards25519.NewBlakeSHA256Ed25519()
214213
tns := GenerateTestNodes(suite, n)
215-
skippedIndex := rand.Intn(int(n))
214+
skippedIndex := rand.IntN(int(n))
216215
var newIndex uint32 = 53 // XXX should there be a limit to the index ?
217216
tns[skippedIndex].Index = newIndex
218217
list := NodesFromTest(tns)
@@ -290,9 +289,9 @@ func TestDKGSkipIndex(t *testing.T) {
290289
newT := thr + nodesToAdd - 1 // set the threshold to accept one offline new node
291290
var newTns = make([]*TestNode, 0, newN)
292291
// remove a random node from the previous group
293-
offlineToRemove := uint32(rand.Intn(int(n)))
292+
offlineToRemove := rand.IntN(int(n))
294293
for i, node := range tns {
295-
if i == int(offlineToRemove) {
294+
if i == offlineToRemove {
296295
continue
297296
}
298297
newTns = append(newTns, node)

0 commit comments

Comments
 (0)