pub struct ElectionProviderMultiPhaseQueryApi<'api> { /* private fields */ }
Implementations§
Source§impl<'api> ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> ElectionProviderMultiPhaseQueryApi<'api>
Sourcepub async fn round(&self) -> Result<u32>
pub async fn round(&self) -> Result<u32>
Internal counter for the number of rounds.
This is useful for de-duplication of transactions submitted to the pool, and general diagnostics of the pallet.
This is merely incremented once per every time that an upstream elect
is called.
Sourcepub async fn current_phase(&self) -> Result<Phase<u32>>
pub async fn current_phase(&self) -> Result<Phase<u32>>
Current phase.
Sourcepub async fn queued_solution(&self) -> Result<Option<ReadySolution>>
pub async fn queued_solution(&self) -> Result<Option<ReadySolution>>
Current best solution, signed or unsigned, queued to be returned upon elect
.
Sourcepub async fn snapshot(&self) -> Result<Option<RoundSnapshot>>
pub async fn snapshot(&self) -> Result<Option<RoundSnapshot>>
Snapshot data of the round.
This is created at the beginning of the signed phase and cleared upon calling elect
.
Sourcepub async fn desired_targets(&self) -> Result<Option<u32>>
pub async fn desired_targets(&self) -> Result<Option<u32>>
Desired number of targets to elect for this round.
Only exists when [Snapshot
] is present.
Sourcepub async fn snapshot_metadata(&self) -> Result<Option<SolutionOrSnapshotSize>>
pub async fn snapshot_metadata(&self) -> Result<Option<SolutionOrSnapshotSize>>
The metadata of the [RoundSnapshot
]
Only exists when [Snapshot
] is present.
Sourcepub async fn signed_submission_next_index(&self) -> Result<u32>
pub async fn signed_submission_next_index(&self) -> Result<u32>
The next index to be assigned to an incoming signed submission.
Every accepted submission is assigned a unique index; that index is bound to that particular submission for the duration of the election. On election finalization, the next index is reset to 0.
We can’t just use SignedSubmissionIndices.len()
, because that’s a bounded set; past its
capacity, it will simply saturate. We can’t just iterate over SignedSubmissionsMap
,
because iteration is slow. Instead, we store the value here.
Sourcepub async fn signed_submission_indices(
&self,
) -> Result<Vec<(ElectionScore, u32, u32)>>
pub async fn signed_submission_indices( &self, ) -> Result<Vec<(ElectionScore, u32, u32)>>
A sorted, bounded vector of (score, block_number, index)
, where each index
points to a
value in SignedSubmissions
.
We never need to process more than a single signed submission at a time. Signed submissions can be quite large, so we’re willing to pay the cost of multiple database accesses to access them one at a time instead of reading and decoding all of them at once.
Sourcepub async fn signed_submissions_map(
&self,
key_0: u32,
) -> Result<Option<SignedSubmission<AccountId, u128, NposSolution16>>>
pub async fn signed_submissions_map( &self, key_0: u32, ) -> Result<Option<SignedSubmission<AccountId, u128, NposSolution16>>>
Unchecked, signed solutions.
Together with SubmissionIndices
, this stores a bounded set of SignedSubmissions
while
allowing us to keep only a single one in memory at a time.
Twox note: the key of the map is an auto-incrementing index which users cannot inspect or affect; we shouldn’t need a cryptographically secure hasher.
Sourcepub async fn minimum_untrusted_score(&self) -> Result<Option<ElectionScore>>
pub async fn minimum_untrusted_score(&self) -> Result<Option<ElectionScore>>
The minimum score that each ‘untrusted’ solution must attain in order to be considered feasible.
Can be set via set_minimum_untrusted_score
.
Trait Implementations§
Source§impl<'api> Clone for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> Clone for ElectionProviderMultiPhaseQueryApi<'api>
Source§fn clone(&self) -> ElectionProviderMultiPhaseQueryApi<'api>
fn clone(&self) -> ElectionProviderMultiPhaseQueryApi<'api>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'api> Freeze for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> !RefUnwindSafe for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> Send for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> Sync for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> Unpin for ElectionProviderMultiPhaseQueryApi<'api>
impl<'api> !UnwindSafe for ElectionProviderMultiPhaseQueryApi<'api>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.