Newer
Older
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
// Execution Phase
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
// Treasury Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
// Dmp DownwardMessageQueueHeads
hex_literal::hex!("63f78c98723ddc9073523ef3beefda0c4d7fefc408aac59dbfe80a72ac8e3ce5").to_vec().into(),
// Dmp DownwardMessageQueues
hex_literal::hex!("63f78c98723ddc9073523ef3beefda0ca95dac46c07a40d91506e7637ec4ba57").to_vec().into(),
// Configuration ActiveConfig
hex_literal::hex!("06de3d8a54d27e44a9d5ce189618f22db4b49d95320d9021994c850f25b8e385").to_vec().into(),
// The transactional storage limit.
hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),
Shawn Tabrizi
committed
let params = (&config, &whitelist);
Ok(batches)
#[cfg(test)]
mod test {
use super::*;
#[test]
fn max_upward_message_size() {
assert_eq!(
ump_migrations::MAX_UPWARD_MESSAGE_SIZE,
pallet_message_queue::MaxMessageLenOf::<Runtime>::get()
);
}
}
#[cfg(all(test, feature = "try-runtime"))]
mod remote_tests {
use super::*;
use frame_try_runtime::{runtime_decl_for_try_runtime::TryRuntime, UpgradeCheckSelect};
use remote_externalities::{
Builder, Mode, OfflineConfig, OnlineConfig, SnapshotConfig, Transport,
};
use std::env::var;
#[tokio::test]
async fn run_migrations() {
if var("RUN_MIGRATION_TESTS").is_err() {
return
}
sp_tracing::try_init_simple();
let transport: Transport =
var("WS").unwrap_or("wss://westend-rpc.polkadot.io:443".to_string()).into();
let maybe_state_snapshot: Option<SnapshotConfig> = var("SNAP").map(|s| s.into()).ok();
let mut ext = Builder::<Block>::default()
.mode(if let Some(state_snapshot) = maybe_state_snapshot {
Mode::OfflineOrElseOnline(
OfflineConfig { state_snapshot: state_snapshot.clone() },
OnlineConfig {
transport,
state_snapshot: Some(state_snapshot),
..Default::default()
},
)
} else {
Mode::Online(OnlineConfig { transport, ..Default::default() })
})
.build()
.await
.unwrap();
ext.execute_with(|| Runtime::on_runtime_upgrade(UpgradeCheckSelect::PreAndPost));
mod clean_state_migration {
use frame_support::{pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade};
use pallet_state_trie_migration::MigrationLimits;
#[cfg(not(feature = "std"))]
use sp_std::prelude::*;
#[storage_alias]
type AutoLimits = StorageValue<StateTrieMigration, Option<MigrationLimits>, ValueQuery>;
// Actual type of value is `MigrationTask<T>`, putting a dummy
// one to avoid the trait constraint on T.
// Since we only use `kill` it is fine.
#[storage_alias]
type MigrationProcess = StorageValue<StateTrieMigration, u32, ValueQuery>;
#[storage_alias]
type SignedMigrationMaxLimits = StorageValue<StateTrieMigration, MigrationLimits, OptionQuery>;
/// Initialize an automatic migration process.
pub struct CleanMigrate;
impl OnRuntimeUpgrade for CleanMigrate {
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
Ok(Default::default())
}
fn on_runtime_upgrade() -> frame_support::weights::Weight {
MigrationProcess::kill();
AutoLimits::kill();
SignedMigrationMaxLimits::kill();
<Runtime as frame_system::Config>::DbWeight::get().writes(3)
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
!AutoLimits::exists() && !SignedMigrationMaxLimits::exists(),
"State migration clean.",