refactor(core): extract historical balance bypass rules#2283
refactor(core): extract historical balance bypass rules#2283gzliudan 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 refactors the “historical balance bypass” logic out of core/state_processor.go into a dedicated module, keeping the transaction application flow cleaner while preserving the bypass behavior, and adds targeted unit tests around bypass matching vs skipping.
Changes:
- Replace the inline historical-bypass table/logic in
ApplyTransactionWithEVMwith a call toapplyHistoricalBalanceBypass. - Introduce
core/state_processor_historical_bypass.gocontaining the bypass rules and application helper. - Add unit tests covering apply/skip scenarios for the historical bypass.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/state_processor.go | Removes the large inline bypass block and calls the extracted helper during tx application. |
| core/state_processor_historical_bypass.go | New dedicated bypass rules table and applyHistoricalBalanceBypass implementation. |
| core/state_processor_historical_bypass_test.go | New tests validating bypass application and expected skip behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move the historical balance bypass table and application logic out of state_processor.go into a dedicated file. Keep the state processing flow focused without changing the bypass behavior, and add focused tests for matching and non-matching historical rules.
e97da95 to
d6a38ad
Compare
Proposed changes
Move the historical balance bypass table and application logic out of state_processor.go into a dedicated file.
Keep the state processing flow focused without changing the bypass behavior, and add focused tests for matching and non-matching historical rules.
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