fix(core): refresh coinbase owner per transaction#2285
fix(core): refresh coinbase owner per transaction#2285gzliudan wants to merge 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
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
This PR fixes incorrect fee recipient behavior during block processing by ensuring the coinbase “owner” is resolved from state for each transaction (instead of being computed once before iterating the block’s transactions). This prevents fee credits from going to a stale owner if the owner mapping changes mid-block.
Changes:
- Move coinbase owner lookup into
ApplyTransactionWithEVMso it is refreshed per transaction. - Remove the now-unneeded
getCoinbaseOwnerhelper and adjust internal call sites accordingly. - Update unit tests to match the new
ApplyTransactionWithEVMfunction signature.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/state_processor.go | Computes coinbase owner inside ApplyTransactionWithEVM per-tx; removes helper; updates callers. |
| core/state_processor_test.go | Updates tests to call ApplyTransactionWithEVM with the new signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
62da702 to
971ebb3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
672da00 to
36fcd96
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem: block processing reused a coinbase owner value captured before the transaction loop, so fee credits could go to a stale owner when the owner mapping changed during execution. Cause: Process and ProcessBlockNoValidator computed coinbaseOwner once and passed it through ApplyTransactionWithEVM for every transaction in the block. Solution: move the owner lookup into ApplyTransactionWithEVM so each transaction reads the current owner from state, remove the unused helper, and update tests to the new function signature.
36fcd96 to
f39220b
Compare
Proposed changes
Problem: block processing reused a coinbase owner value captured before the transaction loop, so fee credits could go to a stale owner when the owner mapping changed during execution.
Cause: Process and ProcessBlockNoValidator computed coinbaseOwner once and passed it through ApplyTransactionWithEVM for every transaction in the block.
Solution: move the owner lookup into ApplyTransactionWithEVM so each transaction reads the current owner from state, remove the unused helper, and update tests to the new function signature.
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