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.
- Check that the total number of winners is sufficient (
DesiredTargets
). - Check that the claimed score (
sp_npos_elections::ElectionScore
) is correct,
- and more than the minimum score that can be specified via
Verifier::set_minimum_score
.
- Check that all of the bounds of the solution are respected, namely
Verifier::MaxBackersPerWinner
,Verifier::MaxWinnersPerPage
andVerifier::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:
- 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. SeeVerifier::verify_synchronous
andVerifier::verify_synchronous_multi
. - Multi-page, asynchronous verification. This is useful in the context of multi-page, signed
solutions. See
verifier::AsynchronousVerifier
andverifier::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:
- being challenged and potentially replaced by better solution, if any.
- 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§
- Genesis
Config - 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. - Queued
Solution - 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 - Feasibility
Error - Errors that can happen in the feasibility check.
- Status
- The status of this pallet.
- Verification
Result - Simple enum to encapsulate the result of the verification of a candidate solution.
Traits§
- Asynchronous
Verifier - Something that can do the verification asynchronously.
- Config
- Configuration trait of this pallet.
- Solution
Data Provider - 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§
- Module
Deprecated - Type alias to
Pallet
, to be used byconstruct_runtime
.