From 85e248b93e9e491d1a13c0994c3c11041656a82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Tue, 9 Jul 2024 11:03:36 +0200 Subject: [PATCH 1/2] feat: update L2 base fee formula --- consensus/misc/eip1559.go | 12 ++++++------ consensus/misc/eip1559_test.go | 12 ++++++------ params/version.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/consensus/misc/eip1559.go b/consensus/misc/eip1559.go index 9a17bba51488..1e6b54389f86 100644 --- a/consensus/misc/eip1559.go +++ b/consensus/misc/eip1559.go @@ -25,7 +25,7 @@ import ( ) // Protocol-enforced maximum L2 base fee. -// We would only go above this if L1 base fee hits 700 Gwei. +// We would only go above this if L1 base fee hits 2164 Gwei. const MaximumL2BaseFee = 10000000000 // VerifyEip1559Header verifies some header attributes which were changed in EIP-1559, @@ -51,13 +51,13 @@ func VerifyEip1559Header(config *params.ChainConfig, parent, header *types.Heade // CalcBaseFee calculates the basefee of the header. func CalcBaseFee(config *params.ChainConfig, parent *types.Header, parentL1BaseFee *big.Int) *big.Int { - l2SequencerFee := big.NewInt(10000000) // 0.01 Gwei - provingFee := big.NewInt(140000000) // 0.14 Gwei + l2SequencerFee := big.NewInt(1000000) // 0.001 Gwei + provingFee := big.NewInt(47700000) // 0.0477 Gwei - // L1_base_fee * 0.014 + // L1_base_fee * 0.0046 verificationFee := parentL1BaseFee - verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(14)) - verificationFee = new(big.Int).Div(verificationFee, big.NewInt(1000)) + verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(46)) + verificationFee = new(big.Int).Div(verificationFee, big.NewInt(10000)) baseFee := big.NewInt(0) baseFee.Add(baseFee, l2SequencerFee) diff --git a/consensus/misc/eip1559_test.go b/consensus/misc/eip1559_test.go index 48dfabef54ad..9c1972eee2c7 100644 --- a/consensus/misc/eip1559_test.go +++ b/consensus/misc/eip1559_test.go @@ -112,12 +112,12 @@ func TestCalcBaseFee(t *testing.T) { parentL1BaseFee int64 expectedL2BaseFee int64 }{ - {0, 150000000}, - {1000000000, 164000000}, - {2000000000, 178000000}, - {100000000000, 1550000000}, - {111111111111, 1705555555}, - {1000000000000, 10000000000}, // cap at max L2 base fee + {0, 48700000}, + {1000000000, 53300000}, + {2000000000, 57900000}, + {100000000000, 508700000}, + {111111111111, 559811111}, + {2164000000000, 10000000000}, // cap at max L2 base fee } for i, test := range tests { if have, want := CalcBaseFee(config(), nil, big.NewInt(test.parentL1BaseFee)), big.NewInt(test.expectedL2BaseFee); have.Cmp(want) != 0 { diff --git a/params/version.go b/params/version.go index 20548857f702..d3bbaea7850c 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 5 // Minor version component of the current release - VersionPatch = 5 // Patch version component of the current release + VersionPatch = 6 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) From 363bfb6557bdd8d8288e4cce5c6b786d0ae7487e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Tue, 9 Jul 2024 11:15:57 +0200 Subject: [PATCH 2/2] update test tx hashes --- core/state_processor_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/state_processor_test.go b/core/state_processor_test.go index dd104d4ac763..950a03738cf0 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -360,13 +360,13 @@ func TestStateProcessorErrors(t *testing.T) { txs: []*types.Transaction{ mkDynamicCreationTx(0, 500000, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), tooBigInitCode[:]), }, - want: "could not apply tx 0 [0xa3d2dadf08846f3328b84b0a38240ace42f79c99ea4b9c097c8dcb345f61a84e]: max initcode size exceeded: code size 49153 limit 49152", + want: "could not apply tx 0 [0x13f95e090076d99bb91e3c61923b4ddfa270940363b282ac2d17ea07dada4aa4]: max initcode size exceeded: code size 49153 limit 49152", }, { // ErrIntrinsicGas: Not enough gas to cover init code txs: []*types.Transaction{ mkDynamicCreationTx(0, 54299, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), smallInitCode[:]), }, - want: "could not apply tx 0 [0x0880861c73bc504c01041b6d506737a119ca7c68c1fe666dc1682636b807c9db]: intrinsic gas too low: have 54299, want 54300", + want: "could not apply tx 0 [0x74d818187d75665003870481a53dc4bc938fe7ee79d24ebf941ca9042d8ef3ae]: intrinsic gas too low: have 54299, want 54300", }, } { block := GenerateBadBlock(genesis, ethash.NewFaker(), tt.txs, gspec.Config)