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

fix(sender): make sure gas price is above baseFee #1531

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.4.64"
var tag = "v4.4.65"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
15 changes: 14 additions & 1 deletion rollup/internal/controller/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,16 @@ func (s *Sender) SendConfirmation(cfm *Confirmation) {
func (s *Sender) getFeeData(target *common.Address, data []byte, sidecar *gethTypes.BlobTxSidecar, baseFee, blobBaseFee uint64, fallbackGasLimit uint64) (*FeeData, error) {
switch s.config.TxType {
case LegacyTxType:
return s.estimateLegacyGas(target, data, fallbackGasLimit)
feeData, err := s.estimateLegacyGas(target, data, fallbackGasLimit)
if err != nil {
return nil, err
}
baseFeeInt := new(big.Int).SetUint64(baseFee)
maxGasPrice := new(big.Int).SetUint64(s.config.MaxGasPrice)
if feeData.gasPrice.Cmp(baseFeeInt) < 0 && baseFeeInt.Cmp(maxGasPrice) <= 0 {
feeData.gasPrice = baseFeeInt
colinlyguo marked this conversation as resolved.
Show resolved Hide resolved
}
return feeData, nil
case DynamicFeeTxType:
if sidecar == nil {
return s.estimateDynamicGas(target, data, baseFee, fallbackGasLimit)
Expand Down Expand Up @@ -357,6 +366,10 @@ func (s *Sender) resubmitTransaction(tx *gethTypes.Transaction, baseFee, blobBas
originalGasPrice := tx.GasPrice()
gasPrice := new(big.Int).Mul(originalGasPrice, escalateMultipleNum)
gasPrice = new(big.Int).Div(gasPrice, escalateMultipleDen)
baseFeeInt := new(big.Int).SetUint64(baseFee)
if gasPrice.Cmp(baseFeeInt) < 0 {
gasPrice = baseFeeInt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may as well add a multiplier here? the drawback would be over-charging by the multiplier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gasPrice is already multiplied. if after being multiplied it's still below baseFee we should bump it. I prefer not to multiplying again here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the txn is submitted, and before it's included in a block, the block's base fee is updated by gas-oracle price update, the gas price will be < base fee again. same suspicion in another comment discussion.

}
if gasPrice.Cmp(maxGasPrice) > 0 {
gasPrice = maxGasPrice
}
Expand Down