Struct frame_system::CheckWeight
source · Expand description
Block resource (weight) limit check.
Transaction Validity
This extension does not influence any fields of TransactionValidity in case the
transaction is valid.
Implementations§
source§impl<T: Config + Send + Sync> CheckWeight<T>where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
impl<T: Config + Send + Sync> CheckWeight<T>where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
sourcepub fn do_pre_dispatch(
info: &DispatchInfoOf<T::RuntimeCall>,
len: usize
) -> Result<(), TransactionValidityError>
pub fn do_pre_dispatch(
info: &DispatchInfoOf<T::RuntimeCall>,
len: usize
) -> Result<(), TransactionValidityError>
Do the pre-dispatch checks. This can be applied to both signed and unsigned.
It checks and notes the new weight and length.
Examples found in repository?
src/extensions/check_weight.rs (line 193)
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
fn pre_dispatch(
self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> Result<(), TransactionValidityError> {
Self::do_pre_dispatch(info, len)
}
fn validate(
&self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> TransactionValidity {
Self::do_validate(info, len)
}
fn pre_dispatch_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> Result<(), TransactionValidityError> {
Self::do_pre_dispatch(info, len)
}sourcepub fn do_validate(
info: &DispatchInfoOf<T::RuntimeCall>,
len: usize
) -> TransactionValidity
pub fn do_validate(
info: &DispatchInfoOf<T::RuntimeCall>,
len: usize
) -> TransactionValidity
Do the validate checks. This can be applied to both signed and unsigned.
It only checks that the block weight and length limit will not exceed.
Examples found in repository?
src/extensions/check_weight.rs (line 203)
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
fn validate(
&self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> TransactionValidity {
Self::do_validate(info, len)
}
fn pre_dispatch_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> Result<(), TransactionValidityError> {
Self::do_pre_dispatch(info, len)
}
fn validate_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> TransactionValidity {
Self::do_validate(info, len)
}Trait Implementations§
source§impl<T: Clone + Config + Send + Sync> Clone for CheckWeight<T>
impl<T: Clone + Config + Send + Sync> Clone for CheckWeight<T>
source§fn clone(&self) -> CheckWeight<T>
fn clone(&self) -> CheckWeight<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<T: Config + Send + Sync> Decode for CheckWeight<T>where
PhantomData<T>: Decode,
impl<T: Config + Send + Sync> Decode for CheckWeight<T>where
PhantomData<T>: Decode,
source§impl<T: Default + Config + Send + Sync> Default for CheckWeight<T>
impl<T: Default + Config + Send + Sync> Default for CheckWeight<T>
source§fn default() -> CheckWeight<T>
fn default() -> CheckWeight<T>
Returns the “default value” for a type. Read more
source§impl<T: Config + Send + Sync> Encode for CheckWeight<T>where
PhantomData<T>: Encode,
impl<T: Config + Send + Sync> Encode for CheckWeight<T>where
PhantomData<T>: Encode,
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
)
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl<T: PartialEq + Config + Send + Sync> PartialEq<CheckWeight<T>> for CheckWeight<T>
impl<T: PartialEq + Config + Send + Sync> PartialEq<CheckWeight<T>> for CheckWeight<T>
source§fn eq(&self, other: &CheckWeight<T>) -> bool
fn eq(&self, other: &CheckWeight<T>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<T: Config + Send + Sync> SignedExtension for CheckWeight<T>where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
impl<T: Config + Send + Sync> SignedExtension for CheckWeight<T>where
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
§type Call = <T as Config>::RuntimeCall
type Call = <T as Config>::RuntimeCall
The type which encodes the call to be dispatched.
§type AdditionalSigned = ()
type AdditionalSigned = ()
Any additional data that will go into the signed payload. This may be created dynamically
from the transaction using the
additional_signed function.§type Pre = ()
type Pre = ()
The type that encodes information that can be passed from pre_dispatch to post-dispatch.
source§const IDENTIFIER: &'static str = "CheckWeight"
const IDENTIFIER: &'static str = "CheckWeight"
Unique identifier of this signed extension. Read more
source§fn additional_signed(&self) -> Result<(), TransactionValidityError>
fn additional_signed(&self) -> Result<(), TransactionValidityError>
Construct any additional data that should be in the signed payload of the transaction. Can
also perform any pre-signature-verification checks and return an error if needed.
source§fn pre_dispatch(
self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> Result<(), TransactionValidityError>
fn pre_dispatch(
self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> Result<(), TransactionValidityError>
Do any pre-flight stuff for a signed transaction. Read more
source§fn validate(
&self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> TransactionValidity
fn validate(
&self,
_who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> TransactionValidity
Validate a signed transaction for the transaction queue. Read more
source§fn pre_dispatch_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> Result<(), TransactionValidityError>
fn pre_dispatch_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> Result<(), TransactionValidityError>
Do any pre-flight stuff for a unsigned transaction. Read more
source§fn validate_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> TransactionValidity
fn validate_unsigned(
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize
) -> TransactionValidity
Validate an unsigned transaction for the transaction queue. Read more
source§fn post_dispatch(
_pre: Option<Self::Pre>,
info: &DispatchInfoOf<Self::Call>,
post_info: &PostDispatchInfoOf<Self::Call>,
_len: usize,
_result: &DispatchResult
) -> Result<(), TransactionValidityError>
fn post_dispatch(
_pre: Option<Self::Pre>,
info: &DispatchInfoOf<Self::Call>,
post_info: &PostDispatchInfoOf<Self::Call>,
_len: usize,
_result: &DispatchResult
) -> Result<(), TransactionValidityError>
Do any post-flight stuff for an extrinsic. Read more
source§impl<T> TypeInfo for CheckWeight<T>where
PhantomData<T>: TypeInfo + 'static,
T: Config + Send + Sync + 'static,
impl<T> TypeInfo for CheckWeight<T>where
PhantomData<T>: TypeInfo + 'static,
T: Config + Send + Sync + 'static,
impl<T: Config + Send + Sync> EncodeLike<CheckWeight<T>> for CheckWeight<T>where
PhantomData<T>: Encode,
impl<T: Eq + Config + Send + Sync> Eq for CheckWeight<T>
impl<T: Config + Send + Sync> StructuralEq for CheckWeight<T>
impl<T: Config + Send + Sync> StructuralPartialEq for CheckWeight<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for CheckWeight<T>where
T: RefUnwindSafe,
impl<T> Send for CheckWeight<T>
impl<T> Sync for CheckWeight<T>
impl<T> Unpin for CheckWeight<T>where
T: Unpin,
impl<T> UnwindSafe for CheckWeight<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> Hashable for Twhere
T: Codec,
impl<T> Hashable for Twhere
T: Codec,
fn blake2_128(&self) -> [u8; 16]
fn blake2_256(&self) -> [u8; 32]
fn blake2_128_concat(&self) -> Vec<u8, Global> ⓘ
fn twox_128(&self) -> [u8; 16]
fn twox_256(&self) -> [u8; 32]
fn twox_64_concat(&self) -> Vec<u8, Global> ⓘ
fn identity(&self) -> Vec<u8, Global> ⓘ
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, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
§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>,
Consume self to return an equivalent value of
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
The counterpart to
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.