Add DefaultParams to allow more transaction extensions to be used when calling _default() methods#1979
Merged
Add DefaultParams to allow more transaction extensions to be used when calling _default() methods#1979
Conversation
…n calling _default() methods
lexnv
approved these changes
Apr 3, 2025
niklasad1
approved these changes
Apr 3, 2025
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.
We currently rely on extrinsic parameters implementing
Defaulton these two methods ofTxClient:Extrinsic params are, by default, a tuple containing an entry for each transaction extension configured via
AnyOf. Our default transaction extensions are this:And
AnyOfis implemented such that the parameters to configure each extension are expected in a tuple with a size matching the extensions above.We currently have support for 9 default transaction extensions above, but if this number were to exceed 12 (which is the max tuple size that Rust implements
Defaultfor), then we could no longer useAnyOfin conjunction with our_defaultmethods, since the parameters would no longer implementDefault.So, we add a
DefaultParamstrait instead, which supports up to 26 entries in the tuple (as long as each of those implsDefault), matching the number of tuple entriesAnyOfsupports.The downside is that a user going off the beaten path will need to implement
DefaultParamsinstead ofDefaultfor their own params if they want to use the_defaultmethods, but this is likely to be a rare case.Closes #1975.