This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Quickly skip invalid transactions during block authorship. #9789
Merged
Conversation
This file contains 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
tomusdrw
added
A0-please_review
Pull request needs code review.
B5-clientnoteworthy
C1-low
PR touches the given topic and has a low impact on builders.
labels
Sep 15, 2021
gww-parity
reviewed
Sep 29, 2021
bkchr
reviewed
Sep 29, 2021
bkchr
approved these changes
Sep 30, 2021
bot merge |
Trying merge. |
Bot will approve on the behalf of @tomusdrw, since they are a team lead, in an attempt to reach the minimum approval count |
ghost
approved these changes
Oct 1, 2021
ghost
deleted the
td-invalid-skip
branch
October 1, 2021 14:25
ordian
added a commit
that referenced
this pull request
Oct 2, 2021
* master: (67 commits) Downstream `node-template` pull (#9915) Implement core::fmt::Debug for BoundedVec (#9914) Quickly skip invalid transactions during block authorship. (#9789) Add SS58 prefix for Automata (#9805) Clean up sc-peerset (#9806) Test each benchmark case in own #[test] (#9860) Add build with docker section to README (#9792) Simple Trait to Inspect Metadata (#9893) Pallet Assets: Create new asset classes from genesis config (#9742) doc: subkey usage (#9905) Silence alert about large-statement-fetcher (#9882) Fix democracy on-initialize weight (#9890) Fix basic authorship flaky test (#9906) contracts: Add event field names (#9896) subkey readme update on install (#9900) add feature wasmtime-jitdump (#9871) Return `target_hash` for finality_target instead of an Option (#9867) Update wasmtime to 0.29.0 (#9552) Less sleeps (#9848) remove unidiomatic (#9895) ...
ordian
added a commit
that referenced
this pull request
Oct 5, 2021
* master: (125 commits) Update multiple dependencies (#9936) Speed up timestamp generation when logging (#9933) First word should be Substrate not Polkadot (#9935) Improved file not found error message (#9931) don't read events in elections anymore. (#9898) Remove incorrect sanity check (#9924) Require crypto scheme for `insert-key` (#9909) chore: refresh of the substrate_builder image (#9808) Introduce block authorship soft deadline (#9663) Rework Transaction Priority calculation (#9834) Do not propagate host RUSTFLAGS when checking for WASM toolchain (#9926) Small quoting comment fix (#9927) add clippy to CI (#9694) Ensure BeforeBestBlockBy voting rule accounts for base (#9920) rm `.maintain` lock (#9919) Downstream `node-template` pull (#9915) Implement core::fmt::Debug for BoundedVec (#9914) Quickly skip invalid transactions during block authorship. (#9789) Add SS58 prefix for Automata (#9805) Clean up sc-peerset (#9806) ...
19 tasks
bkchr
added a commit
that referenced
this pull request
Apr 13, 2023
The check was intially added by: #5121 But a later pr fixed it properly: #9789 TLDR: We don't need to check for skipped anymore, as we already remove all transactions that are being unlocked by an invalid transactions and thus, we will not tag them as invalid directly because the nonce for example is incorrect. Fixes: #13911
bkchr
added a commit
that referenced
this pull request
Apr 14, 2023
The check was intially added by: #5121 But a later pr fixed it properly: #9789 TLDR: We don't need to check for skipped anymore, as we already remove all transactions that are being unlocked by an invalid transactions and thus, we will not tag them as invalid directly because the nonce for example is incorrect. Fixes: #13911
nathanwhit
pushed a commit
to nathanwhit/substrate
that referenced
this pull request
Jul 19, 2023
The check was intially added by: paritytech#5121 But a later pr fixed it properly: paritytech#9789 TLDR: We don't need to check for skipped anymore, as we already remove all transactions that are being unlocked by an invalid transactions and thus, we will not tag them as invalid directly because the nonce for example is incorrect. Fixes: paritytech#13911
This pull request was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
C1-low
PR touches the given topic and has a low impact on builders.
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.
Before this PR, basic authorship crate was trying to push to the block each and every ready transaction received from the transaction pool.
This might be costly, cause it involves multiple calls into the runtime. It's especially inefficient for transactions that are well known to be invalid before even attempting to execute them, because they depend (i.e.
require
) some other transaction that was found to be invalid.Same logic applies to transactions that are skipped due to resource exhaustion (i.e. they are unable to fit the block, cause it contains a few transactions already that consumed much of the available weight or block length size).
After the PR, the authorship task reports invalidity of transactions back to the iterator, which keeps track of invalid transactions and is able to skip the dependent ones efficiently (i.e. does not even return them to the authorship task).
This should speed up block authorship in the edge case of block being partially full already or in case there is a long chain of transactions that depend on a invalid one.
Note that the authorship task does not ask the transaction pool to remove the transactions that were skipped - this is desired, the pool itself should re-validate transactions that depend on a first-in-chain transaction reported as invalid.