diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 19dcd394a0958c..66a2b9880b68d4 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -255,22 +255,23 @@ The precompile costs `POINT_EVALUATION_PRECOMPILE_GAS` and executes the followin ```python def point_evaluation_precompile(input: Bytes) -> Bytes: - # Verify P(z) = a - # versioned hash: first 32 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 | versioned_hash = input[:32] - # Evaluation point: next 32 bytes - x = int.from_bytes(input[32:64], 'little') - assert x < BLS_MODULUS - # Expected output: next 32 bytes - y = int.from_bytes(input[64:96], 'little') - assert y < BLS_MODULUS - # The remaining data will always be the proof, including in future versions - # input kzg point: next 48 bytes - data_kzg = input[96:144] - assert kzg_to_versioned_hash(data_kzg) == versioned_hash - # Quotient kzg: next 48 bytes - quotient_kzg = input[144:192] - assert verify_kzg_proof(data_kzg, x, y, quotient_kzg) + z = input[32:64] + y = input[64:96] + commitment = input[96:144] + kzg_proof = input[144:192] + + # Verify KZG proof + assert verify_kzg_proof(commitment, z, y, kzg_proof) + + # Verify commitment matches versioned_hash + assert kzg_to_versioned_hash(commitment) == versioned_hash + return Bytes([]) ```