From 04a42145c7eb23d3ac7fc405924283003fe590ca Mon Sep 17 00:00:00 2001 From: gajinder Date: Sat, 19 Oct 2024 18:46:51 +0530 Subject: [PATCH 1/3] Update EIP-7742: update the required EL headers and the gas fee mechanism --- EIPS/eip-7742.md | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/EIPS/eip-7742.md b/EIPS/eip-7742.md index db94f38a8880be..37d57bd71f7403 100644 --- a/EIPS/eip-7742.md +++ b/EIPS/eip-7742.md @@ -2,7 +2,7 @@ eip: 7742 title: Uncouple blob count between CL and EL description: Have CL verify blob maximum and have EL get target value from CL -author: Alex Stokes (@ralexstokes) +author: Alex Stokes (@ralexstokes), Gajinder Singh (@g11tech) discussions-to: https://ethereum-magicians.org/t/eip-7742-uncouple-blob-count-between-cl-and-el/20550 status: Review type: Standards Track @@ -61,20 +61,37 @@ to preserve the security of optimistic sync. ## Specification -### Block structure and validity +### EL Block structure and validity Upon activation of this EIP, execution clients **MUST** extend the header schema with an -additional 64-bit field: the `target_blob_count`. This value is set to the current target blob count. The Engine API -is modified along with this EIP to provide the `target_blob_count` with each payload and implementations can use this -value to correctly set the block header field. - -Validity of the `target_blob_count` is guaranteed from the consensus layer, much like how withdrawals are handled. - -When verifying a block, execution clients **MUST** ensure the target blob count in the block header matches the one +additional 64-bit field: the `target_blob_gas` and `max_bob_gas` to allow target to be dynamically upgraded against max by the CLs as well as to not have an assumed static max vs target relationship. + +Because the of the dynamic block target and max, the pricing mechanism will need to be modified from simple exponentiation of `excess_blob_gas`. It will be much simpler to now follow the block `base_fee` mechanism. So we retire `excess_blob_gas` mechanism and we introduce `blob_base_fee` as follows: + +```python + def calcBlockBlobBaseFee(parent: Header) + const blockExcessGas = abs(parent.blobGasUsed - parent.targetBlobGas) + # get update fraction that limits the gas update factor to <= 1.125 on either direction + # 3338477÷393216 = 8.49 + const blockUpdateFraction = ciel(max(parent.targetBlobGas, parent.maxBlobGas - parent.targetBlobGas) * 8.49) + const gasUpdateFactor = fakeExponential(1, blockExcessGas, blockUpdateFraction) + if(block.blobGasUsed >= block.targetBlobGas) + return parent.blobBaseFee * gasUpdateFactor + else + return max(ciel(parent.blobBaseFee/gasUpdateFactor), MIN_BLOB_BASE_FEE) + + def BuildBlock(...) + ... + const blobBaseFee = calcBlockBlobBaseFee(parent) + ... +``` + +Validity of the `target_blob_gas` and `max_bob_gas` is guaranteed from the consensus layer which specify `target_blob_count` and `max_blob_count`, much like how withdrawals are handled. + +When verifying a block, execution clients **MUST** ensure the target and max blob gas in the block header corresponds to the one provided by the consensus client. -For a genesis block with no existing parent, the value should be set according to the agreed specification for the -target blob count given by that genesis block's protocol rule set. +At hardfork transition, the `blob gas used` is set to the calculated in 4844 fashion from the parent post which the new mechanism kicks in. For a genesis block with no existing parent, one can just set it to `MIN_BLOB_BASE_FEE`. ### Block processing From aeecc7187e2e123bdc37f5b42b0fe73a47bde077 Mon Sep 17 00:00:00 2001 From: gajinder Date: Sat, 19 Oct 2024 20:28:10 +0530 Subject: [PATCH 2/3] update comment --- EIPS/eip-7742.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EIPS/eip-7742.md b/EIPS/eip-7742.md index 37d57bd71f7403..44e4e1c7a54c39 100644 --- a/EIPS/eip-7742.md +++ b/EIPS/eip-7742.md @@ -73,6 +73,8 @@ Because the of the dynamic block target and max, the pricing mechanism will need const blockExcessGas = abs(parent.blobGasUsed - parent.targetBlobGas) # get update fraction that limits the gas update factor to <= 1.125 on either direction # 3338477÷393216 = 8.49 + # ELs can cache this fraction for a pair of target and max as target max aren't expected to actually + # vary block by block const blockUpdateFraction = ciel(max(parent.targetBlobGas, parent.maxBlobGas - parent.targetBlobGas) * 8.49) const gasUpdateFactor = fakeExponential(1, blockExcessGas, blockUpdateFraction) if(block.blobGasUsed >= block.targetBlobGas) From a798f0ac2d60b613363741a84ae9833dff14debd Mon Sep 17 00:00:00 2001 From: gajinder Date: Sat, 19 Oct 2024 20:30:55 +0530 Subject: [PATCH 3/3] clarify --- EIPS/eip-7742.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-7742.md b/EIPS/eip-7742.md index 44e4e1c7a54c39..352e19e1a5422b 100644 --- a/EIPS/eip-7742.md +++ b/EIPS/eip-7742.md @@ -66,7 +66,7 @@ to preserve the security of optimistic sync. Upon activation of this EIP, execution clients **MUST** extend the header schema with an additional 64-bit field: the `target_blob_gas` and `max_bob_gas` to allow target to be dynamically upgraded against max by the CLs as well as to not have an assumed static max vs target relationship. -Because the of the dynamic block target and max, the pricing mechanism will need to be modified from simple exponentiation of `excess_blob_gas`. It will be much simpler to now follow the block `base_fee` mechanism. So we retire `excess_blob_gas` mechanism and we introduce `blob_base_fee` as follows: +Because the of the dynamic block target and max, the pricing update mechanism will need to be modified from simple exponentiation of `excess_blob_gas/BLOB_BASE_FEE_UPDATE_FRACTION`. It will be much simpler to now follow the block `base_fee` mechanism. So we retire `excess_blob_gas` mechanism and we introduce `blob_base_fee` as follows: ```python def calcBlockBlobBaseFee(parent: Header)