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

geth -pricelimit not very useful after EIP1559 #23837

Closed
Kzenox7 opened this issue Oct 30, 2021 · 5 comments · Fixed by #23855
Closed

geth -pricelimit not very useful after EIP1559 #23837

Kzenox7 opened this issue Oct 30, 2021 · 5 comments · Fixed by #23855

Comments

@Kzenox7
Copy link

Kzenox7 commented Oct 30, 2021

I'd like to raise a potential issue with the geth -pricelimit parameter and EIP1559.

From my observations it looks like this parameter only checks the value of MaxPriorityFeePerGas instead of something more useful like MaxFeePerGas. I believe that the -pricelimit is now fairly useless since MaxPriorityFeePerGas is almost always around 1 to 3 Gwei even though the total tx gas price could easily be 100+ Gwei.

Due to this behaviour I have set this parameter to 1 Gwei which causes the geth node to receive a huge amount of low gas pre-EIP1559 tx's that have been pending for months.

It is not in alignment with the way it works for pre-EIP1559 transactions.

@rjl493456442
Copy link
Member

It's an interesting issue! I mark it as triage to discuss with team.

@fjl
Copy link
Contributor

fjl commented Nov 4, 2021

The issue is: in TxPool, the value of -pricelimit is stored in the field gasPrice. We apply this check when validating incoming transactions:

go-ethereum/core/tx_pool.go

Lines 624 to 627 in 03bc8b7

// Drop non-local transactions under our own minimal accepted gas price or tip
if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 {
return ErrUnderpriced
}

However, we apply a different check when selecting transactions for mining:

go-ethereum/core/tx_pool.go

Lines 547 to 549 in 03bc8b7

if tx.EffectiveGasTipIntCmp(pool.gasPrice, pool.priced.urgent.baseFee) < 0 {
txs = txs[:i]
break

I think this issue could be resolved by making the check in validateTx also use the EffectiveGasTipIntCmp method.

@fjl fjl removed the status:triage label Nov 4, 2021
fjl added a commit to fjl/go-ethereum that referenced this issue Nov 4, 2021
The price limit is supposed to exclude transactions with too low fee
amount. Before EIP-1559, it was sufficient to check the limit against
the gas price of the transaction. After 1559, it is more complicated
because the concept of 'transaction gas price' does not really exist.

When mining, the price limit is used to exclude transactions below a
certain effective fee amount. This change makes it apply the same check
earlier, in tx validation. Transactions below the specified fee amount
cannot enter the pool.

Fixes ethereum#23837
karalabe pushed a commit that referenced this issue Nov 8, 2021
The price limit is supposed to exclude transactions with too low fee
amount. Before EIP-1559, it was sufficient to check the limit against
the gas price of the transaction. After 1559, it is more complicated
because the concept of 'transaction gas price' does not really exist.

When mining, the price limit is used to exclude transactions below a
certain effective fee amount. This change makes it apply the same check
earlier, in tx validation. Transactions below the specified fee amount
cannot enter the pool.

Fixes #23837
sidhujag pushed a commit to syscoin/go-ethereum that referenced this issue Nov 8, 2021
…3855)

The price limit is supposed to exclude transactions with too low fee
amount. Before EIP-1559, it was sufficient to check the limit against
the gas price of the transaction. After 1559, it is more complicated
because the concept of 'transaction gas price' does not really exist.

When mining, the price limit is used to exclude transactions below a
certain effective fee amount. This change makes it apply the same check
earlier, in tx validation. Transactions below the specified fee amount
cannot enter the pool.

Fixes ethereum#23837
@XWJACK
Copy link
Contributor

XWJACK commented Dec 7, 2021

The issue is: in TxPool, the value of -pricelimit is stored in the field gasPrice. We apply this check when validating incoming transactions:

go-ethereum/core/tx_pool.go

Lines 624 to 627 in 03bc8b7

// Drop non-local transactions under our own minimal accepted gas price or tip
if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 {
return ErrUnderpriced
}

However, we apply a different check when selecting transactions for mining:

go-ethereum/core/tx_pool.go

Lines 547 to 549 in 03bc8b7

if tx.EffectiveGasTipIntCmp(pool.gasPrice, pool.priced.urgent.baseFee) < 0 {
txs = txs[:i]
break

I think this issue could be resolved by making the check in validateTx also use the EffectiveGasTipIntCmp method.

pool.gasPrice is config by pricelimit.

gasPrice: new(big.Int).SetUint64(config.PriceLimit),

baseFee will always changed by tx pool . so if you do that, users will not able to send tx below baseFee rather than pricelimit. highly recommended revert this pr #23855.

baseFee *big.Int // heap should always be re-sorted after baseFee is changed

@fjl fjl reopened this Dec 7, 2021
@XWJACK
Copy link
Contributor

XWJACK commented Dec 7, 2021

may be we should using GasFeeCapIntCmp?

        // Drop non-local transactions under our own minimal accepted gas price or tip.
	if !local && tx.GasFeeCapIntCmp(pool.gasPrice) < 0 {
		return ErrUnderpriced
	}

// GasFeeCapIntCmp compares the fee cap of the transaction against the given fee cap.
func (tx *Transaction) GasFeeCapIntCmp(other *big.Int) int {
return tx.inner.gasFeeCap().Cmp(other)
}

gasFeeCap reference MaxFeePerGas
// GasFeeCap returns the fee cap per gas of the transaction.
func (tx *Transaction) GasFeeCap() *big.Int { return new(big.Int).Set(tx.inner.gasFeeCap()) }

@fjl
Copy link
Contributor

fjl commented Dec 7, 2021

Best if we keep discussion in the new issue #24079

@fjl fjl closed this as completed Dec 7, 2021
yongjun925 pushed a commit to DODOEX/go-ethereum that referenced this issue Dec 3, 2022
…3855)

The price limit is supposed to exclude transactions with too low fee
amount. Before EIP-1559, it was sufficient to check the limit against
the gas price of the transaction. After 1559, it is more complicated
because the concept of 'transaction gas price' does not really exist.

When mining, the price limit is used to exclude transactions below a
certain effective fee amount. This change makes it apply the same check
earlier, in tx validation. Transactions below the specified fee amount
cannot enter the pool.

Fixes ethereum#23837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants