Skip to content

Commit

Permalink
Update EIP-4844: Specify precompile input's z and y to be encoded as …
Browse files Browse the repository at this point in the history
…big endian
  • Loading branch information
g11tech committed May 12, 2023
1 parent 686c73c commit f837475
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,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]
Expand All @@ -275,10 +275,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, kzg_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())
```

Expand Down

0 comments on commit f837475

Please sign in to comment.