[][src]Trait sp_runtime::traits::SignedExtension

pub trait SignedExtension: Codec + Debug + Sync + Send + Clone + Eq + PartialEq {
    type AccountId;
    type Call: Dispatchable;
    type AdditionalSigned: Encode;
    type Pre: Default;

    const IDENTIFIER: &'static str;

    fn additional_signed(
        &self
    ) -> Result<Self::AdditionalSigned, TransactionValidityError>; fn validate(
        &self,
        _who: &Self::AccountId,
        _call: &Self::Call,
        _info: &DispatchInfoOf<Self::Call>,
        _len: usize
    ) -> TransactionValidity { ... }
fn pre_dispatch(
        self,
        who: &Self::AccountId,
        call: &Self::Call,
        info: &DispatchInfoOf<Self::Call>,
        len: usize
    ) -> Result<Self::Pre, TransactionValidityError> { ... }
fn validate_unsigned(
        _call: &Self::Call,
        _info: &DispatchInfoOf<Self::Call>,
        _len: usize
    ) -> TransactionValidity { ... }
fn pre_dispatch_unsigned(
        call: &Self::Call,
        info: &DispatchInfoOf<Self::Call>,
        len: usize
    ) -> Result<Self::Pre, TransactionValidityError> { ... }
fn post_dispatch(
        _pre: Self::Pre,
        _info: &DispatchInfoOf<Self::Call>,
        _post_info: &PostDispatchInfoOf<Self::Call>,
        _len: usize,
        _result: &DispatchResult
    ) -> Result<(), TransactionValidityError> { ... }
fn identifier() -> Vec<&'static str> { ... } }

Means by which a transaction may be extended. This type embodies both the data and the logic that should be additionally associated with the transaction. It should be plain old data.

Associated Types

type AccountId

The type which encodes the sender identity.

type Call: Dispatchable

The type which encodes the call to be dispatched.

type AdditionalSigned: Encode

Any additional data that will go into the signed payload. This may be created dynamically from the transaction using the additional_signed function.

type Pre: Default

The type that encodes information that can be passed from pre_dispatch to post-dispatch.

Loading content...

Associated Constants

const IDENTIFIER: &'static str

Unique identifier of this signed extension.

This will be exposed in the metadata to identify the signed extension used in an extrinsic.

Loading content...

Required methods

fn additional_signed(
    &self
) -> Result<Self::AdditionalSigned, TransactionValidityError>

Construct any additional data that should be in the signed payload of the transaction. Can also perform any pre-signature-verification checks and return an error if needed.

Loading content...

Provided methods

fn validate(
    &self,
    _who: &Self::AccountId,
    _call: &Self::Call,
    _info: &DispatchInfoOf<Self::Call>,
    _len: usize
) -> TransactionValidity

Validate a signed transaction for the transaction queue.

This function can be called frequently by the transaction queue, to obtain transaction validity against current state. It should perform all checks that determine a valid transaction, that can pay for its execution and quickly eliminate ones that are stale or incorrect.

Make sure to perform the same checks in pre_dispatch function.

fn pre_dispatch(
    self,
    who: &Self::AccountId,
    call: &Self::Call,
    info: &DispatchInfoOf<Self::Call>,
    len: usize
) -> Result<Self::Pre, TransactionValidityError>

Do any pre-flight stuff for a signed transaction.

Note this function by default delegates to validate, so that all checks performed for the transaction queue are also performed during the dispatch phase (applying the extrinsic).

If you ever override this function, you need to make sure to always perform the same validation as in validate.

fn validate_unsigned(
    _call: &Self::Call,
    _info: &DispatchInfoOf<Self::Call>,
    _len: usize
) -> TransactionValidity

Validate an unsigned transaction for the transaction queue.

This function can be called frequently by the transaction queue to obtain transaction validity against current state. It should perform all checks that determine a valid unsigned transaction, and quickly eliminate ones that are stale or incorrect.

Make sure to perform the same checks in pre_dispatch_unsigned function.

fn pre_dispatch_unsigned(
    call: &Self::Call,
    info: &DispatchInfoOf<Self::Call>,
    len: usize
) -> Result<Self::Pre, TransactionValidityError>

Do any pre-flight stuff for a unsigned transaction.

Note this function by default delegates to validate_unsigned, so that all checks performed for the transaction queue are also performed during the dispatch phase (applying the extrinsic).

If you ever override this function, you need to make sure to always perform the same validation as in validate_unsigned.

fn post_dispatch(
    _pre: Self::Pre,
    _info: &DispatchInfoOf<Self::Call>,
    _post_info: &PostDispatchInfoOf<Self::Call>,
    _len: usize,
    _result: &DispatchResult
) -> Result<(), TransactionValidityError>

Do any post-flight stuff for an extrinsic.

This gets given the DispatchResult _result from the extrinsic and can, if desired, introduce a TransactionValidityError, causing the block to become invalid for including it.

WARNING: It is dangerous to return an error here. To do so will fundamentally invalidate the transaction and any block that it is included in, causing the block author to not be compensated for their work in validating the transaction or producing the block so far.

It can only be used safely when you know that the extrinsic is one that can only be introduced by the current block author; generally this implies that it is an inherent and will come from either an offchain-worker or via InherentData.

fn identifier() -> Vec<&'static str>

Returns the list of unique identifier for this signed extension.

As a [SignedExtension] can be a tuple of [SignedExtension]s we need to return a Vec that holds all the unique identifiers. Each individual SignedExtension must return exactly one identifier.

This method provides a default implementation that returns vec![SELF::IDENTIFIER].

Loading content...

Implementations on Foreign Types

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension> SignedExtension for (TupleElement0,) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned,)

