Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: LP v2 migrations #1966

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ license = "LGPL-3.0"
homepage = "https://centrifuge.io/"
repository = "https://github.com/centrifuge/centrifuge-chain"
documentation = "https://reference.centrifuge.io/centrifuge_chain/index.html"
version = "0.14.0"
version = "0.14.3"

[workspace.dependencies]
hex-literal = { version = "0.4.1" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/liquidity-pools-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mod tests;
pub mod pallet {
use super::*;

const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
const STORAGE_VERSION: StorageVersion = StorageVersion::new(3);
cdamian marked this conversation as resolved.
Show resolved Hide resolved

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
Expand Down
4 changes: 2 additions & 2 deletions runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("altair"),
impl_name: create_runtime_str!("altair"),
authoring_version: 1,
spec_version: 1401,
spec_version: 1403,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -2027,7 +2027,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
migrations::UpgradeAltair1401,
migrations::UpgradeAltair1403,
>;

// Frame Order in this block dictates the index of each one in the metadata
Expand Down
16 changes: 11 additions & 5 deletions runtime/altair/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

use frame_support::migrations::VersionedMigration;

use crate::Runtime;

/// The migration set for Altair @ Kusama.
/// It includes all the migrations that have to be applied on that chain.
pub type UpgradeAltair1401 = (
// Clear OutboundMessageNonceStore
frame_support::migrations::VersionedMigration<
pub type UpgradeAltair1403 = (
// Clear v0 RelayerList storage
runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration<Runtime>,
// Clear OutboundMessageNonceStore and migrate outbound storage to LP queue
runtime_common::migrations::liquidity_pools_v2::v0_init_message_queue::Migration<Runtime>,
// Remove deprecated DomainRouters entries and migrate relevant ones to Axelar Router Config
VersionedMigration<
0,
1,
runtime_common::migrations::liquidity_pools_gateway::Migration<Runtime>,
3,
runtime_common::migrations::liquidity_pools_v2::init_axelar_router::Migration<Runtime>,
pallet_liquidity_pools_gateway::Pallet<Runtime>,
<Runtime as frame_system::Config>::DbWeight,
>,
Expand Down
4 changes: 2 additions & 2 deletions runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("centrifuge"),
impl_name: create_runtime_str!("centrifuge"),
authoring_version: 1,
spec_version: 1401,
spec_version: 1403,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down Expand Up @@ -2041,7 +2041,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
migrations::UpgradeCentrifuge1401,
migrations::UpgradeCentrifuge1403,
>;

// Frame Order in this block dictates the index of each one in the metadata
Expand Down
18 changes: 13 additions & 5 deletions runtime/centrifuge/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

use frame_support::migrations::VersionedMigration;

use crate::Runtime;

/// The migration set for Centrifuge @ Polkadot.
/// It includes all the migrations that have to be applied on that chain.
pub type UpgradeCentrifuge1401 = (
// Clear OutboundMessageNonceStore
frame_support::migrations::VersionedMigration<
pub type UpgradeCentrifuge1403 = (
// Clear v0 RelayerList storage
runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration<Runtime>,
// Clear OutboundMessageNonceStore and migrate outbound storage to LP queue
runtime_common::migrations::liquidity_pools_v2::v0_init_message_queue::Migration<Runtime>,
// Remove deprecated DomainRouters entries and migrate relevant ones to Axelar Router Config
VersionedMigration<
0,
1,
runtime_common::migrations::liquidity_pools_gateway::Migration<Runtime>,
3,
runtime_common::migrations::liquidity_pools_v2::init_axelar_router::Migration<Runtime>,
pallet_liquidity_pools_gateway::Pallet<Runtime>,
<Runtime as frame_system::Config>::DbWeight,
>,
// Remove deprecated RelayerList storage
runtime_common::migrations::liquidity_pools_v2::kill_relayer_list::Migration<Runtime>,
// Remove undecodable ForeignInvestmentInfo v0 entries
runtime_common::migrations::foreign_investments_v2::Migration<Runtime>,
// Bump to v1
Expand Down
7 changes: 7 additions & 0 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pallet-investments = { workspace = true }
pallet-keystore = { workspace = true }
pallet-liquidity-pools = { workspace = true }
pallet-liquidity-pools-gateway = { workspace = true }
pallet-liquidity-pools-gateway-queue = { workspace = true }
pallet-liquidity-rewards = { workspace = true }
pallet-loans = { workspace = true }
pallet-membership = { workspace = true }
Expand Down Expand Up @@ -207,6 +208,8 @@ std = [
"pallet-keystore/std",
"pallet-liquidity-pools/std",
"pallet-liquidity-pools-gateway/std",
"pallet-liquidity-pools-gateway-queue/std",
"pallet-axelar-router/std",
"pallet-liquidity-rewards/std",
"pallet-loans/std",
"pallet-membership/std",
Expand Down Expand Up @@ -284,6 +287,8 @@ runtime-benchmarks = [
"pallet-keystore/runtime-benchmarks",
"pallet-liquidity-pools/runtime-benchmarks",
"pallet-liquidity-pools-gateway/runtime-benchmarks",
"pallet-liquidity-pools-gateway-queue/runtime-benchmarks",
"pallet-axelar-router/runtime-benchmarks",
"pallet-liquidity-rewards/runtime-benchmarks",
"pallet-loans/runtime-benchmarks",
"pallet-membership/runtime-benchmarks",
Expand Down Expand Up @@ -357,6 +362,8 @@ try-runtime = [
"pallet-keystore/try-runtime",
"pallet-liquidity-pools/try-runtime",
"pallet-liquidity-pools-gateway/try-runtime",
"pallet-liquidity-pools-gateway-queue/try-runtime",
"pallet-axelar-router/try-runtime",
"pallet-liquidity-rewards/try-runtime",
"pallet-loans/try-runtime",
"pallet-membership/try-runtime",
Expand Down
3 changes: 3 additions & 0 deletions runtime/common/src/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,12 @@ mod tests {

#[cfg(feature = "std")]
pub mod utils {
#[cfg(feature = "std")]
use sp_core::H160;
#[cfg(feature = "std")]
use sp_std::collections::btree_map::BTreeMap;

#[cfg(feature = "std")]
use crate::evm::precompile::H160Addresses;

pub fn account_genesis<PrecompileSet: H160Addresses>() -> BTreeMap<H160, fp_evm::GenesisAccount>
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/migrations/foreign_investments_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use sp_std::vec::Vec;
pub struct Migration<T>(sp_std::marker::PhantomData<T>);

const REMOVAL_LIMIT: u32 = 10u32;
const LOG_PREFIX: &str = "LiquidityPoolsGatewayV1";
const LOG_PREFIX: &str = "ForeignInvestmentsV2";

impl<T> OnRuntimeUpgrade for Migration<T>
where
Expand Down
117 changes: 0 additions & 117 deletions runtime/common/src/migrations/liquidity_pools_gateway.rs

This file was deleted.

Loading
Loading