diff --git a/Cargo.lock b/Cargo.lock index ee9b4d66..2ab772d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20410,6 +20410,7 @@ dependencies = [ "pezsp-runtime", "pezsp-runtime-interface", "pezsp-state-machine", + "pezsp-test-primitives", "pezsp-trie", "pezsp-version", "scale-info", diff --git a/Cargo.toml b/Cargo.toml index 8b0a1746..4f52aff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/bizinikiwi/primitives/api/Cargo.toml b/bizinikiwi/primitives/api/Cargo.toml index 417530b7..a26e636d 100644 --- a/bizinikiwi/primitives/api/Cargo.toml +++ b/bizinikiwi/primitives/api/Cargo.toml @@ -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 } diff --git a/vendor/pezkuwi-subxt/metadata/Cargo.toml b/vendor/pezkuwi-subxt/metadata/Cargo.toml index 6387eadc..642cd2b3 100644 --- a/vendor/pezkuwi-subxt/metadata/Cargo.toml +++ b/vendor/pezkuwi-subxt/metadata/Cargo.toml @@ -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 ), + 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> for TryFromError { + fn from(e: frame_decode::storage::StorageInfoError<'static>) -> Self { + Self::StorageInfoError(e) + } +} + +impl From> for TryFromError { + fn from(e: frame_decode::runtime_apis::RuntimeApiInfoError<'static>) -> Self { + Self::RuntimeInfoError(e) + } +} + +impl From> for TryFromError { + fn from(e: frame_decode::view_functions::ViewFunctionInfoError<'static>) -> Self { + Self::ViewFunctionInfoError(e) + } } impl TryFrom for crate::Metadata {