Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ members = [
"pallets/asset",
"pallets/balances",
"pallets/base",
"pallets/bridge",
"pallets/committee",
"pallets/compliance-manager",
"pallets/contracts",
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions pallets/runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions pallets/runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
45 changes: 45 additions & 0 deletions pallets/runtime/common/src/migration.rs
Original file line number Diff line number Diff line change
@@ -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<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>>(
PhantomData<(P, DbWeight)>,
);
impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> frame_support::traits::OnRuntimeUpgrade
for RemovePallet<P, DbWeight>
{
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)
}
}
5 changes: 3 additions & 2 deletions pallets/runtime/common/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -784,6 +784,7 @@ macro_rules! runtime_apis {
(
pallet_scheduler::migration::v4::CleanupAgendas<Runtime>,
pallet_contracts::Migration<Runtime>,
polymesh_runtime_common::migration::RemovePallet<BridgePalletName, <Runtime as frame_system::Config>::DbWeight>,
)
>;

Expand Down
2 changes: 0 additions & 2 deletions pallets/runtime/develop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ construct_runtime!(

MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event<T>} = 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<T>, Storage, Event<T>} = 17,
Expand Down
2 changes: 0 additions & 2 deletions pallets/runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ construct_runtime!(

MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event<T>} = 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<T>, Storage, Event<T>} = 17,
Expand Down
2 changes: 0 additions & 2 deletions pallets/runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ construct_runtime!(

MultiSig: pallet_multisig::{Pallet, Call, Config, Storage, Event<T>} = 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<T>, Storage, Event<T>} = 17,
Expand Down
2 changes: 0 additions & 2 deletions pallets/runtime/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down