Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(miner): move TAIKO_MIN_TIP check to commitL2Transactions #272

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"math/big"
"os"
"strconv"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 16 additions & 0 deletions miner/taiko_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"
"math/big"
"os"
"strconv"
"time"

"github.com/ethereum/go-ethereum/beacon/engine"
Expand Down Expand Up @@ -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)
Expand Down
Loading