Skip to content

Commit be3c0f7

Browse files
committed
Also make test_barycentric_within_domain() not exhaustive
1 parent 09983a4 commit be3c0f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,22 @@ def test_barycentric_outside_domain(spec):
139139
@single_phase
140140
def test_barycentric_within_domain(spec):
141141
"""
142-
Test barycentric formula correctness by using it to evaluate a polynomial at all the points of its domain
142+
Test barycentric formula correctness by using it to evaluate a polynomial at various points inside its domain
143143
(the roots of unity).
144144
145145
Then make sure that we would get the same result if we evaluated it from coefficient form without using the
146146
barycentric formula
147147
"""
148+
rng = random.Random(5566)
148149
poly_coeff, poly_eval = get_poly_in_both_forms(spec)
149150
roots_of_unity_brp = spec.bit_reversal_permutation(spec.ROOTS_OF_UNITY)
150151

151152
assert len(poly_coeff) == len(poly_eval) == len(roots_of_unity_brp)
152153
n = len(poly_coeff)
153154

154-
# Iterate over the entire domain
155-
for i in range(n):
155+
# Iterate over some roots of unity
156+
for i in range(12):
157+
i = rng.randint(0, n - 1)
156158
# Grab a root of unity and use it as the evaluation point
157159
z = int(roots_of_unity_brp[i])
158160

0 commit comments

Comments
 (0)