Skip to content

Commit 9854e22

Browse files
committed
feat: update L2 base fee formula (#951)
* update `CalcBaseFee` * update `TestCalcBaseFee` * update `TestStateProcessorErrors` * bump version * update threshold
1 parent 0c6436d commit 9854e22

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

consensus/misc/eip1559/eip1559_scroll.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
// Protocol-enforced maximum L2 base fee.
29-
// We would only go above this if L1 base fee hits 2164 Gwei.
29+
// We would only go above this if L1 base fee hits 2931 Gwei.
3030
const MaximumL2BaseFee = 10000000000
3131

3232
// VerifyEIP1559Header verifies some header attributes which were changed in EIP-1559,
@@ -53,11 +53,11 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
5353
// CalcBaseFee calculates the basefee of the header.
5454
func CalcBaseFee(config *params.ChainConfig, parent *types.Header, parentL1BaseFee *big.Int) *big.Int {
5555
l2SequencerFee := big.NewInt(1000000) // 0.001 Gwei
56-
provingFee := big.NewInt(47700000) // 0.0477 Gwei
56+
provingFee := big.NewInt(33700000) // 0.0337 Gwei
5757

58-
// L1_base_fee * 0.0046
58+
// L1_base_fee * 0.0034
5959
verificationFee := parentL1BaseFee
60-
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(46))
60+
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(34))
6161
verificationFee = new(big.Int).Div(verificationFee, big.NewInt(10000))
6262

6363
baseFee := big.NewInt(0)

consensus/misc/eip1559/eip1559_scroll_test.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,13 @@ func TestCalcBaseFee(t *testing.T) {
111111
parentL1BaseFee int64
112112
expectedL2BaseFee int64
113113
}{
114-
{0, 48700000},
115-
{1000000000, 53300000},
116-
{2000000000, 57900000},
117-
{100000000000, 508700000},
118-
{111111111111, 559811111},
119-
{2164000000000, 10000000000}, // cap at max L2 base fee
114+
{0, 34700000},
115+
{1000000000, 38100000},
116+
{2000000000, 41500000},
117+
{100000000000, 374700000},
118+
{111111111111, 412477777},
119+
{2164000000000, 7392300000},
120+
{2931000000000, 10000000000}, // cap at max L2 base fee
120121
}
121122
for i, test := range tests {
122123
if have, want := CalcBaseFee(config(), nil, big.NewInt(test.parentL1BaseFee)), big.NewInt(test.expectedL2BaseFee); have.Cmp(want) != 0 {

core/state_processor_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"math/big"
2222
"testing"
2323

24+
"github.com/holiman/uint256"
2425
"github.com/scroll-tech/go-ethereum/common"
2526
"github.com/scroll-tech/go-ethereum/common/math"
2627
"github.com/scroll-tech/go-ethereum/consensus"
@@ -34,7 +35,6 @@ import (
3435
"github.com/scroll-tech/go-ethereum/crypto"
3536
"github.com/scroll-tech/go-ethereum/params"
3637
"github.com/scroll-tech/go-ethereum/trie"
37-
"github.com/holiman/uint256"
3838
"golang.org/x/crypto/sha3"
3939
)
4040

0 commit comments

Comments
 (0)