Skip to content

Commit d178b00

Browse files
authored
feat: update L2 base fee formula (#1169)
* feat: update L2 base fee formula * chore: auto version bump [bot] * fix: lint * fix: upgrade ci runner * update multiplier
1 parent bda2089 commit d178b00

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

.github/workflows/semgrep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ name: Semgrep
1414
jobs:
1515
semgrep:
1616
name: semgrep/ci
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-22.04
1818
permissions: {}
1919
env:
2020
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

consensus/misc/eip1559.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, parentL1BaseF
5555
return big.NewInt(10000000) // 0.01 Gwei
5656
}
5757
l2SequencerFee := big.NewInt(1000000) // 0.001 Gwei
58-
provingFee := big.NewInt(38200000) // 0.0382 Gwei
58+
provingFee := big.NewInt(14680000) // 0.01468 Gwei
5959

60-
// L1_base_fee * 0.00017
60+
// L1_base_fee * 0.000034
6161
verificationFee := parentL1BaseFee
62-
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(17))
63-
verificationFee = new(big.Int).Div(verificationFee, big.NewInt(100000))
62+
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(34))
63+
verificationFee = new(big.Int).Div(verificationFee, big.NewInt(1000000))
6464

6565
baseFee := big.NewInt(0)
6666
baseFee.Add(baseFee, l2SequencerFee)

consensus/misc/eip1559_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ func TestCalcBaseFee(t *testing.T) {
112112
parentL1BaseFee int64
113113
expectedL2BaseFee int64
114114
}{
115-
{0, 39200000},
116-
{1000000000, 39370000},
117-
{2000000000, 39540000},
118-
{100000000000, 56200000},
119-
{111111111111, 58088888},
120-
{2164000000000, 407080000},
121-
{58592942000000, 10000000000}, // cap at max L2 base fee
115+
{0, 15680000},
116+
{1000000000, 15714000},
117+
{2000000000, 15748000},
118+
{100000000000, 19080000},
119+
{111111111111, 19457777},
120+
{2164000000000, 89256000},
121+
{644149677419355, 10000000000}, // cap at max L2 base fee
122122
}
123123
for i, test := range tests {
124124
if have, want := CalcBaseFee(config(), nil, big.NewInt(test.parentL1BaseFee)), big.NewInt(test.expectedL2BaseFee); have.Cmp(want) != 0 {

core/state_processor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,13 @@ func TestStateProcessorErrors(t *testing.T) {
389389
txs: []*types.Transaction{
390390
mkDynamicCreationTx(0, 500000, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), tooBigInitCode[:]),
391391
},
392-
want: "could not apply tx 0 [0xa31de6e26bd5ffba0ca91a2bc29fc2eaad6a6cfc5ad9ab6ffb69cac121e0125c]: max initcode size exceeded: code size 49153 limit 49152",
392+
want: "could not apply tx 0 [0x9fff9d187a68f9dce9664475ed9a01a5178992f15b44ce88ee7b1129a183e6af]: max initcode size exceeded: code size 49153 limit 49152",
393393
},
394394
{ // ErrIntrinsicGas: Not enough gas to cover init code
395395
txs: []*types.Transaction{
396396
mkDynamicCreationTx(0, 54299, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), smallInitCode[:]),
397397
},
398-
want: "could not apply tx 0 [0xf36b7d68cf239f956f7c36be26688a97aaa317ea5f5230d109bb30dbc8598ccb]: intrinsic gas too low: have 54299, want 54300",
398+
want: "could not apply tx 0 [0x272eefb0eeb3b973e933ae5dba17e7ecf6bfded5ce358f2a78426153c247f677]: intrinsic gas too low: have 54299, want 54300",
399399
},
400400
} {
401401
block := GenerateBadBlock(genesis, ethash.NewFaker(), tt.txs, gspec.Config)

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 38 // Patch version component of the current release
27+
VersionPatch = 39 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)