referrerpolicy=no-referrer-when-downgrade
pallet_election_provider_multi_block::verifier

Trait AsynchronousVerifier

Source
pub trait AsynchronousVerifier: Verifier {
    type SolutionDataProvider: SolutionDataProvider;

    // Required methods
    fn status() -> Status;
    fn start() -> Result<(), &'static str>;
    fn stop();
}
Expand description

Something that can do the verification asynchronously.

Required Associated Types§

Source

type SolutionDataProvider: SolutionDataProvider

The data provider that can provide the candidate solution, and to whom we report back the results.

Required Methods§

Source

fn status() -> Status

Get the current stage of the verification process.

Source

fn start() -> Result<(), &'static str>

Start a verification process.

Returns Ok(()) if verification started successfully, and Err(..) if a verification is already ongoing and therefore a new one cannot be started.

From the coming block onwards, the verifier will start and fetch the relevant information and solution pages from SolutionDataProvider. It is expected that the SolutionDataProvider is ready before calling Self::start.

Pages of the solution are fetched sequentially and in order from SolutionDataProvider, from msp to lsp.

This ends in either of the two:

  1. All pages, including the final checks (like score and other facts that can only be derived from a full solution) are valid and the solution is verified. The solution is queued and is ready for further export.
  2. The solution checks verification at one of the steps. Nothing is stored inside the verifier pallet and all intermediary data is removed.

In both cases, the SolutionDataProvider is informed via SolutionDataProvider::report_result. It is sensible for the data provide to call start again if the verification has failed, and nothing otherwise. Indeed, the SolutionDataProvider must adjust its internal state such that it returns a new candidate solution after each failure.

Source

fn stop()

Stop the verification.

This is a force-stop operation, and should only be used in extreme cases where the SolutionDataProvider wants to suddenly bail-out.

An implementation should make sure that no loose ends remain state-wise, and everything is cleaned.

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§