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/flexible fee ban vbnc #1497

Merged
merged 6 commits into from
Nov 12, 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
30 changes: 30 additions & 0 deletions pallets/flexible-fee/src/migrations/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,33 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV3<T> {
Ok(())
}
}

pub struct PolkadotMigrateToV3<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for PolkadotMigrateToV3<T> {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
// Check the storage version
let onchain_version = Pallet::<T>::on_chain_storage_version();
if onchain_version < 3 {
log::info!(target: LOG_TARGET, "In the Polkadot environment, no migration will be performed; only the version number will be updated..");

// Update the storage version
StorageVersion::new(3).put::<Pallet<T>>();

// Return the consumed weight
Weight::from(T::DbWeight::get().reads_writes(1, 1))
} else {
// We don't do anything here.
Weight::zero()
}
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
Ok(sp_std::vec![])
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_cnt: Vec<u8>) -> Result<(), TryRuntimeError> {
Ok(())
}
}
1 change: 1 addition & 0 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,7 @@ pub mod migrations {
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
bifrost_parachain_staking::migrations::InitGenesisMigration<Runtime>,
frame_support::migrations::RemovePallet<CollatorSelectionName, RocksDbWeight>,
bifrost_flexible_fee::migrations::v3::PolkadotMigrateToV3<Runtime>,
);
}

Expand Down