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

remove migrations #498

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
37 changes: 2 additions & 35 deletions runtime/amplitude/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,46 +158,19 @@ parameter_types! {
pub const InactiveAccounts: Vec<AccountId> = Vec::new();
}

// TODO remove contract migrations after update
use pallet_contracts::migration::{v11, v12, v13, v14, v15};

// Custom storage version bump
use frame_support::{
pallet_prelude::StorageVersion,
traits::{GetStorageVersion, OnRuntimeUpgrade},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these imports can be removed in all runtimes.


pub struct CustomOnRuntimeUpgrade;
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
log::info!("Custom on-runtime-upgrade function");

let mut writes = 0;
// WARNING: manually setting the storage version
if ParachainStaking::on_chain_storage_version() == 0 {
log::info!("Upgrading parachain staking storage version to 7");
StorageVersion::new(7).put::<ParachainStaking>();
writes += 1;
}

if Bounties::on_chain_storage_version() == 0 {
log::info!("Upgrading bounties storage version to 4");
StorageVersion::new(4).put::<Bounties>();
writes += 1;
}
// not really a heavy operation
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, writes)
}
}

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(CustomOnRuntimeUpgrade, pallet_contracts::migration::Migration<Runtime>),
AllPalletsWithSystem
>;

pub struct ConvertPrice;
Expand Down Expand Up @@ -1024,13 +997,7 @@ impl pallet_contracts::Config for Runtime {
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type MaxDelegateDependencies = MaxDelegateDependencies;
type RuntimeHoldReason = RuntimeHoldReason;
type Migrations = (
v11::Migration<Self>,
v12::Migration<Runtime, Balances>,
v13::Migration<Self>,
v14::Migration<Self, Balances>,
v15::Migration<Self>,
);
type Migrations = ();
type Debug = ();
type Environment = ();
}
Expand Down
33 changes: 1 addition & 32 deletions runtime/foucoco/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,44 +158,19 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, Si

pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;

// To be removed after contracts migrations executes.
use pallet_contracts::migration::{v11, v12, v13, v14, v15};
// Custom storage version bump
use frame_support::{
pallet_prelude::StorageVersion,
traits::{GetStorageVersion, OnRuntimeUpgrade},
};

pub struct CustomOnRuntimeUpgrade;
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
log::info!("Custom on-runtime-upgrade function");

let mut writes = 0;
// WARNING: manually setting the storage version
if ParachainStaking::on_chain_storage_version() == 0 {
log::info!("Upgrading parachain staking storage version to 7");
StorageVersion::new(7).put::<ParachainStaking>();
writes += 1;
}

if Bounties::on_chain_storage_version() == 0 {
log::info!("Upgrading bounties storage version to 4");
StorageVersion::new(4).put::<Bounties>();
writes += 1;
}
// not really a heavy operation
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, writes)
}
}
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(CustomOnRuntimeUpgrade, pallet_contracts::migration::Migration<Runtime>),
>;

pub struct ConvertPrice;
Expand Down Expand Up @@ -1072,13 +1047,7 @@ impl pallet_contracts::Config for Runtime {
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type MaxDelegateDependencies = MaxDelegateDependencies;
type RuntimeHoldReason = RuntimeHoldReason;
type Migrations = (
v11::Migration<Self>,
v12::Migration<Runtime, Balances>,
v13::Migration<Self>,
v14::Migration<Self, Balances>,
v15::Migration<Self>,
);
type Migrations = ();
type Debug = ();
type Environment = ();
}
Expand Down
35 changes: 1 addition & 34 deletions runtime/pendulum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,46 +158,19 @@ parameter_types! {
pub const InactiveAccounts: Vec<AccountId> = Vec::new();
}

// To be removed after contracts migrations executes.
use pallet_contracts::migration::{v11, v12, v13, v14, v15};

// Custom storage version bump
use frame_support::{
pallet_prelude::StorageVersion,
traits::{GetStorageVersion, OnRuntimeUpgrade},
};

pub struct CustomOnRuntimeUpgrade;
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
log::info!("Custom on-runtime-upgrade function");

let mut writes = 0;
// WARNING: manually setting the storage version
if ParachainStaking::on_chain_storage_version() == 0 {
log::info!("Upgrading parachain staking storage version to 7");
StorageVersion::new(7).put::<ParachainStaking>();
writes += 1;
}

if Bounties::on_chain_storage_version() == 0 {
log::info!("Upgrading bounties storage version to 4");
StorageVersion::new(4).put::<Bounties>();
writes += 1;
}
// not really a heavy operation
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, writes)
}
}

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(CustomOnRuntimeUpgrade, pallet_contracts::migration::Migration<Runtime>),
>;

pub struct ConvertPrice;
Expand Down Expand Up @@ -1024,13 +997,7 @@ impl pallet_contracts::Config for Runtime {
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type MaxDelegateDependencies = MaxDelegateDependencies;
type RuntimeHoldReason = RuntimeHoldReason;
type Migrations = (
v11::Migration<Self>,
v12::Migration<Runtime, Balances>,
v13::Migration<Self>,
v14::Migration<Self, Balances>,
v15::Migration<Self>,
);
type Migrations = ();
type Debug = ();
type Environment = ();
}
Expand Down
Loading