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:
2026-02-14 06:00:17 +03:00
parent aaeaf94e25
commit 019f8b9ea1
5 changed files with 95 additions and 50 deletions
+16 -16
View File
@@ -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
View File
@@ -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 {