mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Insufficient asset quota and deposits (#10382)
* Allow asset accounts to exist by deposit * Place limit on consumers (and therefore freebie asset accounts) * Maximum number of assets * Fixes * Fixes * Formatting * Docs * Formatting * Destroyed assets are properly tidied * Update frame/assets/src/types.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Docs * Docs * Formatting * Docs * Docs * Fixes * Fixes Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -50,9 +50,10 @@ pub use filter::{ClearFilterGuard, FilterStack, FilterStackGuard, InstanceFilter
|
||||
|
||||
mod misc;
|
||||
pub use misc::{
|
||||
Backing, ConstU32, EnsureInherentsAreFirst, EqualPrivilegeOnly, EstimateCallFee, ExecuteBlock,
|
||||
ExtrinsicCall, Get, GetBacking, GetDefault, HandleLifetime, IsSubType, IsType, Len,
|
||||
OffchainWorker, OnKilledAccount, OnNewAccount, PrivilegeCmp, SameOrOther, Time, TryDrop,
|
||||
Backing, ConstBool, ConstI128, ConstI16, ConstI32, ConstI64, ConstI8, ConstU128, ConstU16,
|
||||
ConstU32, ConstU64, ConstU8, EnsureInherentsAreFirst, EqualPrivilegeOnly, EstimateCallFee,
|
||||
ExecuteBlock, ExtrinsicCall, Get, GetBacking, GetDefault, HandleLifetime, IsSubType, IsType,
|
||||
Len, OffchainWorker, OnKilledAccount, OnNewAccount, PrivilegeCmp, SameOrOther, Time, TryDrop,
|
||||
UnixTime, WrapperKeepOpaque, WrapperOpaque,
|
||||
};
|
||||
|
||||
|
||||
@@ -60,20 +60,33 @@ impl<T: Default> Get<T> for GetDefault {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implement `Get<u32>` and `Get<Option<u32>>` using the given const.
|
||||
pub struct ConstU32<const T: u32>;
|
||||
|
||||
impl<const T: u32> Get<u32> for ConstU32<T> {
|
||||
fn get() -> u32 {
|
||||
T
|
||||
}
|
||||
macro_rules! impl_const_get {
|
||||
($name:ident, $t:ty) => {
|
||||
pub struct $name<const T: $t>;
|
||||
impl<const T: $t> Get<$t> for $name<T> {
|
||||
fn get() -> $t {
|
||||
T
|
||||
}
|
||||
}
|
||||
impl<const T: $t> Get<Option<$t>> for $name<T> {
|
||||
fn get() -> Option<$t> {
|
||||
Some(T)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl<const T: u32> Get<Option<u32>> for ConstU32<T> {
|
||||
fn get() -> Option<u32> {
|
||||
Some(T)
|
||||
}
|
||||
}
|
||||
impl_const_get!(ConstBool, bool);
|
||||
impl_const_get!(ConstU8, u8);
|
||||
impl_const_get!(ConstU16, u16);
|
||||
impl_const_get!(ConstU32, u32);
|
||||
impl_const_get!(ConstU64, u64);
|
||||
impl_const_get!(ConstU128, u128);
|
||||
impl_const_get!(ConstI8, i8);
|
||||
impl_const_get!(ConstI16, i16);
|
||||
impl_const_get!(ConstI32, i32);
|
||||
impl_const_get!(ConstI64, i64);
|
||||
impl_const_get!(ConstI128, i128);
|
||||
|
||||
/// A type for which some values make sense to be able to drop without further consideration.
|
||||
pub trait TryDrop: Sized {
|
||||
|
||||
@@ -17,14 +17,17 @@ scale-info = { version = "1.0", default-features = false, features = ["derive"]
|
||||
sp-core = { version = "4.0.0", default-features = false, path = "../../../../primitives/core" }
|
||||
sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../../../primitives/runtime" }
|
||||
sp-version = { version = "4.0.0-dev", default-features = false, path = "../../../../primitives/version" }
|
||||
support = { package = "frame-support", version = "4.0.0-dev", default-features = false, path = "../../" }
|
||||
system = { package = "frame-system", version = "4.0.0-dev", default-features = false, path = "../../../system" }
|
||||
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../" }
|
||||
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../system" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"support/std",
|
||||
"system/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-version/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
]
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
//! This crate tests that `construct_runtime!` expands the pallet parts
|
||||
//! correctly even when frame-support is renamed in Cargo.toml
|
||||
|
||||
use frame_support::{construct_runtime, parameter_types};
|
||||
use sp_core::{sr25519, H256};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic,
|
||||
traits::{BlakeTwo256, IdentityLookup, Verify},
|
||||
};
|
||||
use sp_version::RuntimeVersion;
|
||||
use support::{construct_runtime, parameter_types};
|
||||
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("frame-support-test-compile-pass"),
|
||||
@@ -51,8 +51,8 @@ parameter_types! {
|
||||
pub const SS58Prefix: u8 = 0;
|
||||
}
|
||||
|
||||
impl system::Config for Runtime {
|
||||
type BaseCallFilter = support::traits::Everything;
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type Index = u128;
|
||||
@@ -73,6 +73,7 @@ impl system::Config for Runtime {
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = SS58Prefix;
|
||||
}
|
||||
@@ -87,6 +88,6 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system,
|
||||
System: frame_system,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -566,6 +566,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
|
||||
@@ -246,6 +246,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
|
||||
@@ -226,6 +226,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
|
||||
@@ -274,6 +274,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
impl pallet::Config for Runtime {
|
||||
type Event = Event;
|
||||
|
||||
@@ -152,6 +152,7 @@ mod tests {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
impl pallet_test::Trait for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user