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

EIP-1559 - Dynamic Base Fee #1843

Merged
merged 67 commits into from
Sep 26, 2024
Merged

EIP-1559 - Dynamic Base Fee #1843

merged 67 commits into from
Sep 26, 2024

Conversation

jewei1997
Copy link
Contributor

@jewei1997 jewei1997 commented Sep 5, 2024

Describe your changes and provide context

Implementation of a modified version of eip-1559. How it works is on every EndBlock, it will adjust the BaseFee based on the gas used in the current block. The target gas for the block is always half of the total block gas limit. There are 2 major ways our eip-1559 implementation diverges from Ethereum's:

  1. We don't burn the base fee. We will treat the base fee the same as the validator tip, so both the base fee and the validator tip will go to the validator of the block
  2. How much the base fee goes up or down is adjustable with the MaxDynamicBaseFeeUpwardAdjustment and MaxDynamicBaseFeeDownwardAdjustment parameters. We don't want to just blindly use the 12.5% used by Ethereum because has different block times and block gas limits.

Currently MaxDynamicBaseFeeUpwardAdjustment is set to 5% and MaxDynamicBaseFeeDownwardAdjustment is set to 1%, which means that base fee will go up at most 5% on a completely full block and down 1% on a completely empty block and will go up/down proportionally for everything in between (if block gas used is exactly half full, base fee will remain constant)

Testing performed to validate your change

unit tests
loadtest cluster under load and viewing changing gas prices

x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/module.go Fixed Show fixed Hide fixed
x/evm/module.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
x/evm/module.go Fixed Show fixed Hide fixed
x/evm/module.go Fixed Show fixed Hide fixed
testutil/keeper/evm.go Fixed Show fixed Hide fixed
@@ -34,6 +34,7 @@ func (k *Keeper) HandleInternalEVMCall(ctx sdk.Context, req *types.MsgInternalEV
if err != nil {
return nil, err
}
k.GetEVMAddressOrDefault(ctx, senderAddr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we duplicate this effort with the below line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a mistake--will remove

Copy link

codecov bot commented Sep 7, 2024

Codecov Report

Attention: Patch coverage is 75.65217% with 28 lines in your changes missing coverage. Please review.

Project coverage is 61.43%. Comparing base (71711a1) to head (5c0083f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
x/evm/keeper/fee.go 76.74% 6 Missing and 4 partials ⚠️
x/evm/keeper/replay.go 0.00% 6 Missing ⚠️
evmrpc/info.go 44.44% 5 Missing ⚠️
x/evm/module.go 50.00% 2 Missing and 1 partial ⚠️
x/evm/types/params.go 86.36% 2 Missing and 1 partial ⚠️
app/eth_replay.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1843      +/-   ##
==========================================
+ Coverage   61.20%   61.43%   +0.22%     
==========================================
  Files         261      263       +2     
  Lines       23147    23246      +99     
==========================================
+ Hits        14167    14281     +114     
+ Misses       7980     7960      -20     
- Partials     1000     1005       +5     
Flag Coverage Δ
61.43% <75.65%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/app.go 66.35% <100.00%> (+0.15%) ⬆️
evmrpc/block.go 73.02% <100.00%> (ø)
evmrpc/simulate.go 64.82% <100.00%> (ø)
x/evm/ante/fee.go 64.00% <100.00%> (ø)
x/evm/keeper/evm.go 68.38% <100.00%> (+0.20%) ⬆️
x/evm/keeper/keeper.go 48.55% <100.00%> (ø)
x/evm/keeper/msg_server.go 70.56% <100.00%> (+0.22%) ⬆️
x/evm/keeper/params.go 75.67% <100.00%> (+2.94%) ⬆️
x/evm/migrations/migrate_eip_1559_params.go 100.00% <100.00%> (ø)
x/evm/types/keys.go 23.25% <ø> (ø)
... and 6 more

... and 3 files with indirect coverage changes

x/evm/ante/fee.go Outdated Show resolved Hide resolved
x/evm/keeper/evm.go Outdated Show resolved Hide resolved
x/evm/keeper/evm.go Outdated Show resolved Hide resolved
x/evm/keeper/fee.go Outdated Show resolved Hide resolved
x/evm/keeper/keeper.go Outdated Show resolved Hide resolved
x/evm/module.go Outdated Show resolved Hide resolved
x/evm/keeper/fee.go Dismissed Show dismissed Hide dismissed
@jewei1997 jewei1997 enabled auto-merge (squash) September 26, 2024 02:09
x/evm/keeper/fee.go Fixed Show fixed Hide fixed
@jewei1997 jewei1997 merged commit 6e0cfe9 into main Sep 26, 2024
49 checks passed
@jewei1997 jewei1997 deleted the dynamic-gas-fee-eip-1559 branch September 26, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants