Merge pull request #85 from ethereum-optimism/jg/l1_gas_overhead

miner: Account for L1 Info Deposit gas usage in the pending pool
This commit is contained in:
Joshua Gutow 2023-04-20 11:32:14 -07:00 committed by GitHub
commit 24ae687be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,6 +99,11 @@ var (
var (
evictionInterval = time.Minute // Time interval to check for evictable transactions
statsReportInterval = 8 * time.Second // Time interval to report transaction pool stats
// L1 Info Gas Overhead is the amount of gas the the L1 info deposit consumes.
// It is removed from the tx pool max gas to better indicate that L2 transactions
// are not able to consume all of the gas in a L2 block as the L1 info deposit is always present.
l1InfoGasOverhead = uint64(70_000)
)
var (
@ -1391,6 +1396,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
pool.currentState = statedb
pool.pendingNonces = newNoncer(statedb)
pool.currentMaxGas = newHead.GasLimit
if pool.chainconfig.IsOptimism() {
pool.currentMaxGas -= l1InfoGasOverhead
}
costFn := types.NewL1CostFunc(pool.chainconfig, statedb)
pool.l1CostFn = func(dataGas types.RollupGasData, isDepositTx bool) *big.Int {