mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-29 08:03:48 +00:00
feat(miner): move TAIKO_MIN_TIP check to commitL2Transactions (#272)
This commit is contained in:
parent
aa70708a69
commit
f3a7fb6311
2 changed files with 18 additions and 16 deletions
|
|
@ -22,7 +22,6 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
|
|
@ -100,21 +99,8 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
|||
return core.ErrTipAboveFeeCap
|
||||
}
|
||||
// CHANGE(taiko): check gasFeeCap.
|
||||
if os.Getenv("TAIKO_TEST") == "" {
|
||||
if os.Getenv("TAIKO_MIN_TIP") != "" {
|
||||
minTip, err := strconv.Atoi(os.Getenv("TAIKO_MIN_TIP"))
|
||||
if err != nil {
|
||||
log.Error("Failed to parse TAIKO_MIN_TIP", "err", err)
|
||||
} else {
|
||||
if tx.GasTipCapIntCmp(new(big.Int).SetUint64(uint64(minTip))) < 0 {
|
||||
return fmt.Errorf("max fee per gas is less than %d wei", minTip)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if tx.GasFeeCap().Cmp(common.Big0) == 0 {
|
||||
return errors.New("max fee per gas is 0")
|
||||
}
|
||||
}
|
||||
if os.Getenv("TAIKO_TEST") == "" && tx.GasFeeCap().Cmp(common.Big0) == 0 {
|
||||
return errors.New("max fee per gas is 0")
|
||||
}
|
||||
// Make sure the transaction is signed properly
|
||||
if _, err := types.Sender(signer, tx); err != nil {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/beacon/engine"
|
||||
|
|
@ -261,6 +263,20 @@ func (w *worker) commitL2Transactions(
|
|||
txs.Pop()
|
||||
continue
|
||||
}
|
||||
|
||||
if os.Getenv("TAIKO_MIN_TIP") != "" {
|
||||
minTip, err := strconv.Atoi(os.Getenv("TAIKO_MIN_TIP"))
|
||||
if err != nil {
|
||||
log.Error("Failed to parse TAIKO_MIN_TIP", "err", err)
|
||||
} else {
|
||||
if tx.GasTipCapIntCmp(new(big.Int).SetUint64(uint64(minTip))) < 0 {
|
||||
log.Trace("Ignoring transaction with low tip", "hash", tx.Hash(), "tip", tx.GasTipCap(), "minTip", minTip)
|
||||
txs.Pop()
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Error may be ignored here. The error has already been checked
|
||||
// during transaction acceptance is the transaction pool.
|
||||
from, _ := types.Sender(env.signer, tx)
|
||||
|
|
|
|||
Loading…
Reference in a new issue