I have a live network working on Substrate V3 and MetadataV12. How can I migrate to the MetadataV14?
The MetadataV14 is a part of the Substrate V4. Unfortunately Substrate V4 isn't released.
I have a live network working on Substrate V3 and MetadataV12. How can I migrate to the MetadataV14?
The MetadataV14 is a part of the Substrate V4. Unfortunately Substrate V4 isn't released.
To migrate your chain to the V14 metadata system, follow these steps (from this upgrade guide):
#[pallet::metadata(..)]
attributes from your pallet's Event definition.scale-info
as a dependency to your pallet and runtime crates:scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
std = [ "scale-info/std" ]
scale_info::TypeInfo
for any types which derive Decode
, Encode
(*). For example:#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
struct HeartbeatStatus<BlockNumber> {
pub session_index: SessionIndex,
pub sent_at: BlockNumber,
}
impl sp_api::Metadata<Block> for Runtime {
fn metadata() -> OpaqueMetadata {
OpaqueMetadata::new(Runtime::metadata().into())
}
}
(*) If the type is in a separate crate to the pallet, add the scale-info dependency as above.