Skip to content
Snippets Groups Projects
  • Michal Kucharczyk's avatar
    `fatxpool`: handling limits and priorities improvements (#6405) · 41a5d8ec
    Michal Kucharczyk authored
    This PR provides a number of improvements around handling limits and
    priorities in the fork-aware transaction pool.
    
    
    #### Notes to reviewers.
    #### Following are the notable changes:
    1. #### [Better
    support](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/414ec3cc)
    for `Usurped` transactions
    
    When any view reports an `Usurped` transaction (replaced by other with
    higher priority) it is removed from all the views (also inactive).
    Removal is implemented by simply submitting usurper transaction to all
    the views. It is also ensured that usurped tx will not sneak into the
    `view_store` in newly created view (this is why
    `ViewStore::pending_txs_replacements` was added).
    
    1. ####
    [`TimedTransactionSource`](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/f10590f3)
    introduced:
    
    Every view now has an information when the transaction entered the pool.
    Enforce limits (now only for future txs) uses this timestamp to find
    worst transactions. Having common timestamp ensures coherent assessment
    of the transaction's importance across different views. This also could
    later be used to select which ready transaction shall be dropped.
    
    1. #### `DroppedWatcher`: [improved
    logic](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/560db28c)
    for future transactions
    For future transaction - if the last referencing view is removed, the
    transaction will be dropped from the pool. This prevents future
    unincluded and un-promoted transactions from staying in the pool for
    long time.
    
    #### And some minor changes:
    
    1.
    [simplified](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/2d0bbf83)
    the flow in `update_view_with_mempool` (code duplication + minor bug
    fix).
    2. `graph::BasePool`: [handling
    priorities](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/c9f2d393)
    for future transaction improved (previously transaction with lower prio
    was reported as failed),
    3. `graph::listener`: dedicated `limit_enforced`/`usurped`/`dropped`
    [calls
    added](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/7b58a68c),
    4. flaky test
    [fixed](https://github.com/paritytech/polkadot-sdk/pull/6405/commits/e0a7bc6c
    
    )
    5. new tests added,
    
    related to: #5809
    
    ---------
    
    Co-authored-by: default avatarGitHub Action <action@github.com>
    Co-authored-by: default avatarIulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
    Unverified
    41a5d8ec
Code owners
Assign users and groups as approvers for specific file changes. Learn more.