diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index e54cc7cf1f73d0..9e38ffefa12c27 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -74,7 +74,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `Blob` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_BLOB]` | | | `VersionedHash` | `Bytes32` | | | `KZGCommitment` | `Bytes48` | Same as BLS standard "is valid pubkey" check but also allows `0x00..00` for point-at-infinity | -| `KZGProof` | Bytes48 | Same as for `KZGCommitment` | +| `KZGProof` | `Bytes48` | Same as for `KZGCommitment` | ### Helpers @@ -91,7 +91,7 @@ def lincomb(points: List[KZGCommitment], scalars: List[BLSFieldElement]) -> KZGC return r def blob_to_kzg(blob: Blob) -> KZGCommitment: - return lincomb(blob, KZG_SETUP_LAGRANGE) + return lincomb(KZG_SETUP_LAGRANGE, blob) ``` Converts a KZG point into a versioned hash: @@ -122,24 +122,15 @@ Efficiently evaluates a polynomial in evaluation form using the barycentric form ```python def bls_modular_inverse(x: BLSFieldElement) -> BLSFieldElement: """ - Compute the modular inverse of x using the eGCD algorithm + Compute the modular inverse of x i.e. return y such that x * y % BLS_MODULUS == 1 and return 0 for x == 0 """ - if x == 0: - return 0 - - lm, hm = 1, 0 - low, high = x % BLS_MODULUS, BLS_MODULUS - while low > 1: - r = high // low - nm, new = hm - lm * r, high - low * r - lm, low, hm, high = nm, new, lm, low - return lm % BLS_MODULUS + return pow(x, -1, BLS_MODULUS) if x != 0 else 0 def div(x, y): """Divide two field elements: `x` by `y`""" - return x * inv(y) % MODULUS + return x * bls_modular_inverse(y) % BLS_MODULUS def evaluate_polynomial_in_evaluation_form(poly: List[BLSFieldElement], x: BLSFieldElement) -> BLSFieldElement: