From f1079eaf7b6a88a1f0ced16de2464144efa0a1d5 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 30 Apr 2024 15:58:09 +0200 Subject: [PATCH] Setup `storage_version` for bridging pallets --- bridges/modules/beefy/src/lib.rs | 3 +++ bridges/modules/beefy/src/migration.rs | 22 +++++++++++++++++++ bridges/modules/grandpa/src/lib.rs | 3 +++ bridges/modules/grandpa/src/migration.rs | 22 +++++++++++++++++++ bridges/modules/messages/src/lib.rs | 5 +++-- bridges/modules/messages/src/migration.rs | 22 +++++++++++++++++++ bridges/modules/parachains/src/lib.rs | 2 ++ bridges/modules/parachains/src/migration.rs | 22 +++++++++++++++++++ bridges/modules/relayers/src/lib.rs | 2 ++ bridges/modules/relayers/src/migration.rs | 22 +++++++++++++++++++ .../modules/xcm-bridge-hub-router/src/lib.rs | 2 ++ .../xcm-bridge-hub-router/src/migration.rs | 22 +++++++++++++++++++ bridges/modules/xcm-bridge-hub/src/lib.rs | 2 ++ .../modules/xcm-bridge-hub/src/migration.rs | 22 +++++++++++++++++++ 14 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 bridges/modules/beefy/src/migration.rs create mode 100644 bridges/modules/grandpa/src/migration.rs create mode 100644 bridges/modules/messages/src/migration.rs create mode 100644 bridges/modules/parachains/src/migration.rs create mode 100644 bridges/modules/relayers/src/migration.rs create mode 100644 bridges/modules/xcm-bridge-hub-router/src/migration.rs create mode 100644 bridges/modules/xcm-bridge-hub/src/migration.rs diff --git a/bridges/modules/beefy/src/lib.rs b/bridges/modules/beefy/src/lib.rs index 27c83921021b..4c4502f75f90 100644 --- a/bridges/modules/beefy/src/lib.rs +++ b/bridges/modules/beefy/src/lib.rs @@ -40,6 +40,8 @@ pub use pallet::*; mod utils; +pub mod migration; + #[cfg(test)] mod mock; #[cfg(test)] @@ -126,6 +128,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] #[pallet::without_storage_info] pub struct Pallet(PhantomData<(T, I)>); diff --git a/bridges/modules/beefy/src/migration.rs b/bridges/modules/beefy/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/beefy/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index efcbfb1654b3..ba6d771ccaa2 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -56,6 +56,8 @@ mod call_ext; mod mock; mod storage_types; +pub mod migration; + /// Module, containing weights for this pallet. pub mod weights; pub mod weights_ext; @@ -145,6 +147,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData<(T, I)>); #[pallet::hooks] diff --git a/bridges/modules/grandpa/src/migration.rs b/bridges/modules/grandpa/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/grandpa/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index bc00db9eba5b..b8afc957fbff 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -74,10 +74,10 @@ mod inbound_lane; mod outbound_lane; mod weights_ext; -pub mod weights; - #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; +pub mod migration; +pub mod weights; #[cfg(test)] mod mock; @@ -177,6 +177,7 @@ pub mod pallet { >>::MessagesDeliveryProof; #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData<(T, I)>); impl, I: 'static> OwnedBridgeModule for Pallet { diff --git a/bridges/modules/messages/src/migration.rs b/bridges/modules/messages/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/messages/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/parachains/src/lib.rs b/bridges/modules/parachains/src/lib.rs index 61e04aed3770..5fa890dbc833 100644 --- a/bridges/modules/parachains/src/lib.rs +++ b/bridges/modules/parachains/src/lib.rs @@ -46,6 +46,7 @@ use codec::Encode; pub use call_ext::*; pub use pallet::*; +pub mod migration; pub mod weights; pub mod weights_ext; @@ -314,6 +315,7 @@ pub mod pallet { >; #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData<(T, I)>); impl, I: 'static> OwnedBridgeModule for Pallet { diff --git a/bridges/modules/parachains/src/migration.rs b/bridges/modules/parachains/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/parachains/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/relayers/src/lib.rs b/bridges/modules/relayers/src/lib.rs index 7a3a0f9ea94c..007962b1f33a 100644 --- a/bridges/modules/relayers/src/lib.rs +++ b/bridges/modules/relayers/src/lib.rs @@ -37,6 +37,7 @@ pub use weights::WeightInfo; pub use weights_ext::WeightInfoExt; pub mod benchmarking; +pub mod migration; mod mock; mod payment_adapter; @@ -73,6 +74,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData); #[pallet::call] diff --git a/bridges/modules/relayers/src/migration.rs b/bridges/modules/relayers/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/relayers/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/xcm-bridge-hub-router/src/lib.rs b/bridges/modules/xcm-bridge-hub-router/src/lib.rs index ece72ac8494b..dcb3c696ed27 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/lib.rs @@ -44,6 +44,7 @@ pub use pallet::*; pub use weights::WeightInfo; pub mod benchmarking; +pub mod migration; pub mod weights; mod mock; @@ -107,6 +108,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData<(T, I)>); #[pallet::hooks] diff --git a/bridges/modules/xcm-bridge-hub-router/src/migration.rs b/bridges/modules/xcm-bridge-hub-router/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/xcm-bridge-hub-router/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); diff --git a/bridges/modules/xcm-bridge-hub/src/lib.rs b/bridges/modules/xcm-bridge-hub/src/lib.rs index 60b988497fc5..3dab9512abbf 100644 --- a/bridges/modules/xcm-bridge-hub/src/lib.rs +++ b/bridges/modules/xcm-bridge-hub/src/lib.rs @@ -27,6 +27,7 @@ pub use exporter::PalletAsHaulBlobExporter; pub use pallet::*; mod exporter; +pub mod migration; mod mock; /// The target that will be used when publishing logs related to this pallet. @@ -70,6 +71,7 @@ pub mod pallet { } #[pallet::pallet] + #[pallet::storage_version(migration::STORAGE_VERSION)] pub struct Pallet(PhantomData<(T, I)>); #[pallet::hooks] diff --git a/bridges/modules/xcm-bridge-hub/src/migration.rs b/bridges/modules/xcm-bridge-hub/src/migration.rs new file mode 100644 index 000000000000..f4e568359328 --- /dev/null +++ b/bridges/modules/xcm-bridge-hub/src/migration.rs @@ -0,0 +1,22 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +//! A module that is responsible for migration of storage. + +use frame_support::traits::StorageVersion; + +/// The in-code storage version. +pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);