refactor(eth): remove duplicated chain config source #19344#2177
refactor(eth): remove duplicated chain config source #19344#2177gzliudan wants to merge 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
Drop Ethereum.chainConfig and consistently read chain configuration from blockchain.Config() to avoid dual sources of truth. Changes include API/backend call sites and DebugAPI constructor cleanup. No functional behavior change is intended.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Removes the duplicated chainConfig field from the Ethereum struct, consolidating chain config access through blockchain.Config() to maintain a single source of truth.
Changes:
- Remove
Ethereum.chainConfigfield and update all references to use either the local variable (inNew()) orblockchain.Config() - Simplify
DebugAPIby removing its unusedconfigfield and the corresponding constructor parameter - Update
EthAPIBackendandEthereumAPImethods to read config fromblockchain.Config()
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| eth/backend.go | Remove chainConfig field from struct; use local var in New() and blockchain.Config() elsewhere |
| eth/api_debug.go | Remove unused config field from DebugAPI; simplify constructor |
| eth/api_backend.go | Replace eth.chainConfig with eth.blockchain.Config() |
| eth/api.go | Replace eth.chainConfig with eth.blockchain.Config() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed changes
Drop Ethereum.chainConfig and consistently read chain configuration from blockchain.Config() to avoid dual sources of truth.
Changes include API/backend call sites and DebugAPI constructor cleanup. No functional behavior change is intended.
Ref: ethereum#19344
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that