mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
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
This commit is contained in:
parent
bda20891ae
commit
d178b00fb2
5 changed files with 15 additions and 15 deletions
2
.github/workflows/semgrep.yml
vendored
2
.github/workflows/semgrep.yml
vendored
|
|
@ -14,7 +14,7 @@ name: Semgrep
|
||||||
jobs:
|
jobs:
|
||||||
semgrep:
|
semgrep:
|
||||||
name: semgrep/ci
|
name: semgrep/ci
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
permissions: {}
|
permissions: {}
|
||||||
env:
|
env:
|
||||||
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
|
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,12 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, parentL1BaseF
|
||||||
return big.NewInt(10000000) // 0.01 Gwei
|
return big.NewInt(10000000) // 0.01 Gwei
|
||||||
}
|
}
|
||||||
l2SequencerFee := big.NewInt(1000000) // 0.001 Gwei
|
l2SequencerFee := big.NewInt(1000000) // 0.001 Gwei
|
||||||
provingFee := big.NewInt(38200000) // 0.0382 Gwei
|
provingFee := big.NewInt(14680000) // 0.01468 Gwei
|
||||||
|
|
||||||
// L1_base_fee * 0.00017
|
// L1_base_fee * 0.000034
|
||||||
verificationFee := parentL1BaseFee
|
verificationFee := parentL1BaseFee
|
||||||
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(17))
|
verificationFee = new(big.Int).Mul(verificationFee, big.NewInt(34))
|
||||||
verificationFee = new(big.Int).Div(verificationFee, big.NewInt(100000))
|
verificationFee = new(big.Int).Div(verificationFee, big.NewInt(1000000))
|
||||||
|
|
||||||
baseFee := big.NewInt(0)
|
baseFee := big.NewInt(0)
|
||||||
baseFee.Add(baseFee, l2SequencerFee)
|
baseFee.Add(baseFee, l2SequencerFee)
|
||||||
|
|
|
||||||
|
|
@ -112,13 +112,13 @@ func TestCalcBaseFee(t *testing.T) {
|
||||||
parentL1BaseFee int64
|
parentL1BaseFee int64
|
||||||
expectedL2BaseFee int64
|
expectedL2BaseFee int64
|
||||||
}{
|
}{
|
||||||
{0, 39200000},
|
{0, 15680000},
|
||||||
{1000000000, 39370000},
|
{1000000000, 15714000},
|
||||||
{2000000000, 39540000},
|
{2000000000, 15748000},
|
||||||
{100000000000, 56200000},
|
{100000000000, 19080000},
|
||||||
{111111111111, 58088888},
|
{111111111111, 19457777},
|
||||||
{2164000000000, 407080000},
|
{2164000000000, 89256000},
|
||||||
{58592942000000, 10000000000}, // cap at max L2 base fee
|
{644149677419355, 10000000000}, // cap at max L2 base fee
|
||||||
}
|
}
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
if have, want := CalcBaseFee(config(), nil, big.NewInt(test.parentL1BaseFee)), big.NewInt(test.expectedL2BaseFee); have.Cmp(want) != 0 {
|
if have, want := CalcBaseFee(config(), nil, big.NewInt(test.parentL1BaseFee)), big.NewInt(test.expectedL2BaseFee); have.Cmp(want) != 0 {
|
||||||
|
|
|
||||||
|
|
@ -389,13 +389,13 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
txs: []*types.Transaction{
|
txs: []*types.Transaction{
|
||||||
mkDynamicCreationTx(0, 500000, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), tooBigInitCode[:]),
|
mkDynamicCreationTx(0, 500000, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), tooBigInitCode[:]),
|
||||||
},
|
},
|
||||||
want: "could not apply tx 0 [0xa31de6e26bd5ffba0ca91a2bc29fc2eaad6a6cfc5ad9ab6ffb69cac121e0125c]: max initcode size exceeded: code size 49153 limit 49152",
|
want: "could not apply tx 0 [0x9fff9d187a68f9dce9664475ed9a01a5178992f15b44ce88ee7b1129a183e6af]: max initcode size exceeded: code size 49153 limit 49152",
|
||||||
},
|
},
|
||||||
{ // ErrIntrinsicGas: Not enough gas to cover init code
|
{ // ErrIntrinsicGas: Not enough gas to cover init code
|
||||||
txs: []*types.Transaction{
|
txs: []*types.Transaction{
|
||||||
mkDynamicCreationTx(0, 54299, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), smallInitCode[:]),
|
mkDynamicCreationTx(0, 54299, common.Big0, misc.CalcBaseFee(config, genesis.Header(), parentL1BaseFee), smallInitCode[:]),
|
||||||
},
|
},
|
||||||
want: "could not apply tx 0 [0xf36b7d68cf239f956f7c36be26688a97aaa317ea5f5230d109bb30dbc8598ccb]: intrinsic gas too low: have 54299, want 54300",
|
want: "could not apply tx 0 [0x272eefb0eeb3b973e933ae5dba17e7ecf6bfded5ce358f2a78426153c247f677]: intrinsic gas too low: have 54299, want 54300",
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
block := GenerateBadBlock(genesis, ethash.NewFaker(), tt.txs, gspec.Config)
|
block := GenerateBadBlock(genesis, ethash.NewFaker(), tt.txs, gspec.Config)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor version component of the current release
|
VersionMinor = 8 // Minor version component of the current release
|
||||||
VersionPatch = 38 // Patch version component of the current release
|
VersionPatch = 39 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue