ValidateUnsigned

Trait ValidateUnsigned 

Source
pub trait ValidateUnsigned {
    type Call;

    // Required method
    fn validate_unsigned(
        source: TransactionSource,
        call: &Self::Call,
    ) -> TransactionValidity;

    // Provided method
    fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError> { ... }
}
Expand description

Something that can validate unsigned extrinsics for the transaction pool.

Note that any checks done here are only used for determining the validity of the transaction for the transaction pool. During block execution phase one need to perform the same checks anyway, since this function is not being called.

Required Associated Types§

Source

type Call

The call to validate

Required Methods§

Source

fn validate_unsigned( source: TransactionSource, call: &Self::Call, ) -> TransactionValidity

Return the validity of the call

This doesn’t execute any side-effects; it merely checks whether the transaction would panic if it were included or not.

Changes made to storage should be discarded by caller.

Provided Methods§

Source

fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>

Validate the call right before dispatch.

This method should be used to prevent transactions already in the pool (i.e. passing validate_unsigned) from being included in blocks in case we know they now became invalid.

By default it’s a good idea to call validate_unsigned from within this function again to make sure we never include an invalid transaction.

Changes made to storage WILL be persisted if the call returns Ok.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§