Skip to content

feat(eth,miner): wire miner gas tip updates from RPC #28933#2136

Open
gzliudan wants to merge 2 commits intoXinFinOrg:dev-upgradefrom
gzliudan:fix-mining-gastip
Open

feat(eth,miner): wire miner gas tip updates from RPC #28933#2136
gzliudan wants to merge 2 commits intoXinFinOrg:dev-upgradefrom
gzliudan:fix-mining-gastip

Conversation

@gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Mar 5, 2026

Proposed changes

Synchronize miner gas tip updates across subsystems when RPC updates gas price.

  • update eth miner API to apply gas tip changes to both txpool and miner
  • add miner/worker SetGasTip path and initialize worker tip from config

Ref: ethereum#28933

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

Copilot AI review requested due to automatic review settings March 5, 2026 07:23
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0e90779c-1b98-4984-9546-df9f560aaf54

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Synchronizes miner gas tip (RPC miner_setGasPrice) updates across the txpool and miner, while refactoring mining configuration into a dedicated ethconfig.Config.Miner struct and removing the previous global gas limit target.

Changes:

  • Wire RPC gas price updates to both TxPool.SetGasTip and a new miner SetGasTip path.
  • Introduce miner.Config (Etherbase/ExtraData/GasCeil/GasPrice), migrate CLI + TOML config to ethconfig.Config.Miner, and sanitize miner config in eth.New.
  • Replace the removed params.TargetGasLimit usage with Miner.GasCeil in block building/tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
params/protocol_params.go Adjusts XDCGenesisGasLimit and removes TargetGasLimit global.
miner/worker.go Refactors worker to use miner.Config, adds tip storage and setter, updates tx commit call signature.
miner/miner.go Adds miner.Config + defaults; exposes Miner.SetGasTip.
eth/ethconfig/gen_config.go Updates TOML marshal/unmarshal to include Config.Miner.
eth/ethconfig/config.go Moves mining-related settings under Config.Miner; updates defaults and go:generate.
eth/backend.go Uses Config.Miner.* and adds sanitization for miner gas ceil/price.
eth/api_miner.go Updates RPC gas price setter to also notify the miner.
core/chain_makers.go Replaces TargetGasLimit usage with XDCGenesisGasLimit.
core/bench_test.go Replaces TargetGasLimit usage with XDCGenesisGasLimit.
console/console_test.go Updates test config construction to set Miner.Etherbase.
cmd/utils/flags.go Routes miner flags into cfg.Miner (new setMiner) and updates defaults.
cmd/XDC/main.go Removes runtime mutation of params.TargetGasLimit.
accounts/abi/bind/v2/util_test.go Adjusts test gas price offset to params.GWei.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gzliudan gzliudan force-pushed the fix-mining-gastip branch from fa6170e to 03e760e Compare March 5, 2026 08:05
gzliudan added 2 commits March 6, 2026 10:07
Miner configuration is unified under [Eth.Miner] (GasCeil/GasPrice/Etherbase/ExtraData), replacing legacy top-level [Eth] miner keys.

Operational impact: existing config files using [Eth].GasPrice/[Eth].Etherbase/[Eth].ExtraData must be migrated before upgrade.

Behavior update: gasprice=0 remains valid; only negative gas prices are sanitized at startup.

Default change: XDCGenesisGasLimit is reduced to 42,000,000 and now feeds miner default GasCeil (including default --miner-gaslimit), so nodes relying on defaults should review capacity expectations.
Synchronize miner gas tip updates across subsystems when RPC updates gas price.

- update eth miner API to apply gas tip changes to both txpool and miner
- add miner/worker SetGasTip path and initialize worker tip from config
- adjust bind util test to use params.GWei over base fee

Ref: ethereum#28933
@gzliudan gzliudan force-pushed the fix-mining-gastip branch from 03e760e to 533b383 Compare March 6, 2026 02:08
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