Skip to content

Commit 0124c2b

Browse files
radik878ivokub
andauthored
fix: bit/byte shift in random bound (#1590)
Co-authored-by: Ivo Kubjas <[email protected]>
1 parent 63b6e69 commit 0124c2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

std/conversion/conversion_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func TestNativeToBytes(t *testing.T) {
241241

242242
// case when the number of bytes is smaller than the length of the emulated field element
243243
assert.Run(func(assert *test.Assert) {
244-
bound := new(big.Int).Lsh(big.NewInt(1), fr_bn254.Bytes-1)
244+
bound := new(big.Int).Lsh(big.NewInt(1), fr_bn254.Bits-1)
245245
sint, err := rand.Int(rand.Reader, bound)
246246
assert.NoError(err, "failed to generate random int")
247247
sbytes := make([]byte, fr_bn254.Bytes)
@@ -303,7 +303,7 @@ func TestEmulatedToBytes(t *testing.T) {
303303

304304
// case when the number of bytes is smaller than the length of the emulated field element
305305
assert.Run(func(assert *test.Assert) {
306-
bound := new(big.Int).Lsh(big.NewInt(1), fp_bls12381.Bytes-1)
306+
bound := new(big.Int).Lsh(big.NewInt(1), fp_bls12381.Bits-1)
307307
sint, err := rand.Int(rand.Reader, bound)
308308
assert.NoError(err, "failed to generate random int")
309309
sbytes := make([]byte, fp_bls12381.Bytes)

0 commit comments

Comments
 (0)