Skip to content

Commit

Permalink
EIP4844: validate_blob_transaction_wrapper() now uses latest API
Browse files Browse the repository at this point in the history
  • Loading branch information
asn-d6 committed Nov 22, 2022
1 parent b81f939 commit 2b84aee
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,12 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes

### Cryptographic Helpers

Throughout this proposal we use cryptographic methods and classes defined in the corresponding [consensus 4844 specs](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844).
Throughout this proposal we use cryptographic methods and classes defined in the corresponding [consensus 4844 specs](https://github.com/ethereum/consensus-specs/blob/a45627164d34ddb60acca385e2324835fc14ca5c/specs/eip4844).

Specifically, we use the following methods from [`polynomial-commitments.md`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/polynomial-commitments.md):
Specifically, we use the following methods from [`polynomial-commitments.md`](https://github.com/ethereum/consensus-specs/blob/a45627164d34ddb60acca385e2324835fc14ca5c/specs/eip4844/polynomial-commitments.md):

- [`verify_kzg_proof()`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/polynomial-commitments.md#verify_kzg_proof)
- [`evaluate_polynomial_in_evaluation_form()`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/polynomial-commitments.md#evaluate_polynomial_in_evaluation_form)

We also use the following methods and classes from [`validator.md`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/validator.md):

- [`hash_to_bls_field()`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/validator.md#hash_to_bls_field)
- [`compute_powers()`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/validator.md#compute_powers)
- [`compute_aggregated_poly_and_commitment()`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/validator.md#compute_aggregated_poly_and_commitment)
- [`PolynomialAndCommitment`](https://github.com/ethereum/consensus-specs/blob/6c2b46ae3248760e0f6e52d61077d8b31e43ad1d/specs/eip4844/validator.md#PolynomialAndCommitment)
- [`verify_kzg_proof()`](https://github.com/ethereum/consensus-specs/blob/a45627164d34ddb60acca385e2324835fc14ca5c/specs/eip4844/polynomial-commitments.md#verify_kzg_proof)
- [`verify_aggregate_kzg_proof()`](https://github.com/ethereum/consensus-specs/blob/a45627164d34ddb60acca385e2324835fc14ca5c/specs/eip4844/polynomial-commitments.md#verify_aggregate_kzg_proof)

### Helpers

Expand Down Expand Up @@ -347,20 +340,8 @@ def validate_blob_transaction_wrapper(wrapper: BlobTransactionNetworkWrapper):
# note: assert blobs are not malformatted
assert len(versioned_hashes) == len(commitments) == len(blobs)

aggregated_poly, aggregated_poly_commitment = compute_aggregated_poly_and_commitment(
blobs,
commitments,
)

# Generate challenge `x` and evaluate the aggregated polynomial at `x`
x = hash_to_bls_field(
PolynomialAndCommitment(polynomial=aggregated_poly, kzg_commitment=aggregated_poly_commitment)
)
# Evaluate aggregated polynomial at `x` (evaluation function checks for div-by-zero)
y = evaluate_polynomial_in_evaluation_form(aggregated_poly, x)

# Verify aggregated proof
assert verify_kzg_proof(aggregated_poly_commitment, x, y, wrapper.kzg_aggregated_proof)
# Verify that commitments match the blobs by checking the KZG proof
assert verify_aggregate_kzg_proof(blobs, commitments, wrapper.kzg_aggregated_proof)

# Now that all commitments have been verified, check that versioned_hashes matches the commitments
for versioned_hash, commitment in zip(versioned_hashes, commitments):
Expand Down

0 comments on commit 2b84aee

Please sign in to comment.