Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-4844: Cleanup transaction network payload references #7038

Merged
merged 4 commits into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ def validate_block(block: Block) -> None:
# add validity logic specific to blob txs
if type(tx) is SignedBlobTransaction:

# destination must be not be empty
assert tx.to != None
# there must be at least one blob
assert len(tx.message.blob_versioned_hashes) > 0
assert len(tx.blob_versioned_hashes) > 0

# all versioned blob hashes must start with BLOB_COMMITMENT_VERSION_KZG
for blob_versioned_hash in tx.message.blob_versioned_hashes:
assert blob_versioned_hash[0] == BLOB_COMMITMENT_VERSION_KZG
for h in tx.blob_versioned_hashes:
assert h[0] == BLOB_COMMITMENT_VERSION_KZG

# ensure that the user was willing to at least pay the current data gasprice
assert tx.max_fee_per_data_gas >= get_data_gasprice(parent(block).header)
Expand All @@ -291,24 +293,21 @@ def validate_block(block: Block) -> None:
Blob transactions have two network representations. During transaction gossip responses (`PooledTransactions`), the EIP-2718 `TransactionPayload` of the blob transaction is wrapped to become:

```
rlp([blob_tx_payload, blob_kzgs, blobs, blob_kzg_proofs])
rlp([tx_payload, blobs, commitments, proofs])
```

Each of these elements are defined as follows:

- `blob_tx_payload` - standard EIP-2718 blob transaction `TransactionPayload`
- `blob_kzgs` - list of `KZGCommitment`
- `blobs` - list of `blob` where `blob` is a list of `BLSFieldElement`
- `kzg_aggregated_proof` - `KZGProof`
- `tx_payload` - standard EIP-2718 blob transaction `TransactionPayload`
- `blobs` - list of `blob` bytes where each `blob` is its `BLSFieldElement` list flattened in `big endian`
- `commitments` - list of `KZGCommitment` of the corresponding `blobs`
- `proofs` - list of `KZGProof` of the corresponding `blobs` and `commitments`

The node MUST validate `blob_tx_payload` and verify the wrapped data against it. To do so, ensure that:
The node MUST validate `tx_payload` and verify the wrapped data against it. To do so, ensure that:

- `blob_tx_payload.blob_versioned_hashes` must not be empty
- All hashes in `blob_tx_payload.blob_versioned_hashes` must start with the byte `BLOB_COMMITMENT_VERSION_KZG`
- There must be at most `MAX_DATA_GAS_PER_BLOCK // DATA_GAS_PER_BLOB` total blob commitments in the transaction.
- There are an equal number of versioned hashes, kzg commitments, and blobs.
- The KZG commitments hash to the versioned hashes, i.e. `kzg_to_versioned_hash(kzg[i]) == versioned_hash[i]`
- The KZG commitments match the blob contents. (Note: this can be optimized using `blob_kzg_proofs`, with a proof for a
- There are an equal number of `tx_payload.blob_versioned_hashes`, `blobs`, `commitments`, and `proofs`.
- The KZG `commitments` hash to the versioned hashes, i.e. `kzg_to_versioned_hash(commitments[i]) == tx_payload.blob_versioned_hashes[i]`
- The KZG `commitments` match the corresponding `blobs` and `proofs`. (Note: this can be optimized using `blob_kzg_proofs`, with a proof for a
lightclient marked this conversation as resolved.
Show resolved Hide resolved
random evaluation at a point derived from the commitment and blob data for each blob)

For body retrieval responses (`BlockBodies`), the standard EIP-2718 blob transaction `TransactionPayload` is used.
Expand Down