pub trait ProvideInherent {
    type Call;
    type Error: Encode + IsFatalError;

    const INHERENT_IDENTIFIER: InherentIdentifier;

    fn create_inherent(data: &InherentData) -> Option<Self::Call>;
fn is_inherent(call: &Self::Call) -> bool; fn is_inherent_required(
        _: &InherentData
    ) -> Result<Option<Self::Error>, Self::Error> { ... }
fn check_inherent(
        _: &Self::Call,
        _: &InherentData
    ) -> Result<(), Self::Error> { ... } }
Expand description

A pallet that provides or verifies an inherent extrinsic.

The pallet may provide the inherent, verify an inherent, or both provide and verify.

Associated Types

The call type of the pallet.

The error returned by check_inherent.

Associated Constants

The inherent identifier used by this inherent.

Required methods

Create an inherent out of the given InherentData.

Return whether the call is an inherent call.

NOTE: Signed extrinsics are not inherent, but signed extrinsic with the given call variant can be dispatched.

Warning

In FRAME, inherent are enforced to be before other extrinsics, for this reason, pallets with unsigned transactions must ensure that no unsigned transaction call is an inherent call, when implementing ValidateUnsigned::validate_unsigned. Otherwise block producer can produce invalid blocks by including them after non inherent.

Provided methods

Determines whether this inherent is required in this block.

  • Ok(None) indicates that this inherent is not required in this block. The default implementation returns this.

  • Ok(Some(e)) indicates that this inherent is required in this block. construct_runtime! will call this function from in its implementation of fn check_extrinsics. If the inherent is not present, it will return e.

  • Err(_) indicates that this function failed and further operations should be aborted.

NOTE: If inherent is required then the runtime asserts that the block contains at least one inherent for which:

Check whether the given inherent is valid. Checking the inherent is optional and can be omitted by using the default implementation.

When checking an inherent, the first parameter represents the inherent that is actually included in the block by its author. Whereas the second parameter represents the inherent data that the verifying node calculates.

NOTE: A block can contains multiple inherent.

Implementors