Skip to content

Commit

Permalink
Merge pull request ethereum#3792 from b-wagn/patch-1
Browse files Browse the repository at this point in the history
Update polynomial-commitments-sampling.md - Fix shift_polynomialcoeff
  • Loading branch information
asn-d6 committed Jun 6, 2024
2 parents 3644f36 + ac105f4 commit 76e2d52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions specs/_features/eip7594/polynomial-commitments-sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ def divide_polynomialcoeff(a: PolynomialCoeff, b: PolynomialCoeff) -> Polynomial
def shift_polynomialcoeff(polynomial_coeff: PolynomialCoeff, factor: BLSFieldElement) -> PolynomialCoeff:
"""
Shift the evaluation of a polynomial in coefficient form by factor.
This results in a new polynomial g(x) = f(factor * x)
This returns a new polynomial g in coefficient form such that g(x) = f(factor * x).
In other words, each coefficient of f is scaled by a power of factor.
"""
factor_power = 1
inv_factor = pow(int(factor), BLS_MODULUS - 2, BLS_MODULUS)
o = []
for p in polynomial_coeff:
o.append(int(p) * factor_power % BLS_MODULUS)
factor_power = factor_power * inv_factor % BLS_MODULUS
factor_power = factor_power * int(factor) % BLS_MODULUS
return o
```

Expand Down

0 comments on commit 76e2d52

Please sign in to comment.