-
Notifications
You must be signed in to change notification settings - Fork 816
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
txpool api
: remove_invalid
call improved
#6661
base: master
Are you sure you want to change the base?
Conversation
txpool api
: remove invalid call improved
txpool api
: remove invalid call improvedtxpool api
: remove_invalid
call improved
When view report transaction as invalid it shall be treated as dropped. This commit adds the support for this.
Mempool revalidation now removes the invalid transactions from the view_store. As a result handling `transactions_invalidated` in multi-view-listener does not require handling the case when transaction is still dangling in some view. (It is guaranteed that invalid transaction was removed from the view_store and can be safely notified as Invalid to external listner).
All GitHub workflows were cancelled due to failure one of the required jobs. |
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.
Left some comments, otherwise looks good
substrate/client/transaction-pool/src/fork_aware_txpool/multi_view_listener.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/dropped_watcher.rs
Show resolved
Hide resolved
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!
Description
Currently the transaction which is reported as invalid by a block builder (or
removed_invalid
by other components) is silently skipped.This PR improves this behavior. The transaction pool
report_invalid
function now accepts optional error associated with every reported transaction, and also the optional block hash which provides hints how reported transaction shall be handled. The following API change is proposed:polkadot-sdk/substrate/client/transaction-pool/api/src/lib.rs
Lines 297 to 318 in 8be5ef3
Depending on error, the transaction pool can decide if transaction shall be removed from the view only or entirely from the pool. Invalid event will be dispatched if required.
Notes for reviewers
ViewStore::report_invalid
. Method's doc explains the flow.HashMap
toIndexMap
in revalidation logic. This is to preserve the original order of transactions (mainly for purposes of unit tests).fatxpool
: add tests for rejecting invalid transactions #5477 (comment) (which can now be resolved). The invalid transactions found during mempool revalidation are now also removed from theview_store
. No dangling invalid transaction shall be left in the pool. (bfec262)fixes: #6008, #5477