You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some tests like TestEncode relay on deterministic random numbers generation. This guarantees test stability. Such the tests currently use rand.Seed(1) which is now deprecated and therefore need to be changed to rand.New(rand.NewSource(seed)). The returned instance needs to be propagated to various random generation functions such as testutil.RandomETHAddress().
🛠️ Proposed solution
Find all instances of using rand.Seed(seed) and replace it with rand.New(rand.NewSource(seed)).
The returned instance needs to be propagated to various random generation functions such as testutil.RandomETHAddress().
🧪 Tests
Make sure the existing tests remain stable (i.e. do not modify golden files).
Tested by new automated unit/integration/smoke tests
The text was updated successfully, but these errors were encountered:
- Update global `rand.Seed(x)` with local `rand.New(rand.NewSource(x))`;
- Update test random functions that used global seed with local seed;
- Update `math/rand.Read(x)` with `crypto/rand.Read(x)` (not included in the issue, but deprecated as well).
category: refactor
ticket: #2831
🎯 Problem to be solved
Some tests like TestEncode relay on deterministic random numbers generation. This guarantees test stability. Such the tests currently use
rand.Seed(1)
which is now deprecated and therefore need to be changed torand.New(rand.NewSource(seed))
. The returned instance needs to be propagated to various random generation functions such astestutil.RandomETHAddress()
.🛠️ Proposed solution
rand.Seed(seed)
and replace it withrand.New(rand.NewSource(seed))
.testutil.RandomETHAddress()
.🧪 Tests
The text was updated successfully, but these errors were encountered: