mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
Enrich metadata with type information (#8615)
* Cargo.lock after merge * Restore scale-info feature * Fully qualify TypeInfo derive * Skip PendingSwap T * Add missing skip_type_params attr * metadata docs features * Reduce pallet event attribute to struct * Cargo.lock * Update frame/balances/src/tests_composite.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Line widths check * Cargo.lock * Add scale-info/std * Update frame/system/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Use `skip_type_params` to remove `TypeInfo` requirements on checks * Revert "Remove unused Call metadata stuff" This reverts commit 41311f85 * Skip BalanceSwapAction type parameter * Remove unused event metadata macro * Update frame-metadata * Update primitives/npos-elections/compact/src/codec.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Manual TypeInfo for Header * Remove TypeInfo requirement for consts in BoundedVec etc. * Another TypeInfo bound removed * review: fix indentation * TypeInfo impls for Identity types * Add some todos to add custom TypeInfo impls * Update frame/support/procedural/src/pallet/expand/pallet_struct.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Add some todos to add custom TypeInfo impls * Add a test for manual Data TypeInfo impl * Add custom TypeInfo impl for Vote * Era custom TypeInfo crimes * Revert finality-grandpa version to 0.14.z * review: renamed module to pallet_constants_metadata * New line at end of file * Add missing scale-info/std * Update frame/support/src/storage/types/mod.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Remove StorageEntryType::Map unused flag * Add missing scale-info dependency after merge * SignedExtension::AdditionalSigned metadata * Update frame-metadata, use abbreviated docs and args fields * Update frame/example/Cargo.toml Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Add scale_info/std and remove unused scale-info dependency * Remove scale-info dependency * Remove treasury pallet::metadata * Remove redundant Event test * Add back scale-info as dev dependency * fix error metadata when no error defined in decl_module * Add Module3 to tests * Fix metadata test * Add docs feature to frame-support test * WIP fixing pallet metadata test * Remove redundant FunctionMetadata, FunctionArgumentMetadata as per https://github.com/paritytech/frame-metadata/pull/20 * Use main branch of frame-metadata * Use patch of scale-info for latest changes * Use latest patched scale-info * Manual TypeInfo for DigestItem * Manual TypeInfo for DigestItem * Update scale-info * Skip __Ignore variants for Error, depends on https://github.com/paritytech/scale-info/pull/117 * Named fields for FRAME v2 pallet Call variants * Named fields for FRAME v1 pallet Call variants * Add missing scale-info dependency * WIP expand benchmark call variant * fix benchmark with new function create a new function for each variant of a pallet call. This function is called by benchmarking macro in order not to break call creation with unnamed argument * fix tests * more fix * Fix staking tests * Fix offchain workers calls * Cherry pick rustfmt.toml from master * cargo +nightly-2021-06-22 fmt --all * Update to new call variant structs * More call variant struct updates * Remove unused import * More call variant structs * More call variant structs * Even more call variant structs * Mooar variant structs * Evermore variant structs * Call variant structs ad infinitum * Fmt * More call variants * Last call variant * Call variants all done? * Fix SS58Prefix type * Potential workaround for BitFlags<IdentityFields> TypeInfo * Enable docs capturing for Call, Event, and Error types * Fix IdentityFields TypeInfo * Remove metadata-docs feature * Add capture_docs = true for legacy Call, Event and Error types * Fmt * Fix metadata test type * Update benchmarks with call struct variants * Fmt * More test fixes * Fmt * Fix benches * Use latest capture_docs attr * Latest scale_info * Fmt * review: change &Vec to &[] * Remove pallet metadata attr * review: remove commented out test code * review: skip_type_params trailing comma suggestion * Update to scale-info 0.10.0 * Update construct_runtime ui tests, different because of metadata TypeInfo impls * Add some TypeInfo derives for UI tests * Update storage ensure span ui stderrs * Update call argument bound ui tests Possibly changed because change from tuple to struct variants? * Add scale-info dev dependency * Update to latest finality-grandpa release * review: missing newline * review: missing scale-info/std * review: remove duplicate scale-info/std * review: remove fully qualified TypeInfo * review: add missing scale-info/std * review: remove unnecessary imports. * Fmt * Use crates.io RC version of frame-metadata * Remove scale-info/std because it is a dev dependency * Add missing scale_info dev-dependency for test * Delete empty metadata folder * Fix sp_std import * review: improve manual UncheckedExtrinsic TypeInfo impl * review: use full scale-info for dev-dependency * Remove DefaultByteGetter impl * review: derive TypeInfo for generic header * Fmt * Update primitives/runtime/src/generic/unchecked_extrinsic.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Update primitives/runtime/src/generic/unchecked_extrinsic.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Update bin/node/executor/Cargo.toml Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/identity/src/types.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update frame/support/src/dispatch.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove redundant derive * Simplify scale-info dependency * Strip underscore prefix from call variant struct names * Another underscore field * More underscore fields * Another underscore field * Update to frame-metadata 14.0.0-rc.2 with combined StorageEntryType::Map * Fmt * Revert weights formatting * Fix up some tests * Fix up some tests for StorageEntryTypeMetadata * scale-info dev dependency * Fix test error * Add missing TypeInfo derives * Add back missing scale-info dependency * Add back missing scale-info dependency * Fix npos compact impls * Cargo.lock * Fmt * Fix errors * Fmt * Fix renamed raw_solution field * Fix error * Fmt * Fix some benchmarks * Fmt * Stray R * Fix * Add missing TypeInfos * ui test fix * Fix line widths * Revert "ui test fix" This reverts commit 2d15ec058a216e3f92d713f1174603a2bb1eac65. * Upgrade to scale-info 0.11.0 * Revert "Upgrade to scale-info 0.11.0" This reverts commit 047bb179085a0059c36cd20ab405f55cf0867e28. * Add Runtime type * Update to scale-info 0.12 * Update to scale-info 1.0 * Update frame-metadata to version 14.0.0 * Patch finality-grandpa until release available * Fix metadata tests * Fix metadata tests * Fmt * Remove patched finality-grandpa * Fix tests, use scale_info imports * Fix pallet tests * Add BlockNumber TypeInfo bound * ui test fix * Cargo.lock * Remove pallet metadata * Cargo.lock * Add missing scale-info dependency * Remove pallet event metadata * Fix error * Fix collective errors * Semicolol * Fmt * Remove another metadata attribute * Add new variant to custom digest TypeInfo * Fmt * Cargo.lock from master * Remove comma lol * Fix example call error * Fix example call error properly Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
+104
-150
@@ -36,6 +36,8 @@ pub use log;
|
||||
pub use once_cell;
|
||||
#[doc(hidden)]
|
||||
pub use paste;
|
||||
#[doc(hidden)]
|
||||
pub use scale_info;
|
||||
#[cfg(feature = "std")]
|
||||
pub use serde;
|
||||
pub use sp_core::Void;
|
||||
@@ -90,17 +92,18 @@ pub use self::{
|
||||
pub use sp_runtime::{self, print, traits::Printable, ConsensusEngineId};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::TypeId;
|
||||
|
||||
/// A unified log target for support operations.
|
||||
pub const LOG_TARGET: &'static str = "runtime::frame-support";
|
||||
|
||||
/// A type that cannot be instantiated.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
pub enum Never {}
|
||||
|
||||
/// A pallet identifier. These are per pallet and should be stored in a registry somewhere.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Encode, Decode)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Encode, Decode, TypeInfo)]
|
||||
pub struct PalletId(pub [u8; 8]);
|
||||
|
||||
impl TypeId for PalletId {
|
||||
@@ -811,13 +814,13 @@ pub use serde::{Deserialize, Serialize};
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use codec::{Codec, EncodeLike};
|
||||
use frame_metadata::{
|
||||
DecodeDifferent, DefaultByteGetter, StorageEntryMetadata, StorageEntryModifier,
|
||||
StorageEntryType, StorageHasher, StorageMetadata,
|
||||
use crate::metadata::{
|
||||
PalletStorageMetadata, StorageEntryMetadata, StorageEntryModifier, StorageEntryType,
|
||||
StorageHasher,
|
||||
};
|
||||
use codec::{Codec, EncodeLike};
|
||||
use sp_io::TestExternalities;
|
||||
use sp_std::{marker::PhantomData, result};
|
||||
use sp_std::result;
|
||||
|
||||
/// A PalletInfo implementation which just panics.
|
||||
pub struct PanicPalletInfo;
|
||||
@@ -832,7 +835,7 @@ pub mod tests {
|
||||
}
|
||||
|
||||
pub trait Config: 'static {
|
||||
type BlockNumber: Codec + EncodeLike + Default;
|
||||
type BlockNumber: Codec + EncodeLike + Default + TypeInfo;
|
||||
type Origin;
|
||||
type PalletInfo: crate::traits::PalletInfo;
|
||||
type DbWeight: crate::traits::Get<crate::weights::RuntimeDbWeight>;
|
||||
@@ -1150,132 +1153,109 @@ pub mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
const EXPECTED_METADATA: StorageMetadata = StorageMetadata {
|
||||
prefix: DecodeDifferent::Encode("Test"),
|
||||
entries: DecodeDifferent::Encode(&[
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("Data"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hasher: StorageHasher::Twox64Concat,
|
||||
key: DecodeDifferent::Encode("u32"),
|
||||
value: DecodeDifferent::Encode("u64"),
|
||||
unused: false,
|
||||
fn expected_metadata() -> PalletStorageMetadata {
|
||||
PalletStorageMetadata {
|
||||
prefix: "Test",
|
||||
entries: vec![
|
||||
StorageEntryMetadata {
|
||||
name: "Data",
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Twox64Concat],
|
||||
key: scale_info::meta_type::<u32>(),
|
||||
value: scale_info::meta_type::<u64>(),
|
||||
},
|
||||
default: vec![0, 0, 0, 0, 0, 0, 0, 0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(&__GetByteStructData(
|
||||
PhantomData::<Test>,
|
||||
))),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("OptionLinkedMap"),
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::Map {
|
||||
hasher: StorageHasher::Blake2_128Concat,
|
||||
key: DecodeDifferent::Encode("u32"),
|
||||
value: DecodeDifferent::Encode("u32"),
|
||||
unused: false,
|
||||
StorageEntryMetadata {
|
||||
name: "OptionLinkedMap",
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Blake2_128Concat],
|
||||
key: scale_info::meta_type::<u32>(),
|
||||
value: scale_info::meta_type::<u32>(),
|
||||
},
|
||||
default: vec![0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(
|
||||
&__GetByteStructOptionLinkedMap(PhantomData::<Test>),
|
||||
)),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("GenericData"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hasher: StorageHasher::Identity,
|
||||
key: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
value: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
unused: false,
|
||||
StorageEntryMetadata {
|
||||
name: "GenericData",
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Identity],
|
||||
key: scale_info::meta_type::<u32>(),
|
||||
value: scale_info::meta_type::<u32>(),
|
||||
},
|
||||
default: vec![0, 0, 0, 0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(&__GetByteStructGenericData(
|
||||
PhantomData::<Test>,
|
||||
))),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("GenericData2"),
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::Map {
|
||||
hasher: StorageHasher::Blake2_128Concat,
|
||||
key: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
value: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
unused: false,
|
||||
StorageEntryMetadata {
|
||||
name: "GenericData2",
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Blake2_128Concat],
|
||||
key: scale_info::meta_type::<u32>(),
|
||||
value: scale_info::meta_type::<u32>(),
|
||||
},
|
||||
default: vec![0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(&__GetByteStructGenericData2(
|
||||
PhantomData::<Test>,
|
||||
))),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("DataDM"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::DoubleMap {
|
||||
hasher: StorageHasher::Twox64Concat,
|
||||
key1: DecodeDifferent::Encode("u32"),
|
||||
key2: DecodeDifferent::Encode("u32"),
|
||||
value: DecodeDifferent::Encode("u64"),
|
||||
key2_hasher: StorageHasher::Blake2_128Concat,
|
||||
StorageEntryMetadata {
|
||||
name: "DataDM",
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Twox64Concat, StorageHasher::Blake2_128Concat],
|
||||
key: scale_info::meta_type::<(u32, u32)>(),
|
||||
value: scale_info::meta_type::<u64>(),
|
||||
},
|
||||
default: vec![0, 0, 0, 0, 0, 0, 0, 0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(&__GetByteStructDataDM(
|
||||
PhantomData::<Test>,
|
||||
))),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("GenericDataDM"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::DoubleMap {
|
||||
hasher: StorageHasher::Blake2_128Concat,
|
||||
key1: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
key2: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
value: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
key2_hasher: StorageHasher::Identity,
|
||||
StorageEntryMetadata {
|
||||
name: "GenericDataDM",
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Blake2_128Concat, StorageHasher::Identity],
|
||||
key: scale_info::meta_type::<(u32, u32)>(),
|
||||
value: scale_info::meta_type::<u32>(),
|
||||
},
|
||||
default: vec![0, 0, 0, 0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(&__GetByteStructGenericDataDM(
|
||||
PhantomData::<Test>,
|
||||
))),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("GenericData2DM"),
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::DoubleMap {
|
||||
hasher: StorageHasher::Blake2_128Concat,
|
||||
key1: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
key2: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
value: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
key2_hasher: StorageHasher::Twox64Concat,
|
||||
StorageEntryMetadata {
|
||||
name: "GenericData2DM",
|
||||
modifier: StorageEntryModifier::Optional,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![StorageHasher::Blake2_128Concat, StorageHasher::Twox64Concat],
|
||||
key: scale_info::meta_type::<(u32, u32)>(),
|
||||
value: scale_info::meta_type::<u32>(),
|
||||
},
|
||||
default: vec![0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(
|
||||
&__GetByteStructGenericData2DM(PhantomData::<Test>),
|
||||
)),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("AppendableDM"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::DoubleMap {
|
||||
hasher: StorageHasher::Blake2_128Concat,
|
||||
key1: DecodeDifferent::Encode("u32"),
|
||||
key2: DecodeDifferent::Encode("T::BlockNumber"),
|
||||
value: DecodeDifferent::Encode("Vec<u32>"),
|
||||
key2_hasher: StorageHasher::Blake2_128Concat,
|
||||
StorageEntryMetadata {
|
||||
name: "AppendableDM",
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Map {
|
||||
hashers: vec![
|
||||
StorageHasher::Blake2_128Concat,
|
||||
StorageHasher::Blake2_128Concat,
|
||||
],
|
||||
key: scale_info::meta_type::<(u32, u32)>(),
|
||||
value: scale_info::meta_type::<Vec<u32>>(),
|
||||
},
|
||||
default: vec![0],
|
||||
docs: vec![],
|
||||
},
|
||||
default: DecodeDifferent::Encode(DefaultByteGetter(
|
||||
&__GetByteStructGenericData2DM(PhantomData::<Test>),
|
||||
)),
|
||||
documentation: DecodeDifferent::Encode(&[]),
|
||||
},
|
||||
]),
|
||||
};
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn store_metadata() {
|
||||
let metadata = Module::<Test>::storage_metadata();
|
||||
pretty_assertions::assert_eq!(EXPECTED_METADATA, metadata);
|
||||
pretty_assertions::assert_eq!(expected_metadata(), metadata);
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -1470,7 +1450,7 @@ pub mod pallet_prelude {
|
||||
/// It implements on pallet:
|
||||
/// * [`traits::GetStorageVersion`]
|
||||
/// * [`traits::OnGenesis`]: contains some logic to write pallet version into storage.
|
||||
/// * `ModuleErrorMetadata`: using error declared or no metadata.
|
||||
/// * `PalletErrorTypeInfo`: provides the type information for the pallet error, if defined.
|
||||
///
|
||||
/// It declare `type Module` type alias for `Pallet`, used by [`construct_runtime`].
|
||||
///
|
||||
@@ -1623,9 +1603,6 @@ pub mod pallet_prelude {
|
||||
/// The macro implements `From<Error<T>>` for `&'static str`.
|
||||
/// The macro implements `From<Error<T>>` for `DispatchError`.
|
||||
///
|
||||
/// The macro implements `ModuleErrorMetadata` on `Pallet` defining the `ErrorMetadata` of the
|
||||
/// pallet.
|
||||
///
|
||||
/// # Event: `#[pallet::event]` optional
|
||||
///
|
||||
/// Allow to define pallet events, pallet events are stored in the block when they deposited
|
||||
@@ -1634,7 +1611,6 @@ pub mod pallet_prelude {
|
||||
/// Item is defined as:
|
||||
/// ```ignore
|
||||
/// #[pallet::event]
|
||||
/// #[pallet::metadata($SomeType = "$Metadata", $SomeOtherType = "$Metadata", ..)] // Optional
|
||||
/// #[pallet::generate_deposit($visibility fn deposit_event)] // Optional
|
||||
/// pub enum Event<$some_generic> $optional_where_clause {
|
||||
/// /// Some doc
|
||||
@@ -1649,24 +1625,6 @@ pub mod pallet_prelude {
|
||||
/// std only).
|
||||
/// For ease of use, bound the trait `Member` available in frame_support::pallet_prelude.
|
||||
///
|
||||
/// Variant documentations and field types are put into metadata.
|
||||
/// The attribute `#[pallet::metadata(..)]` allows to specify the metadata to put for some
|
||||
/// types.
|
||||
///
|
||||
/// The metadata of a type is defined by:
|
||||
/// * if matching a type in `#[pallet::metadata(..)]`, then the corresponding metadata.
|
||||
/// * otherwise the type stringified.
|
||||
///
|
||||
/// E.g.:
|
||||
/// ```ignore
|
||||
/// #[pallet::event]
|
||||
/// #[pallet::metadata(u32 = "SpecialU32")]
|
||||
/// pub enum Event<T: Config> {
|
||||
/// Proposed(u32, T::AccountId),
|
||||
/// }
|
||||
/// ```
|
||||
/// will write in event variant metadata `"SpecialU32"` and `"T::AccountId"`.
|
||||
///
|
||||
/// The attribute `#[pallet::generate_deposit($visibility fn deposit_event)]` generate a helper
|
||||
/// function on `Pallet` to deposit event.
|
||||
///
|
||||
@@ -2027,8 +1985,6 @@ pub mod pallet_prelude {
|
||||
/// //
|
||||
/// // The macro generates event metadata, and derive Clone, Debug, Eq, PartialEq and Codec
|
||||
/// #[pallet::event]
|
||||
/// // Additional argument to specify the metadata to use for given type.
|
||||
/// #[pallet::metadata(BalanceOf<T> = "Balance", u32 = "Other")]
|
||||
/// // Generate a funciton on Pallet to deposit an event.
|
||||
/// #[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
/// pub enum Event<T: Config> {
|
||||
@@ -2192,7 +2148,6 @@ pub mod pallet_prelude {
|
||||
/// }
|
||||
///
|
||||
/// #[pallet::event]
|
||||
/// #[pallet::metadata(BalanceOf<T> = "Balance", u32 = "Other")]
|
||||
/// #[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
/// pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// /// doc comment put in metadata
|
||||
@@ -2342,8 +2297,7 @@ pub mod pallet_prelude {
|
||||
/// 7. **migrate event**:
|
||||
/// rewrite as a simple enum under with the attribute `#[pallet::event]`,
|
||||
/// use `#[pallet::generate_deposit($vis fn deposit_event)]` to generate deposit_event,
|
||||
/// use `#[pallet::metadata(...)]` to configure the metadata for types in order not to break
|
||||
/// them. 8. **migrate error**: rewrite it with attribute `#[pallet::error]`.
|
||||
/// 8. **migrate error**: rewrite it with attribute `#[pallet::error]`.
|
||||
/// 9. **migrate storage**:
|
||||
/// decl_storage provide an upgrade template (see 3.). All storages, genesis config, genesis
|
||||
/// build and default implementation of genesis config can be taken from it directly.
|
||||
|
||||
Reference in New Issue
Block a user