[v0.50] update scale-info-legacy and frame-decode to latest (#2119)

* bump scale-info-legacy and frame-decode to latest

* Remove something we don't need in this PR

* Fully remove unused for now dep
This commit is contained in:
James Wilson
2025-11-11 16:47:29 +00:00
committed by GitHub
parent 481e5a8607
commit dac487e19a
4 changed files with 64 additions and 47 deletions
Generated
+4 -4
View File
@@ -1953,9 +1953,9 @@ dependencies = [
[[package]]
name = "frame-decode"
version = "0.11.1"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8c26b7a0fb90c471cc2c90b1a9fa60ab78c6a35a4079130feefd625999708d7"
checksum = "0e5c3badfabd704dda4ddc7fafcd09127e8661d1cca2f16556c6826166932c87"
dependencies = [
"frame-metadata 23.0.0",
"parity-scale-codec",
@@ -4464,9 +4464,9 @@ dependencies = [
[[package]]
name = "scale-info-legacy"
version = "0.2.4"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd183213b6831b6bc08fda67a310bf9299889d669e264a2a2168679079a0c522"
checksum = "f9d7e3c60aa5e479fe4cfba98a8e74f93b329f4ce0628f7a52f41768489bc418"
dependencies = [
"hashbrown 0.15.3",
"scale-type-resolver",
+2 -2
View File
@@ -81,7 +81,7 @@ darling = "0.20.10"
derive-where = "1.2.7"
either = { version = "1.13.0", default-features = false }
finito = { version = "0.1.0", default-features = false }
frame-decode = { version = "0.11.1", default-features = false }
frame-decode = { version = "0.12.0", default-features = false }
frame-metadata = { version = "23.0.0", default-features = false }
futures = { version = "0.3.31", default-features = false, features = ["std"] }
getrandom = { version = "0.2", default-features = false }
@@ -103,7 +103,7 @@ scale-bits = { version = "0.7.0", default-features = false }
scale-decode = { version = "0.16.0", default-features = false }
scale-encode = { version = "0.10.0", default-features = false }
scale-type-resolver = { version = "0.2.0" }
scale-info-legacy = { version = "0.2.4" }
scale-info-legacy = { version = "0.3.0", default-features = false }
scale-typegen = "0.11.1"
scale-typegen-description = "0.11.0"
serde = { version = "1.0.210", default-features = false, features = ["derive"] }
+23 -11
View File
@@ -70,17 +70,32 @@ where
let client = self.client;
let metadata = client.metadata();
frame_decode::helpers::list_storage_entries_any(metadata).map(|entry| StorageEntriesItem {
entry,
client: self.client,
marker: std::marker::PhantomData,
let mut pallet_name = Cow::Borrowed("");
frame_decode::helpers::list_storage_entries_any(metadata).filter_map(move |entry| {
match entry {
frame_decode::storage::Entry::In(name) => {
// Set the pallet name for upcoming entries:
pallet_name = name;
None
}
frame_decode::storage::Entry::Name(entry_name) => {
// Output each entry with the last seen pallet name:
Some(StorageEntriesItem {
pallet_name: pallet_name.clone(),
entry_name,
client: self.client,
marker: std::marker::PhantomData,
})
}
}
})
}
}
/// Working with a specific storage entry.
pub struct StorageEntriesItem<'atblock, Client, T> {
entry: frame_decode::storage::StorageEntry<'atblock>,
pallet_name: Cow<'atblock, str>,
entry_name: Cow<'atblock, str>,
client: &'atblock Client,
marker: std::marker::PhantomData<T>,
}
@@ -92,12 +107,12 @@ where
{
/// The pallet name.
pub fn pallet_name(&self) -> &str {
&self.entry.pallet_name
&self.pallet_name
}
/// The storage entry name.
pub fn entry_name(&self) -> &str {
&self.entry.storage_entry
&self.entry_name
}
/// Extract the relevant storage information so that we can work with this entry.
@@ -106,10 +121,7 @@ where
client: self.client,
marker: std::marker::PhantomData,
}
.entry(
self.entry.pallet_name.clone(),
self.entry.storage_entry.clone(),
)
.entry(&*self.pallet_name, &*self.entry_name)
}
}
+35 -30
View File
@@ -26,19 +26,15 @@ use alloc::borrow::Cow;
use alloc::collections::BTreeMap;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use frame_decode::constants::{Constant, ConstantInfo, ConstantInfoError};
use frame_decode::constants::{ConstantInfo, ConstantInfoError, Entry};
use frame_decode::custom_values::{CustomValue, CustomValueInfo, CustomValueInfoError};
use frame_decode::extrinsics::{
ExtrinsicCallInfo, ExtrinsicExtensionInfo, ExtrinsicInfoArg, ExtrinsicInfoError,
ExtrinsicSignatureInfo,
};
use frame_decode::runtime_apis::{
RuntimeApi, RuntimeApiInfo, RuntimeApiInfoError, RuntimeApiInput,
};
use frame_decode::storage::{StorageEntry, StorageInfo, StorageInfoError, StorageKeyInfo};
use frame_decode::view_functions::{
ViewFunction, ViewFunctionInfo, ViewFunctionInfoError, ViewFunctionInput,
};
use frame_decode::runtime_apis::{RuntimeApiInfo, RuntimeApiInfoError, RuntimeApiInput};
use frame_decode::storage::{StorageInfo, StorageInfoError, StorageKeyInfo};
use frame_decode::view_functions::{ViewFunctionInfo, ViewFunctionInfoError, ViewFunctionInput};
use hashbrown::HashMap;
use scale_info::{PortableRegistry, Variant, form::PortableForm};
@@ -184,15 +180,18 @@ impl frame_decode::storage::StorageTypeInfo for Metadata {
Ok(info)
}
fn storage_entries(&self) -> impl Iterator<Item = StorageEntry<'_>> {
fn storage_entries(&self) -> impl Iterator<Item = Entry<'_>> {
self.pallets().flat_map(|pallet| {
let pallet_name = pallet.name();
pallet.storage().into_iter().flat_map(|storage| {
storage.entries().iter().map(|entry| StorageEntry {
pallet_name: Cow::Borrowed(pallet_name),
storage_entry: Cow::Borrowed(entry.name()),
})
})
let pallet_iter = core::iter::once(Entry::In(pallet_name.into()));
let entries_iter = pallet.storage().into_iter().flat_map(|storage| {
storage
.entries()
.iter()
.map(|entry| Entry::Name(entry.name().into()))
});
pallet_iter.chain(entries_iter)
})
}
}
@@ -225,13 +224,15 @@ impl frame_decode::runtime_apis::RuntimeApiTypeInfo for Metadata {
Ok(info)
}
fn runtime_apis(&self) -> impl Iterator<Item = RuntimeApi<'_>> {
fn runtime_apis(&self) -> impl Iterator<Item = Entry<'_>> {
self.runtime_api_traits().flat_map(|api_trait| {
let trait_name = api_trait.name();
api_trait.methods().map(|method| RuntimeApi {
trait_name: Cow::Borrowed(trait_name),
method_name: Cow::Borrowed(method.name()),
})
let trait_iter = core::iter::once(Entry::In(trait_name.into()));
let method_iter = api_trait
.methods()
.map(|method| Entry::Name(method.name().into()));
trait_iter.chain(method_iter)
})
}
}
@@ -264,13 +265,15 @@ impl frame_decode::view_functions::ViewFunctionTypeInfo for Metadata {
Ok(info)
}
fn view_functions(&self) -> impl Iterator<Item = ViewFunction<'_>> {
fn view_functions(&self) -> impl Iterator<Item = Entry<'_>> {
self.pallets().flat_map(|pallet| {
let pallet_name = pallet.name();
pallet.view_functions().map(|function| ViewFunction {
pallet_name: Cow::Borrowed(pallet_name),
function_name: Cow::Borrowed(function.name()),
})
let pallet_iter = core::iter::once(Entry::In(pallet_name.into()));
let fn_iter = pallet
.view_functions()
.map(|function| Entry::Name(function.name().into()));
pallet_iter.chain(fn_iter)
})
}
}
@@ -302,13 +305,15 @@ impl frame_decode::constants::ConstantTypeInfo for Metadata {
Ok(info)
}
fn constants(&self) -> impl Iterator<Item = Constant<'_>> {
fn constants(&self) -> impl Iterator<Item = Entry<'_>> {
self.pallets().flat_map(|pallet| {
let pallet_name = pallet.name();
pallet.constants().map(|constant| Constant {
pallet_name: Cow::Borrowed(pallet_name),
constant_name: Cow::Borrowed(constant.name()),
})
let pallet_iter = core::iter::once(Entry::In(pallet_name.into()));
let constant_iter = pallet
.constants()
.map(|constant| Entry::Name(constant.name().into()));
pallet_iter.chain(constant_iter)
})
}
}