referrerpolicy=no-referrer-when-downgrade

WeightInfoExt

Trait WeightInfoExt 

Source
pub trait WeightInfoExt {
    // Required methods
    fn on_finalize_block_fixed() -> Weight;
    fn on_finalize_block_per_order() -> Weight;
}

Required Methods§

Source

fn on_finalize_block_fixed() -> Weight

Returns the fixed base cost of finalize_block operations.

This represents the constant overhead incurred during on_finalize() regardless of order count. Includes setup costs, storage reads/writes, and other fixed operations.

Source

fn on_finalize_block_per_order() -> Weight

Returns the additional cost of finalize_block per placed order.

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§

Source§

impl<W: WeightInfo> WeightInfoExt for W

Implementation of WeightInfoExt that derives high-level weights from WeightInfo benchmarks.

This implementation solves the linear dependency problem by splitting the finalization weight into a fixed part and a part linearly growing with the number of orders.

Weight Formula:

Total weight = fixed_part + n_orders * per_order_part(payload_i)

Benchmark Sources:

  • Fixed cost: on_finalize_with_orders(0)
  • Per-order cost: on_finalize_with_orders(1) - on_finalize_per_transaction(0)

Uses differential calculation to isolate marginal costs from benchmark measurements.