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.
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
Add
ConsiderationFromLegacy
traits #2274base: master
Are you sure you want to change the base?
Add
ConsiderationFromLegacy
traits #2274Changes from 5 commits
508496c
5a54bc4
8ffd37b
42de057
de0cc1c
32bb3f2
490e39c
3277217
63413b9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these return
Result<Option<Self>, DispatchError>
instead ofResult<Self, DispatchError>
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I implemented that to return
None
as the default impl. As mentioned earlier,ConsiderationFromLegacy
will be required for those pallets that need it during the migration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm still not convinced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the default impl would never be used and is only meant to make it compile once all currency related crates were removed from the runtime config.
But then it should indeed return an Error and not
None
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah would feel much better returning an error to me instead of the
None
👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still would like to see if possible to avoid the default impl (and polluting the pallet config) by passing this type directly to the migration it is used in tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liamaharon @ggwpez I replaced
None
withErr
. It should be now good to go.For reference, here an example of the new method being used: https://github.com/paritytech/polkadot-sdk/pull/1789/files#diff-489bbb1c7c1b1b8803ab344f63079bdc1b7d67db3d2d8809d6a3a755443619f0R77-R107
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default impl feels like a footgun to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replied why of the default impl in the next comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, not sure why anyone would want to use this default impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FRAME pallet that makes use of it on its
Config
would look something like this:The default impl is for 3rd parties that make use of the pallet, so then they do not have to manually implement it.