mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
XXX: Adjust to u32::MAX and metaV15 built from IR
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Generated
+7
-7
@@ -971,7 +971,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "frame-metadata"
|
||||
version = "15.0.0"
|
||||
source = "git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test#35b8304e004f9a759aa2663e24c5f56e2a50c301"
|
||||
source = "git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15#3f176938c7a6c569d7608aa02efa0def93476675"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"parity-scale-codec",
|
||||
@@ -1508,7 +1508,7 @@ name = "integration-tests"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"futures",
|
||||
"hex",
|
||||
"parity-scale-codec",
|
||||
@@ -3338,7 +3338,7 @@ dependencies = [
|
||||
"bitvec",
|
||||
"blake2",
|
||||
"derivative",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"futures",
|
||||
"getrandom 0.2.8",
|
||||
"hex",
|
||||
@@ -3371,7 +3371,7 @@ version = "0.25.0"
|
||||
dependencies = [
|
||||
"clap 4.1.1",
|
||||
"color-eyre",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"hex",
|
||||
"jsonrpsee",
|
||||
"parity-scale-codec",
|
||||
@@ -3389,7 +3389,7 @@ version = "0.25.0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"darling",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"heck",
|
||||
"hex",
|
||||
"jsonrpsee",
|
||||
@@ -3435,7 +3435,7 @@ version = "0.25.0"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"criterion",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-core-hashing",
|
||||
@@ -3811,7 +3811,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
name = "ui-tests"
|
||||
version = "0.25.0"
|
||||
dependencies = [
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15_test)",
|
||||
"frame-metadata 15.0.0 (git+https://github.com/paritytech/frame-metadata/?branch=lexnv/md_v15)",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"subxt",
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ serde_json = "1.0.68"
|
||||
# hex encoded metadata to bytes
|
||||
hex = "0.4.3"
|
||||
# actual metadata types
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
# decode bytes into the metadata types
|
||||
scale = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
|
||||
# generate the item mod for codegen
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ description = "Generate an API for interacting with a substrate node from FRAME
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] }
|
||||
darling = "0.14.0"
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
heck = "0.4.0"
|
||||
proc-macro2 = "1.0.24"
|
||||
proc-macro-error = "1.0.4"
|
||||
|
||||
@@ -9,9 +9,9 @@ use crate::{
|
||||
},
|
||||
CratePath,
|
||||
};
|
||||
use frame_metadata::{
|
||||
v15::RuntimeMetadataV15,
|
||||
use frame_metadata::v15::{
|
||||
PalletMetadata,
|
||||
RuntimeMetadataV15,
|
||||
};
|
||||
use heck::{
|
||||
ToSnakeCase as _,
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::{
|
||||
types::TypeGenerator,
|
||||
CratePath,
|
||||
};
|
||||
use frame_metadata::{
|
||||
v15::RuntimeMetadataV15,
|
||||
use frame_metadata::v15::{
|
||||
PalletMetadata,
|
||||
RuntimeMetadataV15,
|
||||
};
|
||||
use heck::ToSnakeCase as _;
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{
|
||||
types::TypeGenerator,
|
||||
CratePath,
|
||||
};
|
||||
use frame_metadata::PalletMetadata;
|
||||
use frame_metadata::v15::PalletMetadata;
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
use scale_info::form::PortableForm;
|
||||
|
||||
@@ -138,12 +138,16 @@ pub fn generate_runtime_api_from_bytes(
|
||||
type_substitutes: TypeSubstitutes,
|
||||
crate_path: CratePath,
|
||||
) -> TokenStream2 {
|
||||
println!("Decodign metadata");
|
||||
let decoded: Option<frame_metadata::OpaqueMetadata> = Decode::decode(&mut &*bytes)
|
||||
.unwrap_or_else(|e| abort_call_site!("Failed to decode opaque metadata: {}", e));
|
||||
let decoded = decoded.unwrap();
|
||||
let bytes = &decoded.0;
|
||||
let metadata: RuntimeMetadataPrefixed = Decode::decode(&mut &bytes[..])
|
||||
.unwrap_or_else(|e| abort_call_site!("Failed to decode metadata: {}", e));
|
||||
println!("META done");
|
||||
|
||||
println!("{:#?}", metadata);
|
||||
|
||||
let generator = RuntimeGenerator::new(metadata);
|
||||
generator.generate_runtime(item_mod, derives, type_substitutes, crate_path)
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
};
|
||||
use frame_metadata::v15::{
|
||||
RuntimeMetadataV15,
|
||||
TraitMetadata,
|
||||
RuntimeApiMetadata,
|
||||
};
|
||||
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
@@ -20,7 +20,7 @@ use scale_info::form::PortableForm;
|
||||
|
||||
/// Generates the accessor functions for the given trait.
|
||||
fn generate_trait_api(
|
||||
trait_: &TraitMetadata<PortableForm>,
|
||||
trait_: &RuntimeApiMetadata<PortableForm>,
|
||||
type_gen: &TypeGenerator,
|
||||
types_mod_ident: &syn::Ident,
|
||||
crate_path: &CratePath,
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::{
|
||||
types::TypeGenerator,
|
||||
CratePath,
|
||||
};
|
||||
use frame_metadata::{
|
||||
v15::RuntimeMetadataV15,
|
||||
use frame_metadata::v15::{
|
||||
PalletMetadata,
|
||||
RuntimeMetadataV15,
|
||||
StorageEntryMetadata,
|
||||
StorageEntryModifier,
|
||||
StorageEntryType,
|
||||
|
||||
@@ -64,7 +64,7 @@ async fn fetch_metadata_ws(url: &Uri) -> Result<String, FetchMetadataError> {
|
||||
.build_with_tokio(sender, receiver);
|
||||
|
||||
use codec::Encode;
|
||||
let bytes = 15u32.encode();
|
||||
let bytes = u32::MAX.encode();
|
||||
let param = format!("0x{}", hex::encode(&bytes));
|
||||
|
||||
Ok(client
|
||||
@@ -81,7 +81,7 @@ async fn fetch_metadata_http(url: &Uri) -> Result<String, FetchMetadataError> {
|
||||
.build(url.to_string())?;
|
||||
|
||||
use codec::Encode;
|
||||
let bytes = 15u32.encode();
|
||||
let bytes = u32::MAX.encode();
|
||||
let param = format!("0x{}", hex::encode(&bytes));
|
||||
|
||||
Ok(client
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ description = "Command line utilities for checking metadata compatibility betwee
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
scale-info = "2.0.0"
|
||||
sp-core-hashing = "6.0.0"
|
||||
|
||||
|
||||
+4
-5
@@ -2,10 +2,9 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use frame_metadata::{
|
||||
v15::RuntimeMetadataV15,
|
||||
use frame_metadata::v15::{
|
||||
ExtrinsicMetadata,
|
||||
StorageEntryMetadata,
|
||||
RuntimeMetadataV15,
|
||||
StorageEntryType,
|
||||
};
|
||||
use scale_info::{
|
||||
@@ -216,7 +215,7 @@ fn get_extrinsic_hash(
|
||||
/// Get the hash corresponding to a single storage entry.
|
||||
fn get_storage_entry_hash(
|
||||
registry: &PortableRegistry,
|
||||
entry: &StorageEntryMetadata<PortableForm>,
|
||||
entry: &frame_metadata::v15::StorageEntryMetadata<PortableForm>,
|
||||
visited_ids: &mut HashSet<u32>,
|
||||
) -> [u8; 32] {
|
||||
let mut bytes = hash(entry.name.as_bytes());
|
||||
@@ -326,7 +325,7 @@ pub fn get_call_hash(
|
||||
/// Obtain the hash representation of a `frame_metadata::PalletMetadata`.
|
||||
pub fn get_pallet_hash(
|
||||
registry: &PortableRegistry,
|
||||
pallet: &frame_metadata::PalletMetadata<PortableForm>,
|
||||
pallet: &frame_metadata::v15::PalletMetadata<PortableForm>,
|
||||
) -> [u8; 32] {
|
||||
// Begin with some arbitrary hash (we don't really care what it is).
|
||||
let mut bytes = hash(&[19]);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ serde_json = { version = "1.0.64", features = ["raw_value"] }
|
||||
thiserror = "1.0.24"
|
||||
tracing = "0.1.34"
|
||||
parking_lot = "0.12.0"
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
derivative = "2.2.0"
|
||||
|
||||
subxt-macro = { version = "0.25.0", path = "../macro" }
|
||||
|
||||
@@ -156,7 +156,7 @@ impl<T: Config> OnlineClient<T> {
|
||||
async fn fetch_metadata(rpc: &Rpc<T>) -> Result<Metadata, Error> {
|
||||
use codec::Encode;
|
||||
|
||||
let param = 15u32.encode();
|
||||
let param = u32::MAX.encode();
|
||||
let bytes = rpc
|
||||
.state_call("Metadata_metadata_at_version", Some(¶m), None)
|
||||
.await?;
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
error::Error,
|
||||
};
|
||||
use codec::Decode;
|
||||
use frame_metadata::StorageEntryType;
|
||||
use frame_metadata::v15::StorageEntryType;
|
||||
|
||||
/// This trait is implemented for types which can be decoded with the help of metadata.
|
||||
pub trait DecodeWithMetadata {
|
||||
|
||||
@@ -5,13 +5,16 @@
|
||||
use super::hash_cache::HashCache;
|
||||
use codec::Error as CodecError;
|
||||
use frame_metadata::{
|
||||
v15::RuntimeMetadataV15,
|
||||
PalletConstantMetadata,
|
||||
v15::{
|
||||
PalletConstantMetadata,
|
||||
RuntimeMetadataV15,
|
||||
StorageEntryMetadata,
|
||||
META_RESERVED,
|
||||
},
|
||||
RuntimeMetadata,
|
||||
RuntimeMetadataPrefixed,
|
||||
StorageEntryMetadata,
|
||||
META_RESERVED,
|
||||
};
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use scale_info::{
|
||||
form::PortableForm,
|
||||
@@ -675,6 +678,7 @@ mod tests {
|
||||
signed_extensions: vec![],
|
||||
},
|
||||
meta_type::<()>(),
|
||||
Default::default(),
|
||||
);
|
||||
let prefixed = RuntimeMetadataPrefixed::from(metadata);
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ use crate::{
|
||||
Metadata,
|
||||
},
|
||||
};
|
||||
use frame_metadata::StorageEntryType;
|
||||
use frame_metadata::v15::StorageEntryType;
|
||||
use scale_info::TypeDef;
|
||||
use std::borrow::Cow;
|
||||
|
||||
// We use this type a bunch, so export it from here.
|
||||
pub use frame_metadata::StorageHasher;
|
||||
pub use frame_metadata::v15::StorageHasher;
|
||||
|
||||
/// This represents a storage address. Anything implementing this trait
|
||||
/// can be used to fetch and iterate over storage entries.
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
Config,
|
||||
};
|
||||
use derivative::Derivative;
|
||||
use frame_metadata::StorageEntryType;
|
||||
use frame_metadata::v15::StorageEntryType;
|
||||
use scale_info::form::PortableForm;
|
||||
use std::{
|
||||
future::Future,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use codec::Encode;
|
||||
|
||||
// We use this type a bunch, so export it from here.
|
||||
pub use frame_metadata::StorageHasher;
|
||||
pub use frame_metadata::v15::StorageHasher;
|
||||
|
||||
/// Storage key for a Map.
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -18,7 +18,7 @@ default = ["subxt/integration-tests"]
|
||||
[dev-dependencies]
|
||||
assert_matches = "1.5.0"
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
futures = "0.3.13"
|
||||
hex = "0.4.3"
|
||||
regex = "1.5.0"
|
||||
|
||||
@@ -11,6 +11,6 @@ publish = false
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0.76"
|
||||
scale-info = { version = "2.3.0", features = ["bit-vec"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15_test", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
frame-metadata = { version = "15.0.0", git = "https://github.com/paritytech/frame-metadata/", branch = "lexnv/md_v15", default-features = false, features = ["std", "v14", "v15-unstable"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
|
||||
subxt = { path = "../../subxt" }
|
||||
|
||||
Reference in New Issue
Block a user