referrerpolicy=no-referrer-when-downgrade

Module verifier

Source
Expand description

The verifier pallet

§The Verifier Pallet

This pallet has no end-user functionality, and is only used internally by other pallets in the EPMB machinery to verify solutions.

§Feasibility Check

Before explaining the pallet itself, it should be explained what a verification even means. Verification of a solution page (crate::unsigned::miner::MinerConfig::Solution) includes the process of checking all of its edges against a snapshot to be correct. For instance, all voters that are presented in a solution page must have actually voted for the winner that they are backing, based on the snapshot kept in the parent pallet.

Such checks are bound to each page of the solution, and happen per-page. After checking all of the edges in each page, a handful of other checks are performed. These checks cannot happen per-page, and in order to do them we need to have the entire solution checked and verified.

  1. Check that the total number of winners is sufficient (DesiredTargets).
  2. Check that the claimed score (sp_npos_elections::ElectionScore) is correct,
  1. Check that all of the bounds of the solution are respected, namely Verifier::MaxBackersPerWinner, Verifier::MaxWinnersPerPage and Verifier::MaxBackersPerWinnerFinal.

Note that the common factor of all of the above checks is that they can ONLY be checked after all pages are already verified. So, in the case of a multi-page verification, these checks are performed at the last page.

The errors that can arise while performing the feasibility check are encapsulated in verifier::FeasibilityError.

§Modes of Verification

The verifier pallet provide two modes of functionality:

  1. Single or multi-page, synchronous verification. This is useful in the context of single-page, emergency, or unsigned solutions that need to be verified on the fly. This is similar to how the old school multi-phase pallet works. See Verifier::verify_synchronous and Verifier::verify_synchronous_multi.
  2. Multi-page, asynchronous verification. This is useful in the context of multi-page, signed solutions. See verifier::AsynchronousVerifier and verifier::SolutionDataProvider.

Both of this, plus some helper functions, is exposed via the verifier::Verifier trait.

§Queued Solution

once a solution has been verified, it is called a queued solution. It is sitting in a queue, waiting for either of:

  1. being challenged and potentially replaced by better solution, if any.
  2. being exported as the final outcome of the election.

Re-exports§

pub use crate::weights::traits::pallet_election_provider_multi_block_verifier::*;

Modules§

benchmarking
dispatchables
Auto-generated docs-only module listing all defined dispatchables for this pallet.
storage_types
Auto-generated docs-only module listing all (public and private) defined storage types for this pallet.

Structs§

GenesisConfig
Can be used to configure the genesis state of this pallet.
Pallet
The Pallet struct, the main type that implements traits and standalone functions within the pallet.
QueuedSolution
A wrapper interface for the storage items related to the queued solution.

Enums§

Call
Contains a variant per dispatchable extrinsic that this pallet has.
Event
The Event enum of this pallet
FeasibilityError
Errors that can happen in the feasibility check.
Status
The status of this pallet.
VerificationResult
Simple enum to encapsulate the result of the verification of a candidate solution.

Traits§

AsynchronousVerifier
Something that can do the verification asynchronously.
Config
Configuration trait of this pallet.
SolutionDataProvider
Something that can provide candidate solutions to the verifier.
Verifier
The interface of something that can verify solutions for other sub-pallets in the multi-block election pallet-network.

Functions§

feasibility_check_page_inner_with_snapshot
Same as feasibility_check_page_inner, but with a snapshot.

Type Aliases§

ModuleDeprecated
Type alias to Pallet, to be used by construct_runtime.