-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Simplifying Base Fee Calculation #19160
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
Comments
My understanding is that the generalised base-fee formula for a blockchain with a variable block time should be: Where, I have some concerns with the provided examples:
|
I think you are right @AnshuJalan |
Given that We can also cap T_{parent} with a constant C to make sure when the protocol is halted for some reason, we do not push the base fee to zero. If |
@dantaik I tried to follow along your latest forumla as you mentioned that is implemented in that PR. So if we take this: Example:
Calculation: If i'm not wrong, this is the only scenario which is an edge case, cause coming blocks other than 0, is properly calculated.
Like:
|
Thank you @adaki2004 for doing the analysis, you are right about it. And I think in the PR, I actually used keep the base fee unchanged if the block time is zero.
Updated forumla should be: |
Given the following block sequence:
When calculating the base fee for block D, we should consider the combined gas used by both blocks B and C as the “parent gas used” (implemented by this PR), instead of just using block C’s gas usage. Otherwise, the gas used by block B would be incorrectly excluded from the base fee calculation. We can update the formula by replacing |
The formula above has one remaining issue: the base fee change denominator To address this, we introduce On Ethereum, where We then modify the base fee update formula as follows: Let’s evaluate how well this per-second adjustment (using Simulation Table
The result is a consistent ~12.6–12.7% total base fee increase over any 12-second interval, independent of block times. |
#19224 attempts to implement this improvement. |
Hmm, are you sure this is what we want/need ? For example there is a surge in demand for taiko blockspace and a preconfer simply batches a lot of blocks with same This would mean that numerator is very high for block To me, 1 block -> 1 parent is better (and simpler) too. |
Background
In Taiko, the L2 base fee is determined by the protocol contract within TaikoAnchor's anchor transactions. The current mathematical approach is a derivative of Vitalik's concept of using an AMM curve for base fee calculations. However, the existing smart contract implementation is intricate and challenging to comprehend.
Proposed Simplified Mathematics
Below is the Ethereum EIP-1559 formula, where Ethereum's gas target presumes a block time of 12 seconds:
To accommodate blockchains with variable block times, we can generalize the formula as follows:
It is crucial to recognize that this generalized formula incentivizes block builders to create larger blocks rather than splitting them into smaller ones, even when a portion of the base fee is given to the block builder. This can be demonstrated through the following example:
Example: Comparing One Large Block vs Two Smaller Ones
Consider a scenario where the parent block has a base fee of 100 gwei, a gas target of 10,000,000 gas, and a block time of 12 seconds.
Single Block Scenario
Total base fee collected: 112.5 gwei × 10,000,000 gas = 1,125,000,000 gwei
Split Block Scenario
Now, let's split this block into two smaller blocks with zero block time between them.
Block 1:
Base fee collected in first block: 106.25 gwei × 5,000,000 gas = 531,250,000 gwei
Block 2:
Base fee collected in second block: 112.89 gwei × 5,000,000 gas = 564,450,000 gwei
Comparison and Profitability Analysis
When a portion of the base fee is allocated to the block builder, creating a single larger block results in approximately 29,300,000 gwei more in base fees compared to splitting the gas usage into two smaller blocks. This indicates that block builders are naturally incentivized to create larger blocks to maximize their profits. While this aligns with network efficiency goals, it may discourage preconfirmation practices.
The text was updated successfully, but these errors were encountered: