Add Storage Info to Various Pallets (#10810)

* atomic swap

* bounties

* bounties fmt

* gilt

* indices

* nicks

* randomness-collective-flip

* recovery

* reuse maxapprovals

* Update tests.rs

* Update frame/randomness-collective-flip/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* use the correct bound

* complete recovery

* use `bounded_vec` macro

* Update tests.rs

* transaction payment

* uniques

* mmr

* example offchain worker

* beefy-mmr

* Update frame/recovery/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use BoundedVec instead of a type-parameterized BoundedString

* cargo fmt

* Update frame/atomic-swap/src/lib.rs

* use config const

* Update lib.rs

* update mel_bound

* fmt

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Shawn Tabrizi
2022-02-08 15:10:35 +01:00
committed by GitHub
parent d14e1c641e
commit f6f82d876b
25 changed files with 165 additions and 115 deletions
+8 -3
View File
@@ -62,7 +62,6 @@ pub mod pallet {
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::without_storage_info]
pub struct Pallet<T, I = ()>(_);
#[pallet::config]
@@ -72,10 +71,16 @@ pub mod pallet {
type Event: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::Event>;
/// Identifier for the class of asset.
type ClassId: Member + Parameter + Default + Copy + HasCompact;
type ClassId: Member + Parameter + Default + Copy + HasCompact + MaxEncodedLen;
/// The type used to identify a unique asset within an asset class.
type InstanceId: Member + Parameter + Default + Copy + HasCompact + From<u16>;
type InstanceId: Member
+ Parameter
+ Default
+ Copy
+ HasCompact
+ From<u16>
+ MaxEncodedLen;
/// The currency mechanism, used for paying for reserves.
type Currency: ReservableCurrency<Self::AccountId>;
+11 -6
View File
@@ -18,7 +18,10 @@
//! Various basic types for use in the assets pallet.
use super::*;
use frame_support::{traits::Get, BoundedVec};
use frame_support::{
pallet_prelude::{BoundedVec, MaxEncodedLen},
traits::Get,
};
use scale_info::TypeInfo;
pub(super) type DepositBalanceOf<T, I = ()> =
@@ -28,7 +31,7 @@ pub(super) type ClassDetailsFor<T, I> =
pub(super) type InstanceDetailsFor<T, I> =
InstanceDetails<<T as SystemConfig>::AccountId, DepositBalanceOf<T, I>>;
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct ClassDetails<AccountId, DepositBalance> {
/// Can change `owner`, `issuer`, `freezer` and `admin` accounts.
pub(super) owner: AccountId,
@@ -54,7 +57,7 @@ pub struct ClassDetails<AccountId, DepositBalance> {
}
/// Witness data for the destroy transactions.
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)]
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct DestroyWitness {
/// The total number of outstanding instances of this asset class.
#[codec(compact)]
@@ -78,7 +81,7 @@ impl<AccountId, DepositBalance> ClassDetails<AccountId, DepositBalance> {
}
/// Information concerning the ownership of a single unique asset.
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
pub struct InstanceDetails<AccountId, DepositBalance> {
/// The owner of this asset.
pub(super) owner: AccountId,
@@ -91,8 +94,9 @@ pub struct InstanceDetails<AccountId, DepositBalance> {
pub(super) deposit: DepositBalance,
}
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(StringLimit))]
#[codec(mel_bound(DepositBalance: MaxEncodedLen))]
pub struct ClassMetadata<DepositBalance, StringLimit: Get<u32>> {
/// The balance deposited for this metadata.
///
@@ -106,8 +110,9 @@ pub struct ClassMetadata<DepositBalance, StringLimit: Get<u32>> {
pub(super) is_frozen: bool,
}
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, Default, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(StringLimit))]
#[codec(mel_bound(DepositBalance: MaxEncodedLen))]
pub struct InstanceMetadata<DepositBalance, StringLimit: Get<u32>> {
/// The balance deposited for this metadata.
///