ethereum / execution-specs

Specification for the Execution Layer. Tracking network upgrades.
Creative Commons Zero v1.0 Universal
832 stars 234 forks source link

Refactor base fee calculation #743

Closed gurukamath closed 1 year ago

gurukamath commented 1 year ago

What was wrong?

  1. The base fee calculation should be separated into its own function so that the t8n tool can call that function in order to derive the base_fee_per_gas from the parent block parameters.
  2. Currently, the fork block in Arrow Glacier and Gray Glacier forks has INITIAL_BASE_FEE as the base fee. This was originally meant to be true only in case of London.

Related to Issue #625

How was it fixed?

This commit performs refactors and simplifies the base fee calculation and also corrects the bug in Arrow Glacier and Gray Glacier.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 89.47% and project coverage change: +2.63 :tada:

Comparison is base (cebd3bc) 82.48% compared to head (8ca6d26) 85.11%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #743 +/- ## ========================================== + Coverage 82.48% 85.11% +2.63% ========================================== Files 570 570 Lines 31571 31557 -14 ========================================== + Hits 26040 26860 +820 + Misses 5531 4697 -834 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `85.11% <89.47%> (+2.63%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) | Coverage Δ | | |---|---|---| | [src/ethereum/arrow\_glacier/fork.py](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-c3JjL2V0aGVyZXVtL2Fycm93X2dsYWNpZXIvZm9yay5weQ==) | `57.19% <75.00%> (+6.82%)` | :arrow_up: | | [src/ethereum/gray\_glacier/fork.py](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-c3JjL2V0aGVyZXVtL2dyYXlfZ2xhY2llci9mb3JrLnB5) | `57.19% <75.00%> (+6.82%)` | :arrow_up: | | [src/ethereum/london/fork.py](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-c3JjL2V0aGVyZXVtL2xvbmRvbi9mb3JrLnB5) | `93.28% <100.00%> (+1.06%)` | :arrow_up: | | [src/ethereum/paris/fork.py](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-c3JjL2V0aGVyZXVtL3BhcmlzL2ZvcmsucHk=) | `94.23% <100.00%> (ø)` | | | [src/ethereum/shanghai/fork.py](https://codecov.io/gh/ethereum/execution-specs/pull/743?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum#diff-c3JjL2V0aGVyZXVtL3NoYW5naGFpL2ZvcmsucHk=) | `83.40% <100.00%> (ø)` | | ... and [40 files with indirect coverage changes](https://codecov.io/gh/ethereum/execution-specs/pull/743/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ethereum)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

gurukamath commented 1 year ago

Added the feature to derive base_fee_per_gas from parent in t8n