-
Notifications
You must be signed in to change notification settings - Fork 20.9k
eth: add tx to locals only if it has a chance of acceptance #31618
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
Conversation
I don't like how the wrapping is implemented. It's way too complicated with the extra type. We can just add a function that checks if the error is temporary:
and then use this function in the RPC handler. The problem is just where this function should live. We can't have it in package I guess it could be in package |
core/txpool/locals/errors.go
Outdated
// reason to reject a transaction from being included in the txpool. The result | ||
// may change if the txpool's state changes later. | ||
func IsTemporaryReject(err error) bool { | ||
return legacypool.IsTemporaryReject(err) |
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.
It's kind of OK like this, but also still feels like too much indirection. We can just put the switch here.
@rjl493456442 I pushed a change to move the switch solely into |
I wanted to have this in package locals because the concept of temporary reject only matters in order to decide if something should be tracked in locals. |
…#31618) This pull request improves error handling for local transaction submissions. Specifically, if a transaction fails with a temporary error but might be accepted later, the error will not be returned to the user; instead, the transaction will be tracked locally for resubmission. However, if the transaction fails with a permanent error (e.g., invalid transaction or insufficient balance), the error will be propagated to the user. These errors returned in the legacyPool are regarded as temporary failure: - `ErrOutOfOrderTxFromDelegated` - `txpool.ErrInflightTxLimitReached` - `ErrAuthorityReserved` - `txpool.ErrUnderpriced` - `ErrTxPoolOverflow` - `ErrFutureReplacePending` Notably, InsufficientBalance is also treated as a permanent error, as it’s highly unlikely that users will transfer funds into the sender account after submitting the transaction. Otherwise, users may be confused—seeing their transaction submitted but unaware that the sender lacks sufficient funds—and continue waiting for it to be included. --------- Co-authored-by: lightclient <[email protected]>
…#31618) This pull request improves error handling for local transaction submissions. Specifically, if a transaction fails with a temporary error but might be accepted later, the error will not be returned to the user; instead, the transaction will be tracked locally for resubmission. However, if the transaction fails with a permanent error (e.g., invalid transaction or insufficient balance), the error will be propagated to the user. These errors returned in the legacyPool are regarded as temporary failure: - `ErrOutOfOrderTxFromDelegated` - `txpool.ErrInflightTxLimitReached` - `ErrAuthorityReserved` - `txpool.ErrUnderpriced` - `ErrTxPoolOverflow` - `ErrFutureReplacePending` Notably, InsufficientBalance is also treated as a permanent error, as it’s highly unlikely that users will transfer funds into the sender account after submitting the transaction. Otherwise, users may be confused—seeing their transaction submitted but unaware that the sender lacks sufficient funds—and continue waiting for it to be included. --------- Co-authored-by: lightclient <[email protected]>
From my understanding, after the v1.15.9, only successful txs will return txhash. Permanently failed txs will return error. And only temporarily failed txs will be tracked locally for resubmission. Am I correct? |
If the transaction is failed with permanent error, this error will be bubbled up to users; |
…#31618) This pull request improves error handling for local transaction submissions. Specifically, if a transaction fails with a temporary error but might be accepted later, the error will not be returned to the user; instead, the transaction will be tracked locally for resubmission. However, if the transaction fails with a permanent error (e.g., invalid transaction or insufficient balance), the error will be propagated to the user. These errors returned in the legacyPool are regarded as temporary failure: - `ErrOutOfOrderTxFromDelegated` - `txpool.ErrInflightTxLimitReached` - `ErrAuthorityReserved` - `txpool.ErrUnderpriced` - `ErrTxPoolOverflow` - `ErrFutureReplacePending` Notably, InsufficientBalance is also treated as a permanent error, as it’s highly unlikely that users will transfer funds into the sender account after submitting the transaction. Otherwise, users may be confused—seeing their transaction submitted but unaware that the sender lacks sufficient funds—and continue waiting for it to be included. --------- Co-authored-by: lightclient <[email protected]>
…#31618) This pull request improves error handling for local transaction submissions. Specifically, if a transaction fails with a temporary error but might be accepted later, the error will not be returned to the user; instead, the transaction will be tracked locally for resubmission. However, if the transaction fails with a permanent error (e.g., invalid transaction or insufficient balance), the error will be propagated to the user. These errors returned in the legacyPool are regarded as temporary failure: - `ErrOutOfOrderTxFromDelegated` - `txpool.ErrInflightTxLimitReached` - `ErrAuthorityReserved` - `txpool.ErrUnderpriced` - `ErrTxPoolOverflow` - `ErrFutureReplacePending` Notably, InsufficientBalance is also treated as a permanent error, as it’s highly unlikely that users will transfer funds into the sender account after submitting the transaction. Otherwise, users may be confused—seeing their transaction submitted but unaware that the sender lacks sufficient funds—and continue waiting for it to be included. --------- Co-authored-by: lightclient <[email protected]>
This pull request improves error handling for local transaction submissions.
Specifically, if a transaction fails with a temporary error but might be accepted later,
the error will not be returned to the user; instead, the transaction will be tracked locally
for resubmission.
However, if the transaction fails with a permanent error (e.g., invalid transaction or
insufficient balance), the error will be propagated to the user.
These errors returned in the legacyPool are regarded as temporary failure:
ErrOutOfOrderTxFromDelegated
txpool.ErrInflightTxLimitReached
ErrAuthorityReserved
txpool.ErrUnderpriced
ErrTxPoolOverflow
ErrFutureReplacePending
Notably, InsufficientBalance is also treated as a permanent error, as it’s highly unlikely
that users will transfer funds into the sender account after submitting the transaction.
Otherwise, users may be confused—seeing their transaction submitted but unaware
that the sender lacks sufficient funds—and continue waiting for it to be included.