From f5cbaacd74ba1b4d2219254bf0fdcc11490a5f27 Mon Sep 17 00:00:00 2001 From: gajinder Date: Fri, 12 May 2023 18:37:10 +0530 Subject: [PATCH 1/4] Update EIP-4844: Specify precompile input's z and y to be encoded as big endian --- EIPS/eip-4844.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index f43da5418eafbb..7f128bed92091a 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -184,7 +184,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: Verify p(z) = y given commitment that corresponds to the polynomial p(x) and a KZG proof. Also verify that the provided commitment matches the provided versioned_hash. """ - # The data is encoded as follows: versioned_hash | z | y | commitment | proof | + # The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 bytes big endian assert len(input) == 192 versioned_hash = input[:32] z = input[32:64] @@ -195,10 +195,10 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: # Verify commitment matches versioned_hash assert kzg_to_versioned_hash(commitment) == versioned_hash - # Verify KZG proof + # Verify KZG proof with z and y in big endian format assert verify_kzg_proof(commitment, z, y, proof) - # Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 byte big endian values + # Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 bytes big endian values return Bytes(U256(FIELD_ELEMENTS_PER_BLOB).to_be_bytes32() + U256(BLS_MODULUS).to_be_bytes32()) ``` From e15579d8ac343fa48ecbcb2d0f96dc29aa959c91 Mon Sep 17 00:00:00 2001 From: gajinder Date: Fri, 12 May 2023 18:46:29 +0530 Subject: [PATCH 2/4] specify blob endianess --- EIPS/eip-4844.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 7f128bed92091a..b5592664b091b7 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -64,7 +64,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | Type | Base type | Additional checks | | - | - | - | | `BLSFieldElement` | `uint256` | `x < BLS_MODULUS` | -| `Blob` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_BLOB]` | | +| `Blob` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_BLOB]` | Each field element encoded as padded 32 bytes big endian | | `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` | From 2f727218ca33c480e9160457df4555d7dd271d7b Mon Sep 17 00:00:00 2001 From: gajinder Date: Wed, 17 May 2023 19:29:50 +0530 Subject: [PATCH 3/4] reset blob typing --- EIPS/eip-4844.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index b5592664b091b7..7f128bed92091a 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -64,7 +64,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | Type | Base type | Additional checks | | - | - | - | | `BLSFieldElement` | `uint256` | `x < BLS_MODULUS` | -| `Blob` | `Vector[BLSFieldElement, FIELD_ELEMENTS_PER_BLOB]` | Each field element encoded as padded 32 bytes big endian | +| `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` | From 1d202950b0d10c3e16404aaf67ddaa892268fd43 Mon Sep 17 00:00:00 2001 From: gajinder Date: Sat, 27 May 2023 21:59:49 +0530 Subject: [PATCH 4/4] apply feedback --- EIPS/eip-4844.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 7f128bed92091a..f33aadd1017395 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -184,7 +184,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: Verify p(z) = y given commitment that corresponds to the polynomial p(x) and a KZG proof. Also verify that the provided commitment matches the provided versioned_hash. """ - # The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 bytes big endian + # The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 byte big endian values assert len(input) == 192 versioned_hash = input[:32] z = input[32:64] @@ -198,7 +198,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: # Verify KZG proof with z and y in big endian format assert verify_kzg_proof(commitment, z, y, proof) - # Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 bytes big endian values + # Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 byte big endian values return Bytes(U256(FIELD_ELEMENTS_PER_BLOB).to_be_bytes32() + U256(BLS_MODULUS).to_be_bytes32()) ```