feat: Rebrand Polkadot/Substrate references to PezkuwiChain

This commit systematically rebrands various references from Parity Technologies'
Polkadot/Substrate ecosystem to PezkuwiChain within the kurdistan-sdk.

Key changes include:
- Updated external repository URLs (zombienet-sdk, parity-db, parity-scale-codec, wasm-instrument) to point to pezkuwichain forks.
- Modified internal documentation and code comments to reflect PezkuwiChain naming and structure.
- Replaced direct references to  with  or specific paths within the  for XCM, Pezkuwi, and other modules.
- Cleaned up deprecated  issue and PR references in various  and  files, particularly in  and  modules.
- Adjusted image and logo URLs in documentation to point to PezkuwiChain assets.
- Removed or rephrased comments related to external Polkadot/Substrate PRs and issues.

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent 286de54384
commit 1c0e57d984
9084 changed files with 997839 additions and 997557 deletions
+23 -23
View File
@@ -19,15 +19,15 @@ scale-info = { features = ["derive"], workspace = true }
serde = { features = ["alloc", "derive"], workspace = true }
tracing = { workspace = true }
# Substrate Dependencies
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { features = ["serde"], workspace = true }
sp-state-machine = { workspace = true }
sp-std = { workspace = true }
sp-trie = { workspace = true }
# Bizinikiwi Dependencies
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
pezsp-core = { workspace = true }
pezsp-io = { workspace = true }
pezsp-runtime = { features = ["serde"], workspace = true }
pezsp-state-machine = { workspace = true }
pezsp-std = { workspace = true }
pezsp-trie = { workspace = true }
trie-db = { workspace = true }
[dev-dependencies]
@@ -37,27 +37,27 @@ hex-literal = { workspace = true, default-features = true }
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"pezframe-support/std",
"pezframe-system/std",
"hash-db/std",
"num-traits/std",
"scale-info/std",
"serde/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-state-machine/std",
"sp-std/std",
"sp-trie/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-runtime/std",
"pezsp-state-machine/std",
"pezsp-std/std",
"pezsp-trie/std",
"tracing/std",
"trie-db/std",
]
test-helpers = []
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-io/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-state-machine/runtime-benchmarks",
"sp-trie/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
"pezsp-state-machine/runtime-benchmarks",
"pezsp-trie/runtime-benchmarks",
]
+22 -22
View File
@@ -17,16 +17,16 @@
use crate::{ChainId, HeaderIdProvider};
use codec::{Codec, Decode, Encode, MaxEncodedLen};
use frame_support::{weights::Weight, Parameter};
use pezframe_support::{weights::Weight, Parameter};
use num_traits::{AsPrimitive, Bounded, CheckedSub, Saturating, SaturatingAdd, Zero};
use sp_runtime::{
use pezsp_runtime::{
traits::{
AtLeast32Bit, AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay,
MaybeSerialize, MaybeSerializeDeserialize, Member, SimpleBitOps, Verify,
},
FixedPointOperand, StateVersion,
};
use sp_std::{fmt::Debug, hash::Hash, str::FromStr, vec, vec::Vec};
use pezsp_std::{fmt::Debug, hash::Hash, str::FromStr, vec, vec::Vec};
/// Chain call, that is either SCALE-encoded, or decoded.
#[derive(Debug, Clone, PartialEq)]
@@ -98,18 +98,18 @@ impl<ChainCall: Encode> Encode for EncodedOrDecodedCall<ChainCall> {
}
}
/// Minimal Substrate-based chain representation that may be used from no_std environment.
/// Minimal Bizinikiwi-based chain representation that may be used from no_std environment.
pub trait Chain: Send + Sync + 'static {
/// Chain id.
const ID: ChainId;
/// A type that fulfills the abstract idea of what a Substrate block number is.
// Constraints come from the associated Number type of `sp_runtime::traits::Header`
/// A type that fulfills the abstract idea of what a Bizinikiwi block number is.
// Constraints come from the associated Number type of `pezsp_runtime::traits::Header`
// See here for more info:
// https://docs.rs/sp-runtime/latest/sp_runtime/traits/trait.Header.html#associatedtype.Number
// https://docs.rs/sp-runtime/latest/pezsp_runtime/traits/trait.Header.html#associatedtype.Number
//
// Note that the `AsPrimitive<usize>` trait is required by the GRANDPA justification
// verifier, and is not usually part of a Substrate Header's Number type.
// verifier, and is not usually part of a Bizinikiwi Header's Number type.
type BlockNumber: Parameter
+ Member
+ MaybeSerializeDeserialize
@@ -124,10 +124,10 @@ pub trait Chain: Send + Sync + 'static {
+ Saturating
+ MaxEncodedLen;
/// A type that fulfills the abstract idea of what a Substrate hash is.
// Constraints come from the associated Hash type of `sp_runtime::traits::Header`
/// A type that fulfills the abstract idea of what a Bizinikiwi hash is.
// Constraints come from the associated Hash type of `pezsp_runtime::traits::Header`
// See here for more info:
// https://docs.rs/sp-runtime/latest/sp_runtime/traits/trait.Header.html#associatedtype.Hash
// https://docs.rs/sp-runtime/latest/pezsp_runtime/traits/trait.Header.html#associatedtype.Hash
type Hash: Parameter
+ Member
+ MaybeSerializeDeserialize
@@ -141,16 +141,16 @@ pub trait Chain: Send + Sync + 'static {
+ AsMut<[u8]>
+ MaxEncodedLen;
/// A type that fulfills the abstract idea of what a Substrate hasher (a type
/// A type that fulfills the abstract idea of what a Bizinikiwi hasher (a type
/// that produces hashes) is.
// Constraints come from the associated Hashing type of `sp_runtime::traits::Header`
// Constraints come from the associated Hashing type of `pezsp_runtime::traits::Header`
// See here for more info:
// https://docs.rs/sp-runtime/latest/sp_runtime/traits/trait.Header.html#associatedtype.Hashing
// https://docs.rs/sp-runtime/latest/pezsp_runtime/traits/trait.Header.html#associatedtype.Hashing
type Hasher: HashT<Output = Self::Hash>;
/// A type that fulfills the abstract idea of what a Substrate header is.
/// A type that fulfills the abstract idea of what a Bizinikiwi header is.
// See here for more info:
// https://docs.rs/sp-runtime/latest/sp_runtime/traits/trait.Header.html
// https://docs.rs/sp-runtime/latest/pezsp_runtime/traits/trait.Header.html
type Header: Parameter
+ HeaderT<Number = Self::BlockNumber, Hash = Self::Hash>
+ HeaderIdProvider<Self::Header>
@@ -180,7 +180,7 @@ pub trait Chain: Send + Sync + 'static {
+ PartialOrd
+ SaturatingAdd
+ Zero
+ TryFrom<sp_core::U256>
+ TryFrom<pezsp_core::U256>
+ MaxEncodedLen;
/// Nonce of a transaction used by the chain.
type Nonce: Parameter
@@ -261,8 +261,8 @@ where
}
/// Adapter for `Get<u32>` to access `TEYRCHAIN_ID` from `trait Teyrchain`
pub struct TeyrchainIdOf<Para>(sp_std::marker::PhantomData<Para>);
impl<Para: Teyrchain> frame_support::traits::Get<u32> for TeyrchainIdOf<Para> {
pub struct TeyrchainIdOf<Para>(pezsp_std::marker::PhantomData<Para>);
impl<Para: Teyrchain> pezframe_support::traits::Get<u32> for TeyrchainIdOf<Para> {
fn get() -> u32 {
Para::TEYRCHAIN_ID
}
@@ -332,7 +332,7 @@ macro_rules! decl_bridge_finality_runtime_apis {
stringify!([<$chain:camel FinalityApi_synced_headers_ $consensus:lower _info>]);
)?
sp_api::decl_runtime_apis! {
pezsp_api::decl_runtime_apis! {
/// API for querying information about the finalized chain headers.
///
/// This API is implemented by runtimes that are receiving messages from this chain, not by this
@@ -345,7 +345,7 @@ macro_rules! decl_bridge_finality_runtime_apis {
/// The caller expects that if his transaction improves best known header
/// at least by the free_headers_interval`, it will be fee-free.
///
/// See [`pallet_bridge_grandpa::Config::FreeHeadersInterval`] for details.
/// See [`pezpallet_bridge_grandpa::Config::FreeHeadersInterval`] for details.
fn free_headers_interval() -> Option<BlockNumber>;
$(
@@ -394,7 +394,7 @@ macro_rules! decl_bridge_messages_runtime_apis {
pub const [<FROM_ $chain:upper _MESSAGE_DETAILS_METHOD>]: &str =
stringify!([<From $chain:camel InboundLaneApi_message_details>]);
sp_api::decl_runtime_apis! {
pezsp_api::decl_runtime_apis! {
/// Outbound message lane API for messages that are sent to this chain.
///
/// This API is implemented by runtimes that are receiving messages from this chain, not by this
+13 -13
View File
@@ -19,12 +19,12 @@
use codec::{Compact, Decode, DecodeWithMemTracking, Encode};
use impl_trait_for_tuples::impl_for_tuples;
use scale_info::{StaticTypeInfo, TypeInfo};
use sp_runtime::{
use pezsp_runtime::{
impl_tx_ext_default,
traits::{Dispatchable, TransactionExtension},
transaction_validity::TransactionValidityError,
};
use sp_std::{fmt::Debug, marker::PhantomData};
use pezsp_std::{fmt::Debug, marker::PhantomData};
/// Trait that describes some properties of a `TransactionExtension` that are needed in order to
/// send a transaction to the chain.
@@ -56,28 +56,28 @@ where
type Implicit = S;
}
/// The `TransactionExtensionSchema` for `frame_system::CheckNonZeroSender`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckNonZeroSender`.
pub type CheckNonZeroSender = GenericTransactionExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `frame_system::CheckSpecVersion`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckSpecVersion`.
pub type CheckSpecVersion = GenericTransactionExtensionSchema<(), u32>;
/// The `TransactionExtensionSchema` for `frame_system::CheckTxVersion`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckTxVersion`.
pub type CheckTxVersion = GenericTransactionExtensionSchema<(), u32>;
/// The `TransactionExtensionSchema` for `frame_system::CheckGenesis`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckGenesis`.
pub type CheckGenesis<Hash> = GenericTransactionExtensionSchema<(), Hash>;
/// The `TransactionExtensionSchema` for `frame_system::CheckEra`.
pub type CheckEra<Hash> = GenericTransactionExtensionSchema<sp_runtime::generic::Era, Hash>;
/// The `TransactionExtensionSchema` for `pezframe_system::CheckEra`.
pub type CheckEra<Hash> = GenericTransactionExtensionSchema<pezsp_runtime::generic::Era, Hash>;
/// The `TransactionExtensionSchema` for `frame_system::CheckNonce`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckNonce`.
pub type CheckNonce<TxNonce> = GenericTransactionExtensionSchema<Compact<TxNonce>, ()>;
/// The `TransactionExtensionSchema` for `frame_system::CheckWeight`.
/// The `TransactionExtensionSchema` for `pezframe_system::CheckWeight`.
pub type CheckWeight = GenericTransactionExtensionSchema<(), ()>;
/// The `TransactionExtensionSchema` for `pallet_transaction_payment::ChargeTransactionPayment`.
/// The `TransactionExtensionSchema` for `pezpallet_transaction_payment::ChargeTransactionPayment`.
pub type ChargeTransactionPayment<Balance> =
GenericTransactionExtensionSchema<Compact<Balance>, ()>;
@@ -139,8 +139,8 @@ where
// is kinda random here
self.implicit
.clone()
.ok_or(frame_support::unsigned::TransactionValidityError::Unknown(
frame_support::unsigned::UnknownTransaction::Custom(0xFF),
.ok_or(pezframe_support::unsigned::TransactionValidityError::Unknown(
pezframe_support::unsigned::UnknownTransaction::Custom(0xFF),
))
}
type Pre = ();
+33 -33
View File
@@ -20,25 +20,25 @@
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen};
use frame_support::{
pallet_prelude::DispatchResult, weights::Weight, PalletError, StorageHasher, StorageValue,
use pezframe_support::{
pezpallet_prelude::DispatchResult, weights::Weight, PalletError, StorageHasher, StorageValue,
};
use frame_system::RawOrigin;
use pezframe_system::RawOrigin;
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_core::storage::StorageKey;
use sp_runtime::{
use pezsp_core::storage::StorageKey;
use pezsp_runtime::{
traits::{BadOrigin, Header as HeaderT, UniqueSaturatedInto},
RuntimeDebug,
};
use sp_std::{fmt::Debug, ops::RangeInclusive, vec, vec::Vec};
use pezsp_std::{fmt::Debug, ops::RangeInclusive, vec, vec::Vec};
pub use chain::{
AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, EncodedOrDecodedCall, HashOf,
HasherOf, HeaderOf, NonceOf, SignatureOf, Teyrchain, TeyrchainIdOf, TransactionEraOf,
UnderlyingChainOf, UnderlyingChainProvider, __private,
};
pub use frame_support::storage::storage_prefix as storage_value_final_key;
pub use pezframe_support::storage::storage_prefix as storage_value_final_key;
use num_traits::{CheckedAdd, CheckedSub, One, SaturatingAdd, Zero};
#[cfg(feature = "std")]
pub use storage_proof::craft_valid_storage_proof;
@@ -62,7 +62,7 @@ mod storage_proof;
mod storage_types;
// Re-export macro to avoid include paste dependency everywhere
pub use sp_runtime::paste;
pub use pezsp_runtime::paste;
// Re-export for usage in macro.
#[doc(hidden)]
@@ -200,13 +200,13 @@ impl<BlockNumber: Copy + UniqueSaturatedInto<u64>, BlockHash: Copy>
}
/// Returns era that is used by FRAME-based runtimes.
pub fn frame_era(&self) -> sp_runtime::generic::Era {
pub fn frame_era(&self) -> pezsp_runtime::generic::Era {
match *self {
TransactionEra::Immortal => sp_runtime::generic::Era::immortal(),
TransactionEra::Immortal => pezsp_runtime::generic::Era::immortal(),
// `unique_saturated_into` is fine here - mortality `u64::MAX` is not something we
// expect to see on any chain
TransactionEra::Mortal(header_id, period) =>
sp_runtime::generic::Era::mortal(period as _, header_id.0.unique_saturated_into()),
pezsp_runtime::generic::Era::mortal(period as _, header_id.0.unique_saturated_into()),
}
}
@@ -220,25 +220,25 @@ impl<BlockNumber: Copy + UniqueSaturatedInto<u64>, BlockHash: Copy>
}
/// This is a copy of the
/// `frame_support::storage::generator::StorageMap::storage_map_final_key` for maps based
/// `pezframe_support::storage::generator::StorageMap::storage_map_final_key` for maps based
/// on selected hasher.
///
/// We're using it because to call `storage_map_final_key` directly, we need access to the runtime
/// and pallet instance, which (sometimes) is impossible.
pub fn storage_map_final_key<H: StorageHasher>(
pallet_prefix: &str,
pezpallet_prefix: &str,
map_name: &str,
key: &[u8],
) -> StorageKey {
let key_hashed = H::hash(key);
let pallet_prefix_hashed = frame_support::Twox128::hash(pallet_prefix.as_bytes());
let storage_prefix_hashed = frame_support::Twox128::hash(map_name.as_bytes());
let pezpallet_prefix_hashed = pezframe_support::Twox128::hash(pezpallet_prefix.as_bytes());
let storage_prefix_hashed = pezframe_support::Twox128::hash(map_name.as_bytes());
let mut final_key = Vec::with_capacity(
pallet_prefix_hashed.len() + storage_prefix_hashed.len() + key_hashed.as_ref().len(),
pezpallet_prefix_hashed.len() + storage_prefix_hashed.len() + key_hashed.as_ref().len(),
);
final_key.extend_from_slice(&pallet_prefix_hashed[..]);
final_key.extend_from_slice(&pezpallet_prefix_hashed[..]);
final_key.extend_from_slice(&storage_prefix_hashed[..]);
final_key.extend_from_slice(key_hashed.as_ref());
@@ -247,13 +247,13 @@ pub fn storage_map_final_key<H: StorageHasher>(
/// This is how a storage key of storage value is computed.
///
/// Copied from `frame_support::storage::storage_prefix`.
pub fn storage_value_key(pallet_prefix: &str, value_name: &str) -> StorageKey {
let pallet_hash = sp_io::hashing::twox_128(pallet_prefix.as_bytes());
let storage_hash = sp_io::hashing::twox_128(value_name.as_bytes());
/// Copied from `pezframe_support::storage::storage_prefix`.
pub fn storage_value_key(pezpallet_prefix: &str, value_name: &str) -> StorageKey {
let pezpallet_hash = pezsp_io::hashing::twox_128(pezpallet_prefix.as_bytes());
let storage_hash = pezsp_io::hashing::twox_128(value_name.as_bytes());
let mut final_key = vec![0u8; 32];
final_key[..16].copy_from_slice(&pallet_hash);
final_key[..16].copy_from_slice(&pezpallet_hash);
final_key[16..].copy_from_slice(&storage_hash);
StorageKey(final_key)
@@ -272,12 +272,12 @@ pub trait StorageMapKeyProvider {
type Value: 'static + FullCodec;
/// This is a copy of the
/// `frame_support::storage::generator::StorageMap::storage_map_final_key`.
/// `pezframe_support::storage::generator::StorageMap::storage_map_final_key`.
///
/// We're using it because to call `storage_map_final_key` directly, we need access
/// to the runtime and pallet instance, which (sometimes) is impossible.
fn final_key(pallet_prefix: &str, key: &Self::Key) -> StorageKey {
storage_map_final_key::<Self::Hasher>(pallet_prefix, Self::MAP_NAME, &key.encode())
fn final_key(pezpallet_prefix: &str, key: &Self::Key) -> StorageKey {
storage_map_final_key::<Self::Hasher>(pezpallet_prefix, Self::MAP_NAME, &key.encode())
}
}
@@ -298,24 +298,24 @@ pub trait StorageDoubleMapKeyProvider {
type Value: 'static + FullCodec;
/// This is a copy of the
/// `frame_support::storage::generator::StorageDoubleMap::storage_double_map_final_key`.
/// `pezframe_support::storage::generator::StorageDoubleMap::storage_double_map_final_key`.
///
/// We're using it because to call `storage_double_map_final_key` directly, we need access
/// to the runtime and pallet instance, which (sometimes) is impossible.
fn final_key(pallet_prefix: &str, key1: &Self::Key1, key2: &Self::Key2) -> StorageKey {
fn final_key(pezpallet_prefix: &str, key1: &Self::Key1, key2: &Self::Key2) -> StorageKey {
let key1_hashed = Self::Hasher1::hash(&key1.encode());
let key2_hashed = Self::Hasher2::hash(&key2.encode());
let pallet_prefix_hashed = frame_support::Twox128::hash(pallet_prefix.as_bytes());
let storage_prefix_hashed = frame_support::Twox128::hash(Self::MAP_NAME.as_bytes());
let pezpallet_prefix_hashed = pezframe_support::Twox128::hash(pezpallet_prefix.as_bytes());
let storage_prefix_hashed = pezframe_support::Twox128::hash(Self::MAP_NAME.as_bytes());
let mut final_key = Vec::with_capacity(
pallet_prefix_hashed.len() +
pezpallet_prefix_hashed.len() +
storage_prefix_hashed.len() +
key1_hashed.as_ref().len() +
key2_hashed.as_ref().len(),
);
final_key.extend_from_slice(&pallet_prefix_hashed[..]);
final_key.extend_from_slice(&pezpallet_prefix_hashed[..]);
final_key.extend_from_slice(&storage_prefix_hashed[..]);
final_key.extend_from_slice(key1_hashed.as_ref());
final_key.extend_from_slice(key2_hashed.as_ref());
@@ -374,7 +374,7 @@ impl OperatingMode for BasicOperatingMode {
const COMMON_LOG_TARGET: &'static str = "runtime::bridge-module";
/// Bridge module that has owner and operating mode
pub trait OwnedBridgeModule<T: frame_system::Config> {
pub trait OwnedBridgeModule<T: pezframe_system::Config> {
/// The target that will be used when publishing logs related to this module.
const LOG_TARGET: &'static str;
@@ -463,7 +463,7 @@ pub trait WeightExtraOps {
impl WeightExtraOps for Weight {
fn min_components_checked_div(&self, other: Weight) -> Option<u64> {
Some(sp_std::cmp::min(
Some(pezsp_std::cmp::min(
self.ref_time().checked_div(other.ref_time())?,
self.proof_size().checked_div(other.proof_size())?,
))
+2 -2
View File
@@ -17,9 +17,9 @@
//! Primitives that may be used by different message delivery and dispatch mechanisms.
use codec::{Decode, DecodeWithMemTracking, Encode};
use frame_support::weights::Weight;
use pezframe_support::weights::Weight;
use scale_info::TypeInfo;
use sp_runtime::RuntimeDebug;
use pezsp_runtime::RuntimeDebug;
/// Message dispatch result.
#[derive(Encode, Decode, DecodeWithMemTracking, RuntimeDebug, Clone, PartialEq, Eq, TypeInfo)]
+25 -25
View File
@@ -16,10 +16,10 @@
//! Logic for working with storage proofs.
use frame_support::PalletError;
use sp_core::RuntimeDebug;
use sp_std::vec::Vec;
use sp_trie::{
use pezframe_support::PalletError;
use pezsp_core::RuntimeDebug;
use pezsp_std::vec::Vec;
use pezsp_trie::{
accessed_nodes_tracker::AccessedNodesTracker, read_trie_value, LayoutV1, MemoryDB, StorageProof,
};
@@ -27,7 +27,7 @@ use codec::{Decode, DecodeWithMemTracking, Encode};
use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
use scale_info::TypeInfo;
#[cfg(feature = "test-helpers")]
use sp_trie::{recorder_ext::RecorderExt, Recorder, TrieDBBuilder, TrieError, TrieHash};
use pezsp_trie::{recorder_ext::RecorderExt, Recorder, TrieDBBuilder, TrieError, TrieHash};
#[cfg(feature = "test-helpers")]
use trie_db::{Trie, TrieConfiguration, TrieDBMut};
@@ -59,24 +59,24 @@ pub enum StorageProofError {
DuplicateNodes,
}
impl From<sp_trie::StorageProofError> for StorageProofError {
fn from(e: sp_trie::StorageProofError) -> Self {
impl From<pezsp_trie::StorageProofError> for StorageProofError {
fn from(e: pezsp_trie::StorageProofError) -> Self {
match e {
sp_trie::StorageProofError::DuplicateNodes => StorageProofError::DuplicateNodes,
pezsp_trie::StorageProofError::DuplicateNodes => StorageProofError::DuplicateNodes,
}
}
}
impl From<sp_trie::accessed_nodes_tracker::Error> for StorageProofError {
fn from(e: sp_trie::accessed_nodes_tracker::Error) -> Self {
impl From<pezsp_trie::accessed_nodes_tracker::Error> for StorageProofError {
fn from(e: pezsp_trie::accessed_nodes_tracker::Error) -> Self {
match e {
sp_trie::accessed_nodes_tracker::Error::UnusedNodes => StorageProofError::UnusedKey,
pezsp_trie::accessed_nodes_tracker::Error::UnusedNodes => StorageProofError::UnusedKey,
}
}
}
/// Raw storage proof type (just raw trie nodes).
pub type RawStorageProof = sp_trie::RawStorageProof;
pub type RawStorageProof = pezsp_trie::RawStorageProof;
/// Calculates size for `RawStorageProof`.
pub fn raw_storage_proof_size(raw_storage_proof: &RawStorageProof) -> usize {
@@ -204,7 +204,7 @@ where
pub fn grow_storage_value(mut value: Vec<u8>, params: &UnverifiedStorageProofParams) -> Vec<u8> {
if let Some(db_size) = params.db_size {
if db_size as usize > value.len() {
value.extend(sp_std::iter::repeat(42u8).take(db_size as usize - value.len()));
value.extend(pezsp_std::iter::repeat(42u8).take(db_size as usize - value.len()));
}
}
value
@@ -221,7 +221,7 @@ pub fn grow_storage_proof<L: TrieConfiguration>(
prefix: Vec<u8>,
num_extra_nodes: usize,
) {
use sp_trie::TrieMut;
use pezsp_trie::TrieMut;
let mut added_nodes = 0;
for i in 0..prefix.len() {
@@ -266,7 +266,7 @@ pub fn grow_storage_proof<L: TrieConfiguration>(
pub fn record_all_keys<L: TrieConfiguration, DB>(
db: &DB,
root: &TrieHash<L>,
) -> Result<RawStorageProof, sp_std::boxed::Box<TrieError<L>>>
) -> Result<RawStorageProof, pezsp_std::boxed::Box<TrieError<L>>>
where
DB: hash_db::HashDBRef<L::Hash, trie_db::DBValue>,
{
@@ -284,14 +284,14 @@ where
///
/// Note: This should only be used for **testing**.
#[cfg(feature = "std")]
pub fn craft_valid_storage_proof() -> (sp_core::H256, RawStorageProof) {
use sp_state_machine::{backend::Backend, prove_read, InMemoryBackend};
pub fn craft_valid_storage_proof() -> (pezsp_core::H256, RawStorageProof) {
use pezsp_state_machine::{backend::Backend, prove_read, InMemoryBackend};
let state_version = sp_runtime::StateVersion::default();
let state_version = pezsp_runtime::StateVersion::default();
// construct storage proof
let backend = <InMemoryBackend<sp_core::Blake2Hasher>>::from((
sp_std::vec![
let backend = <InMemoryBackend<pezsp_core::Blake2Hasher>>::from((
pezsp_std::vec![
(None, vec![(b"key1".to_vec(), Some(b"value1".to_vec()))]),
(None, vec![(b"key2".to_vec(), Some(b"value2".to_vec()))]),
(None, vec![(b"key3".to_vec(), Some(b"value3".to_vec()))]),
@@ -301,7 +301,7 @@ pub fn craft_valid_storage_proof() -> (sp_core::H256, RawStorageProof) {
],
state_version,
));
let root = backend.storage_root(sp_std::iter::empty(), state_version).0;
let root = backend.storage_root(pezsp_std::iter::empty(), state_version).0;
let proof =
prove_read(backend, &[&b"key1"[..], &b"key2"[..], &b"key4"[..], &b"key22"[..]]).unwrap();
@@ -319,7 +319,7 @@ pub mod tests_for_storage_proof_checker {
// check proof in runtime
let mut checker =
<StorageProofChecker<sp_core::Blake2Hasher>>::new(root, proof.clone()).unwrap();
<StorageProofChecker<pezsp_core::Blake2Hasher>>::new(root, proof.clone()).unwrap();
assert_eq!(checker.read_value(b"key1"), Ok(Some(b"value1".to_vec())));
assert_eq!(checker.read_value(b"key2"), Ok(Some(b"value2".to_vec())));
assert_eq!(checker.read_value(b"key4"), Ok(Some((42u64, 42u32, 42u16, 42u8).encode())));
@@ -336,7 +336,7 @@ pub mod tests_for_storage_proof_checker {
// checking proof against invalid commitment fails
assert_eq!(
<StorageProofChecker<sp_core::Blake2Hasher>>::new(sp_core::H256::random(), proof).err(),
<StorageProofChecker<pezsp_core::Blake2Hasher>>::new(pezsp_core::H256::random(), proof).err(),
Some(StorageProofError::StorageRootMismatch)
);
}
@@ -346,14 +346,14 @@ pub mod tests_for_storage_proof_checker {
let (root, proof) = craft_valid_storage_proof();
let mut checker =
StorageProofChecker::<sp_core::Blake2Hasher>::new(root, proof.clone()).unwrap();
StorageProofChecker::<pezsp_core::Blake2Hasher>::new(root, proof.clone()).unwrap();
checker.read_value(b"key1").unwrap().unwrap();
checker.read_value(b"key2").unwrap();
checker.read_value(b"key4").unwrap();
checker.read_value(b"key22").unwrap();
assert_eq!(checker.ensure_no_unused_nodes(), Ok(()));
let checker = StorageProofChecker::<sp_core::Blake2Hasher>::new(root, proof).unwrap();
let checker = StorageProofChecker::<pezsp_core::Blake2Hasher>::new(root, proof).unwrap();
assert_eq!(checker.ensure_no_unused_nodes(), Err(StorageProofError::UnusedKey));
}
}
@@ -18,10 +18,10 @@
//! during conversion.
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::traits::Get;
use pezframe_support::traits::Get;
use scale_info::{Type, TypeInfo};
use sp_runtime::RuntimeDebug;
use sp_std::{marker::PhantomData, ops::Deref};
use pezsp_runtime::RuntimeDebug;
use pezsp_std::{marker::PhantomData, ops::Deref};
/// Error that is returned when the value size exceeds maximal configured size.
#[derive(RuntimeDebug)]
@@ -39,8 +39,8 @@ pub struct BoundedStorageValue<B, V> {
_phantom: PhantomData<B>,
}
impl<B, V: sp_std::fmt::Debug> sp_std::fmt::Debug for BoundedStorageValue<B, V> {
fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
impl<B, V: pezsp_std::fmt::Debug> pezsp_std::fmt::Debug for BoundedStorageValue<B, V> {
fn fmt(&self, fmt: &mut pezsp_std::fmt::Formatter) -> pezsp_std::fmt::Result {
self.value.fmt(fmt)
}
}