Add migrations from pallet_asset to statemine, statemint and westmint (#1742)

* statemine: migrate pallet assets to v1

* statemint and westmint: migrate pallet assets to v1

* remove items limit

* update dependencies and crate imports

* change substrate version to dependent PR

* revert to master

* revert changes to cargo toml

* fix weights to test compilation with companion substrate branch

* change destroy etrinsic in westmint to new extrinsics

* update lockfile for {"polkadot", "substrate"}

* rebase

Co-authored-by: parity-processbot <>
This commit is contained in:
Anthony Alaribe
2022-11-15 14:07:50 +02:00
committed by EgorPopelyaev
parent 46e95e2bae
commit 2e371ef995
12 changed files with 386 additions and 346 deletions
Generated
+254 -268
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -13,17 +13,17 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive
scale-info = { version = "2.3.0", default-features = false, features = ["derive"] }
# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
# Polkadot
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
@@ -258,6 +258,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
}
parameter_types! {
@@ -360,7 +361,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::AssetOwner => matches!(
c,
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
@@ -648,7 +652,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(),
pallet_assets::migration::v1::MigrateToV1<Runtime>,
>;
#[cfg(feature = "runtime-benchmarks")]
@@ -59,31 +59,44 @@ impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:5002 w:5001)
// Storage: System Account (r:5000 w:5000)
// Storage: Assets Metadata (r:1 w:0)
// Storage: Assets Approvals (r:501 w:500)
/// The range of component `c` is `[0, 5000]`.
/// The range of component `s` is `[0, 5000]`.
/// The range of component `a` is `[0, 500]`.
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 103_000
.saturating_add(Weight::from_ref_time(17_019_000 as u64).saturating_mul(c as u64))
// Standard Error: 103_000
.saturating_add(Weight::from_ref_time(18_891_000 as u64).saturating_mul(s as u64))
// Standard Error: 1_038_000
.saturating_add(Weight::from_ref_time(32_265_000 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(5 as u64))
fn start_destroy() -> Weight {
Weight::from_ref_time(31_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:0)
// Storage: System Account (r:20 w:20)
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
Weight::from_ref_time(37_000_000 as u64)
// Standard Error: 19_301
.saturating_add(Weight::from_ref_time(25_467_908 as u64).saturating_mul(c as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64)))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:0)
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
Weight::from_ref_time(39_000_000 as u64)
// Standard Error: 14_298
.saturating_add(Weight::from_ref_time(27_632_144 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(a as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:0)
fn finish_destroy() -> Weight {
Weight::from_ref_time(33_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn mint() -> Weight {
Weight::from_ref_time(35_875_000 as u64)
@@ -20,7 +20,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", default-featur
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -274,6 +274,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
}
parameter_types! {
@@ -376,7 +377,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::AssetOwner => matches!(
c,
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
@@ -661,6 +665,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_assets::migration::v1::MigrateToV1<Runtime>,
>;
#[cfg(feature = "runtime-benchmarks")]
@@ -59,31 +59,44 @@ impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:5002 w:5001)
// Storage: System Account (r:5000 w:5000)
// Storage: Assets Metadata (r:1 w:0)
// Storage: Assets Approvals (r:501 w:500)
/// The range of component `c` is `[0, 5000]`.
/// The range of component `s` is `[0, 5000]`.
/// The range of component `a` is `[0, 500]`.
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 96_000
.saturating_add(Weight::from_ref_time(15_834_000 as u64).saturating_mul(c as u64))
// Standard Error: 96_000
.saturating_add(Weight::from_ref_time(17_275_000 as u64).saturating_mul(s as u64))
// Standard Error: 966_000
.saturating_add(Weight::from_ref_time(35_635_000 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(5 as u64))
fn start_destroy() -> Weight {
Weight::from_ref_time(31_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:0)
// Storage: System Account (r:20 w:20)
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
Weight::from_ref_time(37_000_000 as u64)
// Standard Error: 19_301
.saturating_add(Weight::from_ref_time(25_467_908 as u64).saturating_mul(c as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64)))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:0)
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
Weight::from_ref_time(39_000_000 as u64)
// Standard Error: 14_298
.saturating_add(Weight::from_ref_time(27_632_144 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(a as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:0)
fn finish_destroy() -> Weight {
Weight::from_ref_time(33_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn mint() -> Weight {
Weight::from_ref_time(36_535_000 as u64)
@@ -239,6 +239,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
}
parameter_types! {
@@ -341,7 +342,10 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::AssetOwner => matches!(
c,
RuntimeCall::Assets(pallet_assets::Call::create { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::start_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_accounts { .. }) |
RuntimeCall::Assets(pallet_assets::Call::destroy_approvals { .. }) |
RuntimeCall::Assets(pallet_assets::Call::finish_destroy { .. }) |
RuntimeCall::Assets(pallet_assets::Call::transfer_ownership { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_team { .. }) |
RuntimeCall::Assets(pallet_assets::Call::set_metadata { .. }) |
@@ -621,7 +625,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(),
pallet_assets::migration::v1::MigrateToV1<Runtime>,
>;
#[cfg(feature = "runtime-benchmarks")]
@@ -59,31 +59,44 @@ impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:5002 w:5001)
// Storage: System Account (r:5000 w:5000)
// Storage: Assets Metadata (r:1 w:0)
// Storage: Assets Approvals (r:501 w:500)
/// The range of component `c` is `[0, 5000]`.
/// The range of component `s` is `[0, 5000]`.
/// The range of component `a` is `[0, 500]`.
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
Weight::from_ref_time(0 as u64)
// Standard Error: 70_000
.saturating_add(Weight::from_ref_time(17_625_000 as u64).saturating_mul(c as u64))
// Standard Error: 70_000
.saturating_add(Weight::from_ref_time(18_034_000 as u64).saturating_mul(s as u64))
// Standard Error: 700_000
.saturating_add(Weight::from_ref_time(16_396_000 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(5 as u64))
fn start_destroy() -> Weight {
Weight::from_ref_time(31_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:0)
// Storage: System Account (r:20 w:20)
/// The range of component `c` is `[0, 1000]`.
fn destroy_accounts(c: u32, ) -> Weight {
Weight::from_ref_time(37_000_000 as u64)
// Standard Error: 19_301
.saturating_add(Weight::from_ref_time(25_467_908 as u64).saturating_mul(c as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(s as u64)))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))
.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(s as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:0)
/// The range of component `a` is `[0, 1000]`.
fn destroy_approvals(a: u32, ) -> Weight {
Weight::from_ref_time(39_000_000 as u64)
// Standard Error: 14_298
.saturating_add(Weight::from_ref_time(27_632_144 as u64).saturating_mul(a as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(a as u64)))
.saturating_add(T::DbWeight::get().writes(1 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(a as u64)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:0)
fn finish_destroy() -> Weight {
Weight::from_ref_time(33_000_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn mint() -> Weight {
Weight::from_ref_time(38_154_000 as u64)
@@ -12,7 +12,7 @@ scale-info = { version = "2.3.0", default-features = false, features = ["derive"
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
@@ -409,6 +409,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
}
parameter_types! {
@@ -508,6 +508,7 @@ impl pallet_assets::Config for Runtime {
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type AssetAccountDeposit = AssetAccountDeposit;
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>;
}
impl pallet_aura::Config for Runtime {