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

Trait SolutionDataProvider

Source
pub trait SolutionDataProvider {
    type Solution;

    // Required methods
    fn get_page(page: PageIndex) -> Option<Self::Solution>;
    fn get_score() -> Option<ElectionScore>;
    fn report_result(result: VerificationResult);
}
Expand description

Something that can provide candidate solutions to the verifier.

In reality, this can be implemented by the crate::signed::Pallet, where signed solutions are queued and sorted based on claimed score, and they are put forth one by one, from best to worse.

Required Associated Types§

Source

type Solution

The opaque solution type.

Required Methods§

Source

fn get_page(page: PageIndex) -> Option<Self::Solution>

Return the pageth page of the current best solution that the data provider has in store.

If no candidate solutions are available, then None is returned.

Source

fn get_score() -> Option<ElectionScore>

Get the claimed score of the current best solution.

Source

fn report_result(result: VerificationResult)

Hook to report back the results of the verification of the current candidate solution that is being exposed via Self::get_page and Self::get_score.

Every time that this is called, the verifier AsynchronousVerifier goes back to the Status::Nothing state, and it is the responsibility of Self to call start again, if desired.

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§