referrerpolicy=no-referrer-when-downgrade

Trait pallet_transaction_payment::pallet::Config

source ·
pub trait Config: Config {
    type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
    type OnChargeTransaction: OnChargeTransaction<Self>;
    type WeightToFee: WeightToFee<Balance = <<Self as Config>::OnChargeTransaction as OnChargeTransaction<Self>>::Balance>;
    type LengthToFee: WeightToFee<Balance = <<Self as Config>::OnChargeTransaction as OnChargeTransaction<Self>>::Balance>;
    type FeeMultiplierUpdate: MultiplierUpdate;
    type OperationalFeeMultiplier: Get<u8>;
    type WeightInfo: WeightInfo;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait.

Required Associated Types§

source

type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>

The overarching event type.

source

type OnChargeTransaction: OnChargeTransaction<Self>

Handler for withdrawing, refunding and depositing the transaction fee. Transaction fees are withdrawn before the transaction is executed. After the transaction was executed the transaction weight can be adjusted, depending on the used resources by the transaction. If the transaction weight is lower than expected, parts of the transaction fee might be refunded. In the end the fees can be deposited.

source

type WeightToFee: WeightToFee<Balance = <<Self as Config>::OnChargeTransaction as OnChargeTransaction<Self>>::Balance>

Convert a weight value into a deductible fee based on the currency type.

source

type LengthToFee: WeightToFee<Balance = <<Self as Config>::OnChargeTransaction as OnChargeTransaction<Self>>::Balance>

Convert a length value into a deductible fee based on the currency type.

source

type FeeMultiplierUpdate: MultiplierUpdate

Update the multiplier of the next block, based on the previous block’s weight.

source

type OperationalFeeMultiplier: Get<u8>

A fee multiplier for Operational extrinsics to compute “virtual tip” to boost their priority

This value is multiplied by the final_fee to obtain a “virtual tip” that is later added to a tip component in regular priority calculations. It means that a Normal transaction can front-run a similarly-sized Operational extrinsic (with no tip), by including a tip value greater than the virtual tip.

// For `Normal`
let priority = priority_calc(tip);

// For `Operational`
let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;
let priority = priority_calc(tip + virtual_tip);

Note that since we use final_fee the multiplier applies also to the regular tip sent with the transaction. So, not only does the transaction get a priority bump based on the inclusion_fee, but we also amplify the impact of tips applied to Operational transactions.

source

type WeightInfo: WeightInfo

The weight information of this pallet.

Object Safety§

This trait is not object safe.

Implementors§