-
Notifications
You must be signed in to change notification settings - Fork 779
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
&self, | ||
at: Option<<Self::Block as BlockT>::Hash>, | ||
invalid_tx_errors: &[(TxHash<Self>, Option<sp_blockchain::Error>)], | ||
) -> Vec<Arc<Self::InPoolTransaction>>; |
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.
We could also keep old function remove_invalid
and add new one, with no optional error/block parameters. Really no strong opinion here.
Maybe triggering invalid event in case of removal the transaction via RPC call is (maybe) undesirable - so maybe we should have pure remove function (which would trigger Dropped
, IMO it makes more sense). Any thoughts? (This could also be done as follow-up).
txpool api
: remove invalid call improved
txpool api
: remove invalid call improvedtxpool api
: remove_invalid
call improved
/cmd prdoc --bump minor --audience node_dev |
I'd like to force-push here to clean up commit history. |
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.
Looks good.
substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Sebastian Kunert <[email protected]>
I decided not to force push to preserve comments which could be deleted. I added Some tests are new, but some where just moved (and slightly updated, with no logic changes) from the original I also reviewed these tests having in mind #5477. |
Note
This PR depends on work done in #6647
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 293 to 310 in 8c8e033
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).fixes: #6008