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-interface",
|
||||
"pezsp-state-machine",
|
||||
"pezsp-test-primitives",
|
||||
"pezsp-trie",
|
||||
"pezsp-version",
|
||||
"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-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-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-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" }
|
||||
|
||||
@@ -36,21 +36,21 @@ thiserror = { optional = true, workspace = true }
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"hash-db",
|
||||
"log/std",
|
||||
"pezsp-api-proc-macro/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-externalities",
|
||||
"pezsp-externalities?/std",
|
||||
"pezsp-metadata-ir?/std",
|
||||
"pezsp-runtime-interface/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-trie/std",
|
||||
"pezsp-version/std",
|
||||
"scale-info/std",
|
||||
"thiserror",
|
||||
"codec/std",
|
||||
"hash-db",
|
||||
"log/std",
|
||||
"pezsp-api-proc-macro/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-externalities",
|
||||
"pezsp-externalities?/std",
|
||||
"pezsp-metadata-ir?/std",
|
||||
"pezsp-runtime-interface/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-trie/std",
|
||||
"pezsp-version/std",
|
||||
"scale-info/std",
|
||||
"thiserror",
|
||||
]
|
||||
# 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"]
|
||||
frame-metadata = ["pezsp-metadata-ir"]
|
||||
runtime-benchmarks = [
|
||||
"pezsp-runtime-interface/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-trie?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
"pezsp-runtime-interface/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-trie?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = ["pezsp-runtime/try-runtime", "pezsp-version/try-runtime"]
|
||||
serde = []
|
||||
|
||||
[dev-dependencies]
|
||||
pezsp-test-primitives = { workspace = true }
|
||||
|
||||
+16
-16
@@ -16,35 +16,35 @@ description = "Command line utilities for checking metadata compatibility betwee
|
||||
[features]
|
||||
default = ["legacy", "std"]
|
||||
std = [
|
||||
"bitvec/std",
|
||||
"codec/std",
|
||||
"frame-decode/std",
|
||||
"frame-metadata/std",
|
||||
"pezkuwi-subxt-codegen/std",
|
||||
"pezkuwi-subxt-utils-stripmetadata/std",
|
||||
"pezsp-crypto-hashing/std",
|
||||
"scale-info/std",
|
||||
"bitvec/std",
|
||||
"codec/std",
|
||||
"frame-decode/std",
|
||||
"frame-metadata/std",
|
||||
"pezkuwi-subxt-codegen/std",
|
||||
"pezkuwi-subxt-utils-stripmetadata/std",
|
||||
"pezsp-crypto-hashing/std",
|
||||
"scale-info/std",
|
||||
]
|
||||
|
||||
# Enable decoding of legacy metadata, too.
|
||||
# std required by frame-metadata to decode <V14.
|
||||
legacy = [
|
||||
"dep:scale-info-legacy",
|
||||
"dep:scale-type-resolver",
|
||||
"frame-decode/legacy",
|
||||
"frame-metadata/legacy",
|
||||
"std",
|
||||
"dep:scale-info-legacy",
|
||||
"dep:scale-type-resolver",
|
||||
"frame-decode/legacy",
|
||||
"frame-metadata/legacy",
|
||||
"std",
|
||||
]
|
||||
serde = []
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = [
|
||||
"derive",
|
||||
"derive",
|
||||
] }
|
||||
frame-decode = { workspace = true }
|
||||
frame-metadata = { workspace = true, default-features = false, features = [
|
||||
"current",
|
||||
"decode",
|
||||
"current",
|
||||
"decode",
|
||||
] }
|
||||
hashbrown = { workspace = true }
|
||||
pezsp-crypto-hashing = { workspace = true }
|
||||
|
||||
+54
-13
@@ -3,7 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use alloc::string::String;
|
||||
use thiserror::Error as DeriveError;
|
||||
use core::fmt;
|
||||
mod v14;
|
||||
mod v15;
|
||||
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`]
|
||||
/// types into [`crate::Metadata`].
|
||||
#[derive(Debug, PartialEq, Eq, DeriveError)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[non_exhaustive]
|
||||
pub enum TryFromError {
|
||||
/// Type missing from type registry
|
||||
#[error("Type id {0} is expected but not found in the type registry")]
|
||||
TypeNotFound(u32),
|
||||
/// Type was not a variant/enum type
|
||||
#[error("Type {0} was not a variant/enum type, but is expected to be one")]
|
||||
VariantExpected(u32),
|
||||
/// An unsupported metadata version was provided.
|
||||
#[error("Cannot convert v{0} metadata into Metadata type")]
|
||||
UnsupportedMetadataVersion(u32),
|
||||
/// Type name missing from type registry
|
||||
#[error("Type name {0} is expected but not found in the type registry")]
|
||||
TypeNameNotFound(String),
|
||||
/// Invalid type path.
|
||||
#[error("Type has an invalid path {0}")]
|
||||
InvalidTypePath(String),
|
||||
/// Cannot decode storage entry information.
|
||||
#[error("Error decoding storage entry information: {0}")]
|
||||
StorageInfoError(#[from] frame_decode::storage::StorageInfoError<'static>),
|
||||
StorageInfoError(frame_decode::storage::StorageInfoError<'static>),
|
||||
/// Cannot decode Runtime API information.
|
||||
#[error("Error decoding Runtime API information: {0}")]
|
||||
RuntimeInfoError(#[from] frame_decode::runtime_apis::RuntimeApiInfoError<'static>),
|
||||
RuntimeInfoError(frame_decode::runtime_apis::RuntimeApiInfoError<'static>),
|
||||
/// Cannot decode View Function information.
|
||||
#[error("Error decoding View Function information: {0}")]
|
||||
ViewFunctionInfoError(#[from] frame_decode::view_functions::ViewFunctionInfoError<'static>),
|
||||
ViewFunctionInfoError(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 {
|
||||
|
||||
Reference in New Issue
Block a user