referrerpolicy=no-referrer-when-downgrade

Trait sp_runtime::traits::Applyable

source ·
pub trait Applyable: Sized + Send + Sync {
    type Call: Dispatchable;

    // Required methods
    fn validate<V: ValidateUnsigned<Call = Self::Call>>(
        &self,
        source: TransactionSource,
        info: &DispatchInfoOf<Self::Call>,
        len: usize,
    ) -> TransactionValidity;
    fn apply<V: ValidateUnsigned<Call = Self::Call>>(
        self,
        info: &DispatchInfoOf<Self::Call>,
        len: usize,
    ) -> ApplyExtrinsicResultWithInfo<PostDispatchInfoOf<Self::Call>>;
}
Expand description

An “executable” piece of information, used by the standard Substrate Executive in order to enact a piece of extrinsic information by marshalling and dispatching to a named function call.

Also provides information on to whom this information is attributable and an index that allows each piece of attributable information to be disambiguated.

IMPORTANT: After validation, in both validate and apply, all transactions should have some authorized origin, except for inherents. This is necessary in order to protect the chain against spam. If no extension in the transaction extension pipeline authorized the transaction with an origin, either a system signed origin or a custom origin, then the transaction must be rejected, as the extensions provided in substrate which protect the chain, such as CheckNonce, ChargeTransactionPayment etc., rely on the assumption that the system handles system signed transactions, and the pallets handle the custom origin that they authorized.

Required Associated Types§

source

type Call: Dispatchable

Type by which we can dispatch. Restricts the UnsignedValidator type.

Required Methods§

source

fn validate<V: ValidateUnsigned<Call = Self::Call>>( &self, source: TransactionSource, info: &DispatchInfoOf<Self::Call>, len: usize, ) -> TransactionValidity

Checks to see if this is a valid transaction. It returns information on it if so.

IMPORTANT: Ensure that some origin has been authorized after validating the transaction. If no origin was authorized, the transaction must be rejected.

source

fn apply<V: ValidateUnsigned<Call = Self::Call>>( self, info: &DispatchInfoOf<Self::Call>, len: usize, ) -> ApplyExtrinsicResultWithInfo<PostDispatchInfoOf<Self::Call>>

Executes all necessary logic needed prior to dispatch and deconstructs into function call, index and sender.

IMPORTANT: Ensure that some origin has been authorized after validating the transaction. If no origin was authorized, the transaction must be rejected.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<AccountId, Call, Extension, RuntimeOrigin> Applyable for CheckedExtrinsic<AccountId, Call, Extension>
where AccountId: Member + MaybeDisplay, Call: Member + Dispatchable<RuntimeOrigin = RuntimeOrigin> + Encode, Extension: TransactionExtension<Call>, RuntimeOrigin: From<Option<AccountId>> + AsTransactionAuthorizedOrigin,

§

type Call = Call