[−][src]Struct frame_system::Module
Methods
impl<T: Trait + 'static> Module<T>
[src]
pub fn account<K: EncodeLike<T::AccountId>>(
key: K
) -> AccountInfo<T::Index, T::AccountData>
[src]
key: K
) -> AccountInfo<T::Index, T::AccountData>
The full account information for a particular account ID.
pub fn block_hash<K: EncodeLike<T::BlockNumber>>(key: K) -> T::Hash
[src]
Map of block numbers to block hashes.
pub fn extrinsic_data<K: EncodeLike<u32>>(key: K) -> Vec<u8>
[src]
Extrinsics data for the current block (maps an extrinsic's index to its data).
pub fn block_number() -> T::BlockNumber
[src]
The current block number being processed. Set by execute_block
.
pub fn parent_hash() -> T::Hash
[src]
Hash of the previous block.
pub fn extrinsics_root() -> T::Hash
[src]
Extrinsics root of the current block, also part of the block header.
pub fn digest() -> DigestOf<T>
[src]
Digest of the current block, also part of the block header.
pub fn events() -> Vec<EventRecord<T::Event, T::Hash>>
[src]
Events deposited for the current block.
pub fn event_count() -> u32
[src]
The number of events in the Events<T>
list.
pub fn event_topics<K: EncodeLike<T::Hash>>(
key: K
) -> Vec<(T::BlockNumber, u32)>
[src]
key: K
) -> Vec<(T::BlockNumber, u32)>
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: Trait> Module<T>
[src]
Can also be called using Call
.
pub fn set_code(origin: T::Origin, code: Vec<u8>) -> DispatchResult
[src]
Set the new runtime code.
pub fn set_code_without_checks(
origin: T::Origin,
code: Vec<u8>
) -> DispatchResult
[src]
origin: T::Origin,
code: Vec<u8>
) -> DispatchResult
Set the new runtime code without doing any checks of the given code
.
pub fn set_changes_trie_config(
origin: T::Origin,
changes_trie_config: Option<ChangesTrieConfiguration>
) -> DispatchResult
[src]
origin: T::Origin,
changes_trie_config: Option<ChangesTrieConfiguration>
) -> DispatchResult
Set the new changes trie configuration.
impl<T: Trait> Module<T>
[src]
pub fn deposit_event(event: impl Into<T::Event>)
[src]
Deposits an event into this block's event record.
pub fn inc_ref(who: &T::AccountId)
[src]
Increment the reference counter on an account.
pub fn dec_ref(who: &T::AccountId)
[src]
Decrement the reference counter on an account. This MUST only be done once for every time
you called inc_ref
on who
.
pub fn refs(who: &T::AccountId) -> RefCount
[src]
The number of outstanding references for the account who
.
pub fn allow_death(who: &T::AccountId) -> bool
[src]
True if the account has no outstanding references.
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_weight() -> Weight
[src]
Gets a total weight of all executed extrinsics.
pub fn all_extrinsics_len() -> u32
[src]
pub fn register_extra_weight_unchecked(weight: Weight)
[src]
Inform the system module 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 modules
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.
If no previous weight exists, the function initializes the weight to zero.
pub fn initialize(
number: &T::BlockNumber,
parent_hash: &T::Hash,
txs_root: &T::Hash,
digest: &DigestOf<T>,
kind: InitKind
)
[src]
number: &T::BlockNumber,
parent_hash: &T::Hash,
txs_root: &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.
pub fn deposit_log(item: DigestItemOf<T>)
[src]
Deposits a log and ensures it matches the block's log data.
pub fn externalities() -> TestExternalities
[src]
Get the basic externalities for this module, 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_limits(weight: Weight, len: usize)
[src]
Set the current block weight. This should only be used in some integration tests.
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. If this
is called, then ensure derive_extrinsics
is also called before
block-building is completed.
NOTE: This function is called only when the block is being constructed locally.
execute_block
doesn't note any extrinsics.
pub fn note_applied_extrinsic(
r: &DispatchOutcome,
_encoded_len: u32,
info: DispatchInfo
)
[src]
r: &DispatchOutcome,
_encoded_len: u32,
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 modules).
pub fn derive_extrinsics()
[src]
Remove all extrinsic data and save the extrinsics trie root.
pub fn on_created_account(who: T::AccountId)
[src]
An account is being created.
pub fn can_set_code(origin: T::Origin, code: &[u8]) -> Result<(), DispatchError>
[src]
Determine whether or not it is possible to update the code.
This function has no side effects and is idempotent, but is fairly
heavy. It is automatically called by set_code
; in most cases,
a direct call to set_code
is preferable. It is useful to call
can_set_code
when it is desirable to perform the appropriate
runtime checks without actually changing the code yet.
Trait Implementations
impl<T: Trait> Callable<T> for Module<T>
[src]
impl<T: Clone + Trait> Clone for Module<T>
[src]
impl<T: Copy + Trait> Copy for Module<T>
[src]
impl<T: Trait> Debug for Module<T> where
T: Debug,
[src]
T: Debug,
impl<T: Eq + Trait> Eq for Module<T>
[src]
impl<T: Trait> IsDeadAccount<<T as Trait>::AccountId> for Module<T>
[src]
fn is_dead_account(who: &T::AccountId) -> bool
[src]
impl<T: Trait> ModuleErrorMetadata for Module<T>
[src]
fn metadata() -> &'static [ErrorMetadata]
[src]
impl<T: Trait> OffchainWorker<<T as Trait>::BlockNumber> for Module<T>
[src]
fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Trait> OnFinalize<<T as Trait>::BlockNumber> for Module<T>
[src]
fn on_finalize(_n: BlockNumber)
[src]
impl<T: Trait> OnInitialize<<T as Trait>::BlockNumber> for Module<T>
[src]
fn on_initialize(_n: BlockNumber)
[src]
impl<T: Trait> OnRuntimeUpgrade for Module<T>
[src]
impl<T: PartialEq + Trait> PartialEq<Module<T>> for Module<T>
[src]
impl<T: Trait> StoredMap<<T as Trait>::AccountId, <T as Trait>::AccountData> for Module<T>
[src]
fn get(k: &T::AccountId) -> T::AccountData
[src]
fn is_explicit(k: &T::AccountId) -> bool
[src]
fn insert(k: &T::AccountId, data: T::AccountData)
[src]
fn remove(k: &T::AccountId)
[src]
fn mutate<R>(k: &T::AccountId, f: impl FnOnce(&mut T::AccountData) -> R) -> R
[src]
fn mutate_exists<R>(
k: &T::AccountId,
f: impl FnOnce(&mut Option<T::AccountData>) -> R
) -> R
[src]
k: &T::AccountId,
f: impl FnOnce(&mut Option<T::AccountData>) -> R
) -> R
fn try_mutate_exists<R, E>(
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>
impl<T: Trait> StructuralEq for Module<T>
[src]
impl<T: Trait> StructuralPartialEq for Module<T>
[src]
impl<T: Trait> WeighBlock<<T as Trait>::BlockNumber> for Module<T>
[src]
fn on_runtime_upgrade() -> u32
[src]
fn on_initialize(BlockNumber) -> u32
[src]
fn on_finalize(BlockNumber) -> u32
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Module<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Module<T> where
T: Send,
T: Send,
impl<T> Sync for Module<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Module<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Module<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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
[src]
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
fn from_ref(outer: &Outer) -> &T
[src]
Get a reference to the inner from the outer.
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,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
[src]
T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
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>,
fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,