From d232f24228b9fda9a850d499f53e387cba4b96ae Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 5 Sep 2022 15:29:02 -0700 Subject: [PATCH 01/27] remove MAX_BLOBS_PER_TX --- EIPS/eip-4844.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 8bdfad401a436c..f7b494d3c38897 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,7 +47,6 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | -| `MAX_BLOBS_PER_TX` | `2` | | `GASPRICE_UPDATE_FRACTION_PER_BLOB` | `64` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | @@ -158,7 +157,7 @@ the `TransactionNetworkPayload` version of the transaction also includes `blobs` The execution layer verifies the wrapper validity against the inner `TransactionPayload` after signature verification as: - All hashes in `blob_versioned_hashes` must start with the byte `BLOB_COMMITMENT_VERSION_KZG` -- There may be at most `MAX_BLOBS_PER_TX` blob commitments in any single transaction. +- There may be at most `MAX_BLOBS_PER_BLOCK` blob commitments in any single transaction. - There may be at most `MAX_BLOBS_PER_BLOCK` 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]` From d440dc2edadc16362137b6224cd1777d15c06f71 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 5 Sep 2022 17:48:57 -0700 Subject: [PATCH 02/27] change fake_exponential to taylor expansion --- EIPS/eip-4844.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index f7b494d3c38897..dae5ced790741f 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -91,16 +91,18 @@ def kzg_to_versioned_hash(kzg: KZGCommitment) -> VersionedHash: return BLOB_COMMITMENT_VERSION_KZG + hash(kzg)[1:] ``` -Approximates `2 ** (numerator / denominator)`, with the simplest possible approximation that is continuous and has a continuous derivative: +Approximates `e ** (numerator / denominator)` using Taylor expansion: ```python def fake_exponential(numerator: int, denominator: int) -> int: - cofactor = 2 ** (numerator // denominator) - fractional = numerator % denominator - return cofactor + ( - fractional * cofactor * 2 + - (fractional ** 2 * cofactor) // denominator - ) // (denominator * 3) + i = 1 + output = 0 + numerator_accum = denominator + while numerator_accum > 0: + output += numerator_accum + numerator_accum = (numerator_accum * numerator) // (denominator * i) + i += 1 + return output // denominator ``` ### New transaction type From 1bbcf00aca4f677c23798b8fc1cafcb70704b9d4 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 5 Sep 2022 18:01:59 -0700 Subject: [PATCH 03/27] add MIN_GASPRICE_PER_BLOB --- EIPS/eip-4844.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index dae5ced790741f..0bb53db4432249 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,6 +47,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | +| `MIN_GASPRICE_PER_BLOB` | `1` | | `GASPRICE_UPDATE_FRACTION_PER_BLOB` | `64` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | @@ -91,13 +92,13 @@ def kzg_to_versioned_hash(kzg: KZGCommitment) -> VersionedHash: return BLOB_COMMITMENT_VERSION_KZG + hash(kzg)[1:] ``` -Approximates `e ** (numerator / denominator)` using Taylor expansion: +Approximates `factor * e ** (numerator / denominator)` using Taylor expansion: ```python -def fake_exponential(numerator: int, denominator: int) -> int: +def fake_exponential(factor: int, numerator: int, denominator: int) -> int: i = 1 output = 0 - numerator_accum = denominator + numerator_accum = factor * denominator while numerator_accum > 0: output += numerator_accum numerator_accum = (numerator_accum * numerator) // (denominator * i) @@ -294,6 +295,7 @@ def get_intrinsic_gas(tx: SignedBlobTransaction, parent: Header) -> int: def get_blob_gas(header: Header) -> int: return fake_exponential( + MIN_GASPRICE_PER_BLOB, header.excess_blobs, GASPRICE_UPDATE_FRACTION_PER_BLOB ) From 104d11404613f315ce3963b2241063e4bffaa9f6 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 5 Sep 2022 18:17:11 -0700 Subject: [PATCH 04/27] change update fraction and add motivation --- EIPS/eip-4844.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 0bb53db4432249..a630a33735344b 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -48,7 +48,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | | `MIN_GASPRICE_PER_BLOB` | `1` | -| `GASPRICE_UPDATE_FRACTION_PER_BLOB` | `64` | +| `GASPRICE_UPDATE_FRACTION_PER_BLOB` | `84` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | | `MAX_ACCESS_LIST_SIZE` | `2**24` | @@ -301,6 +301,8 @@ def get_blob_gas(header: Header) -> int: ) ``` +The parameter `GASPRICE_UPDATE_FRACTION_PER_BLOB` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 10% per block. + ### Networking Transactions are presented as `TransactionType || TransactionNetworkPayload` on the execution layer network, From 8dc23c0ba62854d9e31103b778096db64467245c Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:00:40 +0200 Subject: [PATCH 05/27] align tx field naming with 1559 --- EIPS/eip-4844.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index a630a33735344b..b234b7abf430d7 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -120,7 +120,7 @@ class SignedBlobTransaction(Container): class BlobTransaction(Container): chain_id: uint256 nonce: uint64 - priority_fee_per_gas: uint256 + max_priority_fee_per_gas: uint256 max_fee_per_gas: uint256 gas: uint64 to: Union[None, Address] # Address = Bytes20 @@ -139,7 +139,7 @@ class ECDSASignature(Container): s: uint256 ``` -The `priority_fee_per_gas` and `max_fee_per_gas` fields follow [EIP-1559](./eip-1559.md) semantics, +The `max_priority_fee_per_gas` and `max_fee_per_gas` fields follow [EIP-1559](./eip-1559.md) semantics, and `access_list` as in [`EIP-2930`](./eip-2930.md). [`EIP-2718`](./eip-2718.md) is extended with a "wrapper data", the typed transaction can be encoded in two forms, dependent on the context: From 9528d7fa70c36a152a5a725cc64c139759b7479c Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:13:51 +0200 Subject: [PATCH 06/27] move explanation to rationale --- EIPS/eip-4844.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index b234b7abf430d7..64c686bdbb53d4 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -301,7 +301,6 @@ def get_blob_gas(header: Header) -> int: ) ``` -The parameter `GASPRICE_UPDATE_FRACTION_PER_BLOB` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 10% per block. ### Networking @@ -428,6 +427,8 @@ If in block `N`, `blob_gas = G1`, and block `N` has `X` blobs, then in block `N+ and so the `blob_gas` of block `N+1` increases by a factor of `2**((X - TARGET_BLOBS_PER_BLOCK) / GASPRICE_UPDATE_FRACTION_PER_BLOB)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. +The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 10% per block. + ## Backwards Compatibility ### Blob non-accessibility From b7d7ad1d7cfa8063410b1092cc52d141162029bb Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:16:42 +0200 Subject: [PATCH 07/27] introduce data gas --- EIPS/eip-4844.md | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 64c686bdbb53d4..91858222e19404 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,15 +47,16 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | -| `MIN_GASPRICE_PER_BLOB` | `1` | -| `GASPRICE_UPDATE_FRACTION_PER_BLOB` | `84` | +| `MIN_DATA_GASPRICE` | `1` | +| `DATA_GASPRICE_UPDATE_FRACTION` | `84` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | | `MAX_ACCESS_LIST_SIZE` | `2**24` | | `MAX_ACCESS_LIST_STORAGE_KEYS` | `2**24` | | `MAX_TX_WRAP_KZG_COMMITMENTS` | `2**24` | | `LIMIT_BLOBS_PER_TX` | `2**24` | -| `GAS_PER_BLOB` | `120000` | +| `DATA_GAS_PER_BLOB` | `1` | +| `SIMPLE_GAS_PER_BLOB` | `120000` | | `HASH_OPCODE_BYTE` | `Bytes1(0x49)` | | `HASH_OPCODE_GAS` | `3` | @@ -273,27 +274,21 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: ### Gas price of blobs (Simplified version) -For early draft implementations, we simply change `get_blob_gas(parent)` to always return `GAS_PER_BLOB`. +For early draft implementations, we simply change `get_blob_gas(parent)` to always return `SIMPLE_GAS_PER_BLOB`. -### Gas price update rule (Full version) +### Gas accounting (Full version) -We propose a simple independent EIP-1559-style targeting rule to compute the gas cost of the transaction. -We use the `excess_blobs` header field to store persistent data needed to compute the cost. +We introduce data gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559. +We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are charged for in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost). ```python -def get_intrinsic_gas(tx: SignedBlobTransaction, parent: Header) -> int: - intrinsic_gas = 21000 # G_transaction - if tx.message.to == None: # i.e. if a contract is created - intrinsic_gas = 53000 - # EIP-2028 data gas cost reduction for zero bytes - intrinsic_gas += 16 * len(tx.message.data) - 12 * len(tx.message.data.count(0)) - # EIP-2930 Optional access lists - intrinsic_gas += 1900 * sum(len(entry.storage_keys) for entry in tx.message.access_list) + 2400 * len(tx.message.access_list) - # New additional gas cost per blob - intrinsic_gas += len(tx.message.blob_versioned_hashes) * get_blob_gas(parent) - return intrinsic_gas - -def get_blob_gas(header: Header) -> int: +def calc_data_fee(tx: SignedBlobTransaction, parent: Header) -> int: + return get_total_data_gas(tx) * get_data_gasprice(header) + +def get_total_data_gas(tx: SignedBlobTransaction) -> int: + return DATA_GAS_PER_BLOB * len(tx.message.blob_versioned_hashes) + +def get_data_gasprice(header: Header) -> int: return fake_exponential( MIN_GASPRICE_PER_BLOB, header.excess_blobs, @@ -301,6 +296,7 @@ def get_blob_gas(header: Header) -> int: ) ``` +The actual `data_fee` as calculated via `calc_data_fee` is deducted from the sender balance before transaction execution, and is not refunded in case of transaction failure. ### Networking @@ -416,15 +412,15 @@ allowing the point verification precompile to work with the new format. Rollups would not have to make any EVM-level changes to how they work; sequencers would simply have to switch over to using a new transaction type at the appropriate time. -### Blob gasprice update rule +### Data gasprice update rule -The blob gasprice update rule is intended to approximate the formula `blob_gas = 2**(excess_blobs / GASPRICE_UPDATE_FRACTION_PER_BLOB)`, +The data gasprice update rule is intended to approximate the formula `data_gasprice = MIN_DATA_GASPRICE * e**(excess_blobs / DATA_GASPRICE_UPDATE_FRACTION)`, where `excess_blobs` is the total "extra" number of blobs that the chain has accepted relative to the "targeted" number (`TARGET_BLOBS_PER_BLOCK` per block). -Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `blob_gas` increases exponentially, reducing usage and eventually forcing the excess back down. +Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `data_gasprice` increases exponentially, reducing usage and eventually forcing the excess back down. The block-by-block behavior is roughly as follows. -If in block `N`, `blob_gas = G1`, and block `N` has `X` blobs, then in block `N+1`, `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`, -and so the `blob_gas` of block `N+1` increases by a factor of `2**((X - TARGET_BLOBS_PER_BLOCK) / GASPRICE_UPDATE_FRACTION_PER_BLOB)`. +If in block `N`, `data_gasprice = G1`, and block `N` has `X` blobs, then in block `N+1`, `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`, +and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 10% per block. From e8e3c641846f9ea25ecf2a6db7581b0c8f3f9ce6 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:17:22 +0200 Subject: [PATCH 08/27] add max_fee_per_data_gas field and validity conditions --- EIPS/eip-4844.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 91858222e19404..ecd7d8b062c6e8 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -128,6 +128,7 @@ class BlobTransaction(Container): value: uint256 data: ByteList[MAX_CALLDATA_SIZE] access_list: List[AccessTuple, MAX_ACCESS_LIST_SIZE] + max_fee_per_data_gas: uint256 blob_versioned_hashes: List[VersionedHash, MAX_VERSIONED_HASHES_LIST_SIZE] class AccessTuple(Container): @@ -296,6 +297,22 @@ def get_data_gasprice(header: Header) -> int: ) ``` +The block validity conditions are modified to include data gas checks: + +``` +def validate_block(block: Block) -> None: + ... + + for tx in block.transactions: + ... + + # 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 + + # ensure that the user was willing to at least pay the current data gasprice + assert tx.message.max_fee_per_data_gas >= get_data_gasprice(parent(block).header) +``` + The actual `data_fee` as calculated via `calc_data_fee` is deducted from the sender balance before transaction execution, and is not refunded in case of transaction failure. ### Networking From 5f0c9b361305a38135158a996b86dda1429a2233 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:24:14 +0200 Subject: [PATCH 09/27] set reasonable MIN_DATA_GASPRICE --- 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 ecd7d8b062c6e8..55793ee6515c42 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,7 +47,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | -| `MIN_DATA_GASPRICE` | `1` | +| `MIN_DATA_GASPRICE` | `10**13` | | `DATA_GASPRICE_UPDATE_FRACTION` | `84` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | From add891974f739d39b108f67d21795f0d91342c01 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 14:28:28 +0200 Subject: [PATCH 10/27] fix naming --- 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 55793ee6515c42..dd140829897643 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -293,7 +293,7 @@ def get_data_gasprice(header: Header) -> int: return fake_exponential( MIN_GASPRICE_PER_BLOB, header.excess_blobs, - GASPRICE_UPDATE_FRACTION_PER_BLOB + DATA_GASPRICE_UPDATE_FRACTION ) ``` From e1cb10a6098ef2bb2d1d511911f1565a0e20c42f Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 15:13:36 +0200 Subject: [PATCH 11/27] Update EIPS/eip-4844.md Co-authored-by: protolambda --- 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 dd140829897643..3d6777cac1e8f4 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -299,7 +299,7 @@ def get_data_gasprice(header: Header) -> int: The block validity conditions are modified to include data gas checks: -``` +```python def validate_block(block: Block) -> None: ... From b99749b20b563882678fc4dcd3eebdf279463c9d Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 22 Sep 2022 15:15:48 +0200 Subject: [PATCH 12/27] remove redundant per-block blob limit info --- EIPS/eip-4844.md | 1 - 1 file changed, 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 3d6777cac1e8f4..4bcd0420a2c2d8 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -162,7 +162,6 @@ the `TransactionNetworkPayload` version of the transaction also includes `blobs` The execution layer verifies the wrapper validity against the inner `TransactionPayload` after signature verification as: - All hashes in `blob_versioned_hashes` must start with the byte `BLOB_COMMITMENT_VERSION_KZG` -- There may be at most `MAX_BLOBS_PER_BLOCK` blob commitments in any single transaction. - There may be at most `MAX_BLOBS_PER_BLOCK` 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]` From f27ae400dab230f10cb278e2bcef89c93e8bed9a Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 26 Sep 2022 14:33:06 +0200 Subject: [PATCH 13/27] Update EIPS/eip-4844.md Co-authored-by: dankrad --- 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 4bcd0420a2c2d8..3753ffcb94f5f9 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -290,7 +290,7 @@ def get_total_data_gas(tx: SignedBlobTransaction) -> int: def get_data_gasprice(header: Header) -> int: return fake_exponential( - MIN_GASPRICE_PER_BLOB, + MIN_DATA_GASPRICE, header.excess_blobs, DATA_GASPRICE_UPDATE_FRACTION ) From 1dce3291cb493d6830c1fd1b820ed3448c3c311a Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Fri, 30 Sep 2022 16:37:47 +0200 Subject: [PATCH 14/27] Apply suggestions from code review Co-authored-by: Danny Ryan --- EIPS/eip-4844.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 3753ffcb94f5f9..59de35d4a98776 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -274,12 +274,14 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: ### Gas price of blobs (Simplified version) +***WARNING:` This is only for testing*** + For early draft implementations, we simply change `get_blob_gas(parent)` to always return `SIMPLE_GAS_PER_BLOB`. ### Gas accounting (Full version) We introduce data gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559. -We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are charged for in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost). +We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost). ```python def calc_data_fee(tx: SignedBlobTransaction, parent: Header) -> int: @@ -435,7 +437,7 @@ where `excess_blobs` is the total "extra" number of blobs that the chain has acc Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `data_gasprice` increases exponentially, reducing usage and eventually forcing the excess back down. The block-by-block behavior is roughly as follows. -If in block `N`, `data_gasprice = G1`, and block `N` has `X` blobs, then in block `N+1`, `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`, +If block `N` contains `X` blobs, then in block `N+1` `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`, and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. From aec01607f8b187f7bd4fcf9612bee4b694790ece Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Fri, 30 Sep 2022 16:53:46 +0200 Subject: [PATCH 15/27] remove calldata mention from blob gas --- 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 59de35d4a98776..b03078abbd4a7d 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -281,7 +281,7 @@ For early draft implementations, we simply change `get_blob_gas(parent)` to alwa ### Gas accounting (Full version) We introduce data gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559. -We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. In the future this could be extended to also cover calldata (at a different relative gas cost). +We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. ```python def calc_data_fee(tx: SignedBlobTransaction, parent: Header) -> int: From df2886f4d7f14b2f2852d063b5d58834f98e22bf Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 22:36:26 +0200 Subject: [PATCH 16/27] Update EIPS/eip-4844.md Co-authored-by: Danny Ryan --- 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 b03078abbd4a7d..51f640ca8dc4f5 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -274,7 +274,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: ### Gas price of blobs (Simplified version) -***WARNING:` This is only for testing*** +***WARNING: This is only for testing*** For early draft implementations, we simply change `get_blob_gas(parent)` to always return `SIMPLE_GAS_PER_BLOB`. From 4ed2d023a8d3c425299b33bae4cbfdc04bb13c92 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 22:41:12 +0200 Subject: [PATCH 17/27] change update fraction to more closely approximate EIP-1559 --- EIPS/eip-4844.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 51f640ca8dc4f5..418fda4d29690f 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -48,7 +48,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | | `MIN_DATA_GASPRICE` | `10**13` | -| `DATA_GASPRICE_UPDATE_FRACTION` | `84` | +| `DATA_GASPRICE_UPDATE_FRACTION` | `68` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | | `MAX_ACCESS_LIST_SIZE` | `2**24` | @@ -441,7 +441,7 @@ If block `N` contains `X` blobs, then in block `N+1` `excess_blobs` increases by and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. -The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 10% per block. +The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 12.5% per block. ## Backwards Compatibility From 946ba9aec39662c1ffb20a3c0ac62aff17b9f025 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 22:52:12 +0200 Subject: [PATCH 18/27] charge 1 data gas per byte --- EIPS/eip-4844.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 418fda4d29690f..c84c2657e17b1f 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,7 +47,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | | `TARGET_BLOBS_PER_BLOCK` | `8` | -| `MIN_DATA_GASPRICE` | `10**13` | +| `MIN_DATA_GASPRICE` | `10**8` | | `DATA_GASPRICE_UPDATE_FRACTION` | `68` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | @@ -55,7 +55,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `MAX_ACCESS_LIST_STORAGE_KEYS` | `2**24` | | `MAX_TX_WRAP_KZG_COMMITMENTS` | `2**24` | | `LIMIT_BLOBS_PER_TX` | `2**24` | -| `DATA_GAS_PER_BLOB` | `1` | +| `DATA_GAS_PER_BLOB` | `2**17` | | `SIMPLE_GAS_PER_BLOB` | `120000` | | `HASH_OPCODE_BYTE` | `Bytes1(0x49)` | | `HASH_OPCODE_GAS` | `3` | From 5e1753bedcb1ea7ef92b62322b14fa808e8e1017 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 23:05:59 +0200 Subject: [PATCH 19/27] track excess data gas instead of excess blobs --- EIPS/eip-4844.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index c84c2657e17b1f..f0ed4468790acc 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -184,9 +184,9 @@ def get_origin(tx: SignedBlobTransaction) -> Address: ### Header extension -The current header encoding is extended with a new 256-bit unsigned integer field `excess_blobs`. This is the running -total of excess blobs included on chain since this EIP was activated. If the total number of blobs is below the -average, `excess_blobs` is capped at zero. +The current header encoding is extended with a new 256-bit unsigned integer field `excess_data_gas`. This is the running +total of excess data gas consumed on chain since this EIP was activated. If the total amount of data gas is below the +target, `excess_data_gas` is capped at zero. The resulting RLP encoding of the header is therefore: @@ -208,18 +208,19 @@ rlp([ mix_digest, nonce, base_fee, - excess_blobs + excess_data_gas ]) ``` -The value of `excess_blobs` can be calculated using the parent header and number of blobs in the block. +The value of `excess_data_gas` can be calculated using the parent header and number of blobs in the block. ```python -def calc_excess_blobs(parent: Header, new_blobs: int) -> int: - if parent.excess_blobs + new_blobs < TARGET_BLOBS_PER_BLOCK: +def calc_excess_data_gas(parent: Header, new_blobs: int) -> int: + consumed_data_gas = new_blobs * DATA_GAS_PER_BLOB + if parent.excess_data_gas + consumed_data_gas < TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB: return 0 else: - return parent.excess_blobs + new_blobs - TARGET_BLOBS_PER_BLOCK + return parent.excess_data_gas + consumed_data_gas - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB ``` ### Beacon chain validation @@ -281,7 +282,7 @@ For early draft implementations, we simply change `get_blob_gas(parent)` to alwa ### Gas accounting (Full version) We introduce data gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559. -We use the `excess_blobs` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. +We use the `excess_data_gas` header field to store persistent data needed to compute the data gas price. For now, only blobs are priced in data gas. ```python def calc_data_fee(tx: SignedBlobTransaction, parent: Header) -> int: @@ -293,7 +294,7 @@ def get_total_data_gas(tx: SignedBlobTransaction) -> int: def get_data_gasprice(header: Header) -> int: return fake_exponential( MIN_DATA_GASPRICE, - header.excess_blobs, + header.excess_data_gas, DATA_GASPRICE_UPDATE_FRACTION ) ``` @@ -432,13 +433,13 @@ sequencers would simply have to switch over to using a new transaction type at t ### Data gasprice update rule -The data gasprice update rule is intended to approximate the formula `data_gasprice = MIN_DATA_GASPRICE * e**(excess_blobs / DATA_GASPRICE_UPDATE_FRACTION)`, -where `excess_blobs` is the total "extra" number of blobs that the chain has accepted relative to the "targeted" number (`TARGET_BLOBS_PER_BLOCK` per block). +The data gasprice update rule is intended to approximate the formula `data_gasprice = MIN_DATA_GASPRICE * e**(excess_data_gas / DATA_GASPRICE_UPDATE_FRACTION)`, +where `excess_data_gas` is the total "extra" amount of data gas that the chain has consumed relative to the "targeted" number (`TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB` per block). Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `data_gasprice` increases exponentially, reducing usage and eventually forcing the excess back down. The block-by-block behavior is roughly as follows. -If block `N` contains `X` blobs, then in block `N+1` `excess_blobs` increases by `X - TARGET_BLOBS_PER_BLOCK`, -and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. +If block `N` consumes `X` data gas, then in block `N+1` `excess_data_gas` increases by `X - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB`, +and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 12.5% per block. From 118b91d081161980b1bb301019d895a00ddbc2d2 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 23:12:29 +0200 Subject: [PATCH 20/27] move target from blobs to data gas --- EIPS/eip-4844.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index f0ed4468790acc..144ab9816d8904 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -46,7 +46,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_ADDRESS` | `Bytes20(0x14)` | | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_BLOBS_PER_BLOCK` | `16` | -| `TARGET_BLOBS_PER_BLOCK` | `8` | +| `TARGET_DATA_GAS_PER_BLOCK` | `2**20` | | `MIN_DATA_GASPRICE` | `10**8` | | `DATA_GASPRICE_UPDATE_FRACTION` | `68` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | @@ -217,10 +217,10 @@ The value of `excess_data_gas` can be calculated using the parent header and num ```python def calc_excess_data_gas(parent: Header, new_blobs: int) -> int: consumed_data_gas = new_blobs * DATA_GAS_PER_BLOB - if parent.excess_data_gas + consumed_data_gas < TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB: + if parent.excess_data_gas + consumed_data_gas < TARGET_DATA_GAS_PER_BLOCK: return 0 else: - return parent.excess_data_gas + consumed_data_gas - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB + return parent.excess_data_gas + consumed_data_gas - TARGET_DATA_GAS_PER_BLOCK ``` ### Beacon chain validation @@ -434,12 +434,12 @@ sequencers would simply have to switch over to using a new transaction type at t ### Data gasprice update rule The data gasprice update rule is intended to approximate the formula `data_gasprice = MIN_DATA_GASPRICE * e**(excess_data_gas / DATA_GASPRICE_UPDATE_FRACTION)`, -where `excess_data_gas` is the total "extra" amount of data gas that the chain has consumed relative to the "targeted" number (`TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB` per block). +where `excess_data_gas` is the total "extra" amount of data gas that the chain has consumed relative to the "targeted" number (`TARGET_DATA_GAS_PER_BLOCK` per block). Like EIP-1559, it's a self-correcting formula: as the excess goes higher, the `data_gasprice` increases exponentially, reducing usage and eventually forcing the excess back down. The block-by-block behavior is roughly as follows. -If block `N` consumes `X` data gas, then in block `N+1` `excess_data_gas` increases by `X - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB`, -and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_BLOBS_PER_BLOCK * DATA_GAS_PER_BLOB) / DATA_GASPRICE_UPDATE_FRACTION)`. +If block `N` consumes `X` data gas, then in block `N+1` `excess_data_gas` increases by `X - TARGET_DATA_GAS_PER_BLOCK`, +and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_DATA_GAS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 12.5% per block. From e01fe36fba9884c94e5bf4619c35d2314fa58e70 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Wed, 5 Oct 2022 23:17:15 +0200 Subject: [PATCH 21/27] move limit from blobs to data gas --- EIPS/eip-4844.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 144ab9816d8904..85ed2ae5d3ee3a 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -45,7 +45,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `BLOB_COMMITMENT_VERSION_KZG` | `Bytes1(0x01)` | | `POINT_EVALUATION_PRECOMPILE_ADDRESS` | `Bytes20(0x14)` | | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | -| `MAX_BLOBS_PER_BLOCK` | `16` | +| `MAX_DATA_GAS_PER_BLOCK` | `2**21` | | `TARGET_DATA_GAS_PER_BLOCK` | `2**20` | | `MIN_DATA_GASPRICE` | `10**8` | | `DATA_GASPRICE_UPDATE_FRACTION` | `68` | @@ -162,7 +162,7 @@ the `TransactionNetworkPayload` version of the transaction also includes `blobs` The execution layer verifies the wrapper validity against the inner `TransactionPayload` after signature verification as: - All hashes in `blob_versioned_hashes` must start with the byte `BLOB_COMMITMENT_VERSION_KZG` -- There may be at most `MAX_BLOBS_PER_BLOCK` total blob commitments in a valid block. +- 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 From 94d6b2c46955f9e5ecd803aedde5cc5fb5630519 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Thu, 6 Oct 2022 11:23:39 -0500 Subject: [PATCH 22/27] adjust update fraction for excess data gas tracking --- 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 85ed2ae5d3ee3a..a6bcb0e05d68cc 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -48,7 +48,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `MAX_DATA_GAS_PER_BLOCK` | `2**21` | | `TARGET_DATA_GAS_PER_BLOCK` | `2**20` | | `MIN_DATA_GASPRICE` | `10**8` | -| `DATA_GASPRICE_UPDATE_FRACTION` | `68` | +| `DATA_GASPRICE_UPDATE_FRACTION` | `8902606` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | | `MAX_ACCESS_LIST_SIZE` | `2**24` | From 27e719c160ec6a2d7ad7a4f96118089d63524a9a Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Tue, 25 Oct 2022 12:38:44 -0300 Subject: [PATCH 23/27] clarify update fraction rationale --- 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 a6bcb0e05d68cc..ced5a11053ab76 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -442,7 +442,7 @@ If block `N` consumes `X` data gas, then in block `N+1` `excess_data_gas` increa and so the `data_gasprice` of block `N+1` increases by a factor of `e**((X - TARGET_DATA_GAS_PER_BLOCK) / DATA_GASPRICE_UPDATE_FRACTION)`. Hence, it has a similar effect to the existing EIP-1559, but is more "stable" in the sense that it responds in the same way to the same total usage regardless of how it's distributed. -The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of 12.5% per block. +The parameter `DATA_GASPRICE_UPDATE_FRACTION` controls the maximum rate of change of the blob gas price. It is chosen to target a maximum change rate of `e(TARGET_DATA_GAS_PER_BLOCK / DATA_GASPRICE_UPDATE_FRACTION) ≈ 1.125` per block. ## Backwards Compatibility From e86a1799d3246541594ca91657b23d61f67326ad Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 31 Oct 2022 12:15:39 -0300 Subject: [PATCH 24/27] set min data gasprice to 1 --- 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 ced5a11053ab76..afaee51b37d407 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -47,7 +47,7 @@ Compared to full data sharding, this EIP has a reduced cap on the number of thes | `POINT_EVALUATION_PRECOMPILE_GAS` | `50000` | | `MAX_DATA_GAS_PER_BLOCK` | `2**21` | | `TARGET_DATA_GAS_PER_BLOCK` | `2**20` | -| `MIN_DATA_GASPRICE` | `10**8` | +| `MIN_DATA_GASPRICE` | `1` | | `DATA_GASPRICE_UPDATE_FRACTION` | `8902606` | | `MAX_VERSIONED_HASHES_LIST_SIZE` | `2**24` | | `MAX_CALLDATA_SIZE` | `2**24` | From bc93ac39eb90ef8ae4b880b2c337437a898b45cd Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 31 Oct 2022 12:36:38 -0300 Subject: [PATCH 25/27] clarify fee burn --- 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 afaee51b37d407..7cc7d3c964cd92 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -315,7 +315,7 @@ def validate_block(block: Block) -> None: assert tx.message.max_fee_per_data_gas >= get_data_gasprice(parent(block).header) ``` -The actual `data_fee` as calculated via `calc_data_fee` is deducted from the sender balance before transaction execution, and is not refunded in case of transaction failure. +The actual `data_fee` as calculated via `calc_data_fee` is deducted from the sender balance before transaction execution and burned, and is not refunded in case of transaction failure. ### Networking From c4ecf05400d349981e9a07aff6f2baf990bea444 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 31 Oct 2022 13:16:05 -0300 Subject: [PATCH 26/27] update mempool issues section --- EIPS/eip-4844.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 7cc7d3c964cd92..4e6a0b04455672 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -454,17 +454,12 @@ instead, they go into the `BeaconBlockBody`. This means that there is now a part ### Mempool issues -Blob transactions are unique in that they have a variable intrinsic gas cost. Hence, a transaction that could be included in one block may be invalid for the next. -To prevent mempool attacks, we recommend a simple technique: only propagate transactions whose `gas` is at least twice the current minimum. - -Additionally, blob transactions have a large data size at the mempool layer, which poses a mempool DoS risk, +Blob transactions have a large data size at the mempool layer, which poses a mempool DoS risk, though not an unprecedented one as this also applies to transactions with large amounts of calldata. -The risk is that an attacker makes and publishes a series of large blob transactions with fees `f9 > f8 > ... > f1`, -where each fee is the 10% minimum increment higher than the previous, and finishes it off with a 21000-gas basic transaction with fee `f10`. -Hence, an attacker could impose millions of gas worth of load on the network and only pay 21000 gas worth of fees. -We recommend a simple solution: both for blob transactions and for transactions carrying a large amount of calldata, -increase the minimum increment for mempool replacement from 1.1x to 2x, decreasing the number of resubmissions an attacker can do at any given fee level by ~7x. +We recommend two solutions: +- include a 1.1x (or potentially higher) data gasprice bump requirement to the mempool replacement rules +- modify the Ethereum Wire Protocol to stop automatically broadcasting large transactions ## Test Cases From 9638cfe04dc7259b0f1fe0e2594a9fdb3304ba32 Mon Sep 17 00:00:00 2001 From: Ansgar Dietrichs Date: Mon, 31 Oct 2022 18:18:26 -0300 Subject: [PATCH 27/27] fix linting --- EIPS/eip-4844.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-4844.md b/EIPS/eip-4844.md index 4e6a0b04455672..d54c92ab90772a 100644 --- a/EIPS/eip-4844.md +++ b/EIPS/eip-4844.md @@ -275,7 +275,7 @@ def point_evaluation_precompile(input: Bytes) -> Bytes: ### Gas price of blobs (Simplified version) -***WARNING: This is only for testing*** +___WARNING: This is only for testing___ For early draft implementations, we simply change `get_blob_gas(parent)` to always return `SIMPLE_GAS_PER_BLOB`. @@ -458,6 +458,7 @@ Blob transactions have a large data size at the mempool layer, which poses a mem though not an unprecedented one as this also applies to transactions with large amounts of calldata. We recommend two solutions: + - include a 1.1x (or potentially higher) data gasprice bump requirement to the mempool replacement rules - modify the Ethereum Wire Protocol to stop automatically broadcasting large transactions