diff --git a/.metadata/polymesh_dev/7003000.meta b/.metadata/polymesh_dev/7003000.meta new file mode 100644 index 0000000000..2c2164776d Binary files /dev/null and b/.metadata/polymesh_dev/7003000.meta differ diff --git a/.metadata/polymesh_mainnet/7003000.meta b/.metadata/polymesh_mainnet/7003000.meta new file mode 100644 index 0000000000..a7db9ecfd9 Binary files /dev/null and b/.metadata/polymesh_mainnet/7003000.meta differ diff --git a/.metadata/polymesh_testnet/7003000.meta b/.metadata/polymesh_testnet/7003000.meta new file mode 100644 index 0000000000..496d24301c Binary files /dev/null and b/.metadata/polymesh_testnet/7003000.meta differ diff --git a/Cargo.lock b/Cargo.lock index eaf3531f72..a6fe141980 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4871,28 +4871,6 @@ dependencies = [ "sp-version", ] -[[package]] -name = "pallet-bridge" -version = "1.0.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-balances 0.1.0", - "pallet-base", - "pallet-identity", - "pallet-multisig", - "pallet-scheduler", - "parity-scale-codec 3.6.9", - "polymesh-primitives", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-committee" version = "0.1.0" @@ -6168,7 +6146,7 @@ dependencies = [ [[package]] name = "polymesh" -version = "7.2.0" +version = "7.3.0" dependencies = [ "clap", "frame-benchmarking", @@ -6184,7 +6162,6 @@ dependencies = [ "pallet-asset", "pallet-babe", "pallet-balances 0.1.0", - "pallet-bridge", "pallet-committee", "pallet-corporate-actions", "pallet-external-agents", @@ -6387,6 +6364,7 @@ dependencies = [ "frame-election-provider-support", "frame-support", "frame-system", + "log", "pallet-authorship", "pallet-balances 0.1.0", "pallet-committee", @@ -6425,7 +6403,6 @@ dependencies = [ "pallet-babe", "pallet-balances 0.1.0", "pallet-base", - "pallet-bridge", "pallet-committee", "pallet-compliance-manager", "pallet-contracts", @@ -6508,7 +6485,6 @@ dependencies = [ "pallet-babe", "pallet-balances 0.1.0", "pallet-base", - "pallet-bridge", "pallet-committee", "pallet-compliance-manager", "pallet-contracts", @@ -6593,7 +6569,6 @@ dependencies = [ "pallet-babe", "pallet-balances 0.1.0", "pallet-base", - "pallet-bridge", "pallet-committee", "pallet-compliance-manager", "pallet-contracts", @@ -6684,7 +6659,6 @@ dependencies = [ "pallet-babe", "pallet-balances 0.1.0", "pallet-base", - "pallet-bridge", "pallet-committee", "pallet-compliance-manager", "pallet-contracts", diff --git a/Cargo.toml b/Cargo.toml index 31489f7101..eee2a1e0e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polymesh" -version = "7.2.0" +version = "7.3.0" authors = ["PolymeshAssociation"] build = "build.rs" edition = "2021" @@ -107,7 +107,6 @@ members = [ "pallets/asset", "pallets/balances", "pallets/base", - "pallets/bridge", "pallets/committee", "pallets/compliance-manager", "pallets/contracts", @@ -159,7 +158,6 @@ exclude = [ pallet-asset = { path = "pallets/asset", default-features = false } pallet-balances = { path = "pallets/balances", default-features = false } pallet-base = { path = "pallets/base", default-features = false } -pallet-bridge = { path = "pallets/bridge", default-features = false } pallet-committee = { path = "pallets/committee", default-features = false } pallet-compliance-manager = { path = "pallets/compliance-manager", default-features = false } pallet-corporate-actions = { path = "pallets/corporate-actions", default-features = false } @@ -263,7 +261,6 @@ rand_chacha = { version = "0.3", default-features = false } [dependencies] pallet-asset = { workspace = true } pallet-balances = { workspace = true, default-features = false } -pallet-bridge = { workspace = true, default-features = false } pallet-committee = { workspace = true, default-features = false } pallet-corporate-actions = { workspace = true, default-features = false } pallet-external-agents = { workspace = true, default-features = false } diff --git a/pallets/runtime/common/Cargo.toml b/pallets/runtime/common/Cargo.toml index 4261b155b1..0fe471cfb2 100644 --- a/pallets/runtime/common/Cargo.toml +++ b/pallets/runtime/common/Cargo.toml @@ -19,6 +19,7 @@ pallet-group-rpc-runtime-api = { workspace = true, default-features = false} # General smallvec = "1.4.0" +log = "0.4.8" # Substrate codec = { workspace = true, default-features = false, features = ["derive"] } diff --git a/pallets/runtime/common/src/lib.rs b/pallets/runtime/common/src/lib.rs index 3888d1f6f3..89fca509f3 100644 --- a/pallets/runtime/common/src/lib.rs +++ b/pallets/runtime/common/src/lib.rs @@ -20,6 +20,7 @@ pub mod cdd_check; pub mod fee_details; pub mod impls; +pub mod migration; pub mod runtime; pub use frame_support::{ diff --git a/pallets/runtime/common/src/migration.rs b/pallets/runtime/common/src/migration.rs new file mode 100644 index 0000000000..6a407ae4b9 --- /dev/null +++ b/pallets/runtime/common/src/migration.rs @@ -0,0 +1,45 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use core::marker::PhantomData; +use frame_support::{traits::Get, weights::RuntimeDbWeight}; +use sp_io::{hashing::twox_128, storage::clear_prefix, KillStorageResult}; + +pub struct RemovePallet, DbWeight: Get>( + PhantomData<(P, DbWeight)>, +); +impl, DbWeight: Get> frame_support::traits::OnRuntimeUpgrade + for RemovePallet +{ + fn on_runtime_upgrade() -> frame_support::weights::Weight { + let hashed_prefix = twox_128(P::get().as_bytes()); + let keys_removed = match clear_prefix(&hashed_prefix, None) { + KillStorageResult::AllRemoved(value) => value, + KillStorageResult::SomeRemaining(value) => { + log::error!( + "`clear_prefix` failed to remove all keys for {}. THIS SHOULD NEVER HAPPEN! 🚨", + P::get() + ); + value + } + } as u64; + + log::info!("Removed {} {} keys 🧹", keys_removed, P::get()); + + DbWeight::get().reads_writes(keys_removed + 1, keys_removed) + } +} diff --git a/pallets/runtime/common/src/runtime.rs b/pallets/runtime/common/src/runtime.rs index 4cc882b8cf..d2551df48e 100644 --- a/pallets/runtime/common/src/runtime.rs +++ b/pallets/runtime/common/src/runtime.rs @@ -288,8 +288,6 @@ macro_rules! misc_pallet_impls { type MaxSigners = MaxMultiSigSigners; } - impl pallet_bridge::Config for Runtime {} - impl pallet_portfolio::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = polymesh_weights::pallet_portfolio::SubstrateWeight; @@ -481,6 +479,8 @@ macro_rules! misc_pallet_impls { pub const PreimageMaxSize: u32 = 4096 * 1024; pub const PreimageBaseDeposit: Balance = polymesh_runtime_common::deposit(2, 64); pub const PreimageByteDeposit: Balance = polymesh_runtime_common::deposit(0, 1); + + pub const BridgePalletName: &'static str = "Bridge"; } impl pallet_preimage::Config for Runtime { @@ -784,6 +784,7 @@ macro_rules! runtime_apis { ( pallet_scheduler::migration::v4::CleanupAgendas, pallet_contracts::Migration, + polymesh_runtime_common::migration::RemovePallet::DbWeight>, ) >; diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index d492edd5d4..f4ad8eb883 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -18,7 +18,6 @@ polymesh-weights = { workspace = true, default-features = false } pallet-asset = { workspace = true, default-features = false } pallet-balances = { workspace = true, default-features = false } pallet-base = { workspace = true, default-features = false } -pallet-bridge = { workspace = true, default-features = false } pallet-committee = { workspace = true, default-features = false } pallet-compliance-manager = { workspace = true, default-features = false } pallet-corporate-actions = { workspace = true, default-features = false } @@ -139,7 +138,6 @@ std = [ "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", - "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", "pallet-contracts/std", diff --git a/pallets/runtime/develop/src/runtime.rs b/pallets/runtime/develop/src/runtime.rs index 9d6ef6dced..ca1f3cb256 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -55,7 +55,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 7_002_000, + spec_version: 7_003_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 7, @@ -385,7 +385,8 @@ construct_runtime!( MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event} = 15, - Bridge: pallet_bridge::{Pallet, Storage} = 16, + // Removed: + //Bridge = 16, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees Staking: pallet_staking::{Pallet, Call, Config, Storage, Event} = 17, diff --git a/pallets/runtime/mainnet/Cargo.toml b/pallets/runtime/mainnet/Cargo.toml index f68e8a6852..8817641f41 100644 --- a/pallets/runtime/mainnet/Cargo.toml +++ b/pallets/runtime/mainnet/Cargo.toml @@ -18,7 +18,6 @@ polymesh-weights = { workspace = true, default-features = false } pallet-asset = { workspace = true, default-features = false } pallet-balances = { workspace = true, default-features = false } pallet-base = { workspace = true, default-features = false } -pallet-bridge = { workspace = true, default-features = false } pallet-committee = { workspace = true, default-features = false } pallet-compliance-manager = { workspace = true, default-features = false } pallet-corporate-actions = { workspace = true, default-features = false } @@ -127,7 +126,6 @@ std = [ "pallet-base/std", "pallet-babe/std", "pallet-balances/std", - "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", "pallet-contracts/std", diff --git a/pallets/runtime/mainnet/src/runtime.rs b/pallets/runtime/mainnet/src/runtime.rs index 3c335a8be4..5375cdf907 100644 --- a/pallets/runtime/mainnet/src/runtime.rs +++ b/pallets/runtime/mainnet/src/runtime.rs @@ -53,7 +53,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 7_002_000, + spec_version: 7_003_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 7, @@ -335,7 +335,8 @@ construct_runtime!( MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event} = 15, - Bridge: pallet_bridge::{Pallet, Storage} = 16, + // Removed: + //Bridge = 16, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees Staking: pallet_staking::{Pallet, Call, Config, Storage, Event} = 17, diff --git a/pallets/runtime/testnet/Cargo.toml b/pallets/runtime/testnet/Cargo.toml index d46d6ab8cf..871738d78a 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/Cargo.toml @@ -19,7 +19,6 @@ pallet-asset = { workspace = true, default-features = false } pallet-balances = { workspace = true, default-features = false } pallet-base = { workspace = true, default-features = false } pallet-sto = { workspace = true, default-features = false } -pallet-bridge = { workspace = true, default-features = false } pallet-committee = { workspace = true, default-features = false } pallet-compliance-manager = { workspace = true, default-features = false } pallet-corporate-actions = { workspace = true, default-features = false } @@ -130,7 +129,6 @@ std = [ "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", - "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", "pallet-contracts/std", diff --git a/pallets/runtime/testnet/src/runtime.rs b/pallets/runtime/testnet/src/runtime.rs index e351598d26..9fe15a5155 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -55,7 +55,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 7_002_000, + spec_version: 7_003_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 7, @@ -341,7 +341,8 @@ construct_runtime!( MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event} = 15, - Bridge: pallet_bridge::{Pallet, Storage} = 16, + // Removed: + //Bridge = 16, // Staking: Genesis config deps: Bridge, Balances, Indices, Identity, Babe, Timestamp, Committees Staking: pallet_staking::{Pallet, Call, Config, Storage, Event} = 17, diff --git a/pallets/runtime/tests/Cargo.toml b/pallets/runtime/tests/Cargo.toml index 6e43826d0d..b57f1a65e8 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -9,7 +9,6 @@ node-rpc-runtime-api = { workspace = true, default-features = false } pallet-asset = { workspace = true, default-features = false } pallet-balances = { workspace = true, default-features = false } pallet-base = { workspace = true, default-features = false } -pallet-bridge = { workspace = true, default-features = false } pallet-committee = { workspace = true, default-features = false } pallet-compliance-manager = { workspace = true, default-features = false } pallet-corporate-actions = { workspace = true, default-features = false } @@ -131,7 +130,6 @@ std = [ "pallet-babe/std", "pallet-balances/std", "pallet-sto/std", - "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", "pallet-contracts/std",