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: minor clean-up #7997

Merged
merged 3 commits into from
Nov 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
9 changes: 4 additions & 5 deletions EIPS/eip-4844.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes
| `TARGET_BLOB_GAS_PER_BLOCK` | `393216` |
| `MIN_BLOB_GASPRICE` | `1` |
| `BLOB_GASPRICE_UPDATE_FRACTION` | `3338477` |
| `LIMIT_BLOBS_PER_TX` | `2**12` |
| `GAS_PER_BLOB` | `2**17` |
| `HASH_OPCODE_BYTE` | `Bytes1(0x49)` |
| `HASH_OPCODE_GAS` | `3` |
Expand Down Expand Up @@ -167,10 +166,10 @@ We introduce blob gas as a new type of gas. It is independent of normal gas and
We use the `excess_blob_gas` header field to store persistent data needed to compute the blob gas price. For now, only blobs are priced in blob gas.

```python
def calc_data_fee(header: Header, tx: SignedBlobTransaction) -> int:
def calc_data_fee(header: Header, tx: Transaction) -> int:
return get_total_blob_gas(tx) * get_blob_gasprice(header)

def get_total_blob_gas(tx: SignedBlobTransaction) -> int:
def get_total_blob_gas(tx: Transaction) -> int:
return GAS_PER_BLOB * len(tx.blob_versioned_hashes)

def get_blob_gasprice(header: Header) -> int:
Expand Down Expand Up @@ -259,14 +258,14 @@ def validate_block(block: Block) -> None:

# modify the check for sufficient balance
max_total_fee = tx.gas * tx.max_fee_per_gas
if type(tx) is SignedBlobTransaction:
if get_tx_type(tx) == BLOB_TX_TYPE:
max_total_fee += get_total_blob_gas(tx) * tx.max_fee_per_blob_gas
assert signer(tx).balance >= max_total_fee

...

# add validity logic specific to blob txs
if type(tx) is SignedBlobTransaction:
if get_tx_type(tx) == BLOB_TX_TYPE:
# there must be at least one blob
assert len(tx.blob_versioned_hashes) > 0

Expand Down