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

fix(protocol): refine EIP-1559 basefee calculation and gas excess adjustment in TaikoL2 #17871

Merged
merged 17 commits into from
Aug 6, 2024

Conversation

dantaik
Copy link
Contributor

@dantaik dantaik commented Aug 1, 2024

This PR introduces two changes to improve our implementation of the EIP-1559.

1. Refined EIP-1559 Base Fee Calculation

  • Previous: basefee = eth_qty(excess_gas_issued)
  • New: basefee = eth_qty(excess_gas_issued) / (TARGET * ADJUSTMENT_QUOTIENT)

This modification aligns our implementation more closely with Vitalik Buterin's proposal. While both approaches are functional, the new calculation allows for a more gradual adjustment of the base fee.

2. Gas Excess Adjustment in TaikoL2

Implemented a gas excess adjustment mechanism when TARGET * ADJUSTMENT_QUOTIENT in a block changes to keep the base fee the same. Without this mechanism, the base fee may spike, as demonstrated in the test_change_of_quotient_and_gips test.

3. Set 5m gas per second

Configured the L2 to issue 5 million gas per second (Ethereum issues 2.5 million gas per second which translates into 2.5*12=30 million block gas target).

@dantaik dantaik marked this pull request as ready for review August 1, 2024 07:48
Copy link

openzeppelin-code bot commented Aug 1, 2024

fix(protocol): refine EIP-1559 basefee calculation and gas excess adjustment in TaikoL2

Generated at commit: 585e5fee9b83ed64039783dbca0e8453ea807996

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
2
0
8
42
54
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@dantaik
Copy link
Contributor Author

dantaik commented Aug 2, 2024

Update:

@Brechtpd I updated this PR such that when (TARGET * ADJUSTMENT_QUOTIENT) changes, we adjust the value of parentGasExcess to maintain the same basefee value instead of setting parentGasExcess to zero.

@dantaik dantaik requested a review from Brechtpd August 2, 2024 04:46
@dantaik dantaik changed the title fix(protocol): refine EIP-1559 basefee calculation and gas excess reset in TaikoL2 fix(protocol): refine EIP-1559 basefee calculation and gas excess adjustment in TaikoL2 Aug 5, 2024
@dantaik dantaik requested a review from Brechtpd August 5, 2024 04:36
@dantaik dantaik merged commit 4470005 into bring_basefee_time_input_back Aug 6, 2024
4 checks passed
@dantaik dantaik deleted the Lib1559Math_testing branch August 6, 2024 03:31
dantaik added a commit that referenced this pull request Aug 6, 2024
…ustment in TaikoL2 (#17871)

Co-authored-by: dantaik <[email protected]>
Co-authored-by: Brecht Devos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants