Struct frame_system::pallet::Pallet [−][src]
Implementations
impl<T: Config> Pallet<T>
[src]
pub fn set_code(
origin: OriginFor<T>,
code: Vec<u8>
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
code: Vec<u8>
) -> DispatchResultWithPostInfo
Set the new runtime code.
O(C + S)
whereC
length ofcode
andS
complexity ofcan_set_code
- 1 storage write (codec
O(C)
). - 1 call to
can_set_code
:O(S)
(callssp_io::misc::runtime_version
which is expensive). - 1 event. The weight of this function is dependent on the runtime, but generally this is very expensive. We will treat this as a full block.
pub fn set_code_without_checks(
origin: OriginFor<T>,
code: Vec<u8>
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
code: Vec<u8>
) -> DispatchResultWithPostInfo
Set the new runtime code without doing any checks of the given code
.
O(C)
whereC
length ofcode
- 1 storage write (codec
O(C)
). - 1 event. The weight of this function is dependent on the runtime. We will treat this as a full block.
pub fn set_changes_trie_config(
origin: OriginFor<T>,
changes_trie_config: Option<ChangesTrieConfiguration>
) -> DispatchResultWithPostInfo
[src]
origin: OriginFor<T>,
changes_trie_config: Option<ChangesTrieConfiguration>
) -> DispatchResultWithPostInfo
impl<T: Config> Pallet<T>
[src]
pub fn account<KArg>(k: KArg) -> AccountInfo<T::Index, T::AccountData> where
KArg: EncodeLike<T::AccountId>,
[src]
KArg: EncodeLike<T::AccountId>,
The full account information for a particular account ID.
impl<T: Config> Pallet<T>
[src]
pub fn block_weight() -> ConsumedWeight
[src]
The current weight for the block.
impl<T: Config> Pallet<T>
[src]
pub fn block_hash<KArg>(k: KArg) -> T::Hash where
KArg: EncodeLike<T::BlockNumber>,
[src]
KArg: EncodeLike<T::BlockNumber>,
Map of block numbers to block hashes.
impl<T: Config> Pallet<T>
[src]
pub fn extrinsic_data<KArg>(k: KArg) -> Vec<u8> where
KArg: EncodeLike<u32>,
[src]
KArg: EncodeLike<u32>,
Extrinsics data for the current block (maps an extrinsic’s index to its data).
impl<T: Config> Pallet<T>
[src]
pub fn block_number() -> T::BlockNumber
[src]
The current block number being processed. Set by execute_block
.
impl<T: Config> Pallet<T>
[src]
pub fn parent_hash() -> T::Hash
[src]
Hash of the previous block.
impl<T: Config> Pallet<T>
[src]
impl<T: Config> Pallet<T>
[src]
impl<T: Config> Pallet<T>
[src]
pub fn event_count() -> u32
[src]
The number of events in the Events<T>
list.
impl<T: Config> Pallet<T>
[src]
pub fn event_topics<KArg>(k: KArg) -> Vec<(T::BlockNumber, u32)> where
KArg: EncodeLike<T::Hash>,
[src]
KArg: EncodeLike<T::Hash>,
Mapping between a topic (represented by T::Hash) and a vector of indexes
of events in the <Events<T>>
list.
All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest.
The value has the type (T::BlockNumber, EventIndex)
because if we used only just
the EventIndex
then in case if the topic has the same contents on the next block
no notification will be triggered thus the event might be lost.
impl<T: Config> Pallet<T>
[src]
pub fn account_exists(who: &T::AccountId) -> bool
[src]
pub fn inc_ref(who: &T::AccountId)
[src]
Use inc_consumers
instead
Increment the reference counter on an account.
pub fn dec_ref(who: &T::AccountId)
[src]
Use dec_consumers
instead
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
pub fn refs(who: &T::AccountId) -> RefCount
[src]
Use consumers
instead
The number of outstanding references for the account who
.
pub fn allow_death(who: &T::AccountId) -> bool
[src]
Use !is_provider_required
instead
True if the account has no outstanding references.
pub fn inc_providers(who: &T::AccountId) -> IncRefStatus
[src]
Increment the reference counter on an account.
The account who
’s providers
must be non-zero or this will return an error.
pub fn dec_providers(who: &T::AccountId) -> Result<DecRefStatus, DecRefError>
[src]
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
pub fn providers(who: &T::AccountId) -> RefCount
[src]
The number of outstanding references for the account who
.
pub fn inc_consumers(who: &T::AccountId) -> Result<(), IncRefError>
[src]
Increment the reference counter on an account.
The account who
’s providers
must be non-zero or this will return an error.
pub fn dec_consumers(who: &T::AccountId)
[src]
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_consumers
on who
.
pub fn consumers(who: &T::AccountId) -> RefCount
[src]
The number of outstanding references for the account who
.
pub fn is_provider_required(who: &T::AccountId) -> bool
[src]
True if the account has some outstanding references.
pub fn deposit_event(event: impl Into<T::Event>)
[src]
Deposits an event into this block’s event record.
pub fn deposit_event_indexed(topics: &[T::Hash], event: T::Event)
[src]
Deposits an event into this block’s event record adding this event to the corresponding topic indexes.
This will update storage entries that correspond to the specified topics. It is expected that light-clients could subscribe to this topics.
pub fn extrinsic_index() -> Option<u32>
[src]
Gets the index of extrinsic that is currently executing.
pub fn extrinsic_count() -> u32
[src]
Gets extrinsics count.
pub fn all_extrinsics_len() -> u32
[src]
pub fn register_extra_weight_unchecked(weight: Weight, class: DispatchClass)
[src]
Inform the system pallet of some additional weight that should be accounted for, in the current block.
NOTE: use with extra care; this function is made public only be used for certain pallets
that need it. A runtime that does not have dynamic calls should never need this and should
stick to static weights. A typical use case for this is inner calls or smart contract calls.
Furthermore, it only makes sense to use this when it is presumably cheap to provide the
argument weight
; In other words, if this function is to be used to account for some
unknown, user provided call’s weight, it would only make sense to use it if you are sure you
can rapidly compute the weight of the inner call.
Even more dangerous is to note that this function does NOT take any action, if the new sum of block weight is more than the block weight limit. This is what the unchecked.
Another potential use-case could be for the on_initialize
and on_finalize
hooks.
pub fn initialize(
number: &T::BlockNumber,
parent_hash: &T::Hash,
digest: &DigestOf<T>,
kind: InitKind
)
[src]
number: &T::BlockNumber,
parent_hash: &T::Hash,
digest: &DigestOf<T>,
kind: InitKind
)
Start the execution of a particular block.
pub fn finalize() -> T::Header
[src]
Remove temporary “environment” entries in storage, compute the storage root and return the resulting header for this block.
pub fn deposit_log(item: DigestItemOf<T>)
[src]
pub fn externalities() -> TestExternalities
[src]
Get the basic externalities for this pallet, useful for tests.
pub fn set_block_number(n: T::BlockNumber)
[src]
Set the block number to something in particular. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
pub fn set_extrinsic_index(extrinsic_index: u32)
[src]
Sets the index of extrinsic that is currently executing.
pub fn set_parent_hash(n: T::Hash)
[src]
Set the parent hash number to something in particular. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
pub fn set_block_consumed_resources(weight: Weight, len: usize)
[src]
Set the current block weight. This should only be used in some integration tests.
pub fn reset_events()
[src]
Reset events. Can be used as an alternative to
initialize
for tests that don’t need to bother with the other environment entries.
pub fn runtime_version() -> RuntimeVersion
[src]
Return the chain’s current runtime version.
pub fn account_nonce(who: impl EncodeLike<T::AccountId>) -> T::Index
[src]
Retrieve the account transaction counter from storage.
pub fn inc_account_nonce(who: impl EncodeLike<T::AccountId>)
[src]
Increment a particular account’s nonce by 1.
pub fn note_extrinsic(encoded_xt: Vec<u8>)
[src]
Note what the extrinsic data of the current extrinsic index is.
This is required to be called before applying an extrinsic. The data will used
in Self::finalize
to calculate the correct extrinsics root.
pub fn note_applied_extrinsic(
r: &DispatchResultWithPostInfo,
info: DispatchInfo
)
[src]
r: &DispatchResultWithPostInfo,
info: DispatchInfo
)
To be called immediately after an extrinsic has been applied.
pub fn note_finished_extrinsics()
[src]
To be called immediately after note_applied_extrinsic
of the last extrinsic of the block
has been called.
pub fn note_finished_initialize()
[src]
To be called immediately after finishing the initialization of the block
(e.g., called on_initialize
for all pallets).
pub fn on_created_account(
who: T::AccountId,
_a: &mut AccountInfo<T::Index, T::AccountData>
)
[src]
who: T::AccountId,
_a: &mut AccountInfo<T::Index, T::AccountData>
)
An account is being created.
pub fn can_set_code(code: &[u8]) -> Result<(), DispatchError>
[src]
Determine whether or not it is possible to update the code.
Checks the given code if it is a valid runtime wasm blob by instantianting it and extracting the runtime version of it. It checks that the runtime version of the old and new runtime has the same spec name and that the spec version is increasing.
Trait Implementations
impl<T: Config> BlockNumberProvider for Pallet<T>
[src]
type BlockNumber = <T as Config>::BlockNumber
Type of BlockNumber
to provide.
fn current_block_number() -> Self::BlockNumber
[src]
impl<T: Config> Callable<T> for Pallet<T>
[src]
impl<T> Clone for Pallet<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Debug for Pallet<T>
[src]
impl<T> Eq for Pallet<T>
[src]
impl<T: Config> GetPalletVersion for Pallet<T>
[src]
fn current_version() -> PalletVersion
[src]
fn storage_version() -> Option<PalletVersion>
[src]
impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_runtime_upgrade() -> Weight
[src]
fn integrity_test()
[src]
pub fn on_finalize(_n: BlockNumber)
[src]
pub fn on_initialize(_n: BlockNumber) -> u64
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Config> IntegrityTest for Pallet<T>
[src]
fn integrity_test()
[src]
impl<T: Config> ModuleErrorMetadata for Pallet<T>
[src]
impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn offchain_worker(n: <T as Config>::BlockNumber)
[src]
impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_finalize(n: <T as Config>::BlockNumber)
[src]
impl<T: Config> OnGenesis for Pallet<T>
[src]
fn on_genesis()
[src]
impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
[src]
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
[src]
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
[src]
fn on_runtime_upgrade() -> Weight
[src]
impl<T> PartialEq<Pallet<T>> for Pallet<T>
[src]
impl<T: Config> StoredMap<<T as Config>::AccountId, <T as Config>::AccountData> for Pallet<T>
[src]
Implement StoredMap for a simple single-item, provide-when-not-default system. This works fine for storing a single item which allows the account to continue existing as long as it’s not empty/default.
Anything more complex will need more sophisticated logic.
fn get(k: &T::AccountId) -> T::AccountData
[src]
fn try_mutate_exists<R, E: From<StoredMapError>>(
k: &T::AccountId,
f: impl FnOnce(&mut Option<T::AccountData>) -> Result<R, E>
) -> Result<R, E>
[src]
k: &T::AccountId,
f: impl FnOnce(&mut Option<T::AccountData>) -> Result<R, E>
) -> Result<R, E>
pub fn mutate<R>(
k: &K,
f: impl FnOnce(&mut T) -> R
) -> Result<R, StoredMapError>
[src]
k: &K,
f: impl FnOnce(&mut T) -> R
) -> Result<R, StoredMapError>
pub fn mutate_exists<R>(
k: &K,
f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>
[src]
k: &K,
f: impl FnOnce(&mut Option<T>) -> R
) -> Result<R, StoredMapError>
pub fn insert(k: &K, t: T) -> Result<(), StoredMapError>
[src]
pub fn remove(k: &K) -> Result<(), StoredMapError>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Pallet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Pallet<T> where
T: Send,
T: Send,
impl<T> Sync for Pallet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Pallet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Pallet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
[src]
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
[src]
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
[src]
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
[src]
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
[src]
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
[src]
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
[src]
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,