Skip to content
Snippets Groups Projects
Unverified Commit 0d6dcb3f authored by James Wilson's avatar James Wilson Committed by GitHub
Browse files

Make TypeInfo for SkipCheckIfFeeless transparent, too (#2449)


The `SkipCheckifFeeless::IDENTIFIER` became transparent (ie was whatever
the inner signed ext was). This PR just makes the `TypeInfo` transparent
too, so that libraries that use said info to decode the data (ie subxt)
can behave identically whether or not the `SkipCheckifFeeless` wrapper
is used or not.

---------

Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
parent 408af9b3
No related merge requests found
Pipeline #417020 canceled with stages
in 47 seconds
......@@ -40,7 +40,7 @@ use frame_support::{
dispatch::{CheckIfFeeless, DispatchResult},
traits::{IsType, OriginTrait},
};
use scale_info::TypeInfo;
use scale_info::{StaticTypeInfo, TypeInfo};
use sp_runtime::{
traits::{DispatchInfoOf, PostDispatchInfoOf, SignedExtension},
transaction_validity::TransactionValidityError,
......@@ -75,10 +75,17 @@ pub mod pallet {
}
/// A [`SignedExtension`] that skips the wrapped extension if the dispatchable is feeless.
#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)]
#[scale_info(skip_type_params(T))]
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
pub struct SkipCheckIfFeeless<T, S>(pub S, sp_std::marker::PhantomData<T>);
// Make this extension "invisible" from the outside (ie metadata type information)
impl<T, S: StaticTypeInfo> TypeInfo for SkipCheckIfFeeless<T, S> {
type Identity = S;
fn type_info() -> scale_info::Type {
S::type_info()
}
}
impl<T, S: Encode> sp_std::fmt::Debug for SkipCheckIfFeeless<T, S> {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment