Skip to content

Commit

Permalink
Update frame metadata to v16 (#657)
Browse files Browse the repository at this point in the history
* update

* fix clippy

* fix tests

* cargo fmt and rustup update

* cargo fmt

* fix clippy

* Update dump_metadata.rs
  • Loading branch information
haerdib authored Oct 31, 2023
1 parent ac99e67 commit fce185f
Show file tree
Hide file tree
Showing 16 changed files with 517 additions and 75 deletions.
20 changes: 4 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ members = [
async-trait = "0.1.68"
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ['derive'] }
derive_more = { version = "0.99.5" }
frame-metadata = { version = "15.1", default-features = false, features = ["v14", "v15-unstable", "serde_full", "decode"] }
frame-metadata = { version = "16.0", default-features = false, features = ["current", "serde_full", "decode"] }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }
log = { version = "0.4.14", default-features = false }
maybe-async = { version = "0.2.7" }
Expand Down
Binary file modified ksm_metadata_v14.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
codec = { package = "parity-scale-codec", version = "3.6.1", features = ["derive", "bit-vec"], default-features = false }
derive_more = { version = "0.99.17" }
either = { version = "1.6.1", default-features = false }
frame-metadata = { version = "15.1", default-features = false, features = ["v14", "v15-unstable", "serde_full", "decode"] }
frame-metadata = { version = "16.0", default-features = false, features = ["current", "serde_full", "decode"] }
hex = { version = "0.4.3", default-features = false }
log = { version = "0.4.14", default-features = false }
scale-bits = { version = "0.4.0", default-features = false, features = ["scale-info", "serde"] }
Expand Down
4 changes: 2 additions & 2 deletions node-api/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use core::fmt::Debug;
use derive_more::From;

// Re-expose the errors we use from other crates here:
pub use crate::metadata::{InvalidMetadataError, MetadataError};
pub use crate::metadata::{MetadataConversionError, MetadataError};
pub use scale_decode::Error as DecodeError;
pub use scale_encode::Error as EncodeError;
pub use sp_core::crypto::SecretStringError;
Expand All @@ -34,7 +34,7 @@ pub enum Error {
/// Secret string error.
SecretString(SecretStringError),
/// Invalid metadata error
InvalidMetadata(InvalidMetadataError),
InvalidMetadata(MetadataConversionError),
/// Invalid metadata error
Metadata(MetadataError),
/// Runtime error.
Expand Down
10 changes: 7 additions & 3 deletions node-api/src/metadata/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,22 @@ pub enum MetadataError {
ConstantNotFound(&'static str),
/// Variant not found.
VariantIndexNotFound(u8),
/// Type is not in metadata.
TypeNotFound(u32),
/// Api is not in metadata.
RuntimeApiNotFound(String),
}

#[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Encode, Decode)]
pub enum InvalidMetadataError {
pub enum MetadataConversionError {
InvalidPrefix,
InvalidVersion,
/// Type is missing from type registry.
MissingType(u32),
/// Type was not variant/enum type.
TypeDefNotVariant(u32),
/// Type is not in metadata.
TypeNotFound(u32),
/// Type Name is not in metadata.
TypeNameNotFound(String),
// Path not found.
InvalidTypePath(String),
}
Loading

0 comments on commit fce185f

Please sign in to comment.