From ca8b4ed70f626f99d49ffe5f711833bf3acec03b Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Mon, 25 Mar 2024 18:07:57 +0900 Subject: [PATCH] Update kip-162 --- KIPs/kip-162.md | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/KIPs/kip-162.md b/KIPs/kip-162.md index d61b2a46..fe000a3b 100644 --- a/KIPs/kip-162.md +++ b/KIPs/kip-162.md @@ -198,33 +198,24 @@ def EffectiveGasPrice(header: Header, tx: Transaction): maxPriorityFeePerGas = tx.maxPriorityFeePerGas else: maxFeePerGas = tx.gasPrice - maxPriorityFeePerGas = tx.gasPrice + maxPriorityFeePerGas = tx.gasPrice # Option A + maxPriorityFeePerGas = 0 # Option B + maxPriorityFeePerGas = tx.maxPriorityFeePerGas # Option C (only for Klaytn tx types) return min(header.baseFeePerGas + maxPriorityFeePerGas, maxFeePerGas) ``` - **Option A**. Effective gas price is equal to `gasPrice`. The sender pays the full price as declared in the `gasPrice`. The transactions are reliably included in the blocks because this nonzero priority fee will make the transactions high priority. A side effect is that the senders either pay larger price than before, or has to precisely predict the base fee in order to save the gas fee. This policy is identical to [EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). - ```py - maxFeePerGas = tx.gasPrice - maxPriorityFeePerGas = tx.gasPrice - - effectiveGasPrice = min(header.baseFeePerGas + maxPriorityFeePerGas, maxFeePerGas) - = tx.gasPrice - ``` - **Option B**. Effective gas price is equal to `baseFeePerGas`. The sender pays the base fee regardless of the `gasPrice` field. The sender gets to pay what she had been paying today. The gas fee is still highly predictable. A side effect is that transactions might be delayed in the event of network congestion because the blocks will be filled with transactions paying nonzero priority fee. - ```py - maxFeePerGas = tx.gasPrice - maxPriorityFeePerGas = 0 - effectiveGasPrice = min(header.baseFeePerGas + maxPriorityFeePerGas, maxFeePerGas) - = header.baseFeePerGas - ``` +- **Option C (only applicable to Klaytn tx types)**. Add the transaction field `maxPriorityFeePerGas`. Either add an optional field to the existing type or define new tx types. The details are orthogonal to the current proposal. Effective price example. Prices are in 'ston' (1e-9). -| baseFeePerGas | transaction | EffectiveGasPrice | EffectivePriorityFeePerGas | +| baseFeePerGas | transaction | effectiveGasPrice | effectivePriorityFeePerGas | |-|-|-|-| | 25 | {type: 0, gasPrice: 51}, **Option A** | 51 | 26 | | 25 | {type: 0, gasPrice: 51}, **Option B** | 25 | 0 | +| 25 | {type: 8, gasPrice: 51, maxPriorityFeePerGas: 1}, **Option C** | 26 | 1 | | 25 | {type: 2, maxFeePerGas: 51, maxPriorityFeePerGas: 1} | 26 | 1 | @@ -232,15 +223,16 @@ Effective price example. Prices are in 'ston' (1e-9). ## Continued use of other transaction types +Depends on which of the options A,B,C we follow, but either way all transaction types should work. Legacy (type 0) transactions, EIP-2920 AccessList (type 1) transactions, and Klaytn transaction types (types 8+) will work and be included in blocks. Those transactions have `gasPrice` field but no `maxFeePerGas` nor `maxPriorityFeePerGas` fields. -TODO: choose option A or B - - Option A: Those transactions may experience sudden increase in gas costs because previously they only paid `baseFeePerGas` but now they have to pay `gasPrice`. To reduce the impact, `eth_gasPrice` implementations may return a number slightly higher than the `baseFeePerGas`. - Option B: Those transactions may experience delay in the event of congested network. However, since Klaytn has large block spaces and frequent block time, such a delay should be an exceptional event. +- Option C: SDKs and apps using the old format or existing type may experience delay because those transactions are considered zero priority fee. The ecosystem may upgrade to utilize the priority fee feature in Klaytn tx types. + ## EVM opcodes The `GASPRICE` (0x3a) opcode is backwards compatible because it had been correctly returning the effective gas price before `DRAGON_FORK_BLOCK_NUMBER`. The `BASEFEE` (0x48) opcode remains the same; returns the base fee per gas of the currently executing block.