pub trait OnRuntimeUpgradeHelpersExt {
fn storage_key(ident: &str) -> [u8; 32] { ... }
fn get_temp_storage<T: Decode>(at: &str) -> Option<T> { ... }
fn set_temp_storage<T: Encode>(data: T, at: &str) { ... }
}
Expand description
Some helper functions for OnRuntimeUpgrade
during try-runtime
testing.
Provided Methods§
sourcefn storage_key(ident: &str) -> [u8; 32]
fn storage_key(ident: &str) -> [u8; 32]
Generate a storage key unique to this runtime upgrade.
This can be used to communicate data from pre-upgrade to post-upgrade state and check
them. See Self::set_temp_storage
and Self::get_temp_storage
.
sourcefn get_temp_storage<T: Decode>(at: &str) -> Option<T>
fn get_temp_storage<T: Decode>(at: &str) -> Option<T>
Get temporary storage data written by Self::set_temp_storage
.
Returns None
if either the data is unavailable or un-decodable.
A at
storage identifier must be provided to indicate where the storage is being read from.
sourcefn set_temp_storage<T: Encode>(data: T, at: &str)
fn set_temp_storage<T: Encode>(data: T, at: &str)
Write some temporary data to a specific storage that can be read (potentially in
post-upgrade hook) via Self::get_temp_storage
.
A at
storage identifier must be provided to indicate where the storage is being written
to.