Skip to content

Commit

Permalink
apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed May 27, 2023
1 parent 5c752a9 commit e0f0265
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,21 @@ def validate_block(block: Block) -> None:
for tx in block.transactions:
...

# destination must be not be empty
asset tx.to != None
# the signer must be able to afford the transaction
assert signer(tx).balance >= tx.gas * tx.max_fee_per_gas + get_total_data_gas(tx) * tx.max_fee_per_data_gas
# 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)

# ensure the versioned hashes are non zero and valid
assert len(tx.blob_versioned_hashes) > 0
for versioned_hash in tx.blob_versioned_hashes:
assert versioned_hash[0] == BLOB_COMMITMENT_VERSION_KZG
num_blobs += len(tx.blob_versioned_hashes)

if type(tx) is SignedBlobTransaction:
# destination must be not be empty
assert tx.to != None
# the signer must be able to afford the transaction
assert signer(tx).balance >= tx.gas * tx.max_fee_per_gas + get_total_data_gas(tx) * tx.max_fee_per_data_gas
# 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)

# ensure the versioned hashes are non zero and valid
assert len(tx.blob_versioned_hashes) > 0
for versioned_hash in tx.blob_versioned_hashes:
assert versioned_hash[0] == BLOB_COMMITMENT_VERSION_KZG
num_blobs += len(tx.blob_versioned_hashes)

assert num_blobs <= (MAX_DATA_GAS_PER_BLOCK // DATA_GAS_PER_BLOB)
# check that the excess data gas is correct
expected_edg = calc_excess_data_gas(parent(block).header, num_blobs)
assert expected_edg == block.excess_data_gas
Expand Down

0 comments on commit e0f0265

Please sign in to comment.