Open
Description
During 2s block investigation it turned out that ForkAwareTxPool::register_listeners
call takes significant amount of time.
As the current implementation was delivered in the sprit of "make it work, make it fast", the time for optimization has come. Here is the idea.
Instead of having a single listener for every transaction in every view, we need to use the single stream of aggregated events for every transaction in the single view.
Some implementation details / hints:
- view provides the stream of tuples:
(tx_hash, status)
, new stream needs to be added here, and should follow logic ofdropped_by_limits_sink
. - new task for multi_view_listener needs to be added. It will select: aggregated streams map, add/remove view msgs, per-tx msgs: invalidate,finalize,...,
- external listener is a stream (could be unfold). Internally it selects: add/remove view, view event
(block_hash,status)
, per-tx msgs: invalidated, drpoped, finalzied, broadcated) and implements required logic (which currently is implemneted inExternalWatcherContext
, create_external_watcher
adds a new channel (rx
,tx
) between an unfolded stream (external listener instance) and mvl task. New enum for messages is needed.