-
Notifications
You must be signed in to change notification settings - Fork 69
core/txpool: move some validation to outside of mutex #27006 #1858
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
core/txpool: move some validation to outside of mutex #27006 #1858
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 You can disable this status message by setting the ✨ 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 |
26d4be9 to
d63a860
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR optimizes transaction pool performance by moving non-state-dependent validation outside of the mutex lock. The validation logic is split into two functions: validateTxBasics (called without mutex) performs checks that don't require state access, while validateTx (called with mutex) handles state-dependent validation like balance and nonce checks.
Key changes:
- Converted
eip2718,eip1559, andcurrentMaxGasfields from plain types to atomic types for safe concurrent access - Split
validateTxintovalidateTxBasicsandvalidateTxto enable early validation without acquiring the mutex - Updated validation order: intrinsic gas and signature checks now happen before insufficient funds checks
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| core/txpool/txpool.go | Implements the performance optimization by converting fields to atomic types, splitting validation logic, and updating all access patterns to use atomic operations |
| core/txpool/txpool_test.go | Updates tests to reflect new validation order, improves error checking with errors.Is(), and updates function calls and atomic field access patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d63a860 to
3d16415
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed changes
Ref: ethereum#27006
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
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