Skip to content

Commit

Permalink
support nil seedGen in testingenv with default
Browse files Browse the repository at this point in the history
  • Loading branch information
ohill committed Oct 19, 2023
1 parent 5cb064b commit 2a88dbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions data/committee/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func testingenv(t testing.TB, numAccounts, numTxs int, seedGen io.Reader) (selec
}

func testingenvMoreKeys(t testing.TB, numAccounts, numTxs int, keyBatchesForward uint, seedGen io.Reader) (selectionParameterFn, selectionParameterListFn, basics.Round, []basics.Address, []*crypto.SignatureSecrets, []*crypto.VrfPrivkey, []*crypto.OneTimeSignatureSecrets, []transactions.SignedTxn) {
if seedGen == nil {
seedGen = rand.New(rand.NewSource(1)) // same source as setting GODEBUG=randautoseed=0, same as pre-Go 1.20 default seed
}
P := numAccounts // n accounts
TXs := numTxs // n txns
maxMoneyAtStart := 100000 // max money start
Expand Down
10 changes: 5 additions & 5 deletions data/committee/credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func TestAccountSelected(t *testing.T) {
func TestRichAccountSelected(t *testing.T) {
partitiontest.PartitionTest(t)

selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 10, 2000, rand.New(rand.NewSource(1)))
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 10, 2000, nil)

period := Period(0)
ok, record, selectionSeed, _ := selParams(addresses[0])
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestNoMoneyAccountNotSelected(t *testing.T) {
func TestLeadersSelected(t *testing.T) {
partitiontest.PartitionTest(t)

selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, rand.New(rand.NewSource(1)))
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, nil)

period := Period(0)
step := Propose
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestLeadersSelected(t *testing.T) {
func TestCommitteeSelected(t *testing.T) {
partitiontest.PartitionTest(t)

selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, rand.New(rand.NewSource(1)))
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, nil)

period := Period(0)
step := Soft
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestCommitteeSelected(t *testing.T) {
func TestAccountNotSelected(t *testing.T) {
partitiontest.PartitionTest(t)

selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, rand.New(rand.NewSource(1)))
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(t, 100, 2000, nil)
period := Period(0)
leaders := uint64(0)
for i := range addresses {
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestAccountNotSelected(t *testing.T) {

// TODO update to remove VRF verification overhead
func BenchmarkSortition(b *testing.B) {
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(b, 100, 2000, rand.New(rand.NewSource(1)))
selParams, _, round, addresses, _, vrfSecrets, _, _ := testingenv(b, 100, 2000, nil)

period := Period(0)
step := Soft
Expand Down

0 comments on commit 2a88dbd

Please sign in to comment.