pub struct SlotInfo<T: Config<I>, I: 'static = ()> {
digest: SlotDigest<T>,
shares: T::Shares,
commit: CommitInstance<T, I>,
variant: T::Position,
}Expand description
Represents a slot within a pool, derived from an index entry.
A SlotInfo tracks the underlying digest, the allocated shares, the
slot’s single CommitInstance (a collective receipt)
and the variant/disposition. It is primarily used when creating or
managing pools derived from index entries.
Fields§
§digest: SlotDigest<T>Unique identifier for the slot
Shares allocated to this slot
commit: CommitInstance<T, I>Commit-Instance associated with this slot
Since pools collectively manages funds, slots also inherit such behaviour. Hence it acts similar to a proprietor holding a deposit receipt from digest for their commitment.
variant: T::PositionDisposition of this slot (e.g., Affirmative, Contrary, Awaiting)
Implementations§
Source§impl<T: Config<I>, I: 'static> SlotInfo<T, I>
impl<T: Config<I>, I: 'static> SlotInfo<T, I>
Returns the pool’s slot’s total shares.
Sourcepub fn commit(&self) -> CommitInstance<T, I>
pub fn commit(&self) -> CommitInstance<T, I>
Returns the pool’s slot’s commit-instance (as a pseudo-proprietor).
Sourcepub fn digest(&self) -> SlotDigest<T>
pub fn digest(&self) -> SlotDigest<T>
Returns the pool’s slot’s digest.
Sourcefn set_slot_commit(&mut self, commit: CommitInstance<T, I>)
fn set_slot_commit(&mut self, commit: CommitInstance<T, I>)
Updates the CommitInstance associated with this slot.
This method replaces the existing commit instance with the provided one. It does not perform any validation, aggregation, or merging of commits, the caller is responsible for ensuring correctness and consistency.
§Parameters
commit: The newCommitInstanceto associate with this slot.
§Invariants
- This operation assumes the slot is already initialized.
- The provided commit should be semantically valid for this slot’s digest, shares, and variant.
§Note
This is an internal mutation helper and is not intended to enforce higher-level commitment rules.
Trait Implementations§
Source§impl<T: Config<I>, I: 'static> Decode for SlotInfo<T, I>
impl<T: Config<I>, I: 'static> Decode for SlotInfo<T, I>
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Source§impl<T: Config<I>, I: 'static> Encode for SlotInfo<T, I>
impl<T: Config<I>, I: 'static> Encode for SlotInfo<T, I>
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl<T: Config<I>, I: 'static> From<EntryInfo<T, I>> for SlotInfo<T, I>
impl<T: Config<I>, I: 'static> From<EntryInfo<T, I>> for SlotInfo<T, I>
Source§fn from(entry: EntryInfo<T, I>) -> Self
fn from(entry: EntryInfo<T, I>) -> Self
Converts an EntryInfo into a SlotInfo.
This is used when creating a pool from an index, as each index entry corresponds to a pool slot. The deposit-receipt is initialized to empty as slot doesn’t hold a commit currently.
§Returns
A SlotInfo with the same digest, shares, and variant.
Source§impl<T: Config<I>, I: 'static> MaxEncodedLen for SlotInfo<T, I>where
SlotDigest<T>: MaxEncodedLen,
T::Shares: MaxEncodedLen,
CommitInstance<T, I>: MaxEncodedLen,
T::Position: MaxEncodedLen,
impl<T: Config<I>, I: 'static> MaxEncodedLen for SlotInfo<T, I>where
SlotDigest<T>: MaxEncodedLen,
T::Shares: MaxEncodedLen,
CommitInstance<T, I>: MaxEncodedLen,
T::Position: MaxEncodedLen,
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Source§impl<T, I> TypeInfo for SlotInfo<T, I>where
SlotDigest<T>: TypeInfo + 'static,
T::Shares: TypeInfo + 'static,
CommitInstance<T, I>: TypeInfo + 'static,
T::Position: TypeInfo + 'static,
T: Config<I> + 'static,
I: 'static,
impl<T, I> TypeInfo for SlotInfo<T, I>where
SlotDigest<T>: TypeInfo + 'static,
T::Shares: TypeInfo + 'static,
CommitInstance<T, I>: TypeInfo + 'static,
T::Position: TypeInfo + 'static,
T: Config<I> + 'static,
I: 'static,
impl<T: Config<I>, I: 'static> DecodeWithMemTracking for SlotInfo<T, I>where
SlotDigest<T>: DecodeWithMemTracking,
T::Shares: DecodeWithMemTracking,
CommitInstance<T, I>: DecodeWithMemTracking,
T::Position: DecodeWithMemTracking,
impl<T: Config<I>, I: 'static> EncodeLike for SlotInfo<T, I>
impl<T: Config<I>, I: 'static> Eq for SlotInfo<T, I>
Auto Trait Implementations§
impl<T, I> Freeze for SlotInfo<T, I>where
<T as Config>::AccountId: Freeze,
<T as Config<I>>::Shares: Freeze,
<T as Config<I>>::Position: Freeze,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Freeze,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: Freeze,
<T as Config<I>>::Bias: Freeze,
<T as Config<I>>::Time: Freeze,
impl<T, I> RefUnwindSafe for SlotInfo<T, I>where
<T as Config>::AccountId: RefUnwindSafe,
<T as Config<I>>::Shares: RefUnwindSafe,
<T as Config<I>>::Position: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: RefUnwindSafe,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: RefUnwindSafe,
<T as Config<I>>::Bias: RefUnwindSafe,
<T as Config<I>>::Time: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: RefUnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: RefUnwindSafe,
impl<T, I> Send for SlotInfo<T, I>where
<T as Config<I>>::Position: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Send,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Send,
impl<T, I> Sync for SlotInfo<T, I>where
<T as Config<I>>::Position: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Sync,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Sync,
impl<T, I> Unpin for SlotInfo<T, I>where
<T as Config>::AccountId: Unpin,
<T as Config<I>>::Shares: Unpin,
<T as Config<I>>::Position: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: Unpin,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: Unpin,
<T as Config<I>>::Bias: Unpin,
<T as Config<I>>::Time: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: Unpin,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: Unpin,
impl<T, I> UnwindSafe for SlotInfo<T, I>where
<T as Config>::AccountId: UnwindSafe,
<T as Config<I>>::Shares: UnwindSafe,
<T as Config<I>>::Position: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynExtensionSchema<ReceiptAddon>>::Repr: UnwindSafe,
<<T as Config<I>>::Asset as Inspect<<T as Config>::AccountId>>::Balance: UnwindSafe,
<T as Config<I>>::Bias: UnwindSafe,
<T as Config<I>>::Time: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptAsset>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptRational>>::Bound: UnwindSafe,
<<<T as Config<I>>::BalanceContext as ModelContext>::Context as VirtualDynBound<ReceiptTime>>::Bound: UnwindSafe,
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
§impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
impl<T> DecodeWithMemLimit for Twhere
T: DecodeWithMemTracking,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Hashable for Twhere
T: Codec,
impl<T> Hashable for Twhere
T: Codec,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
impl<T, U, Tag> IntoTag<U, Tag> for Twhere
U: FromTag<T, Tag>,
Tag: DiscriminantTag,
§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
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
Source§impl<T, Time> Logging<Time> for Twhere
Time: Time,
impl<T, Time> Logging<Time> for Twhere
Time: Time,
Source§const FALLBACK_TARGET: &'static str = "routine"
const FALLBACK_TARGET: &'static str = "routine"
Default logging target if none is provided.
Most routines, especially offchain workers or background tasks, use this target for simplicity.
It allows a consistent place to look for routine logs without requiring every call to specify a target.
Note: This target is only a conveninence and may be somewhat vague. To ensure errors can still be traced accurately, the logged messages should include additional metadata (e.g., module name, error index, or contextual info) so that the source of the error can be identified even if the target is generic.
Source§type Logger = DispatchError
type Logger = DispatchError
The type taken and returned for logging.
We simply return the same [DispatchError] that was logged,
so logging does not change control flow or error propagation.
DispatchError is used because in Substrate it encompasses all
runtime errors - including module errors, token errors, arithmetic
issues, and transactional boundaries - making it the universal
substrate-side error representation.
Source§type Level = LogLevel
type Level = LogLevel
The log level type.
We use the LogLevel enum to standardize severity levels
(Info, Warn, Error, Debug) across all routine logs.
Source§fn log(
level: <T as Logging<Time>>::Level,
err: &<T as Logging<Time>>::Logger,
timestamp: Time,
target: Option<&str>,
fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>,
) -> <T as Logging<Time>>::Logger
fn log( level: <T as Logging<Time>>::Level, err: &<T as Logging<Time>>::Logger, timestamp: Time, target: Option<&str>, fmt: Option<fn(Time, &<T as Logging<Time>>::Level, &str, &str) -> String>, ) -> <T as Logging<Time>>::Logger
Source§fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn info(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
Source§fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
fn warn(
err: &Self::Logger,
timestamp: Timestamp,
target: Option<&str>,
fmt: Option<fn(Timestamp, &Self::Level, &str, &str) -> String>,
) -> Self::Loggerwhere
Self: Sized,
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read more§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.