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

Allow Custom Gas Price Configurations Greater Than Default Limits #1463

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vinayak0035
Copy link

PR Description:

This PR introduces a change that allows custom gas price configurations to be set to values greater than the default price limits :

  1. Core/Txpool/Legacypool (legacypool.go)
  2. Eth/Backend (backend.go)
  3. Eth/GasPrice (gasprice.go)

Problem Addressed:

Previously, when setting a gas price limit or price threshold, values greater than the default price would be overridden by the default. This PR removes that restriction, enabling users to configure values greater than the default limit.

Example:

If the default price limit is set to 25 Gwei and you want to configure the price to 30 Gwei, the updated code will now respect your configuration:

"PriceLimit": 30

In the previous behavior, this would have been automatically reset to 25 Gwei. With this update, you can now use 30 Gwei without it being overridden by the default value.

Code Changes:

1. Core/Txpool/Legacypool (legacypool.go)

// PIP-35: Enforce min price limit to 25 gwei
if conf.PriceLimit < params.BorDefaultTxPoolPriceLimit {
    log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", DefaultConfig.PriceLimit)
    conf.PriceLimit = DefaultConfig.PriceLimit
}

2. Eth/Backend (backend.go)

// PIP-35: Enforce min gas price to 25 gwei
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(big.NewInt(params.BorDefaultMinerGasPrice)) < 0 {
    log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
    config.Miner.GasPrice = ethconfig.Defaults.Miner.GasPrice
}

3. Eth/GasPrice (gasprice.go)

// PIP-35: Enforce the ignore price to 25 gwei
ignorePrice := params.IgnorePrice
if ignorePrice == nil || ignorePrice.Int64() < DefaultIgnorePrice.Int64() {
    ignorePrice = DefaultIgnorePrice
    log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
} else {
    log.Info("Gasprice oracle is ignoring threshold set", "threshold", ignorePrice)
}

Summary:

This update ensures that gas price configurations are no longer restricted to default values when set higher, allowing greater flexibility for users who need to adjust their gas price limits and thresholds.

@petejkim
Copy link

petejkim commented Feb 28, 2025

Why would we want this? This limitation was added so that transactions don't get stuck due to being underpriced.

Previously, the recommended setting was 30 Gwei, but some validators didn't have that setting, messing up suggested gas prices and making transactions with gas price <30Gwei (often set automatically by the wallet while a validator not enforcing the limit is validating) get stuck waiting once a validator that enforces the limit starts validating.

Having a consistent gas price across all validators is extremely important for the UX.

If you need this in Shibarium, you can have it in your fork, but this should not be merged into upstream Bor.

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

Successfully merging this pull request may close these issues.

2 participants