Trait FinalizedPolicy

Source
pub trait FinalizedPolicy<Context>
where Context: Config,
{ // Required methods fn finality_after() -> <Context as Config>::Moment; fn finality_ticks() -> BlockNumberFor<Context>; }
Expand description

Defines a finality evaluation policy for values managed by Finalized storage.

Intended for Substrate FRAME-based runtimes only.

This trait specifies the parameters used to derive a confidence signal for speculative, fork-aware data based on:

  • elapsed wall-clock time, and
  • block-scoped repeated observations.

It only answers:

  • how long a value must survive before it may be considered stable, and
  • how many distinct block observations are required to strengthen confidence.

The policy provides inputs to confidence evaluation and does not imply on-chain finality or absolute truth.

Required Methods§

Source

fn finality_after() -> <Context as Config>::Moment

Wall-clock elapsed time window that must pass after the first observation before a value may begin to contribute to a stronger confidence signal.

Conceptually, this represents the delay between:

  • an initial observation window, and
  • an optimal finalized window where confidence can be evaluated.

The duration is expressed using the runtime’s timestamp type (see [pallet_timestamp::Config::Moment]).

Source

fn finality_ticks() -> BlockNumberFor<Context>

Number of distinct blocks in which the value must be observed after the finality window has elapsed.

Observations are block-scoped:

  • At most one observation per block is counted.
  • Repeated OCW executions within the same block do not increase this value.

This parameter acts as a confidence-strengthening threshold to guard against transient forks.

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§