mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Rebrand subxt to pezkuwi-subxt with pezsp_runtime support
- Renamed all crate names from subxt-* to pezkuwi-subxt-* - Updated codegen to use pezsp_runtime, pezsp_core, pezframe_support instead of sp_runtime, sp_core, frame_support - Replaced all internal references from subxt_* to pezkuwi_subxt_* - Added local path dependencies to Pezkuwi SDK crates - Updated workspace configuration for edition 2024
This commit is contained in:
+3
-4
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "subxt-metadata"
|
||||
name = "pezkuwi-subxt-metadata"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -34,7 +34,7 @@ scale-type-resolver = { workspace = true, optional = true }
|
||||
frame-decode = { workspace = true }
|
||||
frame-metadata = { workspace = true, default-features = false, features = ["current", "decode"] }
|
||||
codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] }
|
||||
sp-crypto-hashing = { workspace = true }
|
||||
pezsp-crypto-hashing = { workspace = true }
|
||||
hashbrown = { workspace = true }
|
||||
thiserror = { workspace = true, default-features = false }
|
||||
|
||||
@@ -42,9 +42,8 @@ thiserror = { workspace = true, default-features = false }
|
||||
bitvec = { workspace = true, features = ["alloc"] }
|
||||
criterion = { workspace = true }
|
||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||
subxt-utils-stripmetadata = { workspace = true }
|
||||
frame-decode = { workspace = true, features = ["legacy-types"] }
|
||||
subxt-codegen = { workspace = true }
|
||||
pezkuwi-subxt-codegen = { workspace = true }
|
||||
|
||||
[lib]
|
||||
# Without this, libtest cli opts interfere with criterion benches:
|
||||
|
||||
@@ -8,7 +8,7 @@ use codec::Decode;
|
||||
use criterion::*;
|
||||
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
||||
use std::{fs, path::Path};
|
||||
use subxt_metadata::Metadata;
|
||||
use pezkuwi_subxt_metadata::Metadata;
|
||||
|
||||
fn load_metadata() -> Metadata {
|
||||
let bytes = fs::read(Path::new("../artifacts/polkadot_metadata_full.scale"))
|
||||
|
||||
@@ -50,7 +50,7 @@ fn test_opts() -> super::Opts {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a pair of original metadata + converted subxt_metadata::Metadata
|
||||
/// Return a pair of original metadata + converted pezkuwi_subxt_metadata::Metadata
|
||||
fn metadata_pair(
|
||||
version: u8,
|
||||
opts: super::Opts,
|
||||
@@ -67,7 +67,7 @@ fn metadata_pair(
|
||||
types_for_spec
|
||||
};
|
||||
|
||||
let subxt_metadata = match &metadata {
|
||||
let pezkuwi_subxt_metadata = match &metadata {
|
||||
RuntimeMetadata::V9(m) => super::from_v9(m, &types_for_spec, opts),
|
||||
RuntimeMetadata::V10(m) => super::from_v10(m, &types_for_spec, opts),
|
||||
RuntimeMetadata::V11(m) => super::from_v11(m, &types_for_spec, opts),
|
||||
@@ -75,9 +75,9 @@ fn metadata_pair(
|
||||
RuntimeMetadata::V13(m) => super::from_v13(m, &types_for_spec, opts),
|
||||
_ => panic!("Metadata version {} not expected", metadata.version()),
|
||||
}
|
||||
.expect("Could not convert to subxt_metadata::Metadata");
|
||||
.expect("Could not convert to pezkuwi_subxt_metadata::Metadata");
|
||||
|
||||
(types_for_spec, metadata, subxt_metadata)
|
||||
(types_for_spec, metadata, pezkuwi_subxt_metadata)
|
||||
}
|
||||
|
||||
/// A representation of the shape of some type that we can compare across metadatas.
|
||||
@@ -441,7 +441,7 @@ fn builtin_event() {
|
||||
#[test]
|
||||
fn codegen_works() {
|
||||
for version in 9..=13 {
|
||||
// We need to do this against `subxt_codegen::Metadata` and so cannot re-use our
|
||||
// We need to do this against `pezkuwi_subxt_codegen::Metadata` and so cannot re-use our
|
||||
// test functions for it. This is because the compiler sees some difference between
|
||||
// `subxct_codegen::Metadata` and `crate::Metadata` even though they should be identical.
|
||||
let new_md = {
|
||||
@@ -457,18 +457,18 @@ fn codegen_works() {
|
||||
};
|
||||
|
||||
match &metadata {
|
||||
RuntimeMetadata::V9(m) => subxt_codegen::Metadata::from_v9(m, &types_for_spec),
|
||||
RuntimeMetadata::V10(m) => subxt_codegen::Metadata::from_v10(m, &types_for_spec),
|
||||
RuntimeMetadata::V11(m) => subxt_codegen::Metadata::from_v11(m, &types_for_spec),
|
||||
RuntimeMetadata::V12(m) => subxt_codegen::Metadata::from_v12(m, &types_for_spec),
|
||||
RuntimeMetadata::V13(m) => subxt_codegen::Metadata::from_v13(m, &types_for_spec),
|
||||
RuntimeMetadata::V9(m) => pezkuwi_subxt_codegen::Metadata::from_v9(m, &types_for_spec),
|
||||
RuntimeMetadata::V10(m) => pezkuwi_subxt_codegen::Metadata::from_v10(m, &types_for_spec),
|
||||
RuntimeMetadata::V11(m) => pezkuwi_subxt_codegen::Metadata::from_v11(m, &types_for_spec),
|
||||
RuntimeMetadata::V12(m) => pezkuwi_subxt_codegen::Metadata::from_v12(m, &types_for_spec),
|
||||
RuntimeMetadata::V13(m) => pezkuwi_subxt_codegen::Metadata::from_v13(m, &types_for_spec),
|
||||
_ => panic!("Metadata version {} not expected", metadata.version()),
|
||||
}
|
||||
.expect("Could not convert to subxt_metadata::Metadata")
|
||||
.expect("Could not convert to pezkuwi_subxt_metadata::Metadata")
|
||||
};
|
||||
|
||||
// We only test that generation succeeds without any errors, not necessarily that it's 100% useful:
|
||||
let codegen = subxt_codegen::CodegenBuilder::new();
|
||||
let codegen = pezkuwi_subxt_codegen::CodegenBuilder::new();
|
||||
let _ = codegen
|
||||
.generate(new_md)
|
||||
.map_err(|e| e.into_compile_error())
|
||||
|
||||
@@ -32,7 +32,7 @@ enum TypeBeingHashed {
|
||||
|
||||
/// Hashing function utilized internally.
|
||||
fn hash(data: &[u8]) -> Hash {
|
||||
sp_crypto_hashing::twox_256(data)
|
||||
pezsp_crypto_hashing::twox_256(data)
|
||||
}
|
||||
|
||||
/// XOR two hashes together. Only use this when you don't care about the order
|
||||
@@ -1169,7 +1169,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn hash_comparison_trimmed_metadata() {
|
||||
use subxt_utils_stripmetadata::StripMetadata;
|
||||
use pezkuwi_subxt_utils_stripmetadata::StripMetadata;
|
||||
|
||||
// trim the metadata:
|
||||
let metadata = metadata_with_pallet_events();
|
||||
|
||||
Reference in New Issue
Block a user