`fatxpool`: improved handling of finality stalls (#7639)
#### PR Description This pull request introduces measures to handle finality stalls by : - notifying outdated transactions with a [`FinalityTimeout`](https://github.com/paritytech/polkadot-sdk/blob/d821c84d/substrate/client/transaction-pool/api/src/lib.rs#L145-L147) event. - removing outdated views from the `view_store` An item is considered _outdated_ when the difference between its associated block and the current block exceeds a pre-defined threshold. #### Note for Reviewers The core logic is provided in the following small commits: - `ViewStore`: new method [`finality_stall_view_cleanup`](https://github.com/paritytech/polkadot-sdk/blob/d821c84d/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L869-L903) for removing stale views was added: 64267000 - `ForkAwareTransactionPool`: core logic for tracking finality stalls added here: 7b37ea6f. Entry point in [`finality_stall_cleanup`](https://github.com/paritytech/polkadot-sdk/blob/d821c84d/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1096-L1136) - Some related renaming was made to better reflect purpose/shorten the names: 1a3a1284, a511601f. Also new method [`transactions_finality_timeout`](https://github.com/paritytech/polkadot-sdk/blob/a511601f/substrate/client/transaction-pool/src/fork_aware_txpool/multi_view_listener.rs#L771-L790) for triggering external events was added for `MultiViewListener`. - `included_transactions` which basically is mapping `block hash -> included transactions hashes`, is also used to find to included transactions. I also sneaked in some minor improvements: - fixed per-transaction logging: 1572f721 - `handle_pre_finalized` method was removed, it was some old leftover which is no longer needed: a6f84ad0 , closes: #5482 --------- Co-authored-by:cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com> Co-authored-by:
Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Showing
- prdoc/pr_7639.prdoc 12 additions, 0 deletionsprdoc/pr_7639.prdoc
- substrate/client/transaction-pool/src/common/tracing_log_xt.rs 10 additions, 10 deletions...rate/client/transaction-pool/src/common/tracing_log_xt.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/dropped_watcher.rs 8 additions, 8 deletions...transaction-pool/src/fork_aware_txpool/dropped_watcher.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs 175 additions, 45 deletions...ansaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/multi_view_listener.rs 85 additions, 43 deletions...saction-pool/src/fork_aware_txpool/multi_view_listener.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/view.rs 2 additions, 1 deletion...ate/client/transaction-pool/src/fork_aware_txpool/view.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs 41 additions, 47 deletions...ient/transaction-pool/src/fork_aware_txpool/view_store.rs
- substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs 2 additions, 0 deletions...ction-pool/src/single_state_txpool/single_state_txpool.rs
- substrate/client/transaction-pool/tests/fatp.rs 0 additions, 1 deletionsubstrate/client/transaction-pool/tests/fatp.rs
- substrate/client/transaction-pool/tests/fatp_common/mod.rs 14 additions, 1 deletionsubstrate/client/transaction-pool/tests/fatp_common/mod.rs
- substrate/client/transaction-pool/tests/fatp_finality_timeout.rs 273 additions, 0 deletions...te/client/transaction-pool/tests/fatp_finality_timeout.rs
Please register or sign in to comment