-
Notifications
You must be signed in to change notification settings - Fork 744
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
Remove bounds from PrevalidateAttests
struct definition
#2886
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -591,11 +591,9 @@ impl<T: Config> Pallet<T> { | |
/// otherwise free to place on chain. | ||
#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>) | ||
where | ||
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>; | ||
pub struct PrevalidateAttests<T>(core::marker::PhantomData<fn(T)>); | ||
|
||
impl<T: Config + Send + Sync> Debug for PrevalidateAttests<T> | ||
impl<T: Config> Debug for PrevalidateAttests<T> | ||
where | ||
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>, | ||
{ | ||
|
@@ -610,7 +608,7 @@ where | |
} | ||
} | ||
|
||
impl<T: Config + Send + Sync> PrevalidateAttests<T> | ||
impl<T: Config> PrevalidateAttests<T> | ||
where | ||
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>, | ||
{ | ||
|
@@ -620,7 +618,7 @@ where | |
} | ||
} | ||
|
||
impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> | ||
impl<T: Config> SignedExtension for PrevalidateAttests<T> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you would just kept the bounds here, it would have been enough. But we can go with the phantomdata trick. |
||
where | ||
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>, | ||
{ | ||
|
@@ -1469,6 +1467,12 @@ mod tests { | |
); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn prevalidate_assets_is_send_and_sync() { | ||
fn is_send_and_sync<T: Send + Sync>() {} | ||
is_send_and_sync::<PrevalidateAttests<Test>>(); | ||
} | ||
ggwpez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
#[cfg(feature = "runtime-benchmarks")] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
||
title: Remove bounds from `PrevalidateAttests` struct definition | ||
|
||
doc: | ||
- audience: Runtime Dev | ||
description: | | ||
Minimal change to `PrevalidateAssets` to remove some trait bounds on the struct itself while | ||
keeping all its capabilities. | ||
|
||
crates: | ||
- name: polkadot-runtime-common |
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.
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.
Not sure we really need this :P
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.
WDYM? The
PhantomData<fn(T)>
?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.
Yes
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.
But if i use
PhantomData<T>
then its notSend + Sync
and if i remove the PD then it errorsparameter T is never used
.Signed Extension does require it though.
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 does it needs to be Send and Sync?
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
SignedExtension
trait requires it, i did not check why.The new TEs will also require it.