Quadratic weighting struct
A tool for weighting more complex transactions.
#
GoalCalculate transaction weights for transactions with 3 or more parameters.
#
Use casesCalculate correct weight based on data within a function, required to calculate transaction fees.
#
OverviewThis is a more complex way scale to weight transactions. It computes weight according to the following formula:
ax^2 + by + c
Where a, b, and c are fields in the struct, and x and y are transaction parameters. Have a look at the [examples][#examples] section to see it implemented and used in context.
#
StepsQuadratic
struct#
1. Write the Write a weighting struct that weighs transactions where the first parameter is a boolean value.
#
2. Classify dispatch callsSince this implementation of WeighData
requires a DispatchClass
, use default
to classify all calls as normal.
PaysFee
#
3. Implement Last, specify how PaysFee
is used for the custom WeighData
struct.
#
Examples- Feeless transaction pallet
- pallet-weights