Skip to content

Commit 5a3822e

Browse files
fix(test): fix conversion test and also simplify the use of rng
1 parent 7c6914d commit 5a3822e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

prover/zkevm/prover/hash/keccak/base_conversion/bc_output_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func makeTestCaseBaseConversionOutput() (
5353
}
5454
return define, prover
5555
}
56+
5657
func TestBaseConversionOutput(t *testing.T) {
5758
define, prover := makeTestCaseBaseConversionOutput()
5859
comp := wizard.Compile(define, dummy.Compile)
@@ -73,18 +74,15 @@ func (b *hashBaseConversion) assignInputs(run *wizard.ProverRuntime) {
7374
sliceLoB[j] = common.NewVectorBuilder(b.Inputs.LimbsLoB[j])
7475
}
7576

77+
// #nosec G404 -- we don't need a cryptographic PRNG for testing purposes
78+
rng := rand.New(utils.NewRandSource(678988))
79+
7680
max := keccakf.BaseBPow4
7781
for j := range sliceHiB {
7882
for row := 0; row < size; row++ {
7983
// generate a random value in baseB
80-
// #nosec G404 -- we don't need a cryptographic PRNG for testing purposes
81-
rng := rand.New(utils.NewRandSource(int64(row * j)))
82-
// #nosec G404 -- we don't need a cryptographic PRNG for testing purposes
83-
rngm := rand.New(utils.NewRandSource(int64((row + 3) * j)))
84-
n := rng.IntN(max) + 1
85-
m := rngm.IntN(max) + 1
86-
sliceHiB[j].PushInt(n)
87-
sliceLoB[j].PushInt(m)
84+
sliceHiB[j].PushInt(rng.IntN(max))
85+
sliceLoB[j].PushInt(rng.IntN(max))
8886
}
8987
}
9088

0 commit comments

Comments
 (0)