Struct casper_types::account::action_thresholds::ActionThresholds
source · pub struct ActionThresholds {
pub deployment: Weight,
pub key_management: Weight,
}
Expand description
Thresholds that have to be met when executing an action of a certain type.
Fields§
§deployment: Weight
Threshold for deploy execution.
key_management: Weight
Threshold for managing action threshold.
Implementations§
source§impl ActionThresholds
impl ActionThresholds
sourcepub fn new(
deployment: Weight,
key_management: Weight
) -> Result<ActionThresholds, SetThresholdFailure>
pub fn new( deployment: Weight, key_management: Weight ) -> Result<ActionThresholds, SetThresholdFailure>
Creates new ActionThresholds object with provided weights
Requires deployment threshold to be lower than or equal to key management threshold.
sourcepub fn set_deployment_threshold(
&mut self,
new_threshold: Weight
) -> Result<(), SetThresholdFailure>
pub fn set_deployment_threshold( &mut self, new_threshold: Weight ) -> Result<(), SetThresholdFailure>
Sets new threshold for ActionType::Deployment.
Should return an error if setting new threshold for action_type
breaks
one of the invariants. Currently, invariant is that
ActionType::Deployment
threshold shouldn’t be higher than any
other, which should be checked both when increasing Deployment
threshold and decreasing the other.
sourcepub fn set_key_management_threshold(
&mut self,
new_threshold: Weight
) -> Result<(), SetThresholdFailure>
pub fn set_key_management_threshold( &mut self, new_threshold: Weight ) -> Result<(), SetThresholdFailure>
Sets new threshold for ActionType::KeyManagement.
sourcepub fn deployment(&self) -> &Weight
pub fn deployment(&self) -> &Weight
Returns the deployment action threshold.
sourcepub fn key_management(&self) -> &Weight
pub fn key_management(&self) -> &Weight
Returns key management action threshold.
sourcepub fn set_threshold(
&mut self,
action_type: ActionType,
new_threshold: Weight
) -> Result<(), SetThresholdFailure>
pub fn set_threshold( &mut self, action_type: ActionType, new_threshold: Weight ) -> Result<(), SetThresholdFailure>
Unified function that takes an action type, and changes appropriate threshold defined by the ActionType variants.
Trait Implementations§
source§impl Clone for ActionThresholds
impl Clone for ActionThresholds
source§fn clone(&self) -> ActionThresholds
fn clone(&self) -> ActionThresholds
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ActionThresholds
impl Debug for ActionThresholds
source§impl Default for ActionThresholds
impl Default for ActionThresholds
source§impl<'de> Deserialize<'de> for ActionThresholds
impl<'de> Deserialize<'de> for ActionThresholds
source§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 FromBytes for ActionThresholds
impl FromBytes for ActionThresholds
source§impl PartialEq for ActionThresholds
impl PartialEq for ActionThresholds
source§fn eq(&self, other: &ActionThresholds) -> bool
fn eq(&self, other: &ActionThresholds) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ActionThresholds
impl Serialize for ActionThresholds
source§impl ToBytes for ActionThresholds
impl ToBytes for ActionThresholds
source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.