mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 08:07:58 +00:00
Rewrap all comments to 100 line width (#9490)
* reformat everything again * manual formatting * last manual fix * Fix build
This commit is contained in:
@@ -92,23 +92,24 @@ impl Counter {
|
||||
/// ```
|
||||
///
|
||||
/// * Map: `Foo: map hasher($hash) type => type`: Implements the
|
||||
/// [`StorageMap`](../frame_support/storage/trait.StorageMap.html) trait using the
|
||||
/// [`StorageMap generator`](../frame_support/storage/generator/trait.StorageMap.html).
|
||||
/// And [`StoragePrefixedMap`](../frame_support/storage/trait.StoragePrefixedMap.html).
|
||||
/// [`StorageMap`](../frame_support/storage/trait.StorageMap.html) trait using the [`StorageMap
|
||||
/// generator`](../frame_support/storage/generator/trait.StorageMap.html). And
|
||||
/// [`StoragePrefixedMap`](../frame_support/storage/trait.StoragePrefixedMap.html).
|
||||
///
|
||||
/// `$hash` representing a choice of hashing algorithms available in the
|
||||
/// [`Hashable`](../frame_support/trait.Hashable.html) trait. You will generally want to use one
|
||||
/// of three hashers:
|
||||
/// * `blake2_128_concat`: The default, safe choice. Use if you are unsure or don't care. It is
|
||||
/// secure against user-tainted keys, fairly fast and memory-efficient and supports
|
||||
/// iteration over its keys and values. This must be used if the keys of your map can be
|
||||
/// selected *en masse* by untrusted users.
|
||||
/// secure against user-tainted keys, fairly fast and memory-efficient and supports iteration
|
||||
/// over its keys and values. This must be used if the keys of your map can be selected *en
|
||||
/// masse* by untrusted users.
|
||||
/// * `twox_64_concat`: This is an insecure hasher and can only be used safely if you know that
|
||||
/// the preimages cannot be chosen at will by untrusted users. It is memory-efficient, extremely
|
||||
/// performant and supports iteration over its keys and values. You can safely use this is the
|
||||
/// key is:
|
||||
/// - A (slowly) incrementing index.
|
||||
/// - Known to be the result of a cryptographic hash (though `identity` is a better choice here).
|
||||
/// - Known to be the result of a cryptographic hash (though `identity` is a better choice
|
||||
/// here).
|
||||
/// - Known to be the public key of a cryptographic key pair in existence.
|
||||
/// * `identity`: This is not a hasher at all, and just uses the key material directly. Since it
|
||||
/// does no hashing or appending, it's the fastest possible hasher, however, it's also the least
|
||||
@@ -132,8 +133,9 @@ impl Counter {
|
||||
///
|
||||
/// * Double map: `Foo: double_map hasher($hash1) u32, hasher($hash2) u32 => u32`: Implements the
|
||||
/// [`StorageDoubleMap`](../frame_support/storage/trait.StorageDoubleMap.html) trait using the
|
||||
/// [`StorageDoubleMap generator`](../frame_support/storage/generator/trait.StorageDoubleMap.html).
|
||||
/// And [`StoragePrefixedMap`](../frame_support/storage/trait.StoragePrefixedMap.html).
|
||||
/// [`StorageDoubleMap
|
||||
/// generator`](../frame_support/storage/generator/trait.StorageDoubleMap.html). And
|
||||
/// [`StoragePrefixedMap`](../frame_support/storage/trait.StoragePrefixedMap.html).
|
||||
///
|
||||
/// `$hash1` and `$hash2` representing choices of hashing algorithms available in the
|
||||
/// [`Hashable`](../frame_support/trait.Hashable.html) trait. They must be chosen with care, see
|
||||
@@ -147,8 +149,8 @@ impl Counter {
|
||||
///
|
||||
/// Thus keys are stored at:
|
||||
/// ```nocompile
|
||||
/// Twox128(module_prefix) ++ Twox128(storage_prefix) ++ Hasher1(encode(key1)) ++ Hasher2(encode(key2))
|
||||
/// ```
|
||||
/// Twox128(module_prefix) ++ Twox128(storage_prefix) ++ Hasher1(encode(key1)) ++
|
||||
/// Hasher2(encode(key2)) ```
|
||||
///
|
||||
/// Supported hashers (ordered from least to best security):
|
||||
///
|
||||
@@ -176,8 +178,8 @@ impl Counter {
|
||||
/// Will include the item in `GenesisConfig`.
|
||||
/// * \[optional\] `build(#closure)`: Closure called with storage overlays.
|
||||
/// * \[optional\] `max_values(#expr)`: `expr` is an expression returning a `u32`. It is used to
|
||||
/// implement `StorageInfoTrait`. Note this attribute is not available for storage value as the maximum
|
||||
/// number of values is 1.
|
||||
/// implement `StorageInfoTrait`. Note this attribute is not available for storage value as the
|
||||
/// maximum number of values is 1.
|
||||
/// * `#type`: Storage type.
|
||||
/// * \[optional\] `#default`: Value returned when none.
|
||||
///
|
||||
@@ -339,8 +341,8 @@ pub fn decl_storage(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// # Type definitions
|
||||
///
|
||||
/// * The macro generates a type alias for each pallet to their `Module` (or `Pallet`).
|
||||
/// E.g. `type System = frame_system::Pallet<Runtime>`
|
||||
/// * The macro generates a type alias for each pallet to their `Module` (or `Pallet`). E.g. `type
|
||||
/// System = frame_system::Pallet<Runtime>`
|
||||
#[proc_macro]
|
||||
pub fn construct_runtime(input: TokenStream) -> TokenStream {
|
||||
construct_runtime::construct_runtime(input)
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::{pallet::Def, COUNTER};
|
||||
use frame_support_procedural_tools::clean_type_string;
|
||||
use syn::spanned::Spanned;
|
||||
|
||||
///
|
||||
/// * Generate enum call and implement various trait on it.
|
||||
/// * Implement Callable and call_function on `Pallet`
|
||||
pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::{parse::helper::get_doc_literals, Def};
|
||||
|
||||
///
|
||||
/// * Generate default rust doc
|
||||
pub fn expand_config(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let config = &def.config;
|
||||
|
||||
@@ -30,6 +30,7 @@ struct ConstDef {
|
||||
pub default_byte_impl: proc_macro2::TokenStream,
|
||||
}
|
||||
|
||||
///
|
||||
/// * Impl fn module_constant_metadata for pallet.
|
||||
pub fn expand_constants(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let frame_support = &def.frame_support;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::{parse::helper::get_doc_literals, Def};
|
||||
|
||||
///
|
||||
/// * impl various trait on Error
|
||||
/// * impl ModuleErrorMetadata for Error
|
||||
pub fn expand_error(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::{
|
||||
};
|
||||
use syn::{spanned::Spanned, Ident};
|
||||
|
||||
///
|
||||
/// * Add __Ignore variant on Event
|
||||
/// * Impl various trait on Event including metadata
|
||||
/// * if deposit_event is defined, implement deposit_event on module.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::Def;
|
||||
|
||||
///
|
||||
/// * implement the trait `sp_runtime::BuildModuleGenesisStorage`
|
||||
/// * add #[cfg(features = "std")] to GenesisBuild implementation.
|
||||
pub fn expand_genesis_build(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::{
|
||||
};
|
||||
use syn::{spanned::Spanned, Ident};
|
||||
|
||||
///
|
||||
/// * add various derive trait on GenesisConfig struct.
|
||||
pub fn expand_genesis_config(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let count = COUNTER.with(|counter| counter.borrow_mut().inc());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::Def;
|
||||
|
||||
///
|
||||
/// * implement the individual traits using the Hooks trait
|
||||
pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let (where_clause, span, has_runtime_upgrade) = match def.hooks.as_ref() {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
use crate::{pallet::Def, NUMBER_OF_INSTANCE};
|
||||
use proc_macro2::Span;
|
||||
|
||||
///
|
||||
/// * Provide inherent instance to be used by construct_runtime
|
||||
/// * Provide Instance1 ..= Instance16 for instantiable pallet
|
||||
pub fn expand_instances(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::{expand::merge_where_clauses, parse::helper::get_doc_literals, Def};
|
||||
|
||||
///
|
||||
/// * Add derive trait on Pallet
|
||||
/// * Implement GetStorageVersion on Pallet
|
||||
/// * Implement OnGenesis on Pallet
|
||||
|
||||
@@ -46,6 +46,7 @@ fn check_prefix_duplicates(storage_def: &StorageDef, set: &mut HashSet<String>)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// * if generics are unnamed: replace the first generic `_` by the generated prefix structure
|
||||
/// * if generics are named: reorder the generic, remove their name, and add the missing ones.
|
||||
/// * Add `#[allow(type_alias_bounds)]`
|
||||
@@ -150,6 +151,7 @@ pub fn process_generics(def: &mut Def) -> syn::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
///
|
||||
/// * generate StoragePrefix structs (e.g. for a storage `MyStorage` a struct with the name
|
||||
/// `_GeneratedPrefixForStorage$NameOfStorage` is generated) and implements StorageInstance trait.
|
||||
/// * if generics are unnamed: replace the first generic `_` by the generated prefix structure
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
use crate::pallet::Def;
|
||||
|
||||
///
|
||||
/// * Generate the struct
|
||||
/// * implement the `Get<..>` on it
|
||||
/// * Rename the name of the function to internal name
|
||||
|
||||
@@ -112,7 +112,8 @@ pub struct StorageDef {
|
||||
pub instances: Vec<helper::InstanceUsage>,
|
||||
/// Optional getter to generate. If some then query_kind is ensured to be some as well.
|
||||
pub getter: Option<syn::Ident>,
|
||||
/// Optional expression that evaluates to a type that can be used as StoragePrefix instead of ident.
|
||||
/// Optional expression that evaluates to a type that can be used as StoragePrefix instead of
|
||||
/// ident.
|
||||
pub rename_as: Option<syn::LitStr>,
|
||||
/// Whereas the querytype of the storage is OptionQuery or ValueQuery.
|
||||
/// Note that this is best effort as it can't be determined when QueryKind is generic, and
|
||||
|
||||
Reference in New Issue
Block a user