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 #1376

Open
wants to merge 3 commits 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.

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.

1 participant