-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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 setcode tx validation into legacyPool #31209
base: master
Are you sure you want to change the base?
Conversation
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.
The changes look correct to me, but not sure I understand the motivation in the PR?
We have a mechanism for defining tx validation checks that is currently used by both pools. Not every method is implemented by both pools, e.g. FirstNonceGap
is not implemented by the legacy pool. KnownConflicts
is similar where it is optional for pools to implement and so only the legacy pool implements it.
If we go through this PR, we also need to change the comment for UsedAndLeftSlots
because it is currently listed as "mandatory" for pools to implement.
authorization conflict checks are now performed regardless
of whether the transaction is a replacement or not.
could you point out this change for me also? having trouble seeing this in the diff
core/txpool/legacypool/legacypool.go
Outdated
exists = queue.Contains(tx.Nonce()) | ||
} | ||
} | ||
// Replace the existing inflight transaction for delegated accounts |
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.
// Replace the existing inflight transaction for delegated accounts | |
// Replace the existing in-flight transaction for delegated accounts |
core/txpool/legacypool/legacypool.go
Outdated
queue := pool.queue[from] | ||
if queue != nil { | ||
count += queue.Len() | ||
if !exists { |
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.
if !exists { | |
exists = queue.Contains(tx.Nonce()) || exists |
simpler ?
The primary motivation is to keep common validation as generic as possible and not to
It's true that legacyPool doesn't need to check the nonce gap. But it's the technical debt Checking nonce is a very common requirement, while auth conflict is very specific to
This |
Okay I see what you mean where Since you have already implemented I suppose we can just accept this. Once we fix the nits on this PR it can be merged. |
Yep, we should definitely fix the @fjl How do you feel about the changes of relocating the setcode-tx specific validations to the legacypool? Would be nice to have some inputs from your side |
1168004
to
8d562a4
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.
LGTM - will give Felix a couple days in case he wants to weigh in
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.
LGTM, but I agree with @lightclient that we should probably get rid of the validationOptionsWithState in favor of some code duplication since it isn't a great abstraction
In this PR, several improvements have been made:
Authorization-related validations have been moved to legacyPool.
Previously, these checks were part of the standard validation procedure,
which applies common validations across different pools. Since these
checks are specific to SetCode transactions, relocating them to legacyPool
is a more reasonable choice.
Additionally, authorization conflict checks are now performed regardless
of whether the transaction is a replacement or not.