Skip to content

Remove bounds from PrevalidateAttests struct definition#2886

Merged
ggwpez merged 3 commits intomasterfrom
oty-prevalidate-assets
Jan 9, 2024
Merged

Remove bounds from PrevalidateAttests struct definition#2886
ggwpez merged 3 commits intomasterfrom
oty-prevalidate-assets

Conversation

@ggwpez
Copy link
Member

@ggwpez ggwpez commented Jan 9, 2024

Removing some bounds as it came up in #2726 while still keeping Send + Sync capabilities.

@ggwpez ggwpez added the T8-polkadot This PR/Issue is related to/affects the Polkadot network. label Jan 9, 2024
@ggwpez ggwpez changed the title Make PrevalidateAttests Send + Sync and remove bounds Remove bounds from PrevalidateAttests struct definition Jan 9, 2024
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
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)>);
Copy link
Member

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

Copy link
Member Author

@ggwpez ggwpez Jan 9, 2024

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)>?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Member Author

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 not Send + Sync and if i remove the PD then it errors parameter T is never used.
Signed Extension does require it though.

Copy link
Member

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?

Copy link
Member Author

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.

}

impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T>
impl<T: Config> SignedExtension for PrevalidateAttests<T>
Copy link
Member

Choose a reason for hiding this comment

The 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.

@bkchr bkchr added the R0-no-crate-publish-required The change does not require any crates to be re-published. label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published. T8-polkadot This PR/Issue is related to/affects the Polkadot network.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants