-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fatxpool: proper handling of priorities when mempool is full
#6647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michalkucharczyk
merged 43 commits into
master
from
mku-fatxpool-mempool-priorities-at-limits
Jan 14, 2025
Merged
Changes from 30 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
018f9d4
dropped_watcher: new fns are public
michalkucharczyk 4aa24d3
dropped_watcher: improvement
michalkucharczyk 9fe88a6
fatp: handling higher prio with full mempool
michalkucharczyk 54ae11c
graph: fold_ready improved
michalkucharczyk a6882eb
graph: make some staff public
michalkucharczyk 8d3dffe
tests added
michalkucharczyk 70fd186
type removed
michalkucharczyk d3a1a7b
improvements
michalkucharczyk 4246dac
make use of your brain
michalkucharczyk c203d72
fatp: pending actions now support removals
michalkucharczyk edb1257
validated_pool: SubmitOutcome
michalkucharczyk f778176
view/view_store: SubmitOutcome
michalkucharczyk a72b3f9
mempool: update_transaction stub
michalkucharczyk c411bb4
fatp: SubmitOutcome
michalkucharczyk 7b461bf
fatp: todo added
michalkucharczyk 8765d2c
single-state txpool: SubmitOutcome integration
michalkucharczyk e8ccd44
tests: SubmitOutcome fixes
michalkucharczyk 6cca272
mempool: sizes fix
michalkucharczyk 3b17a16
dropping transaction - size limit is properly obeyed now
michalkucharczyk 4f767e5
merge / rebase fixes
michalkucharczyk 6ba133e
mempool: prio is now locked option
michalkucharczyk 46fa1fd
tests added + dead code cleanup
michalkucharczyk 2221d7a
comments cleanup
michalkucharczyk 0244ba0
tweaks
michalkucharczyk 037e016
Merge remote-tracking branch 'origin/master' into mku-fatxpool-mempoo…
michalkucharczyk 5d0283e
review comments
michalkucharczyk caca2e1
clippy
michalkucharczyk b86ef05
clean up
michalkucharczyk 736d698
Merge branch 'master' into mku-fatxpool-mempool-priorities-at-limits
michalkucharczyk 4294261
Update from michalkucharczyk running command 'prdoc --bump minor --au…
b4290cd
Update prdoc/pr_6647.prdoc
michalkucharczyk 80a94b8
Apply suggestions from code review
michalkucharczyk 2fe4a18
Apply suggestions from code review
michalkucharczyk 17bd8f2
Merge remote-tracking branch 'origin/master' into mku-fatxpool-mempoo…
michalkucharczyk e5771b9
fmt
michalkucharczyk 8913ab0
substrate_test_client: validate_transaction_blocking implmeneted
michalkucharczyk bdf5b2a
txmempool: try_replace_transaction cleanup
michalkucharczyk 8ee3b7b
submit_local: prio/limits improvements
michalkucharczyk 15739bf
tests: submit_local is now tested properly
michalkucharczyk 55659ee
Update substrate/client/transaction-pool/tests/fatp_prios.rs
michalkucharczyk b697b0f
txmempool: tests naiming and comments improved
michalkucharczyk 2d52106
Merge remote-tracking branch 'origin/master' into mku-fatxpool-mempoo…
michalkucharczyk 4b3241f
fmt
michalkucharczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| title: '`fatxpool`: proper handling of priorities when mempool is full' | ||
| doc: | ||
| - audience: Node Dev | ||
| description: |- | ||
| Higher-priority transactions can now replace lower-priority transactions even when the internal _tx_mem_pool_ is full. | ||
|
|
||
| **Notes for reviewers:** | ||
| - The _tx_mem_pool_ now maintains information about transaction priority. Although _tx_mem_pool_ itself is stateless, transaction priority is updated after submission to the view. An alternative approach could involve validating transactions at the `at` block, but this is computationally expensive. To avoid additional validation overhead, I opted to use the priority obtained from runtime during submission to the view. This is the rationale behind introducing the `SubmitOutcome` struct, which synchronously communicates transaction priority from the view to the pool. This results in a very brief window during which the transaction priority remains unknown - those transaction are not taken into consideration while dropping takes place. In the future, if needed, we could update transaction priority using view revalidation results to keep this information fully up-to-date (as priority of transaction may change with chain-state evolution). | ||
| - When _tx_mem_pool_ becomes full (an event anticipated to be rare), transaction priority must be known to perform priority-based removal. In such cases, the most recent block known is utilized for validation. I think that speculative submission to the view and re-using the priority from this submission would be an unnecessary complication. | ||
| - Once the priority is determined, lower-priority transactions whose cumulative size meets or exceeds the size of the new transaction are collected to ensure the pool size limit is not exceeded. | ||
| - Transaction removed from _tx_mem_pool_ , also needs to be removed from all the views with appropriate event (which is done by `remove_transaction_subtree`). To ensure complete removal, the `PendingTxReplacement` struct was re-factored to more generic `PendingPreInsertTask` (introduced in #6405) which covers removal and submssion of transaction in the view which may be potentially created in the background. This is to ensure that removed transaction will not re-enter to the newly created view. | ||
|
|
||
| Closes: #5809 | ||
| crates: | ||
| - name: sc-transaction-pool | ||
| bump: minor | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.