`fatxpool`: event streams moved to view domain (#7545)
#### Overview This pull request refactors the transaction pool `graph` module by renaming components for better clarity. The `EventHandler` trait was introduced to enhance flexibility in handling transaction lifecycle events. Changes include renaming `graph::Listener` to `graph::EventDispatcher` and moving certain functionalities from `graph` to `view` module in order to decouple `graph` from `view`-related specifics. This PR does not introduce changes in the logic. #### Notes for Reviewers All the changes looks dense at first, but in fact following was done: - The `graph::Listener` was renamed to [`graph::EventDispatcher`](https://github.com/paritytech/polkadot-sdk/blob/515cb404/substrate/client/transaction-pool/src/graph/listener.rs#L74C12-L74C27), to better reflect its role in dispatching transaction-related events from `ValidatedPool`. The `EventDispatcher` now utilizes the `L: EventHandler` generic type to handle transaction status events. - The new [`EventHandler`](https://github.com/paritytech/polkadot-sdk/blob/515cb404/substrate/client/transaction-pool/src/graph/listener.rs#L34) trait was introduced to handle transaction lifecycle events, improving implementation flexibility and providing clearer role descriptions within the system. Introduction of this trait allowed the removal of `View` related entities (e.g. streams) from the `ValidatedPool`'s event dispatcher (previously _listener_). - The _dropped monitoring_ and _aggregated events_ stream [functionalities](https://github.com/paritytech/polkadot-sdk/blob/515cb404/substrate/client/transaction-pool/src/fork_aware_txpool/view.rs#L157-L188) and [related types](https://github.com/paritytech/polkadot-sdk/blob/515cb404/substrate/client/transaction-pool/src/fork_aware_txpool/view.rs#L112-L121) were moved from `graph::listener` to the `view` module. The [`ViewPoolObserver`](https://github.com/paritytech/polkadot-sdk/blob/515cb404 /substrate/client/transaction-pool/src/fork_aware_txpool/view.rs#L128C19-L128C35), which implements `EventHandler`, now provides the implementation of streams feeding. - Fields, arguments, and variables previously named `listener` were renamed to `event_dispatcher` to align with their purpose and type naming. - Various structs such as `Pool` and `ValidatedPool` were updated to include a generic `L: EventHandler` across the codebase. --------- Co-authored-by:cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
parent
ba7cb484
Showing
- prdoc/pr_7545.prdoc 9 additions, 0 deletionsprdoc/pr_7545.prdoc
- substrate/client/transaction-pool/benches/basics.rs 1 addition, 1 deletionsubstrate/client/transaction-pool/benches/basics.rs
- substrate/client/transaction-pool/src/common/tests.rs 3 additions, 1 deletionsubstrate/client/transaction-pool/src/common/tests.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/dropped_watcher.rs 2 additions, 1 deletion...transaction-pool/src/fork_aware_txpool/dropped_watcher.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs 29 additions, 29 deletions...ansaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/mod.rs 1 addition, 1 deletion...rate/client/transaction-pool/src/fork_aware_txpool/mod.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/multi_view_listener.rs 2 additions, 2 deletions...saction-pool/src/fork_aware_txpool/multi_view_listener.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/revalidation_worker.rs 3 additions, 7 deletions...saction-pool/src/fork_aware_txpool/revalidation_worker.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/view.rs 176 additions, 19 deletions...ate/client/transaction-pool/src/fork_aware_txpool/view.rs
- substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs 14 additions, 7 deletions...ient/transaction-pool/src/fork_aware_txpool/view_store.rs
- substrate/client/transaction-pool/src/graph/listener.rs 91 additions, 108 deletionssubstrate/client/transaction-pool/src/graph/listener.rs
- substrate/client/transaction-pool/src/graph/mod.rs 3 additions, 4 deletionssubstrate/client/transaction-pool/src/graph/mod.rs
- substrate/client/transaction-pool/src/graph/pool.rs 28 additions, 8 deletionssubstrate/client/transaction-pool/src/graph/pool.rs
- substrate/client/transaction-pool/src/graph/validated_pool.rs 82 additions, 63 deletions...trate/client/transaction-pool/src/graph/validated_pool.rs
- substrate/client/transaction-pool/src/single_state_txpool/revalidation.rs 5 additions, 4 deletions.../transaction-pool/src/single_state_txpool/revalidation.rs
- substrate/client/transaction-pool/src/single_state_txpool/single_state_txpool.rs 9 additions, 5 deletions...ction-pool/src/single_state_txpool/single_state_txpool.rs
- substrate/client/transaction-pool/tests/pool.rs 2 additions, 0 deletionssubstrate/client/transaction-pool/tests/pool.rs
Please register or sign in to comment