miner: Account for L1 Info Deposit gas usage in the pending pool

This commit is contained in:
Joshua Gutow 2023-04-20 11:14:09 -07:00
parent 547f15be87
commit f856aea527

View File

@ -99,6 +99,11 @@ var (
var ( var (
evictionInterval = time.Minute // Time interval to check for evictable transactions evictionInterval = time.Minute // Time interval to check for evictable transactions
statsReportInterval = 8 * time.Second // Time interval to report transaction pool stats 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 ( var (
@ -1391,6 +1396,9 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
pool.currentState = statedb pool.currentState = statedb
pool.pendingNonces = newNoncer(statedb) pool.pendingNonces = newNoncer(statedb)
pool.currentMaxGas = newHead.GasLimit pool.currentMaxGas = newHead.GasLimit
if pool.chainconfig.IsOptimism() {
pool.currentMaxGas -= l1InfoGasOverhead
}
costFn := types.NewL1CostFunc(pool.chainconfig, statedb) costFn := types.NewL1CostFunc(pool.chainconfig, statedb)
pool.l1CostFn = func(dataGas types.RollupGasData, isDepositTx bool) *big.Int { pool.l1CostFn = func(dataGas types.RollupGasData, isDepositTx bool) *big.Int {