type Pre = (TupleElement0::Pre,)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension> SignedExtension for (TupleElement0, TupleElement1) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension, TupleElement10: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement10: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned, TupleElement10::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre, TupleElement10::Pre)

impl<AccountId, Call: Dispatchable, TupleElement0: SignedExtension, TupleElement1: SignedExtension, TupleElement2: SignedExtension, TupleElement3: SignedExtension, TupleElement4: SignedExtension, TupleElement5: SignedExtension, TupleElement6: SignedExtension, TupleElement7: SignedExtension, TupleElement8: SignedExtension, TupleElement9: SignedExtension, TupleElement10: SignedExtension, TupleElement11: SignedExtension> SignedExtension for (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7, TupleElement8, TupleElement9, TupleElement10, TupleElement11) where
    TupleElement0: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement1: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement2: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement3: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement4: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement5: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement6: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement7: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement8: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement9: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement10: SignedExtension<AccountId = AccountId, Call = Call>,
    TupleElement11: SignedExtension<AccountId = AccountId, Call = Call>, 
[src]

type AccountId = AccountId

type Call = Call

type AdditionalSigned = (TupleElement0::AdditionalSigned, TupleElement1::AdditionalSigned, TupleElement2::AdditionalSigned, TupleElement3::AdditionalSigned, TupleElement4::AdditionalSigned, TupleElement5::AdditionalSigned, TupleElement6::AdditionalSigned, TupleElement7::AdditionalSigned, TupleElement8::AdditionalSigned, TupleElement9::AdditionalSigned, TupleElement10::AdditionalSigned, TupleElement11::AdditionalSigned)

type Pre = (TupleElement0::Pre, TupleElement1::Pre, TupleElement2::Pre, TupleElement3::Pre, TupleElement4::Pre, TupleElement5::Pre, TupleElement6::Pre, TupleElement7::Pre, TupleElement8::Pre, TupleElement9::Pre, TupleElement10::Pre, TupleElement11::Pre)

impl SignedExtension for ()[src]

Only for bare bone testing when you don't care about signed extensions at all.

type AccountId = u64

type AdditionalSigned = ()

type Call = ()

type Pre = ()

Loading content...

Implementors

Loading content...