#[non_exhaustive]pub struct ValidatorSet {
pub total_stake: Option<u64>,
pub active_validators: Vec<Validator>,
pub pending_active_validators: Option<MoveTable>,
pub pending_removals: Vec<u64>,
pub staking_pool_mappings: Option<MoveTable>,
pub inactive_validators: Option<MoveTable>,
pub validator_candidates: Option<MoveTable>,
pub at_risk_validators: BTreeMap<String, u64>,
pub extra_fields: Option<MoveTable>,
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.total_stake: Option<u64>
Total amount of stake from all active validators at the beginning of the epoch.
Written only once per epoch, in advance_epoch
function.
active_validators: Vec<Validator>
The current list of active validators.
pending_active_validators: Option<MoveTable>
List of new validator candidates added during the current epoch. They will be processed at the end of the epoch.
key: u64 (index), value: 0x3::validator::Validator
pending_removals: Vec<u64>
Removal requests from the validators. Each element is an index
pointing to active_validators
.
staking_pool_mappings: Option<MoveTable>
Mappings from staking pool’s ID to the sui address of a validator.
key: address (staking pool Id), value: address (sui address of the validator)
inactive_validators: Option<MoveTable>
Mapping from a staking pool ID to the inactive validator that has that pool as its staking pool.
When a validator is deactivated the validator is removed from active_validators
it
is added to this table so that stakers can continue to withdraw their stake from it.
key: address (staking pool Id), value: 0x3::validator_wrapper::ValidatorWrapper
validator_candidates: Option<MoveTable>
Table storing preactive/candidate validators, mapping their addresses to their Validator
structs.
When an address calls request_add_validator_candidate
, they get added to this table and become a preactive
validator.
When the candidate has met the min stake requirement, they can call request_add_validator
to
officially add them to the active validator set active_validators
next epoch.
key: address (sui address of the validator), value: 0x3::validator_wrapper::ValidatorWrapper
at_risk_validators: BTreeMap<String, u64>
Table storing the number of epochs during which a validator’s stake has been below the low stake threshold.
extra_fields: Option<MoveTable>
Any extra fields that’s not defined statically.
Implementations§
Source§impl ValidatorSet
impl ValidatorSet
pub const TOTAL_STAKE_FIELD: &'static MessageField
pub const ACTIVE_VALIDATORS_FIELD: &'static MessageField
pub const PENDING_ACTIVE_VALIDATORS_FIELD: &'static MessageField
pub const PENDING_REMOVALS_FIELD: &'static MessageField
pub const STAKING_POOL_MAPPINGS_FIELD: &'static MessageField
pub const INACTIVE_VALIDATORS_FIELD: &'static MessageField
pub const VALIDATOR_CANDIDATES_FIELD: &'static MessageField
pub const AT_RISK_VALIDATORS_FIELD: &'static MessageField
pub const EXTRA_FIELDS_FIELD: &'static MessageField
Source§impl ValidatorSet
impl ValidatorSet
pub fn path_builder() -> ValidatorSetFieldPathBuilder
Source§impl ValidatorSet
impl ValidatorSet
pub const fn const_default() -> Self
Sourcepub fn total_stake_opt_mut(&mut self) -> Option<&mut u64>
pub fn total_stake_opt_mut(&mut self) -> Option<&mut u64>
Sourcepub fn total_stake_mut(&mut self) -> &mut u64
pub fn total_stake_mut(&mut self) -> &mut u64
Returns a mutable reference to total_stake
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn total_stake_opt(&self) -> Option<u64>
pub fn total_stake_opt(&self) -> Option<u64>
Sourcepub fn set_total_stake<T: Into<u64>>(&mut self, field: T)
pub fn set_total_stake<T: Into<u64>>(&mut self, field: T)
Sets total_stake
with the provided value.
Sourcepub fn with_total_stake<T: Into<u64>>(self, field: T) -> Self
pub fn with_total_stake<T: Into<u64>>(self, field: T) -> Self
Sets total_stake
with the provided value.
Sourcepub fn active_validators(&self) -> &[Validator]
pub fn active_validators(&self) -> &[Validator]
Returns the value of active_validators
, or the default value if active_validators
is unset.
Sourcepub fn active_validators_mut(&mut self) -> &mut Vec<Validator>
pub fn active_validators_mut(&mut self) -> &mut Vec<Validator>
Returns a mutable reference to active_validators
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn set_active_validators(&mut self, field: Vec<Validator>)
pub fn set_active_validators(&mut self, field: Vec<Validator>)
Sets active_validators
with the provided value.
Sourcepub fn with_active_validators(self, field: Vec<Validator>) -> Self
pub fn with_active_validators(self, field: Vec<Validator>) -> Self
Sets active_validators
with the provided value.
Sourcepub fn pending_active_validators(&self) -> &MoveTable
pub fn pending_active_validators(&self) -> &MoveTable
Returns the value of pending_active_validators
, or the default value if pending_active_validators
is unset.
Sourcepub fn pending_active_validators_opt_mut(&mut self) -> Option<&mut MoveTable>
pub fn pending_active_validators_opt_mut(&mut self) -> Option<&mut MoveTable>
Sourcepub fn pending_active_validators_mut(&mut self) -> &mut MoveTable
pub fn pending_active_validators_mut(&mut self) -> &mut MoveTable
Returns a mutable reference to pending_active_validators
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn pending_active_validators_opt(&self) -> Option<&MoveTable>
pub fn pending_active_validators_opt(&self) -> Option<&MoveTable>
Sourcepub fn set_pending_active_validators<T: Into<MoveTable>>(&mut self, field: T)
pub fn set_pending_active_validators<T: Into<MoveTable>>(&mut self, field: T)
Sets pending_active_validators
with the provided value.
Sourcepub fn with_pending_active_validators<T: Into<MoveTable>>(
self,
field: T,
) -> Self
pub fn with_pending_active_validators<T: Into<MoveTable>>( self, field: T, ) -> Self
Sets pending_active_validators
with the provided value.
Sourcepub fn pending_removals(&self) -> &[u64]
pub fn pending_removals(&self) -> &[u64]
Returns the value of pending_removals
, or the default value if pending_removals
is unset.
Sourcepub fn pending_removals_mut(&mut self) -> &mut Vec<u64>
pub fn pending_removals_mut(&mut self) -> &mut Vec<u64>
Returns a mutable reference to pending_removals
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn set_pending_removals(&mut self, field: Vec<u64>)
pub fn set_pending_removals(&mut self, field: Vec<u64>)
Sets pending_removals
with the provided value.
Sourcepub fn with_pending_removals(self, field: Vec<u64>) -> Self
pub fn with_pending_removals(self, field: Vec<u64>) -> Self
Sets pending_removals
with the provided value.
Sourcepub fn staking_pool_mappings(&self) -> &MoveTable
pub fn staking_pool_mappings(&self) -> &MoveTable
Returns the value of staking_pool_mappings
, or the default value if staking_pool_mappings
is unset.
Sourcepub fn staking_pool_mappings_opt_mut(&mut self) -> Option<&mut MoveTable>
pub fn staking_pool_mappings_opt_mut(&mut self) -> Option<&mut MoveTable>
Sourcepub fn staking_pool_mappings_mut(&mut self) -> &mut MoveTable
pub fn staking_pool_mappings_mut(&mut self) -> &mut MoveTable
Returns a mutable reference to staking_pool_mappings
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn staking_pool_mappings_opt(&self) -> Option<&MoveTable>
pub fn staking_pool_mappings_opt(&self) -> Option<&MoveTable>
Sourcepub fn set_staking_pool_mappings<T: Into<MoveTable>>(&mut self, field: T)
pub fn set_staking_pool_mappings<T: Into<MoveTable>>(&mut self, field: T)
Sets staking_pool_mappings
with the provided value.
Sourcepub fn with_staking_pool_mappings<T: Into<MoveTable>>(self, field: T) -> Self
pub fn with_staking_pool_mappings<T: Into<MoveTable>>(self, field: T) -> Self
Sets staking_pool_mappings
with the provided value.
Sourcepub fn inactive_validators(&self) -> &MoveTable
pub fn inactive_validators(&self) -> &MoveTable
Returns the value of inactive_validators
, or the default value if inactive_validators
is unset.
Sourcepub fn inactive_validators_opt_mut(&mut self) -> Option<&mut MoveTable>
pub fn inactive_validators_opt_mut(&mut self) -> Option<&mut MoveTable>
Sourcepub fn inactive_validators_mut(&mut self) -> &mut MoveTable
pub fn inactive_validators_mut(&mut self) -> &mut MoveTable
Returns a mutable reference to inactive_validators
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn inactive_validators_opt(&self) -> Option<&MoveTable>
pub fn inactive_validators_opt(&self) -> Option<&MoveTable>
Sourcepub fn set_inactive_validators<T: Into<MoveTable>>(&mut self, field: T)
pub fn set_inactive_validators<T: Into<MoveTable>>(&mut self, field: T)
Sets inactive_validators
with the provided value.
Sourcepub fn with_inactive_validators<T: Into<MoveTable>>(self, field: T) -> Self
pub fn with_inactive_validators<T: Into<MoveTable>>(self, field: T) -> Self
Sets inactive_validators
with the provided value.
Sourcepub fn validator_candidates(&self) -> &MoveTable
pub fn validator_candidates(&self) -> &MoveTable
Returns the value of validator_candidates
, or the default value if validator_candidates
is unset.
Sourcepub fn validator_candidates_opt_mut(&mut self) -> Option<&mut MoveTable>
pub fn validator_candidates_opt_mut(&mut self) -> Option<&mut MoveTable>
Sourcepub fn validator_candidates_mut(&mut self) -> &mut MoveTable
pub fn validator_candidates_mut(&mut self) -> &mut MoveTable
Returns a mutable reference to validator_candidates
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn validator_candidates_opt(&self) -> Option<&MoveTable>
pub fn validator_candidates_opt(&self) -> Option<&MoveTable>
Sourcepub fn set_validator_candidates<T: Into<MoveTable>>(&mut self, field: T)
pub fn set_validator_candidates<T: Into<MoveTable>>(&mut self, field: T)
Sets validator_candidates
with the provided value.
Sourcepub fn with_validator_candidates<T: Into<MoveTable>>(self, field: T) -> Self
pub fn with_validator_candidates<T: Into<MoveTable>>(self, field: T) -> Self
Sets validator_candidates
with the provided value.
Sourcepub fn at_risk_validators(&self) -> &BTreeMap<String, u64>
pub fn at_risk_validators(&self) -> &BTreeMap<String, u64>
Returns the value of at_risk_validators
, or the default value if at_risk_validators
is unset.
Sourcepub fn at_risk_validators_mut(&mut self) -> &mut BTreeMap<String, u64>
pub fn at_risk_validators_mut(&mut self) -> &mut BTreeMap<String, u64>
Returns a mutable reference to at_risk_validators
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn set_at_risk_validators(&mut self, field: BTreeMap<String, u64>)
pub fn set_at_risk_validators(&mut self, field: BTreeMap<String, u64>)
Sets at_risk_validators
with the provided value.
Sourcepub fn with_at_risk_validators(self, field: BTreeMap<String, u64>) -> Self
pub fn with_at_risk_validators(self, field: BTreeMap<String, u64>) -> Self
Sets at_risk_validators
with the provided value.
Sourcepub fn extra_fields(&self) -> &MoveTable
pub fn extra_fields(&self) -> &MoveTable
Returns the value of extra_fields
, or the default value if extra_fields
is unset.
Sourcepub fn extra_fields_opt_mut(&mut self) -> Option<&mut MoveTable>
pub fn extra_fields_opt_mut(&mut self) -> Option<&mut MoveTable>
Sourcepub fn extra_fields_mut(&mut self) -> &mut MoveTable
pub fn extra_fields_mut(&mut self) -> &mut MoveTable
Returns a mutable reference to extra_fields
.
If the field is unset, it is first initialized with the default value.
Sourcepub fn extra_fields_opt(&self) -> Option<&MoveTable>
pub fn extra_fields_opt(&self) -> Option<&MoveTable>
Sourcepub fn set_extra_fields<T: Into<MoveTable>>(&mut self, field: T)
pub fn set_extra_fields<T: Into<MoveTable>>(&mut self, field: T)
Sets extra_fields
with the provided value.
Sourcepub fn with_extra_fields<T: Into<MoveTable>>(self, field: T) -> Self
pub fn with_extra_fields<T: Into<MoveTable>>(self, field: T) -> Self
Sets extra_fields
with the provided value.
Source§impl ValidatorSet
impl ValidatorSet
Sourcepub fn total_stake(&self) -> u64
pub fn total_stake(&self) -> u64
Returns the value of total_stake
, or the default value if total_stake
is unset.
Trait Implementations§
Source§impl Clone for ValidatorSet
impl Clone for ValidatorSet
Source§fn clone(&self) -> ValidatorSet
fn clone(&self) -> ValidatorSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ValidatorSet
impl Debug for ValidatorSet
Source§impl Default for ValidatorSet
impl Default for ValidatorSet
§impl<'de> Deserialize<'de> for ValidatorSet
impl<'de> Deserialize<'de> for ValidatorSet
§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Message for ValidatorSet
impl Message for ValidatorSet
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.Source§impl MessageFields for ValidatorSet
impl MessageFields for ValidatorSet
const FIELDS: &'static [&'static MessageField]
Source§impl PartialEq for ValidatorSet
impl PartialEq for ValidatorSet
§impl Serialize for ValidatorSet
impl Serialize for ValidatorSet
impl StructuralPartialEq for ValidatorSet
Auto Trait Implementations§
impl Freeze for ValidatorSet
impl RefUnwindSafe for ValidatorSet
impl Send for ValidatorSet
impl Sync for ValidatorSet
impl Unpin for ValidatorSet
impl UnwindSafe for ValidatorSet
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moreSource§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered
].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.