fatxpool: limits handling optimizations and fixes#8596
Merged
michalkucharczyk merged 69 commits intomasterfrom Jun 24, 2025
Merged
fatxpool: limits handling optimizations and fixes#8596michalkucharczyk merged 69 commits intomasterfrom
fatxpool: limits handling optimizations and fixes#8596michalkucharczyk merged 69 commits intomasterfrom
Conversation
substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool/tx_mem_pool_map.rs
Outdated
Show resolved
Hide resolved
substrate/client/network/src/litep2p/shim/notification/config.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs
Outdated
Show resolved
Hide resolved
substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs
Outdated
Show resolved
Hide resolved
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
|
Successfully created backport PR for |
paritytech-release-backport-bot bot
pushed a commit
that referenced
this pull request
Jun 24, 2025
This PR adds some optimization and fixes in handling limits in fork-aware transaction pool. #### Notes for reviewers Changes made (random order): - debug levels adjusted in numerous places places ( `debug -> trace` for tx, `trace -> debug` for general flow) for better readablity, - internal TxMemPool [storage](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L268-L272) is now [sorted](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool/tx_mem_pool_map.rs#L123-L132). A new helper exposes methods to reduce number of transaction clones (e.g. [here](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1404-L1410), see [previous verions](https://github.com/paritytech/polkadot-sdk/blob/2863b7a9a879935ff16987d0e95065d088dad9f8/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1352-L1359)). This new structure eliminates the necessity of sorting transactions on the fly which was a not efficient, naive, [first](https://github.com/paritytech/polkadot-sdk/blob/e44b89fb7ca3385f314803c733ad97b26cd14e9f/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L384-L400) implementation. - some _mutexes_ were migrated to `tokio::sync::Mutex` to avoid tokio threads locking, - `sync` to `async` _[message](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L743) based_ bridge was implemented. It's purpose is mainly to support `LocalTransactionPool / OffchainTransactionPool` infrastucture. `sync` methods can be called from both non-tokio and tokio context. This requires one additional [blocking](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L398-L402) task for transaction pool. - `ViewStore::most_recent_view` is now a [reference](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L171) to `View`. - `TXMEMPOOL_TRANSACTION_LIMIT_MULTIPLIER` removed, there is no point for buffering more. Initially intended to work as buffer accommodating transactions from two different full views (which could have different set of transactions), turned out to be a bottleneck in maintain function (it still is but aligning sizes reduced the impact), - [bug](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L769) :see_no_evil: fixed in pre-insert actions removal - [`ValidateTransactionPriority`](https://github.com/paritytech/polkadot-sdk/blob/045bc6d342620a02ee9b28d8de51f72ae680f06f/substrate/client/transaction-pool/src/graph/pool.rs#L64-L71) was added. The goal is to allow faster processing of validation requests that were made from the `maintain` context. Otherwise all requests were landing in the same queue and maintain requests could be delayed. Now the processing power is evenly 50/50 split between _maintain_ and _submit+revalidate_ context. Related work: - michalkucharczyk/tx-test-tool#42, - #8152, Todo: - [x] some run should be done also for parachain, --------- Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit 6efe9f5)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 25, 2025
[`TransactionPool::report_invalid`](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/api/src/lib.rs#L314) is now `async`, function was typically used in async context, seems right to be fully async. _Note_: expected to be merged after: #8596 --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
michalkucharczyk
added a commit
that referenced
this pull request
Jun 25, 2025
Backport #8596 into `stable2506` from michalkucharczyk. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> --------- Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Egor_P <egor@parity.io>
This was referenced Sep 23, 2025
saraswatpuneet
added a commit
to frequency-chain/frequency
that referenced
this pull request
Sep 29, 2025
…addressed (#2559) # Goal The goal of this PR is to upgrade polkadot version to 2506-1 Following changes took place - Host functions require some safe marshalling. - xcm and assets weights updated to match latest interface. - `RuntimeEvent` in `Config` is being made redundant ( haven't removed it but added allow deprecated for now) - Updated tomls - Suppressed a warning around `runtume_interface` that rust was warning about but it's polkadot design choice. - Update node layer with updated functions and introduce new arguments - update xcm configs in runtime with latest trait - address clippy errors Polkadot Notes on migration to [2506](https://github.com/paritytech/polkadot-sdk/blob/master/prdoc/stable2506) Closes #2521 # Discussion * Polkadot fixes towards transaction pool paritytech/polkadot-sdk#8596 # Checklist - [ ] Updated Pallet Readme? - [ ] Updated js/api-augment for Custom RPC APIs? - [ ] Design doc(s) updated? - [ ] Unit Tests added? - [ ] e2e Tests added? - [ ] Benchmarks added? - [x] Spec version incremented?
manuelmauro
added a commit
to moonbeam-foundation/polkadot-sdk
that referenced
this pull request
Oct 3, 2025
This PR adds some optimization and fixes in handling limits in fork-aware transaction pool. Changes made (random order): - debug levels adjusted in numerous places places ( `debug -> trace` for tx, `trace -> debug` for general flow) for better readablity, - internal TxMemPool [storage](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L268-L272) is now [sorted](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool/tx_mem_pool_map.rs#L123-L132). A new helper exposes methods to reduce number of transaction clones (e.g. [here](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1404-L1410), see [previous verions](https://github.com/paritytech/polkadot-sdk/blob/2863b7a9a879935ff16987d0e95065d088dad9f8/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1352-L1359)). This new structure eliminates the necessity of sorting transactions on the fly which was a not efficient, naive, [first](https://github.com/paritytech/polkadot-sdk/blob/e44b89fb7ca3385f314803c733ad97b26cd14e9f/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L384-L400) implementation. - some _mutexes_ were migrated to `tokio::sync::Mutex` to avoid tokio threads locking, - `sync` to `async` _[message](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L743) based_ bridge was implemented. It's purpose is mainly to support `LocalTransactionPool / OffchainTransactionPool` infrastucture. `sync` methods can be called from both non-tokio and tokio context. This requires one additional [blocking](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L398-L402) task for transaction pool. - `ViewStore::most_recent_view` is now a [reference](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L171) to `View`. - `TXMEMPOOL_TRANSACTION_LIMIT_MULTIPLIER` removed, there is no point for buffering more. Initially intended to work as buffer accommodating transactions from two different full views (which could have different set of transactions), turned out to be a bottleneck in maintain function (it still is but aligning sizes reduced the impact), - [bug](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L769) :see_no_evil: fixed in pre-insert actions removal - [`ValidateTransactionPriority`](https://github.com/paritytech/polkadot-sdk/blob/045bc6d342620a02ee9b28d8de51f72ae680f06f/substrate/client/transaction-pool/src/graph/pool.rs#L64-L71) was added. The goal is to allow faster processing of validation requests that were made from the `maintain` context. Otherwise all requests were landing in the same queue and maintain requests could be delayed. Now the processing power is evenly 50/50 split between _maintain_ and _submit+revalidate_ context. Related work: - michalkucharczyk/tx-test-tool#42, - paritytech#8152, Todo: - [x] some run should be done also for parachain, --------- Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
manuelmauro
added a commit
to moonbeam-foundation/polkadot-sdk
that referenced
this pull request
Oct 3, 2025
This PR adds some optimization and fixes in handling limits in fork-aware transaction pool. Changes made (random order): - debug levels adjusted in numerous places places ( `debug -> trace` for tx, `trace -> debug` for general flow) for better readablity, - internal TxMemPool [storage](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L268-L272) is now [sorted](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool/tx_mem_pool_map.rs#L123-L132). A new helper exposes methods to reduce number of transaction clones (e.g. [here](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1404-L1410), see [previous verions](https://github.com/paritytech/polkadot-sdk/blob/2863b7a9a879935ff16987d0e95065d088dad9f8/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1352-L1359)). This new structure eliminates the necessity of sorting transactions on the fly which was a not efficient, naive, [first](https://github.com/paritytech/polkadot-sdk/blob/e44b89fb7ca3385f314803c733ad97b26cd14e9f/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L384-L400) implementation. - some _mutexes_ were migrated to `tokio::sync::Mutex` to avoid tokio threads locking, - `sync` to `async` _[message](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L743) based_ bridge was implemented. It's purpose is mainly to support `LocalTransactionPool / OffchainTransactionPool` infrastucture. `sync` methods can be called from both non-tokio and tokio context. This requires one additional [blocking](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L398-L402) task for transaction pool. - `ViewStore::most_recent_view` is now a [reference](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L171) to `View`. - `TXMEMPOOL_TRANSACTION_LIMIT_MULTIPLIER` removed, there is no point for buffering more. Initially intended to work as buffer accommodating transactions from two different full views (which could have different set of transactions), turned out to be a bottleneck in maintain function (it still is but aligning sizes reduced the impact), - [bug](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L769) :see_no_evil: fixed in pre-insert actions removal - [`ValidateTransactionPriority`](https://github.com/paritytech/polkadot-sdk/blob/045bc6d342620a02ee9b28d8de51f72ae680f06f/substrate/client/transaction-pool/src/graph/pool.rs#L64-L71) was added. The goal is to allow faster processing of validation requests that were made from the `maintain` context. Otherwise all requests were landing in the same queue and maintain requests could be delayed. Now the processing power is evenly 50/50 split between _maintain_ and _submit+revalidate_ context. Related work: - michalkucharczyk/tx-test-tool#42, - paritytech#8152, Todo: - [x] some run should be done also for parachain, --------- Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
alvicsam
pushed a commit
that referenced
this pull request
Oct 17, 2025
This PR adds some optimization and fixes in handling limits in fork-aware transaction pool. #### Notes for reviewers Changes made (random order): - debug levels adjusted in numerous places places ( `debug -> trace` for tx, `trace -> debug` for general flow) for better readablity, - internal TxMemPool [storage](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L268-L272) is now [sorted](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool/tx_mem_pool_map.rs#L123-L132). A new helper exposes methods to reduce number of transaction clones (e.g. [here](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1404-L1410), see [previous verions](https://github.com/paritytech/polkadot-sdk/blob/2863b7a9a879935ff16987d0e95065d088dad9f8/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L1352-L1359)). This new structure eliminates the necessity of sorting transactions on the fly which was a not efficient, naive, [first](https://github.com/paritytech/polkadot-sdk/blob/e44b89fb7ca3385f314803c733ad97b26cd14e9f/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L384-L400) implementation. - some _mutexes_ were migrated to `tokio::sync::Mutex` to avoid tokio threads locking, - `sync` to `async` _[message](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/tx_mem_pool.rs#L743) based_ bridge was implemented. It's purpose is mainly to support `LocalTransactionPool / OffchainTransactionPool` infrastucture. `sync` methods can be called from both non-tokio and tokio context. This requires one additional [blocking](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs#L398-L402) task for transaction pool. - `ViewStore::most_recent_view` is now a [reference](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L171) to `View`. - `TXMEMPOOL_TRANSACTION_LIMIT_MULTIPLIER` removed, there is no point for buffering more. Initially intended to work as buffer accommodating transactions from two different full views (which could have different set of transactions), turned out to be a bottleneck in maintain function (it still is but aligning sizes reduced the impact), - [bug](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/src/fork_aware_txpool/view_store.rs#L769) :see_no_evil: fixed in pre-insert actions removal - [`ValidateTransactionPriority`](https://github.com/paritytech/polkadot-sdk/blob/045bc6d342620a02ee9b28d8de51f72ae680f06f/substrate/client/transaction-pool/src/graph/pool.rs#L64-L71) was added. The goal is to allow faster processing of validation requests that were made from the `maintain` context. Otherwise all requests were landing in the same queue and maintain requests could be delayed. Now the processing power is evenly 50/50 split between _maintain_ and _submit+revalidate_ context. Related work: - michalkucharczyk/tx-test-tool#42, - #8152, Todo: - [x] some run should be done also for parachain, --------- Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
alvicsam
pushed a commit
that referenced
this pull request
Oct 17, 2025
[`TransactionPool::report_invalid`](https://github.com/paritytech/polkadot-sdk/blob/74dafaee5c600fd2c8a59a280f647f94ccf0a755/substrate/client/transaction-pool/api/src/lib.rs#L314) is now `async`, function was typically used in async context, seems right to be fully async. _Note_: expected to be merged after: #8596 --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds some optimization and fixes in handling limits in fork-aware transaction pool.
Notes for reviewers
Changes made (random order):
debug -> tracefor tx,trace -> debugfor general flow) for better readablity,tokio::sync::Mutexto avoid tokio threads locking,synctoasyncmessage based bridge was implemented. It's purpose is mainly to supportLocalTransactionPool / OffchainTransactionPoolinfrastucture.syncmethods can be called from both non-tokio and tokio context. This requires one additional blocking task for transaction pool.ViewStore::most_recent_viewis now a reference toView.TXMEMPOOL_TRANSACTION_LIMIT_MULTIPLIERremoved, there is no point for buffering more. Initially intended to work as buffer accommodating transactions from two different full views (which could have different set of transactions), turned out to be a bottleneck in maintain function (it still is but aligning sizes reduced the impact),ValidateTransactionPrioritywas added. The goal is to allow faster processing of validation requests that were made from themaintaincontext. Otherwise all requests were landing in the same queue and maintain requests could be delayed. Now the processing power is evenly 50/50 split between maintain and submit+revalidate context.Related work:
fatxpool: some more integration tests #8152,Todo: