Skip to content

Commit

Permalink
remove networking validity conditions from tx type section
Browse files Browse the repository at this point in the history
  • Loading branch information
adietrichs committed Feb 25, 2023
1 parent d714009 commit 2c08be5
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,10 @@ In the transaction-pool and local transaction-journal the network encoding is us

For previous types of transactions the network encoding is no different, i.e. `TransactionNetworkPayload == TransactionPayload`.

The `TransactionNetworkPayload` wraps a `TransactionPayload` with additional data:
this wrapping data SHOULD be verified directly before or after signature verification.

When a blob transaction is passed through the network (see the [Networking](#networking) section below),
the `TransactionNetworkPayload` version of the transaction also includes `blobs` and `kzgs` (commitments list).
The execution layer verifies the wrapper validity against the inner `TransactionPayload` after signature verification as:

- `blob_versioned_hashes` must not be empty
- All hashes in `blob_versioned_hashes` must start with the byte `BLOB_COMMITMENT_VERSION_KZG`
- There may be at most `MAX_DATA_GAS_PER_BLOCK // DATA_GAS_PER_BLOB` total blob commitments in a valid block.
- There is an equal amount 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 with additional data, using a proof for a
random evaluation at two points derived from the commitment and blob data)
The `TransactionNetworkPayload` wraps a `TransactionPayload` with additional data: When a blob transaction is passed through the network,
the `TransactionNetworkPayload` version of the transaction also includes `blobs` and `kzgs` (commitments list). This wrapping data SHOULD be verified directly before or after signature verification (see the [Networking](#networking) section below).

There are also new validity conditions for blocks, both on the consensus-layer and the execution-layer side. See the [Consensus-layer validation](#consensus-layer-validation) and the [Execution-layer validation](#execution-layer-validation) sections below for details.

The signature is verified and `tx.origin` is calculated as follows:

Expand Down Expand Up @@ -323,10 +312,6 @@ def validate_block(block: Block) -> None:
# there must be at least one blob
assert len(tx.message.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

# the signer must be able to afford the transaction
assert signer(tx).balance >= tx.message.gas * tx.message.max_fee_per_gas + get_total_data_gas(tx) * tx.message.max_fee_per_data_gas

Expand Down Expand Up @@ -367,7 +352,10 @@ def validate_blob_transaction_wrapper(wrapper: BlobTransactionNetworkWrapper):
commitments = wrapper.blob_kzgs
blobs = wrapper.blobs
# note: assert blobs are not malformatted
assert len(versioned_hashes) == len(commitments) == len(blobs)
assert 0 < len(versioned_hashes) == len(commitments) == len(blobs)

# ensure the blobs can fit within the current block data gas limit
assert get_total_data_gas(wrapper.tx) <= MAX_DATA_GAS_PER_BLOCK

# Verify that commitments match the blobs by checking the KZG proof
assert verify_aggregate_kzg_proof(blobs, commitments, wrapper.kzg_aggregated_proof)
Expand Down

0 comments on commit 2c08be5

Please sign in to comment.