fix: resolve CI failures in pezkuwi-subxt-metadata no_std and pezsp-api doc-tests
- Replace thiserror::Error derive with manual Display + core::error::Error impl in pezkuwi-subxt-metadata TryFromError, fixing no_std compilation (thiserror v1 does not support no_std) - Add pezsp-test-primitives as dev-dependency to pezsp-api, fixing 3 failing doc-tests that import pezsp_test_primitives::Block - Revert unnecessary features=["std"] on workspace pezkuwi-subxt-metadata dep - Apply taplo formatting to changed Cargo.toml files
This commit is contained in:
Generated
+1
@@ -20410,6 +20410,7 @@ dependencies = [
|
|||||||
"pezsp-runtime",
|
"pezsp-runtime",
|
||||||
"pezsp-runtime-interface",
|
"pezsp-runtime-interface",
|
||||||
"pezsp-state-machine",
|
"pezsp-state-machine",
|
||||||
|
"pezsp-test-primitives",
|
||||||
"pezsp-trie",
|
"pezsp-trie",
|
||||||
"pezsp-version",
|
"pezsp-version",
|
||||||
"scale-info",
|
"scale-info",
|
||||||
|
|||||||
+1
-1
@@ -1521,7 +1521,7 @@ pezkuwi-subxt-codegen = { path = "vendor/pezkuwi-subxt/codegen", version = "0.44
|
|||||||
pezkuwi-subxt-core = { path = "vendor/pezkuwi-subxt/core", version = "0.44.0", default-features = false }
|
pezkuwi-subxt-core = { path = "vendor/pezkuwi-subxt/core", version = "0.44.0", default-features = false }
|
||||||
pezkuwi-subxt-lightclient = { path = "vendor/pezkuwi-subxt/lightclient", version = "0.44.0", default-features = false }
|
pezkuwi-subxt-lightclient = { path = "vendor/pezkuwi-subxt/lightclient", version = "0.44.0", default-features = false }
|
||||||
pezkuwi-subxt-macro = { path = "vendor/pezkuwi-subxt/macro", version = "0.44.0" }
|
pezkuwi-subxt-macro = { path = "vendor/pezkuwi-subxt/macro", version = "0.44.0" }
|
||||||
pezkuwi-subxt-metadata = { path = "vendor/pezkuwi-subxt/metadata", version = "0.44.0", default-features = false, features = ["std"] }
|
pezkuwi-subxt-metadata = { path = "vendor/pezkuwi-subxt/metadata", version = "0.44.0", default-features = false }
|
||||||
pezkuwi-subxt-rpcs = { path = "vendor/pezkuwi-subxt/rpcs", version = "0.44.0" }
|
pezkuwi-subxt-rpcs = { path = "vendor/pezkuwi-subxt/rpcs", version = "0.44.0" }
|
||||||
pezkuwi-subxt-signer = { path = "vendor/pezkuwi-subxt/signer", version = "0.44.0" }
|
pezkuwi-subxt-signer = { path = "vendor/pezkuwi-subxt/signer", version = "0.44.0" }
|
||||||
pezkuwi-subxt-utils-fetchmetadata = { path = "vendor/pezkuwi-subxt/utils/fetch-metadata", version = "0.44.0" }
|
pezkuwi-subxt-utils-fetchmetadata = { path = "vendor/pezkuwi-subxt/utils/fetch-metadata", version = "0.44.0" }
|
||||||
|
|||||||
@@ -36,21 +36,21 @@ thiserror = { optional = true, workspace = true }
|
|||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = [
|
std = [
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"hash-db",
|
"hash-db",
|
||||||
"log/std",
|
"log/std",
|
||||||
"pezsp-api-proc-macro/std",
|
"pezsp-api-proc-macro/std",
|
||||||
"pezsp-core/std",
|
"pezsp-core/std",
|
||||||
"pezsp-externalities",
|
"pezsp-externalities",
|
||||||
"pezsp-externalities?/std",
|
"pezsp-externalities?/std",
|
||||||
"pezsp-metadata-ir?/std",
|
"pezsp-metadata-ir?/std",
|
||||||
"pezsp-runtime-interface/std",
|
"pezsp-runtime-interface/std",
|
||||||
"pezsp-runtime/std",
|
"pezsp-runtime/std",
|
||||||
"pezsp-state-machine/std",
|
"pezsp-state-machine/std",
|
||||||
"pezsp-trie/std",
|
"pezsp-trie/std",
|
||||||
"pezsp-version/std",
|
"pezsp-version/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
# Special feature to disable logging completely.
|
# Special feature to disable logging completely.
|
||||||
#
|
#
|
||||||
@@ -64,11 +64,14 @@ disable-logging = ["log/max_level_off"]
|
|||||||
no-metadata-docs = ["pezsp-api-proc-macro/no-metadata-docs"]
|
no-metadata-docs = ["pezsp-api-proc-macro/no-metadata-docs"]
|
||||||
frame-metadata = ["pezsp-metadata-ir"]
|
frame-metadata = ["pezsp-metadata-ir"]
|
||||||
runtime-benchmarks = [
|
runtime-benchmarks = [
|
||||||
"pezsp-runtime-interface/runtime-benchmarks",
|
"pezsp-runtime-interface/runtime-benchmarks",
|
||||||
"pezsp-runtime/runtime-benchmarks",
|
"pezsp-runtime/runtime-benchmarks",
|
||||||
"pezsp-state-machine?/runtime-benchmarks",
|
"pezsp-state-machine?/runtime-benchmarks",
|
||||||
"pezsp-trie?/runtime-benchmarks",
|
"pezsp-trie?/runtime-benchmarks",
|
||||||
"pezsp-version/runtime-benchmarks",
|
"pezsp-version/runtime-benchmarks",
|
||||||
]
|
]
|
||||||
try-runtime = ["pezsp-runtime/try-runtime", "pezsp-version/try-runtime"]
|
try-runtime = ["pezsp-runtime/try-runtime", "pezsp-version/try-runtime"]
|
||||||
serde = []
|
serde = []
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
pezsp-test-primitives = { workspace = true }
|
||||||
|
|||||||
+16
-16
@@ -16,35 +16,35 @@ description = "Command line utilities for checking metadata compatibility betwee
|
|||||||
[features]
|
[features]
|
||||||
default = ["legacy", "std"]
|
default = ["legacy", "std"]
|
||||||
std = [
|
std = [
|
||||||
"bitvec/std",
|
"bitvec/std",
|
||||||
"codec/std",
|
"codec/std",
|
||||||
"frame-decode/std",
|
"frame-decode/std",
|
||||||
"frame-metadata/std",
|
"frame-metadata/std",
|
||||||
"pezkuwi-subxt-codegen/std",
|
"pezkuwi-subxt-codegen/std",
|
||||||
"pezkuwi-subxt-utils-stripmetadata/std",
|
"pezkuwi-subxt-utils-stripmetadata/std",
|
||||||
"pezsp-crypto-hashing/std",
|
"pezsp-crypto-hashing/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Enable decoding of legacy metadata, too.
|
# Enable decoding of legacy metadata, too.
|
||||||
# std required by frame-metadata to decode <V14.
|
# std required by frame-metadata to decode <V14.
|
||||||
legacy = [
|
legacy = [
|
||||||
"dep:scale-info-legacy",
|
"dep:scale-info-legacy",
|
||||||
"dep:scale-type-resolver",
|
"dep:scale-type-resolver",
|
||||||
"frame-decode/legacy",
|
"frame-decode/legacy",
|
||||||
"frame-metadata/legacy",
|
"frame-metadata/legacy",
|
||||||
"std",
|
"std",
|
||||||
]
|
]
|
||||||
serde = []
|
serde = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = [
|
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = [
|
||||||
"derive",
|
"derive",
|
||||||
] }
|
] }
|
||||||
frame-decode = { workspace = true }
|
frame-decode = { workspace = true }
|
||||||
frame-metadata = { workspace = true, default-features = false, features = [
|
frame-metadata = { workspace = true, default-features = false, features = [
|
||||||
"current",
|
"current",
|
||||||
"decode",
|
"decode",
|
||||||
] }
|
] }
|
||||||
hashbrown = { workspace = true }
|
hashbrown = { workspace = true }
|
||||||
pezsp-crypto-hashing = { workspace = true }
|
pezsp-crypto-hashing = { workspace = true }
|
||||||
|
|||||||
+54
-13
@@ -3,7 +3,7 @@
|
|||||||
// see LICENSE for license details.
|
// see LICENSE for license details.
|
||||||
|
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use thiserror::Error as DeriveError;
|
use core::fmt;
|
||||||
mod v14;
|
mod v14;
|
||||||
mod v15;
|
mod v15;
|
||||||
mod v16;
|
mod v16;
|
||||||
@@ -19,33 +19,74 @@ pub const SUPPORTED_METADATA_VERSIONS: [u32; 3] = [16, 15, 14];
|
|||||||
|
|
||||||
/// An error emitted if something goes wrong converting [`frame_metadata`]
|
/// An error emitted if something goes wrong converting [`frame_metadata`]
|
||||||
/// types into [`crate::Metadata`].
|
/// types into [`crate::Metadata`].
|
||||||
#[derive(Debug, PartialEq, Eq, DeriveError)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum TryFromError {
|
pub enum TryFromError {
|
||||||
/// Type missing from type registry
|
/// Type missing from type registry
|
||||||
#[error("Type id {0} is expected but not found in the type registry")]
|
|
||||||
TypeNotFound(u32),
|
TypeNotFound(u32),
|
||||||
/// Type was not a variant/enum type
|
/// Type was not a variant/enum type
|
||||||
#[error("Type {0} was not a variant/enum type, but is expected to be one")]
|
|
||||||
VariantExpected(u32),
|
VariantExpected(u32),
|
||||||
/// An unsupported metadata version was provided.
|
/// An unsupported metadata version was provided.
|
||||||
#[error("Cannot convert v{0} metadata into Metadata type")]
|
|
||||||
UnsupportedMetadataVersion(u32),
|
UnsupportedMetadataVersion(u32),
|
||||||
/// Type name missing from type registry
|
/// Type name missing from type registry
|
||||||
#[error("Type name {0} is expected but not found in the type registry")]
|
|
||||||
TypeNameNotFound(String),
|
TypeNameNotFound(String),
|
||||||
/// Invalid type path.
|
/// Invalid type path.
|
||||||
#[error("Type has an invalid path {0}")]
|
|
||||||
InvalidTypePath(String),
|
InvalidTypePath(String),
|
||||||
/// Cannot decode storage entry information.
|
/// Cannot decode storage entry information.
|
||||||
#[error("Error decoding storage entry information: {0}")]
|
StorageInfoError(frame_decode::storage::StorageInfoError<'static>),
|
||||||
StorageInfoError(#[from] frame_decode::storage::StorageInfoError<'static>),
|
|
||||||
/// Cannot decode Runtime API information.
|
/// Cannot decode Runtime API information.
|
||||||
#[error("Error decoding Runtime API information: {0}")]
|
RuntimeInfoError(frame_decode::runtime_apis::RuntimeApiInfoError<'static>),
|
||||||
RuntimeInfoError(#[from] frame_decode::runtime_apis::RuntimeApiInfoError<'static>),
|
|
||||||
/// Cannot decode View Function information.
|
/// Cannot decode View Function information.
|
||||||
#[error("Error decoding View Function information: {0}")]
|
ViewFunctionInfoError(frame_decode::view_functions::ViewFunctionInfoError<'static>),
|
||||||
ViewFunctionInfoError(#[from] frame_decode::view_functions::ViewFunctionInfoError<'static>),
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for TryFromError {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::TypeNotFound(id) => {
|
||||||
|
write!(f, "Type id {id} is expected but not found in the type registry")
|
||||||
|
},
|
||||||
|
Self::VariantExpected(id) => {
|
||||||
|
write!(f, "Type {id} was not a variant/enum type, but is expected to be one")
|
||||||
|
},
|
||||||
|
Self::UnsupportedMetadataVersion(v) => {
|
||||||
|
write!(f, "Cannot convert v{v} metadata into Metadata type")
|
||||||
|
},
|
||||||
|
Self::TypeNameNotFound(name) => {
|
||||||
|
write!(f, "Type name {name} is expected but not found in the type registry")
|
||||||
|
},
|
||||||
|
Self::InvalidTypePath(path) => write!(f, "Type has an invalid path {path}"),
|
||||||
|
Self::StorageInfoError(e) => {
|
||||||
|
write!(f, "Error decoding storage entry information: {e}")
|
||||||
|
},
|
||||||
|
Self::RuntimeInfoError(e) => {
|
||||||
|
write!(f, "Error decoding Runtime API information: {e}")
|
||||||
|
},
|
||||||
|
Self::ViewFunctionInfoError(e) => {
|
||||||
|
write!(f, "Error decoding View Function information: {e}")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl core::error::Error for TryFromError {}
|
||||||
|
|
||||||
|
impl From<frame_decode::storage::StorageInfoError<'static>> for TryFromError {
|
||||||
|
fn from(e: frame_decode::storage::StorageInfoError<'static>) -> Self {
|
||||||
|
Self::StorageInfoError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<frame_decode::runtime_apis::RuntimeApiInfoError<'static>> for TryFromError {
|
||||||
|
fn from(e: frame_decode::runtime_apis::RuntimeApiInfoError<'static>) -> Self {
|
||||||
|
Self::RuntimeInfoError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<frame_decode::view_functions::ViewFunctionInfoError<'static>> for TryFromError {
|
||||||
|
fn from(e: frame_decode::view_functions::ViewFunctionInfoError<'static>) -> Self {
|
||||||
|
Self::ViewFunctionInfoError(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<frame_metadata::RuntimeMetadataPrefixed> for crate::Metadata {
|
impl TryFrom<frame_metadata::RuntimeMetadataPrefixed> for crate::Metadata {
|
||||||
|
|||||||
Reference in New Issue
Block a user