* implement max_values + storages info * some formatting + doc * sudo sanity check * timestamp * assets (not working) * fix assets * impl for proxy * update balances * rename StoragesInfo -> PalletStorageInfo * merge both StorageInfoTrait and PalletStorageInfo I think it is more future proof. In the future some storage could make use of multiple prefix. Like one to store how much value has been inserted, etc... * Update frame/support/procedural/src/storage/parse.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * Update frame/support/procedural/src/storage/storage_struct.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * Fix max_size using hasher information hasher now expose `max_len` which allows to computes their maximum len. For hasher without concatenation, it is the size of the hash part, for hasher with concatenation, it is the size of the hash part + max encoded len of the key. * fix tests * fix ui tests * Move `MaxBoundedLen` into its own crate (#8814) * move MaxEncodedLen into its own crate * remove MaxEncodedLen impl from frame-support * add to assets and balances * try more fixes * fix compile Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * nits * fix compile * line width * fix max-values-macro merge * Add some derive, needed for test and other purpose * use weak bounded vec in some cases * Update lib.rs * move max-encoded-len crate * fix * remove app crypto for now * width * Revert "remove app crypto for now" This reverts commit 73623e9933d50648e0e7fe90b6171a8e45d7f5a2. * unused variable * more unused variables * more fixes * Add #[max_encoded_len_crate(...)] helper attribute The purpose of this attribute is to reduce the surface area of max_encoded_len changes. Crates deriving `MaxEncodedLen` do not need to add it to `Cargo.toml`; they can instead just do ```rust \#[derive(Encode, MaxEncodedLen)] \#[max_encoded_len_crate(frame_support::max_encoded_len)] struct Example; ``` * fix a ui test * use #[max_encoded_len_crate(...)] helper in app_crypto * remove max_encoded_len import where not necessary * update lockfile * fix ui test * ui * newline * fix merge * try fix ui again * Update max-encoded-len/derive/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * extract generate_crate_access_2018 * Update lib.rs * compiler isnt smart enough Co-authored-by: thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> Co-authored-by: Peter Goodspeed-Niklaus <peter.r.goodspeedniklaus@gmail.com>
System Module
The System module provides low-level access to core types and cross-cutting utilities. It acts as the base layer for other pallets to interact with the Substrate framework components.
Overview
The System module defines the core data types used in a Substrate runtime.
It also provides several utility functions (see Module) for other FRAME pallets.
In addition, it manages the storage items for extrinsics data, indexes, event records, and digest items, among other things that support the execution of the current block.
It also handles low-level tasks like depositing logs, basic set up and take down of temporary storage entries, and access to previous block hashes.
Interface
Dispatchable Functions
The System module does not implement any dispatchable functions.
Public Functions
See the Module struct for details of publicly available functions.
Signed Extensions
The System module defines the following extensions:
- [
CheckWeight]: Checks the weight and length of the block and ensure that it does not exceed the limits. - [
CheckNonce]: Checks the nonce of the transaction. Contains a single payload of typeT::Index. - [
CheckEra]: Checks the era of the transaction. Contains a single payload of typeEra. - [
CheckGenesis]: Checks the provided genesis hash of the transaction. Must be a part of the signed payload of the transaction. - [
CheckSpecVersion]: Checks that the runtime version is the same as the one used to sign the transaction. - [
CheckTxVersion]: Checks that the transaction version is the same as the one used to sign the transaction.
Lookup the runtime aggregator file (e.g. node/runtime) to see the full list of signed
extensions included in a chain.
Usage
Prerequisites
Import the System module and derive your module's configuration trait from the system trait.
Example - Get extrinsic count and parent hash for the current block
use frame_support::{decl_module, dispatch};
use frame_system::{self as system, ensure_signed};
pub trait Config: system::Config {}
decl_module! {
pub struct Module<T: Config> for enum Call where origin: T::Origin {
#[weight = 0]
pub fn system_module_example(origin) -> dispatch::DispatchResult {
let _sender = ensure_signed(origin)?;
let _extrinsic_count = <system::Pallet<T>>::extrinsic_count();
let _parent_hash = <system::Pallet<T>>::parent_hash();
Ok(())
}
}
}
License: Apache-2.0