Skip to content

Commit cffad65

Browse files
fix non determinism (cosmos#332)
1 parent 9ddd976 commit cffad65

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/integration/precompiles/p256/test_p256.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ func (s *PrecompileTestSuite) TestRun() {
4141

4242
input := make([]byte, p256.VerifyInputLength)
4343
copy(input[0:32], hash)
44-
copy(input[32:64], rInt.Bytes())
45-
copy(input[64:96], sInt.Bytes())
46-
copy(input[96:128], s.p256Priv.X.Bytes())
47-
copy(input[128:160], s.p256Priv.Y.Bytes())
44+
45+
rInt.FillBytes(input[32:64])
46+
sInt.FillBytes(input[64:96])
47+
s.p256Priv.X.FillBytes(input[96:128])
48+
s.p256Priv.Y.FillBytes(input[128:160])
4849

4950
return input
5051
},
@@ -66,8 +67,8 @@ func (s *PrecompileTestSuite) TestRun() {
6667
copy(input[0:32], hash)
6768
copy(input[32:64], rBz)
6869
copy(input[64:96], sBz)
69-
copy(input[96:128], s.p256Priv.X.Bytes())
70-
copy(input[128:160], s.p256Priv.Y.Bytes())
70+
s.p256Priv.X.FillBytes(input[96:128])
71+
s.p256Priv.Y.FillBytes(input[128:160])
7172

7273
return input
7374
},
@@ -90,10 +91,11 @@ func (s *PrecompileTestSuite) TestRun() {
9091

9192
input := make([]byte, p256.VerifyInputLength)
9293
copy(input[0:32], hash)
93-
copy(input[32:64], rInt.Bytes())
94-
copy(input[64:96], sInt.Bytes())
95-
copy(input[96:128], privB.X.Bytes())
96-
copy(input[128:160], privB.Y.Bytes())
94+
95+
rInt.FillBytes(input[32:64])
96+
sInt.FillBytes(input[64:96])
97+
privB.X.FillBytes(input[96:128])
98+
privB.Y.FillBytes(input[128:160])
9799

98100
return input
99101
},

0 commit comments

Comments
 (0)