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

Add metadata V15 with Runtime API support #48

Merged
merged 19 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
1 change: 1 addition & 0 deletions frame-metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ v12 = []
v13 = []
legacy = ["v13", "v12", "v11", "v10", "v9", "v8"]
v14 = ["scale-info"]
v15-unstable = ["scale-info"]

# Serde support without relying on std features
serde_full = [
Expand Down
11 changes: 11 additions & 0 deletions frame-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ pub mod v13;
#[cfg(feature = "v14")]
pub mod v14;

/// Metadata v15
#[cfg(feature = "v15-unstable")]
pub mod v15;

// Reexport all the types from the latest version.
//
// When a new version becomes available, update this.
Expand Down Expand Up @@ -172,6 +176,12 @@ pub enum RuntimeMetadata {
/// Version 14 for runtime metadata, as raw encoded bytes.
#[cfg(not(feature = "v14"))]
V14(OpaqueMetadata),
/// Version 15 for runtime metadata.
#[cfg(feature = "v15-unstable")]
V15(v15::RuntimeMetadataV15),
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't notice, but how do you ask for V15 metadata in Substrate; will you ask for metadata_at_version(u32::MAX) or something? Or do you ask for 15? Just wondeirng whether we do anything to highlight the instability of it in the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, in substrate we'll have to ask for u32::MAX until we can call the v15 stable

/// Version 15 for runtime metadata, as raw encoded bytes.
#[cfg(not(feature = "v15-unstable"))]
V15(OpaqueMetadata),
}

impl RuntimeMetadata {
Expand All @@ -193,6 +203,7 @@ impl RuntimeMetadata {
RuntimeMetadata::V12(_) => 12,
RuntimeMetadata::V13(_) => 13,
RuntimeMetadata::V14(_) => 14,
RuntimeMetadata::V15(_) => 15,
}
}
}
Expand Down
Loading