From 4ffda41a860274ad302a049f3192167c71c6a1b7 Mon Sep 17 00:00:00 2001 From: gajinder Date: Wed, 17 May 2023 19:18:05 +0530 Subject: [PATCH 1/4] Update EIP-4844: Cleanup transaction network payload references add blob flattening 4844: nit, opcode -> instruction apply feedback apply feedback --- EIPS/eip-4844.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 3b305f1fb0851e..63e55dee3b1da6 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -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 versioned_hash in tx.blob_versioned_hashes: + assert versioned_hash[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) @@ -291,24 +293,23 @@ 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 +- `blobs` must not be empty +- There must be at most `MAX_DATA_GAS_PER_BLOCK // DATA_GAS_PER_BLOB` total `blobs` in the transaction. +- 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 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. From 9a7d419d9ca0e1c5187008f190824ef78dd7471e Mon Sep 17 00:00:00 2001 From: gajinder Date: Tue, 30 May 2023 14:19:18 +0530 Subject: [PATCH 2/4] space correctly --- 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 63e55dee3b1da6..832852af0b1863 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -273,7 +273,7 @@ def validate_block(block: Block) -> None: # all versioned blob hashes must start with BLOB_COMMITMENT_VERSION_KZG for versioned_hash in tx.blob_versioned_hashes: - assert versioned_hash[0] == BLOB_COMMITMENT_VERSION_KZG + assert versioned_hash[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) From 92a8fbaf5fd99462b8cb7978ecaad1e1760a4d9a Mon Sep 17 00:00:00 2001 From: gajinder Date: Tue, 30 May 2023 15:11:57 +0530 Subject: [PATCH 3/4] apply feedback --- EIPS/eip-4844.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 832852af0b1863..6884b4985ac9eb 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -272,8 +272,8 @@ def validate_block(block: Block) -> None: assert len(tx.blob_versioned_hashes) > 0 # all versioned blob hashes must start with BLOB_COMMITMENT_VERSION_KZG - for versioned_hash in tx.blob_versioned_hashes: - assert 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) @@ -305,8 +305,6 @@ Each of these elements are defined as follows: The node MUST validate `tx_payload` and verify the wrapped data against it. To do so, ensure that: -- `blobs` must not be empty -- There must be at most `MAX_DATA_GAS_PER_BLOCK // DATA_GAS_PER_BLOB` total `blobs` in the transaction. - 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 From 968aa07d62ce5a7715c613b64d1fa19fc8f0b6a5 Mon Sep 17 00:00:00 2001 From: lightclient <14004106+lightclient@users.noreply.github.com> Date: Tue, 30 May 2023 11:48:42 +0200 Subject: [PATCH 4/4] 4844: remove extra space, oxford comma --- 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 6884b4985ac9eb..c38f4dcc6af1cb 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -305,7 +305,7 @@ Each of these elements are defined as follows: The node MUST validate `tx_payload` and verify the wrapped data against it. To do so, ensure that: -- There are an equal number of `tx_payload.blob_versioned_hashes`, `blobs`, `commitments` and `proofs`. +- 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 random evaluation at a point derived from the commitment and blob data for each blob)