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:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bp-beefy"
|
||||
description = "Primitives of pallet-bridge-beefy module."
|
||||
description = "Primitives of pezpallet-bridge-beefy module."
|
||||
version = "0.1.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -19,14 +19,14 @@ serde = { features = ["alloc", "derive"], workspace = true }
|
||||
# Bridge Dependencies
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
# Bizinikiwi Dependencies
|
||||
binary-merkle-tree = { workspace = true }
|
||||
frame-support = { workspace = true }
|
||||
pallet-beefy-mmr = { workspace = true }
|
||||
pallet-mmr = { workspace = true }
|
||||
sp-consensus-beefy = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
pezframe-support = { workspace = true }
|
||||
pezpallet-beefy-mmr = { workspace = true }
|
||||
pezpallet-mmr = { workspace = true }
|
||||
pezsp-consensus-beefy = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -34,21 +34,21 @@ std = [
|
||||
"binary-merkle-tree/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"pallet-beefy-mmr/std",
|
||||
"pallet-mmr/std",
|
||||
"pezframe-support/std",
|
||||
"pezpallet-beefy-mmr/std",
|
||||
"pezpallet-mmr/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"sp-consensus-beefy/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"pezsp-consensus-beefy/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"binary-merkle-tree/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"pallet-beefy-mmr/runtime-benchmarks",
|
||||
"pallet-mmr/runtime-benchmarks",
|
||||
"sp-consensus-beefy/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezpallet-beefy-mmr/runtime-benchmarks",
|
||||
"pezpallet-mmr/runtime-benchmarks",
|
||||
"pezsp-consensus-beefy/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
pub use binary_merkle_tree::merkle_root;
|
||||
pub use pallet_beefy_mmr::BeefyEcdsaToEthereum;
|
||||
pub use pallet_mmr::{
|
||||
pub use pezpallet_beefy_mmr::BeefyEcdsaToEthereum;
|
||||
pub use pezpallet_mmr::{
|
||||
primitives::{DataOrHash as MmrDataOrHash, LeafProof as MmrProof},
|
||||
verify_leaves_proof as verify_mmr_leaves_proof,
|
||||
};
|
||||
pub use sp_consensus_beefy::{
|
||||
pub use pezsp_consensus_beefy::{
|
||||
ecdsa_crypto::{
|
||||
AuthorityId as EcdsaValidatorId, AuthoritySignature as EcdsaValidatorSignature,
|
||||
},
|
||||
@@ -37,16 +37,16 @@ pub use sp_consensus_beefy::{
|
||||
|
||||
use bp_runtime::{BasicOperatingMode, BlockNumberOf, Chain, HashOf};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::Parameter;
|
||||
use pezframe_support::Parameter;
|
||||
use scale_info::TypeInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_runtime::{
|
||||
use pezsp_runtime::{
|
||||
traits::{Convert, MaybeSerializeDeserialize},
|
||||
RuntimeAppPublic, RuntimeDebug,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
use pezsp_std::prelude::*;
|
||||
|
||||
/// Substrate-based chain with BEEFY && MMR pallets deployed.
|
||||
/// Bizinikiwi-based chain with BEEFY && MMR pallets deployed.
|
||||
///
|
||||
/// Both BEEFY and MMR pallets and their clients may be configured to use different
|
||||
/// primitives. Some of types can be configured in low-level pallets, but are constrained
|
||||
@@ -54,23 +54,23 @@ use sp_std::prelude::*;
|
||||
pub trait ChainWithBeefy: Chain {
|
||||
/// The hashing algorithm used to compute the digest of the BEEFY commitment.
|
||||
///
|
||||
/// Corresponds to the hashing algorithm, used by `sc_consensus_beefy::BeefyKeystore`.
|
||||
type CommitmentHasher: sp_runtime::traits::Hash;
|
||||
/// Corresponds to the hashing algorithm, used by `pezsc_consensus_beefy::BeefyKeystore`.
|
||||
type CommitmentHasher: pezsp_runtime::traits::Hash;
|
||||
|
||||
/// The hashing algorithm used to build the MMR.
|
||||
///
|
||||
/// The same algorithm is also used to compute merkle roots in BEEFY
|
||||
/// (e.g. validator addresses root in leaf data).
|
||||
///
|
||||
/// Corresponds to the `Hashing` field of the `pallet-mmr` configuration.
|
||||
type MmrHashing: sp_runtime::traits::Hash<Output = Self::MmrHash>;
|
||||
/// Corresponds to the `Hashing` field of the `pezpallet-mmr` configuration.
|
||||
type MmrHashing: pezsp_runtime::traits::Hash<Output = Self::MmrHash>;
|
||||
|
||||
/// The output type of the hashing algorithm used to build the MMR.
|
||||
///
|
||||
/// This type is actually stored in the MMR.
|
||||
|
||||
/// Corresponds to the `Hash` field of the `pallet-mmr` configuration.
|
||||
type MmrHash: sp_std::hash::Hash
|
||||
/// Corresponds to the `Hash` field of the `pezpallet-mmr` configuration.
|
||||
type MmrHash: pezsp_std::hash::Hash
|
||||
+ Parameter
|
||||
+ Copy
|
||||
+ AsRef<[u8]>
|
||||
@@ -83,43 +83,43 @@ pub trait ChainWithBeefy: Chain {
|
||||
|
||||
/// A way to identify a BEEFY validator.
|
||||
///
|
||||
/// Corresponds to the `BeefyId` field of the `pallet-beefy` configuration.
|
||||
/// Corresponds to the `BeefyId` field of the `pezpallet-beefy` configuration.
|
||||
type AuthorityId: BeefyAuthorityId<Self::CommitmentHasher> + Parameter;
|
||||
|
||||
/// A way to convert validator id to its raw representation in the BEEFY merkle tree.
|
||||
///
|
||||
/// Corresponds to the `BeefyAuthorityToMerkleLeaf` field of the `pallet-beefy-mmr`
|
||||
/// Corresponds to the `BeefyAuthorityToMerkleLeaf` field of the `pezpallet-beefy-mmr`
|
||||
/// configuration.
|
||||
type AuthorityIdToMerkleLeaf: Convert<Self::AuthorityId, Vec<u8>>;
|
||||
}
|
||||
|
||||
/// BEEFY validator id used by given Substrate chain.
|
||||
/// BEEFY validator id used by given Bizinikiwi chain.
|
||||
pub type BeefyAuthorityIdOf<C> = <C as ChainWithBeefy>::AuthorityId;
|
||||
/// BEEFY validator set, containing both validator identifiers and the numeric set id.
|
||||
pub type BeefyAuthoritySetOf<C> = ValidatorSet<BeefyAuthorityIdOf<C>>;
|
||||
/// BEEFY authority set, containing both validator identifiers and the numeric set id.
|
||||
pub type BeefyAuthoritySetInfoOf<C> = sp_consensus_beefy::mmr::BeefyAuthoritySet<MmrHashOf<C>>;
|
||||
/// BEEFY validator signature used by given Substrate chain.
|
||||
pub type BeefyAuthoritySetInfoOf<C> = pezsp_consensus_beefy::mmr::BeefyAuthoritySet<MmrHashOf<C>>;
|
||||
/// BEEFY validator signature used by given Bizinikiwi chain.
|
||||
pub type BeefyValidatorSignatureOf<C> =
|
||||
<<C as ChainWithBeefy>::AuthorityId as RuntimeAppPublic>::Signature;
|
||||
/// Signed BEEFY commitment used by given Substrate chain.
|
||||
/// Signed BEEFY commitment used by given Bizinikiwi chain.
|
||||
pub type BeefySignedCommitmentOf<C> =
|
||||
SignedCommitment<BlockNumberOf<C>, BeefyValidatorSignatureOf<C>>;
|
||||
/// Hash algorithm, used to compute the digest of the BEEFY commitment before signing it.
|
||||
pub type BeefyCommitmentHasher<C> = <C as ChainWithBeefy>::CommitmentHasher;
|
||||
/// Hash algorithm used in Beefy MMR construction by given Substrate chain.
|
||||
/// Hash algorithm used in Beefy MMR construction by given Bizinikiwi chain.
|
||||
pub type MmrHashingOf<C> = <C as ChainWithBeefy>::MmrHashing;
|
||||
/// Hash type, used in MMR construction by given Substrate chain.
|
||||
/// Hash type, used in MMR construction by given Bizinikiwi chain.
|
||||
pub type MmrHashOf<C> = <C as ChainWithBeefy>::MmrHash;
|
||||
/// BEEFY MMR proof type used by the given Substrate chain.
|
||||
/// BEEFY MMR proof type used by the given Bizinikiwi chain.
|
||||
pub type MmrProofOf<C> = MmrProof<MmrHashOf<C>>;
|
||||
/// The type of the MMR leaf extra data used by the given Substrate chain.
|
||||
/// The type of the MMR leaf extra data used by the given Bizinikiwi chain.
|
||||
pub type BeefyMmrLeafExtraOf<C> = <C as ChainWithBeefy>::BeefyMmrLeafExtra;
|
||||
/// A way to convert a validator id to its raw representation in the BEEFY merkle tree, used by
|
||||
/// the given Substrate chain.
|
||||
/// the given Bizinikiwi chain.
|
||||
pub type BeefyAuthorityIdToMerkleLeafOf<C> = <C as ChainWithBeefy>::AuthorityIdToMerkleLeaf;
|
||||
/// Actual type of leafs in the BEEFY MMR.
|
||||
pub type BeefyMmrLeafOf<C> = sp_consensus_beefy::mmr::MmrLeaf<
|
||||
pub type BeefyMmrLeafOf<C> = pezsp_consensus_beefy::mmr::MmrLeaf<
|
||||
BlockNumberOf<C>,
|
||||
HashOf<C>,
|
||||
MmrHashOf<C>,
|
||||
|
||||
@@ -19,12 +19,12 @@ serde = { features = ["alloc", "derive"], workspace = true }
|
||||
# Bridge dependencies
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
frame-support = { workspace = true }
|
||||
sp-consensus-grandpa = { features = ["serde"], workspace = true }
|
||||
sp-core = { features = ["serde"], workspace = true }
|
||||
sp-runtime = { features = ["serde"], workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi Dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezsp-consensus-grandpa = { features = ["serde"], workspace = true }
|
||||
pezsp-core = { features = ["serde"], workspace = true }
|
||||
pezsp-runtime = { features = ["serde"], workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
bp-test-utils = { workspace = true, default-features = true }
|
||||
@@ -37,18 +37,18 @@ std = [
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"finality-grandpa/std",
|
||||
"frame-support/std",
|
||||
"pezframe-support/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"sp-consensus-grandpa/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"pezsp-consensus-grandpa/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"bp-test-utils/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"sp-consensus-grandpa/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezsp-consensus-grandpa/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -14,23 +14,23 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Defines structures related to calls of the `pallet-bridge-grandpa` pallet.
|
||||
//! Defines structures related to calls of the `pezpallet-bridge-grandpa` pallet.
|
||||
|
||||
use crate::{justification, InitializationData};
|
||||
|
||||
use bp_runtime::HeaderOf;
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{weights::Weight, RuntimeDebugNoBound};
|
||||
use pezframe_support::{weights::Weight, RuntimeDebugNoBound};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_consensus_grandpa::SetId;
|
||||
use sp_runtime::traits::{Header as HeaderT, Zero};
|
||||
use sp_std::{boxed::Box, fmt::Debug};
|
||||
use pezsp_consensus_grandpa::SetId;
|
||||
use pezsp_runtime::traits::{Header as HeaderT, Zero};
|
||||
use pezsp_std::{boxed::Box, fmt::Debug};
|
||||
|
||||
/// A minimized version of `pallet-bridge-grandpa::Call` that can be used without a runtime.
|
||||
/// A minimized version of `pezpallet-bridge-grandpa::Call` that can be used without a runtime.
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum BridgeGrandpaCall<Header: HeaderT> {
|
||||
/// `pallet-bridge-grandpa::Call::submit_finality_proof`
|
||||
/// `pezpallet-bridge-grandpa::Call::submit_finality_proof`
|
||||
#[codec(index = 0)]
|
||||
submit_finality_proof {
|
||||
/// The header that we are going to finalize.
|
||||
@@ -38,13 +38,13 @@ pub enum BridgeGrandpaCall<Header: HeaderT> {
|
||||
/// Finality justification for the `finality_target`.
|
||||
justification: justification::GrandpaJustification<Header>,
|
||||
},
|
||||
/// `pallet-bridge-grandpa::Call::initialize`
|
||||
/// `pezpallet-bridge-grandpa::Call::initialize`
|
||||
#[codec(index = 1)]
|
||||
initialize {
|
||||
/// All data, required to initialize the pallet.
|
||||
init_data: InitializationData<Header>,
|
||||
},
|
||||
/// `pallet-bridge-grandpa::Call::submit_finality_proof_ex`
|
||||
/// `pezpallet-bridge-grandpa::Call::submit_finality_proof_ex`
|
||||
#[codec(index = 4)]
|
||||
submit_finality_proof_ex {
|
||||
/// The header that we are going to finalize.
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! Logic for checking GRANDPA Finality Proofs.
|
||||
//!
|
||||
//! Adapted copy of substrate/client/finality-grandpa/src/justification.rs. If origin
|
||||
//! will ever be moved to the sp_consensus_grandpa, we should reuse that implementation.
|
||||
//! Adapted copy of bizinikiwi/client/finality-grandpa/src/justification.rs. If origin
|
||||
//! will ever be moved to the pezsp_consensus_grandpa, we should reuse that implementation.
|
||||
|
||||
mod verification;
|
||||
|
||||
@@ -33,9 +33,9 @@ pub use verification::{
|
||||
use bp_runtime::{BlockNumberOf, Chain, HashOf, HeaderId};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthoritySignature};
|
||||
use sp_runtime::{traits::Header as HeaderT, RuntimeDebug, SaturatedConversion};
|
||||
use sp_std::prelude::*;
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthoritySignature};
|
||||
use pezsp_runtime::{traits::Header as HeaderT, RuntimeDebug, SaturatedConversion};
|
||||
use pezsp_std::prelude::*;
|
||||
|
||||
/// A GRANDPA Justification is a proof that a given header was finalized
|
||||
/// at a certain height and with a certain set of authorities.
|
||||
|
||||
@@ -29,9 +29,9 @@ use crate::{
|
||||
};
|
||||
|
||||
use bp_runtime::{BlockNumberOf, HashOf, HeaderOf};
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, EquivocationProof, Precommit};
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_std::{
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthoritySignature, EquivocationProof, Precommit};
|
||||
use pezsp_runtime::traits::Header as HeaderT;
|
||||
use pezsp_std::{
|
||||
collections::{btree_map::BTreeMap, btree_set::BTreeSet},
|
||||
prelude::*,
|
||||
vec,
|
||||
@@ -93,7 +93,7 @@ impl<'a, Header: HeaderT> EquivocationsCollector<'a, Header> {
|
||||
if let AuthorityVotes::Equivocation(equivocation) = vote {
|
||||
equivocations.push(EquivocationProof::new(
|
||||
self.context.authority_set_id,
|
||||
sp_consensus_grandpa::Equivocation::Precommit(equivocation),
|
||||
pezsp_consensus_grandpa::Equivocation::Precommit(equivocation),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ impl<'a, Header: HeaderT> JustificationVerifier<Header> for EquivocationsCollect
|
||||
}
|
||||
|
||||
/// Helper struct for finding equivocations in GRANDPA proofs.
|
||||
pub struct GrandpaEquivocationsFinder<C>(sp_std::marker::PhantomData<C>);
|
||||
pub struct GrandpaEquivocationsFinder<C>(pezsp_std::marker::PhantomData<C>);
|
||||
|
||||
impl<C: ChainWithGrandpa>
|
||||
FindEquivocations<
|
||||
|
||||
@@ -24,9 +24,9 @@ use crate::{justification::GrandpaJustification, AuthoritySet};
|
||||
|
||||
use bp_runtime::HeaderId;
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, SetId};
|
||||
use sp_runtime::{traits::Header as HeaderT, RuntimeDebug};
|
||||
use sp_std::{
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthoritySignature, SetId};
|
||||
use pezsp_runtime::{traits::Header as HeaderT, RuntimeDebug};
|
||||
use pezsp_std::{
|
||||
collections::{
|
||||
btree_map::{
|
||||
BTreeMap,
|
||||
@@ -299,7 +299,7 @@ trait JustificationVerifier<Header: HeaderT> {
|
||||
}
|
||||
|
||||
// verify authority signature
|
||||
if !sp_consensus_grandpa::check_message_signature_with_buffer(
|
||||
if !pezsp_consensus_grandpa::check_message_signature_with_buffer(
|
||||
&finality_grandpa::Message::Precommit(signed.precommit.clone()),
|
||||
&signed.id,
|
||||
&signed.signature,
|
||||
|
||||
@@ -24,9 +24,9 @@ use crate::justification::{
|
||||
use crate::justification::verification::{
|
||||
IterationFlow, JustificationVerificationContext, SignedPrecommit,
|
||||
};
|
||||
use sp_consensus_grandpa::AuthorityId;
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_std::{collections::btree_set::BTreeSet, prelude::*, vec, vec::Vec};
|
||||
use pezsp_consensus_grandpa::AuthorityId;
|
||||
use pezsp_runtime::traits::Header as HeaderT;
|
||||
use pezsp_std::{collections::btree_set::BTreeSet, prelude::*, vec, vec::Vec};
|
||||
|
||||
// Verification callbacks for justification optimization.
|
||||
struct JustificationOptimizer<Header: HeaderT> {
|
||||
|
||||
@@ -24,9 +24,9 @@ use crate::justification::{
|
||||
use crate::justification::verification::{
|
||||
IterationFlow, JustificationVerificationContext, SignedPrecommit,
|
||||
};
|
||||
use sp_consensus_grandpa::AuthorityId;
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_std::{collections::btree_set::BTreeSet, vec::Vec};
|
||||
use pezsp_consensus_grandpa::AuthorityId;
|
||||
use pezsp_runtime::traits::Header as HeaderT;
|
||||
use pezsp_std::{collections::btree_set::BTreeSet, vec::Vec};
|
||||
|
||||
/// Verification callbacks that reject all unknown, duplicate or redundant votes.
|
||||
struct StrictJustificationVerifier {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Defines traits which represent a common interface for Substrate pallets which want to
|
||||
//! Defines traits which represent a common interface for Bizinikiwi pallets which want to
|
||||
//! incorporate bridge functionality.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
@@ -29,14 +29,14 @@ use bp_runtime::{
|
||||
};
|
||||
use codec::{Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::{clone::Clone, cmp::Eq, default::Default, fmt::Debug};
|
||||
use frame_support::PalletError;
|
||||
use pezframe_support::PalletError;
|
||||
use scale_info::TypeInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_consensus_grandpa::{
|
||||
use pezsp_consensus_grandpa::{
|
||||
AuthorityList, ConsensusLog, ScheduledChange, SetId, GRANDPA_ENGINE_ID,
|
||||
};
|
||||
use sp_runtime::{traits::Header as HeaderT, Digest, RuntimeDebug, SaturatedConversion};
|
||||
use sp_std::{boxed::Box, vec::Vec};
|
||||
use pezsp_runtime::{traits::Header as HeaderT, Digest, RuntimeDebug, SaturatedConversion};
|
||||
use pezsp_std::{boxed::Box, vec::Vec};
|
||||
|
||||
pub use call_info::{BridgeGrandpaCall, BridgeGrandpaCallOf, SubmitFinalityProofInfo};
|
||||
|
||||
@@ -80,7 +80,7 @@ impl<H: HeaderT> StoredHeaderDataBuilder<H::Number, H::Hash> for H {
|
||||
}
|
||||
}
|
||||
|
||||
/// Substrate header chain, abstracted from the way it is stored.
|
||||
/// Bizinikiwi header chain, abstracted from the way it is stored.
|
||||
pub trait HeaderChain<C: Chain> {
|
||||
/// Returns state (storage) root of given finalized header.
|
||||
fn finalized_header_state_root(header_hash: HashOf<C>) -> Option<HashOf<C>>;
|
||||
@@ -164,12 +164,12 @@ pub trait ConsensusLogReader {
|
||||
}
|
||||
|
||||
/// A struct that provides helper methods for querying the GRANDPA consensus log.
|
||||
pub struct GrandpaConsensusLogReader<Number>(sp_std::marker::PhantomData<Number>);
|
||||
pub struct GrandpaConsensusLogReader<Number>(pezsp_std::marker::PhantomData<Number>);
|
||||
|
||||
impl<Number: Codec> GrandpaConsensusLogReader<Number> {
|
||||
/// Find and return scheduled (regular) change digest item.
|
||||
pub fn find_scheduled_change(digest: &Digest) -> Option<ScheduledChange<Number>> {
|
||||
use sp_runtime::generic::OpaqueDigestItemId;
|
||||
use pezsp_runtime::generic::OpaqueDigestItemId;
|
||||
let id = OpaqueDigestItemId::Consensus(&GRANDPA_ENGINE_ID);
|
||||
|
||||
let filter_log = |log: ConsensusLog<Number>| match log {
|
||||
@@ -246,7 +246,7 @@ pub trait FindEquivocations<FinalityProof, FinalityVerificationContext, Equivoca
|
||||
) -> Result<Vec<EquivocationProof>, Self::Error>;
|
||||
}
|
||||
|
||||
/// Substrate-based chain that is using direct GRANDPA finality.
|
||||
/// Bizinikiwi-based chain that is using direct GRANDPA finality.
|
||||
///
|
||||
/// Keep in mind that teyrchains are relying on relay chain GRANDPA, so they should not implement
|
||||
/// this trait.
|
||||
@@ -394,8 +394,8 @@ pub fn max_expected_submit_finality_proof_arguments_size<C: ChainWithGrandpa>(
|
||||
mod tests {
|
||||
use super::*;
|
||||
use bp_runtime::ChainId;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_runtime::{
|
||||
use pezframe_support::weights::Weight;
|
||||
use pezsp_runtime::{
|
||||
testing::H256, traits::BlakeTwo256, DigestItem, MultiSignature, StateVersion,
|
||||
};
|
||||
|
||||
@@ -407,7 +407,7 @@ mod tests {
|
||||
type BlockNumber = u32;
|
||||
type Hash = H256;
|
||||
type Hasher = BlakeTwo256;
|
||||
type Header = sp_runtime::generic::Header<u32, BlakeTwo256>;
|
||||
type Header = pezsp_runtime::generic::Header<u32, BlakeTwo256>;
|
||||
type AccountId = u64;
|
||||
type Balance = u64;
|
||||
type Nonce = u64;
|
||||
|
||||
@@ -23,13 +23,13 @@ pub const BEST_FINALIZED_VALUE_NAME: &str = "BestFinalized";
|
||||
/// Name of the `CurrentAuthoritySet` storage value.
|
||||
pub const CURRENT_AUTHORITY_SET_VALUE_NAME: &str = "CurrentAuthoritySet";
|
||||
|
||||
use sp_core::storage::StorageKey;
|
||||
use pezsp_core::storage::StorageKey;
|
||||
|
||||
/// Storage key of the `PalletOperatingMode` variable in the runtime storage.
|
||||
pub fn pallet_operating_mode_key(pallet_prefix: &str) -> StorageKey {
|
||||
pub fn pezpallet_operating_mode_key(pezpallet_prefix: &str) -> StorageKey {
|
||||
StorageKey(
|
||||
bp_runtime::storage_value_final_key(
|
||||
pallet_prefix.as_bytes(),
|
||||
pezpallet_prefix.as_bytes(),
|
||||
PALLET_OPERATING_MODE_VALUE_NAME.as_bytes(),
|
||||
)
|
||||
.to_vec(),
|
||||
@@ -37,10 +37,10 @@ pub fn pallet_operating_mode_key(pallet_prefix: &str) -> StorageKey {
|
||||
}
|
||||
|
||||
/// Storage key of the `CurrentAuthoritySet` variable in the runtime storage.
|
||||
pub fn current_authority_set_key(pallet_prefix: &str) -> StorageKey {
|
||||
pub fn current_authority_set_key(pezpallet_prefix: &str) -> StorageKey {
|
||||
StorageKey(
|
||||
bp_runtime::storage_value_final_key(
|
||||
pallet_prefix.as_bytes(),
|
||||
pezpallet_prefix.as_bytes(),
|
||||
CURRENT_AUTHORITY_SET_VALUE_NAME.as_bytes(),
|
||||
)
|
||||
.to_vec(),
|
||||
@@ -48,10 +48,10 @@ pub fn current_authority_set_key(pallet_prefix: &str) -> StorageKey {
|
||||
}
|
||||
|
||||
/// Storage key of the best finalized header number and hash value in the runtime storage.
|
||||
pub fn best_finalized_key(pallet_prefix: &str) -> StorageKey {
|
||||
pub fn best_finalized_key(pezpallet_prefix: &str) -> StorageKey {
|
||||
StorageKey(
|
||||
bp_runtime::storage_value_final_key(
|
||||
pallet_prefix.as_bytes(),
|
||||
pezpallet_prefix.as_bytes(),
|
||||
BEST_FINALIZED_VALUE_NAME.as_bytes(),
|
||||
)
|
||||
.to_vec(),
|
||||
@@ -64,10 +64,10 @@ mod tests {
|
||||
use hex_literal::hex;
|
||||
|
||||
#[test]
|
||||
fn pallet_operating_mode_key_computed_properly() {
|
||||
fn pezpallet_operating_mode_key_computed_properly() {
|
||||
// If this test fails, then something has been changed in module storage that is breaking
|
||||
// compatibility with previous pallet.
|
||||
let storage_key = pallet_operating_mode_key("BridgeGrandpa").0;
|
||||
let storage_key = pezpallet_operating_mode_key("BridgeGrandpa").0;
|
||||
assert_eq!(
|
||||
storage_key,
|
||||
hex!("0b06f475eddb98cf933a12262e0388de0f4cf0917788d791142ff6c1f216e7b3").to_vec(),
|
||||
|
||||
@@ -30,10 +30,10 @@ use bp_test_utils::{
|
||||
JustificationGeneratorParams, ALICE, BOB, CHARLIE, DAVE, EVE, FERDIE, TEST_GRANDPA_SET_ID,
|
||||
};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthorityWeight, SetId};
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthorityWeight, SetId};
|
||||
use pezsp_runtime::traits::Header as HeaderT;
|
||||
|
||||
type TestHeader = sp_runtime::testing::Header;
|
||||
type TestHeader = pezsp_runtime::testing::Header;
|
||||
type TestHash = <TestHeader as HeaderT>::Hash;
|
||||
type TestNumber = <TestHeader as HeaderT>::Number;
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
use bp_header_chain::justification::EquivocationsCollector;
|
||||
use bp_test_utils::*;
|
||||
use finality_grandpa::Precommit;
|
||||
use sp_consensus_grandpa::EquivocationProof;
|
||||
use pezsp_consensus_grandpa::EquivocationProof;
|
||||
|
||||
type TestHeader = sp_runtime::testing::Header;
|
||||
type TestHeader = pezsp_runtime::testing::Header;
|
||||
|
||||
#[test]
|
||||
fn duplicate_votes_are_not_considered_equivocations() {
|
||||
@@ -56,7 +56,7 @@ fn equivocations_are_detected_in_base_justification_redundant_votes() {
|
||||
collector.into_equivocation_proofs(),
|
||||
vec![EquivocationProof::new(
|
||||
1,
|
||||
sp_consensus_grandpa::Equivocation::Precommit(finality_grandpa::Equivocation {
|
||||
pezsp_consensus_grandpa::Equivocation::Precommit(finality_grandpa::Equivocation {
|
||||
round_number: 1,
|
||||
identity: ALICE.into(),
|
||||
first: (
|
||||
@@ -101,7 +101,7 @@ fn equivocations_are_detected_in_extra_justification_redundant_votes() {
|
||||
collector.into_equivocation_proofs(),
|
||||
vec![EquivocationProof::new(
|
||||
1,
|
||||
sp_consensus_grandpa::Equivocation::Precommit(finality_grandpa::Equivocation {
|
||||
pezsp_consensus_grandpa::Equivocation::Precommit(finality_grandpa::Equivocation {
|
||||
round_number: 1,
|
||||
identity: ALICE.into(),
|
||||
first: (
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
use bp_header_chain::justification::verify_and_optimize_justification;
|
||||
use bp_test_utils::*;
|
||||
use finality_grandpa::SignedPrecommit;
|
||||
use sp_consensus_grandpa::AuthoritySignature;
|
||||
use pezsp_consensus_grandpa::AuthoritySignature;
|
||||
|
||||
type TestHeader = sp_runtime::testing::Header;
|
||||
type TestHeader = pezsp_runtime::testing::Header;
|
||||
|
||||
#[test]
|
||||
fn optimizer_does_noting_with_minimal_justification() {
|
||||
|
||||
@@ -22,7 +22,7 @@ use bp_header_chain::justification::{
|
||||
};
|
||||
use bp_test_utils::*;
|
||||
|
||||
type TestHeader = sp_runtime::testing::Header;
|
||||
type TestHeader = pezsp_runtime::testing::Header;
|
||||
|
||||
#[test]
|
||||
fn valid_justification_accepted() {
|
||||
@@ -74,7 +74,7 @@ fn valid_justification_accepted_with_single_fork() {
|
||||
#[test]
|
||||
fn valid_justification_accepted_with_arbitrary_number_of_authorities() {
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use sp_consensus_grandpa::AuthorityId;
|
||||
use pezsp_consensus_grandpa::AuthorityId;
|
||||
|
||||
let n = 15;
|
||||
let required_signatures = required_justification_precommits(n as _);
|
||||
@@ -136,7 +136,7 @@ fn justification_with_invalid_commit_rejected() {
|
||||
fn justification_with_invalid_authority_signature_rejected() {
|
||||
let mut justification = make_default_justification::<TestHeader>(&test_header(1));
|
||||
justification.commit.precommits[0].signature =
|
||||
sp_core::crypto::UncheckedFrom::unchecked_from([1u8; 64]);
|
||||
pezsp_core::crypto::UncheckedFrom::unchecked_from([1u8; 64]);
|
||||
|
||||
assert_eq!(
|
||||
verify_justification::<TestHeader>(
|
||||
|
||||
@@ -19,11 +19,11 @@ serde = { features = ["alloc", "derive"], workspace = true }
|
||||
bp-header-chain = { workspace = true }
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
frame-support = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-io = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi Dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-io = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex = { workspace = true, default-features = true }
|
||||
@@ -35,16 +35,16 @@ std = [
|
||||
"bp-header-chain/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"pezframe-support/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"sp-core/std",
|
||||
"sp-io/std",
|
||||
"sp-std/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-header-chain/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"sp-io/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -14,21 +14,21 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Defines structures related to calls of the `pallet-bridge-messages` pallet.
|
||||
//! Defines structures related to calls of the `pezpallet-bridge-messages` pallet.
|
||||
|
||||
use crate::{MessageNonce, UnrewardedRelayersState};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::weights::Weight;
|
||||
use pezframe_support::weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_std::ops::RangeInclusive;
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_std::ops::RangeInclusive;
|
||||
|
||||
/// A minimized version of `pallet-bridge-messages::Call` that can be used without a runtime.
|
||||
/// A minimized version of `pezpallet-bridge-messages::Call` that can be used without a runtime.
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum BridgeMessagesCall<AccountId, MessagesProof, MessagesDeliveryProof> {
|
||||
/// `pallet-bridge-messages::Call::receive_messages_proof`
|
||||
/// `pezpallet-bridge-messages::Call::receive_messages_proof`
|
||||
#[codec(index = 2)]
|
||||
receive_messages_proof {
|
||||
/// Account id of relayer at the **bridged** chain.
|
||||
@@ -40,7 +40,7 @@ pub enum BridgeMessagesCall<AccountId, MessagesProof, MessagesDeliveryProof> {
|
||||
/// Total dispatch weight of messages in the proof.
|
||||
dispatch_weight: Weight,
|
||||
},
|
||||
/// `pallet-bridge-messages::Call::receive_messages_delivery_proof`
|
||||
/// `pezpallet-bridge-messages::Call::receive_messages_delivery_proof`
|
||||
#[codec(index = 3)]
|
||||
receive_messages_delivery_proof {
|
||||
/// Messages delivery proof.
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
use codec::{Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use sp_core::{RuntimeDebug, TypeId, H256};
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_std::fmt::Debug;
|
||||
use pezsp_core::{RuntimeDebug, TypeId, H256};
|
||||
use pezsp_io::hashing::blake2_256;
|
||||
use pezsp_std::fmt::Debug;
|
||||
|
||||
/// Trait representing a generic `LaneId` type.
|
||||
pub trait LaneIdType:
|
||||
|
||||
@@ -25,14 +25,14 @@ use bp_runtime::{
|
||||
StorageProofError, UnderlyingChainOf, UnderlyingChainProvider,
|
||||
};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use frame_support::PalletError;
|
||||
// Weight is reexported to avoid additional frame-support dependencies in related crates.
|
||||
pub use frame_support::weights::Weight;
|
||||
use pezframe_support::PalletError;
|
||||
// Weight is reexported to avoid additional pezframe-support dependencies in related crates.
|
||||
pub use pezframe_support::weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use source_chain::RelayersRewards;
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_std::{collections::vec_deque::VecDeque, ops::RangeInclusive, prelude::*};
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_std::{collections::vec_deque::VecDeque, ops::RangeInclusive, prelude::*};
|
||||
|
||||
pub use call_info::{
|
||||
BaseMessagesProofInfo, BridgeMessagesCall, MessagesCallInfo, ReceiveMessagesDeliveryProofInfo,
|
||||
@@ -49,7 +49,7 @@ pub mod target_chain;
|
||||
/// Hard limit on message size that can be sent over the bridge.
|
||||
pub const HARD_MESSAGE_SIZE_LIMIT: u32 = 64 * 1024;
|
||||
|
||||
/// Substrate-based chain with messaging support.
|
||||
/// Bizinikiwi-based chain with messaging support.
|
||||
pub trait ChainWithMessages: Chain {
|
||||
/// Name of the bridge messages pallet (used in `construct_runtime` macro call) that is
|
||||
/// deployed at some other chain to bridge with this `ChainWithMessages`.
|
||||
@@ -98,9 +98,9 @@ pub trait ChainWithMessages: Chain {
|
||||
|
||||
/// Return maximal size of the message the chain with `max_extrinsic_size` is able to receive.
|
||||
pub fn maximal_incoming_message_size(max_extrinsic_size: u32) -> u32 {
|
||||
// The maximal size of extrinsic at Substrate-based chain depends on the
|
||||
// `frame_system::Config::MaximumBlockLength` and
|
||||
// `frame_system::Config::AvailableBlockRatio` constants. This check is here to be sure that
|
||||
// The maximal size of extrinsic at Bizinikiwi-based chain depends on the
|
||||
// `pezframe_system::Config::MaximumBlockLength` and
|
||||
// `pezframe_system::Config::AvailableBlockRatio` constants. This check is here to be sure that
|
||||
// the lane won't stuck because message is too large to fit into delivery transaction.
|
||||
//
|
||||
// **IMPORTANT NOTE**: the delivery transaction contains storage proof of the message, not
|
||||
@@ -115,7 +115,7 @@ pub fn maximal_incoming_message_size(max_extrinsic_size: u32) -> u32 {
|
||||
// limit the **weight** (not the size) of the message will be higher than the
|
||||
// `Self::maximal_incoming_message_dispatch_weight()`.
|
||||
|
||||
sp_std::cmp::min(max_extrinsic_size / 3 * 2, HARD_MESSAGE_SIZE_LIMIT)
|
||||
pezsp_std::cmp::min(max_extrinsic_size / 3 * 2, HARD_MESSAGE_SIZE_LIMIT)
|
||||
}
|
||||
|
||||
impl<T> ChainWithMessages for T
|
||||
@@ -510,14 +510,14 @@ pub fn calc_relayers_rewards<AccountId>(
|
||||
received_range: &RangeInclusive<MessageNonce>,
|
||||
) -> RelayersRewards<AccountId>
|
||||
where
|
||||
AccountId: sp_std::cmp::Ord,
|
||||
AccountId: pezsp_std::cmp::Ord,
|
||||
{
|
||||
// remember to reward relayers that have delivered messages
|
||||
// this loop is bounded by `T::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX` on the bridged chain
|
||||
let mut relayers_rewards = RelayersRewards::new();
|
||||
for entry in messages_relayers {
|
||||
let nonce_begin = sp_std::cmp::max(entry.messages.begin, *received_range.start());
|
||||
let nonce_end = sp_std::cmp::min(entry.messages.end, *received_range.end());
|
||||
let nonce_begin = pezsp_std::cmp::max(entry.messages.begin, *received_range.start());
|
||||
let nonce_end = pezsp_std::cmp::min(entry.messages.end, *received_range.end());
|
||||
if nonce_end >= nonce_begin {
|
||||
*relayers_rewards.entry(entry.relayer).or_default() += nonce_end - nonce_begin + 1;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ use crate::{MessageNonce, UnrewardedRelayer};
|
||||
use bp_runtime::{raw_storage_proof_size, RawStorageProof, Size};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_std::{
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_std::{
|
||||
collections::{btree_map::BTreeMap, vec_deque::VecDeque},
|
||||
fmt::Debug,
|
||||
ops::RangeInclusive,
|
||||
@@ -52,7 +52,7 @@ impl<BridgedHeaderHash, LaneId> Size
|
||||
for FromBridgedChainMessagesDeliveryProof<BridgedHeaderHash, LaneId>
|
||||
{
|
||||
fn size(&self) -> u32 {
|
||||
use frame_support::sp_runtime::SaturatedConversion;
|
||||
use pezframe_support::pezsp_runtime::SaturatedConversion;
|
||||
raw_storage_proof_size(&self.storage_proof).saturated_into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@ pub const INBOUND_LANES_MAP_NAME: &str = "InboundLanes";
|
||||
use crate::{MessageKey, MessageNonce};
|
||||
|
||||
use codec::Encode;
|
||||
use frame_support::Blake2_128Concat;
|
||||
use sp_core::storage::StorageKey;
|
||||
use pezframe_support::Blake2_128Concat;
|
||||
use pezsp_core::storage::StorageKey;
|
||||
|
||||
/// Storage key of the `PalletOperatingMode` value in the runtime storage.
|
||||
pub fn operating_mode_key(pallet_prefix: &str) -> StorageKey {
|
||||
pub fn operating_mode_key(pezpallet_prefix: &str) -> StorageKey {
|
||||
StorageKey(
|
||||
bp_runtime::storage_value_final_key(
|
||||
pallet_prefix.as_bytes(),
|
||||
pezpallet_prefix.as_bytes(),
|
||||
OPERATING_MODE_VALUE_NAME.as_bytes(),
|
||||
)
|
||||
.to_vec(),
|
||||
@@ -44,30 +44,30 @@ pub fn operating_mode_key(pallet_prefix: &str) -> StorageKey {
|
||||
|
||||
/// Storage key of the outbound message in the runtime storage.
|
||||
pub fn message_key<LaneId: Encode>(
|
||||
pallet_prefix: &str,
|
||||
pezpallet_prefix: &str,
|
||||
lane: LaneId,
|
||||
nonce: MessageNonce,
|
||||
) -> StorageKey {
|
||||
bp_runtime::storage_map_final_key::<Blake2_128Concat>(
|
||||
pallet_prefix,
|
||||
pezpallet_prefix,
|
||||
OUTBOUND_MESSAGES_MAP_NAME,
|
||||
&MessageKey { lane_id: lane, nonce }.encode(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the outbound message lane state in the runtime storage.
|
||||
pub fn outbound_lane_data_key<LaneId: Encode>(pallet_prefix: &str, lane: &LaneId) -> StorageKey {
|
||||
pub fn outbound_lane_data_key<LaneId: Encode>(pezpallet_prefix: &str, lane: &LaneId) -> StorageKey {
|
||||
bp_runtime::storage_map_final_key::<Blake2_128Concat>(
|
||||
pallet_prefix,
|
||||
pezpallet_prefix,
|
||||
OUTBOUND_LANES_MAP_NAME,
|
||||
&lane.encode(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Storage key of the inbound message lane state in the runtime storage.
|
||||
pub fn inbound_lane_data_key<LaneId: Encode>(pallet_prefix: &str, lane: &LaneId) -> StorageKey {
|
||||
pub fn inbound_lane_data_key<LaneId: Encode>(pezpallet_prefix: &str, lane: &LaneId) -> StorageKey {
|
||||
bp_runtime::storage_map_final_key::<Blake2_128Concat>(
|
||||
pallet_prefix,
|
||||
pezpallet_prefix,
|
||||
INBOUND_LANES_MAP_NAME,
|
||||
&lane.encode(),
|
||||
)
|
||||
|
||||
@@ -20,10 +20,10 @@ use crate::{Message, MessageKey, MessageNonce, MessagePayload, OutboundLaneData}
|
||||
|
||||
use bp_runtime::{messages::MessageDispatchResult, raw_storage_proof_size, RawStorageProof, Size};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, Error as CodecError};
|
||||
use frame_support::weights::Weight;
|
||||
use pezframe_support::weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_std::{fmt::Debug, marker::PhantomData, prelude::*};
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_std::{fmt::Debug, marker::PhantomData, prelude::*};
|
||||
|
||||
/// Messages proof from bridged chain.
|
||||
///
|
||||
@@ -53,7 +53,7 @@ pub struct FromBridgedChainMessagesProof<BridgedHeaderHash, Lane> {
|
||||
|
||||
impl<BridgedHeaderHash, Lane> Size for FromBridgedChainMessagesProof<BridgedHeaderHash, Lane> {
|
||||
fn size(&self) -> u32 {
|
||||
use frame_support::sp_runtime::SaturatedConversion;
|
||||
use pezframe_support::pezsp_runtime::SaturatedConversion;
|
||||
raw_storage_proof_size(&self.storage_proof).saturated_into()
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ pub trait MessageDispatch {
|
||||
type DispatchPayload: Decode;
|
||||
|
||||
/// Fine-grained result of single message dispatch (for better diagnostic purposes)
|
||||
type DispatchLevelResult: Clone + sp_std::fmt::Debug + Eq;
|
||||
type DispatchLevelResult: Clone + pezsp_std::fmt::Debug + Eq;
|
||||
|
||||
/// Lane identifier type.
|
||||
type LaneId: Encode;
|
||||
|
||||
@@ -21,12 +21,12 @@ serde = { optional = true, features = [
|
||||
bp-messages = { workspace = true }
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate Based Dependencies
|
||||
frame-support = { workspace = true }
|
||||
frame-system = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi Based Dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex = { workspace = true, default-features = true }
|
||||
@@ -37,18 +37,18 @@ std = [
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-messages/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -29,7 +29,7 @@ use bp_runtime::{
|
||||
},
|
||||
EncodedOrDecodedCall, StorageMapKeyProvider, TransactionEra,
|
||||
};
|
||||
use frame_support::{
|
||||
use pezframe_support::{
|
||||
dispatch::DispatchClass,
|
||||
parameter_types,
|
||||
weights::{
|
||||
@@ -38,18 +38,18 @@ use frame_support::{
|
||||
},
|
||||
Blake2_128Concat,
|
||||
};
|
||||
use frame_system::limits;
|
||||
use sp_core::{storage::StorageKey, Hasher as HasherT};
|
||||
use sp_runtime::{
|
||||
use pezframe_system::limits;
|
||||
use pezsp_core::{storage::StorageKey, Hasher as HasherT};
|
||||
use pezsp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, IdentifyAccount, Verify},
|
||||
MultiAddress, MultiSignature, OpaqueExtrinsic,
|
||||
};
|
||||
use sp_std::prelude::Vec;
|
||||
use pezsp_std::prelude::Vec;
|
||||
|
||||
// Re-export's to avoid extra substrate dependencies in chain-specific crates.
|
||||
pub use frame_support::{weights::constants::ExtrinsicBaseWeight, Parameter};
|
||||
pub use sp_runtime::{traits::Convert, Perbill};
|
||||
// Re-export's to avoid extra bizinikiwi dependencies in chain-specific crates.
|
||||
pub use pezframe_support::{weights::constants::ExtrinsicBaseWeight, Parameter};
|
||||
pub use pezsp_runtime::{traits::Convert, Perbill};
|
||||
|
||||
pub mod teyrchains;
|
||||
|
||||
@@ -159,7 +159,7 @@ parameter_types! {
|
||||
.build_or_panic();
|
||||
}
|
||||
|
||||
// TODO [#78] may need to be updated after https://github.com/paritytech/parity-bridges-common/issues/78
|
||||
// TODO [#78] may need to be updated after https://github.com/pezkuwichain/kurdistan-sdk/issues/88
|
||||
/// Maximal number of messages in single delivery transaction.
|
||||
pub const MAX_MESSAGES_IN_DELIVERY_TRANSACTION: MessageNonce = 128;
|
||||
|
||||
@@ -256,7 +256,7 @@ pub fn max_extrinsic_weight() -> Weight {
|
||||
///
|
||||
/// We need to use this approach when we don't have access to the runtime.
|
||||
/// The equivalent command to invoke in case full `Runtime` is known is this:
|
||||
/// `let key = frame_system::Account::<Runtime>::storage_map_final_key(&account_id);`
|
||||
/// `let key = pezframe_system::Account::<Runtime>::storage_map_final_key(&account_id);`
|
||||
pub struct AccountInfoStorageMapKeyProvider;
|
||||
|
||||
impl StorageMapKeyProvider for AccountInfoStorageMapKeyProvider {
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
//!
|
||||
//! Even though this (bridges) repository references pezkuwi repository, we can't
|
||||
//! reference pezkuwi crates from pallets. That's because bridges repository is
|
||||
//! included in the Cumulus repository and included pallets are used by Cumulus
|
||||
//! included in the Pezcumulus repository and included pallets are used by Pezcumulus
|
||||
//! teyrchains. Having pallets that are referencing pezkuwi, would mean that there may
|
||||
//! be two versions of pezkuwi crates included in the runtime. Which is bad.
|
||||
|
||||
use bp_runtime::{raw_storage_proof_size, RawStorageProof, Size};
|
||||
use codec::{CompactAs, Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::Hasher;
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::vec::Vec;
|
||||
use pezsp_core::Hasher;
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use pezsp_std::vec::Vec;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -65,7 +65,7 @@ impl From<u32> for ParaId {
|
||||
///
|
||||
/// This is an equivalent of the `pezkuwi_teyrchain_primitives::HeadData`.
|
||||
///
|
||||
/// The teyrchain head means (at least in Cumulus) a SCALE-encoded teyrchain header.
|
||||
/// The teyrchain head means (at least in Pezcumulus) a SCALE-encoded teyrchain header.
|
||||
#[derive(
|
||||
PartialEq,
|
||||
Eq,
|
||||
@@ -85,7 +85,7 @@ pub struct ParaHead(pub Vec<u8>);
|
||||
impl ParaHead {
|
||||
/// Returns the hash of this head data.
|
||||
pub fn hash(&self) -> crate::Hash {
|
||||
sp_runtime::traits::BlakeTwo256::hash(&self.0)
|
||||
pezsp_runtime::traits::BlakeTwo256::hash(&self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ pub struct ParaHeadsProof {
|
||||
|
||||
impl Size for ParaHeadsProof {
|
||||
fn size(&self) -> u32 {
|
||||
use frame_support::sp_runtime::SaturatedConversion;
|
||||
use pezframe_support::pezsp_runtime::SaturatedConversion;
|
||||
raw_storage_proof_size(&self.storage_proof).saturated_into()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ bp-messages = { workspace = true }
|
||||
bp-runtime = { workspace = true }
|
||||
bp-teyrchains = { workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
frame-support = { workspace = true }
|
||||
frame-system = { workspace = true }
|
||||
pallet-utility = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi Dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
pezpallet-utility = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = { workspace = true, default-features = true }
|
||||
@@ -38,20 +38,20 @@ std = [
|
||||
"bp-runtime/std",
|
||||
"bp-teyrchains/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"pallet-utility/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"pezpallet-utility/std",
|
||||
"scale-info/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-header-chain/runtime-benchmarks",
|
||||
"bp-messages/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"bp-teyrchains/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezpallet-utility/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! All runtime calls, supported by `pallet-bridge-relayers` when it acts as a signed
|
||||
//! All runtime calls, supported by `pezpallet-bridge-relayers` when it acts as a signed
|
||||
//! extension.
|
||||
|
||||
use bp_header_chain::SubmitFinalityProofInfo;
|
||||
@@ -22,17 +22,17 @@ use bp_messages::MessagesCallInfo;
|
||||
use bp_runtime::StaticStrProvider;
|
||||
use bp_teyrchains::SubmitTeyrchainHeadsInfo;
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
use pezframe_support::{
|
||||
dispatch::CallableCallFor, traits::IsSubType, weights::Weight, RuntimeDebugNoBound,
|
||||
};
|
||||
use frame_system::Config as SystemConfig;
|
||||
use pallet_utility::{Call as UtilityCall, Pallet as UtilityPallet};
|
||||
use sp_runtime::{
|
||||
use pezframe_system::Config as SystemConfig;
|
||||
use pezpallet_utility::{Call as UtilityCall, Pallet as UtilityPallet};
|
||||
use pezsp_runtime::{
|
||||
traits::Get,
|
||||
transaction_validity::{TransactionPriority, TransactionValidityError},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use sp_std::{fmt::Debug, marker::PhantomData, vec, vec::Vec};
|
||||
use pezsp_std::{fmt::Debug, marker::PhantomData, vec, vec::Vec};
|
||||
|
||||
/// Type of the call that the signed extension recognizes.
|
||||
#[derive(PartialEq, RuntimeDebugNoBound)]
|
||||
@@ -113,7 +113,7 @@ pub struct ExtensionCallData {
|
||||
|
||||
/// Signed extension configuration.
|
||||
///
|
||||
/// The single `pallet-bridge-relayers` instance may be shared by multiple messages
|
||||
/// The single `pezpallet-bridge-relayers` instance may be shared by multiple messages
|
||||
/// pallet instances, bridging with different remote networks. We expect every instance
|
||||
/// of the messages pallet to add a separate signed extension to runtime. So it must
|
||||
/// have a separate configuration.
|
||||
@@ -122,7 +122,7 @@ pub trait ExtensionConfig {
|
||||
type IdProvider: StaticStrProvider;
|
||||
/// Runtime that optionally supports batched calls. We assume that batched call
|
||||
/// succeeds if and only if all of its nested calls succeed.
|
||||
type Runtime: frame_system::Config;
|
||||
type Runtime: pezframe_system::Config;
|
||||
/// Relayers pallet instance.
|
||||
type BridgeRelayersPalletInstance: 'static;
|
||||
/// Messages pallet instance.
|
||||
@@ -162,7 +162,7 @@ pub trait ExtensionConfig {
|
||||
}
|
||||
|
||||
/// Something that can unpack batch calls (all-or-nothing flavor) of given size.
|
||||
pub trait BatchCallUnpacker<Runtime: frame_system::Config> {
|
||||
pub trait BatchCallUnpacker<Runtime: pezframe_system::Config> {
|
||||
/// Unpack batch call with no more than `max_packed_calls` calls.
|
||||
fn unpack(call: &Runtime::RuntimeCall, max_packed_calls: u32) -> Vec<&Runtime::RuntimeCall>;
|
||||
}
|
||||
@@ -172,14 +172,14 @@ pub struct RuntimeWithUtilityPallet<Runtime>(PhantomData<Runtime>);
|
||||
|
||||
impl<Runtime> BatchCallUnpacker<Runtime> for RuntimeWithUtilityPallet<Runtime>
|
||||
where
|
||||
Runtime: pallet_utility::Config<RuntimeCall = <Runtime as SystemConfig>::RuntimeCall>,
|
||||
Runtime: pezpallet_utility::Config<RuntimeCall = <Runtime as SystemConfig>::RuntimeCall>,
|
||||
<Runtime as SystemConfig>::RuntimeCall:
|
||||
IsSubType<CallableCallFor<UtilityPallet<Runtime>, Runtime>>,
|
||||
{
|
||||
fn unpack(
|
||||
call: &<Runtime as frame_system::Config>::RuntimeCall,
|
||||
call: &<Runtime as pezframe_system::Config>::RuntimeCall,
|
||||
max_packed_calls: u32,
|
||||
) -> Vec<&<Runtime as frame_system::Config>::RuntimeCall> {
|
||||
) -> Vec<&<Runtime as pezframe_system::Config>::RuntimeCall> {
|
||||
match call.is_sub_type() {
|
||||
Some(UtilityCall::<Runtime>::batch_all { ref calls })
|
||||
if calls.len() <= max_packed_calls as usize =>
|
||||
@@ -190,7 +190,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<Runtime: frame_system::Config> BatchCallUnpacker<Runtime> for () {
|
||||
impl<Runtime: pezframe_system::Config> BatchCallUnpacker<Runtime> for () {
|
||||
fn unpack(call: &Runtime::RuntimeCall, _max_packed_calls: u32) -> Vec<&Runtime::RuntimeCall> {
|
||||
vec![call]
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ pub use extension::{
|
||||
pub use registration::{ExplicitOrAccountParams, Registration, StakeAndSlash};
|
||||
|
||||
use bp_runtime::{ChainId, StorageDoubleMapKeyProvider};
|
||||
use frame_support::{traits::tokens::Preservation, Blake2_128Concat, Identity};
|
||||
use pezframe_support::{traits::tokens::Preservation, Blake2_128Concat, Identity};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
use pezsp_runtime::{
|
||||
codec::{Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen},
|
||||
traits::AccountIdConversion,
|
||||
TypeId,
|
||||
};
|
||||
use sp_std::{fmt::Debug, marker::PhantomData};
|
||||
use pezsp_std::{fmt::Debug, marker::PhantomData};
|
||||
|
||||
mod extension;
|
||||
mod registration;
|
||||
@@ -164,12 +164,12 @@ impl<T, Relayer, LaneId, RewardBalance>
|
||||
PaymentProcedure<Relayer, RewardsAccountParams<LaneId>, RewardBalance>
|
||||
for PayRewardFromAccount<T, Relayer, LaneId, RewardBalance>
|
||||
where
|
||||
T: frame_support::traits::fungible::Mutate<Relayer>,
|
||||
T: pezframe_support::traits::fungible::Mutate<Relayer>,
|
||||
T::Balance: From<RewardBalance>,
|
||||
Relayer: Clone + Debug + Decode + Encode + Eq + TypeInfo,
|
||||
LaneId: Decode + Encode,
|
||||
{
|
||||
type Error = sp_runtime::DispatchError;
|
||||
type Error = pezsp_runtime::DispatchError;
|
||||
type Beneficiary = Relayer;
|
||||
|
||||
fn pay_reward(
|
||||
@@ -223,7 +223,7 @@ pub trait RewardLedger<Relayer, Reward, RewardBalance> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use bp_messages::{HashedLaneId, LaneIdType, LegacyLaneId};
|
||||
use sp_runtime::{app_crypto::Ss58Codec, testing::H256};
|
||||
use pezsp_runtime::{app_crypto::Ss58Codec, testing::H256};
|
||||
|
||||
#[test]
|
||||
fn different_lanes_are_using_different_accounts() {
|
||||
@@ -339,7 +339,7 @@ mod tests {
|
||||
for (lane_id, bridged_chain_id, owner, (expected_ss58, expected_account)) in test_data {
|
||||
assert_eq!(
|
||||
expected_account,
|
||||
sp_runtime::AccountId32::new(PayRewardFromAccount::<
|
||||
pezsp_runtime::AccountId32::new(PayRewardFromAccount::<
|
||||
[u8; 32],
|
||||
[u8; 32],
|
||||
LegacyLaneId,
|
||||
|
||||
@@ -41,7 +41,7 @@ use crate::{PayRewardFromAccount, RewardsAccountParams};
|
||||
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
use pezsp_runtime::{
|
||||
traits::{Get, IdentifyAccount, Zero},
|
||||
DispatchError, DispatchResult,
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ();
|
||||
|
||||
@@ -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())?,
|
||||
))
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "bp-test-utils"
|
||||
version = "0.7.0"
|
||||
description = "Utilities for testing substrate-based runtime bridge code"
|
||||
description = "Utilities for testing bizinikiwi-based runtime bridge code"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
@@ -18,12 +18,12 @@ bp-teyrchains = { workspace = true }
|
||||
codec = { workspace = true }
|
||||
ed25519-dalek = { workspace = true }
|
||||
finality-grandpa = { workspace = true }
|
||||
sp-application-crypto = { workspace = true }
|
||||
sp-consensus-grandpa = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
sp-trie = { workspace = true }
|
||||
pezsp-application-crypto = { workspace = true }
|
||||
pezsp-consensus-grandpa = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
pezsp-trie = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -35,19 +35,19 @@ std = [
|
||||
"codec/std",
|
||||
"ed25519-dalek/std",
|
||||
"finality-grandpa/std",
|
||||
"sp-application-crypto/std",
|
||||
"sp-consensus-grandpa/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"sp-trie/std",
|
||||
"pezsp-application-crypto/std",
|
||||
"pezsp-consensus-grandpa/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
"pezsp-trie/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-header-chain/runtime-benchmarks",
|
||||
"bp-pezkuwi-core/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"bp-teyrchains/runtime-benchmarks",
|
||||
"sp-consensus-grandpa/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"sp-trie/runtime-benchmarks",
|
||||
"pezsp-consensus-grandpa/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-trie/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -20,9 +20,9 @@ use bp_header_chain::{justification::JustificationVerificationContext, Authority
|
||||
use codec::Encode;
|
||||
use ed25519_dalek::{Signature, SigningKey, VerifyingKey};
|
||||
use finality_grandpa::voter_set::VoterSet;
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::prelude::*;
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthorityList, AuthorityWeight, SetId};
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use pezsp_std::prelude::*;
|
||||
|
||||
/// Set of test accounts with friendly names: Alice.
|
||||
pub const ALICE: Account = Account(0);
|
||||
@@ -64,7 +64,7 @@ impl Account {
|
||||
|
||||
impl From<Account> for AuthorityId {
|
||||
fn from(p: Account) -> Self {
|
||||
sp_application_crypto::UncheckedFrom::unchecked_from(p.public().to_bytes())
|
||||
pezsp_application_crypto::UncheckedFrom::unchecked_from(p.public().to_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ use bp_pezkuwi_core::teyrchains::{ParaHash, ParaHead, ParaHeadsProof, ParaId};
|
||||
use bp_runtime::record_all_trie_keys;
|
||||
use bp_teyrchains::teyrchain_head_storage_key_at_source;
|
||||
use codec::Encode;
|
||||
use sp_consensus_grandpa::{AuthorityId, AuthoritySignature, AuthorityWeight, SetId};
|
||||
use sp_runtime::traits::{Header as HeaderT, One, Zero};
|
||||
use sp_std::prelude::*;
|
||||
use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
|
||||
use pezsp_consensus_grandpa::{AuthorityId, AuthoritySignature, AuthorityWeight, SetId};
|
||||
use pezsp_runtime::traits::{Header as HeaderT, One, Zero};
|
||||
use pezsp_std::prelude::*;
|
||||
use pezsp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, TrieMut};
|
||||
|
||||
// Re-export all our test account utilities
|
||||
pub use keyring::*;
|
||||
@@ -162,7 +162,7 @@ fn generate_chain<H: HeaderT>(fork_id: u32, depth: u32, ancestor: &H) -> Vec<H>
|
||||
|
||||
// Modifying the digest so headers at the same height but in different forks have different
|
||||
// hashes
|
||||
header.digest_mut().logs.push(sp_runtime::DigestItem::Other(fork_id.encode()));
|
||||
header.digest_mut().logs.push(pezsp_runtime::DigestItem::Other(fork_id.encode()));
|
||||
|
||||
headers.push(header);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ pub fn signed_precommit<H: HeaderT>(
|
||||
) -> finality_grandpa::SignedPrecommit<H::Hash, H::Number, AuthoritySignature, AuthorityId> {
|
||||
let precommit = finality_grandpa::Precommit { target_hash: target.0, target_number: target.1 };
|
||||
|
||||
let encoded = sp_consensus_grandpa::localized_payload(
|
||||
let encoded = pezsp_consensus_grandpa::localized_payload(
|
||||
round,
|
||||
set_id,
|
||||
&finality_grandpa::Message::Precommit(precommit.clone()),
|
||||
|
||||
@@ -20,11 +20,11 @@ bp-header-chain = { workspace = true }
|
||||
bp-pezkuwi-core = { workspace = true }
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate dependencies
|
||||
frame-support = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -33,16 +33,16 @@ std = [
|
||||
"bp-pezkuwi-core/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"pezframe-support/std",
|
||||
"scale-info/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-std/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-header-chain/runtime-benchmarks",
|
||||
"bp-pezkuwi-core/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Defines structures related to calls of the `pallet-bridge-teyrchains` pallet.
|
||||
//! Defines structures related to calls of the `pezpallet-bridge-teyrchains` pallet.
|
||||
|
||||
use crate::{ParaHash, ParaId, RelayBlockHash, RelayBlockNumber};
|
||||
|
||||
@@ -22,14 +22,14 @@ use bp_pezkuwi_core::teyrchains::ParaHeadsProof;
|
||||
use bp_runtime::HeaderId;
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::vec::Vec;
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use pezsp_std::vec::Vec;
|
||||
|
||||
/// A minimized version of `pallet-bridge-teyrchains::Call` that can be used without a runtime.
|
||||
/// A minimized version of `pezpallet-bridge-teyrchains::Call` that can be used without a runtime.
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum BridgeTeyrchainCall {
|
||||
/// `pallet-bridge-teyrchains::Call::submit_teyrchain_heads`
|
||||
/// `pezpallet-bridge-teyrchains::Call::submit_teyrchain_heads`
|
||||
#[codec(index = 0)]
|
||||
submit_teyrchain_heads {
|
||||
/// Relay chain block, for which we have submitted the `teyrchain_heads_proof`.
|
||||
|
||||
@@ -28,11 +28,11 @@ use bp_runtime::{
|
||||
Teyrchain,
|
||||
};
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_support::{weights::Weight, Blake2_128Concat, Twox64Concat};
|
||||
use pezframe_support::{weights::Weight, Blake2_128Concat, Twox64Concat};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::{traits::Header as HeaderT, RuntimeDebug};
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
use pezsp_core::storage::StorageKey;
|
||||
use pezsp_runtime::{traits::Header as HeaderT, RuntimeDebug};
|
||||
use pezsp_std::{marker::PhantomData, prelude::*};
|
||||
|
||||
/// Block hash of the bridged relay chain.
|
||||
pub type RelayBlockHash = bp_pezkuwi_core::Hash;
|
||||
@@ -80,7 +80,7 @@ pub fn teyrchain_head_storage_key_at_source(
|
||||
|
||||
/// Can be use to access the runtime storage key of the teyrchains info at the target chain.
|
||||
///
|
||||
/// The info is stored by the `pallet-bridge-teyrchains` pallet in the `ParasInfo` map.
|
||||
/// The info is stored by the `pezpallet-bridge-teyrchains` pallet in the `ParasInfo` map.
|
||||
pub struct ParasInfoKeyProvider;
|
||||
impl StorageMapKeyProvider for ParasInfoKeyProvider {
|
||||
const MAP_NAME: &'static str = "ParasInfo";
|
||||
@@ -92,7 +92,7 @@ impl StorageMapKeyProvider for ParasInfoKeyProvider {
|
||||
|
||||
/// Can be use to access the runtime storage key of the teyrchain head at the target chain.
|
||||
///
|
||||
/// The head is stored by the `pallet-bridge-teyrchains` pallet in the `ImportedParaHeads` map.
|
||||
/// The head is stored by the `pezpallet-bridge-teyrchains` pallet in the `ImportedParaHeads` map.
|
||||
pub struct ImportedParaHeadsKeyProvider;
|
||||
impl StorageDoubleMapKeyProvider for ImportedParaHeadsKeyProvider {
|
||||
const MAP_NAME: &'static str = "ImportedParaHeads";
|
||||
@@ -165,7 +165,7 @@ impl ParaStoredHeaderDataBuilder for C {
|
||||
fn max_free_head_size() -> u32 {
|
||||
let mut result = 0_u32;
|
||||
for_tuples!( #(
|
||||
result = sp_std::cmp::max(
|
||||
result = pezsp_std::cmp::max(
|
||||
result,
|
||||
SingleParaStoredHeaderDataBuilder::<C>::max_free_head_size(),
|
||||
);
|
||||
|
||||
@@ -14,9 +14,9 @@ workspace = true
|
||||
codec = { features = ["bit-vec", "derive"], workspace = true }
|
||||
scale-info = { features = ["bit-vec", "derive"], workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
sp-core = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
# Bizinikiwi Dependencies
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
|
||||
# Pezkuwi Dependencies
|
||||
xcm = { workspace = true }
|
||||
@@ -26,8 +26,8 @@ default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"xcm/std",
|
||||
]
|
||||
runtime-benchmarks = ["sp-runtime/runtime-benchmarks", "xcm/runtime-benchmarks"]
|
||||
runtime-benchmarks = ["pezsp-runtime/runtime-benchmarks", "xcm/runtime-benchmarks"]
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{FixedU128, RuntimeDebug};
|
||||
use pezsp_core::H256;
|
||||
use pezsp_runtime::{FixedU128, RuntimeDebug};
|
||||
use xcm::latest::prelude::Location;
|
||||
|
||||
/// Minimal delivery fee factor.
|
||||
@@ -57,11 +57,11 @@ impl Default for BridgeState {
|
||||
}
|
||||
}
|
||||
|
||||
/// A minimized version of `pallet-xcm-bridge-hub-router::Call` that can be used without a runtime.
|
||||
/// A minimized version of `pezpallet-xcm-bridge-hub-router::Call` that can be used without a runtime.
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum XcmBridgeHubRouterCall {
|
||||
/// `pallet-xcm-bridge-hub-router::Call::report_bridge_status`
|
||||
/// `pezpallet-xcm-bridge-hub-router::Call::report_bridge_status`
|
||||
#[codec(index = 0)]
|
||||
report_bridge_status { bridge_id: H256, is_congested: bool },
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ serde = { features = ["alloc", "derive"], workspace = true }
|
||||
bp-messages = { workspace = true }
|
||||
bp-runtime = { workspace = true }
|
||||
|
||||
# Substrate Dependencies
|
||||
frame-support = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-io = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
# Bizinikiwi Dependencies
|
||||
pezframe-support = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-io = { workspace = true }
|
||||
pezsp-std = { workspace = true }
|
||||
|
||||
# Pezkuwi Dependencies
|
||||
xcm = { workspace = true }
|
||||
@@ -34,18 +34,18 @@ std = [
|
||||
"bp-messages/std",
|
||||
"bp-runtime/std",
|
||||
"codec/std",
|
||||
"frame-support/std",
|
||||
"pezframe-support/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"sp-core/std",
|
||||
"sp-io/std",
|
||||
"sp-std/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-std/std",
|
||||
"xcm/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"bp-messages/runtime-benchmarks",
|
||||
"bp-runtime/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"sp-io/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"xcm/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -14,25 +14,25 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Defines structures related to calls of the `pallet-xcm-bridge-hub` pallet.
|
||||
//! Defines structures related to calls of the `pezpallet-xcm-bridge-hub` pallet.
|
||||
|
||||
use bp_messages::MessageNonce;
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_std::boxed::Box;
|
||||
use pezsp_std::boxed::Box;
|
||||
use xcm::prelude::VersionedInteriorLocation;
|
||||
|
||||
/// A minimized version of `pallet_xcm_bridge_hub::Call` that can be used without a runtime.
|
||||
/// A minimized version of `pezpallet_xcm_bridge_hub::Call` that can be used without a runtime.
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum XcmBridgeHubCall {
|
||||
/// `pallet_xcm_bridge_hub::Call::open_bridge`
|
||||
/// `pezpallet_xcm_bridge_hub::Call::open_bridge`
|
||||
#[codec(index = 0)]
|
||||
open_bridge {
|
||||
/// Universal `InteriorLocation` from the bridged consensus.
|
||||
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
|
||||
},
|
||||
/// `pallet_xcm_bridge_hub::Call::close_bridge`
|
||||
/// `pezpallet_xcm_bridge_hub::Call::close_bridge`
|
||||
#[codec(index = 1)]
|
||||
close_bridge {
|
||||
/// Universal `InteriorLocation` from the bridged consensus.
|
||||
|
||||
@@ -23,15 +23,15 @@ use bp_messages::LaneIdType;
|
||||
use bp_runtime::{AccountIdOf, BalanceOf, Chain};
|
||||
pub use call_info::XcmBridgeHubCall;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use frame_support::{
|
||||
ensure, sp_runtime::RuntimeDebug, CloneNoBound, PalletError, PartialEqNoBound,
|
||||
use pezframe_support::{
|
||||
ensure, pezsp_runtime::RuntimeDebug, CloneNoBound, PalletError, PartialEqNoBound,
|
||||
RuntimeDebugNoBound,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_core::H256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_std::boxed::Box;
|
||||
use pezsp_core::H256;
|
||||
use pezsp_io::hashing::blake2_256;
|
||||
use pezsp_std::boxed::Box;
|
||||
use xcm::{
|
||||
latest::prelude::*, prelude::XcmVersion, IntoVersion, VersionedInteriorLocation,
|
||||
VersionedLocation,
|
||||
@@ -41,7 +41,7 @@ mod call_info;
|
||||
|
||||
/// Encoded XCM blob. We expect the bridge messages pallet to use this blob type for both inbound
|
||||
/// and outbound payloads.
|
||||
pub type XcmAsPlainPayload = sp_std::vec::Vec<u8>;
|
||||
pub type XcmAsPlainPayload = pezsp_std::vec::Vec<u8>;
|
||||
|
||||
/// Bridge identifier - used **only** for communicating with sibling/parent chains in the same
|
||||
/// consensus.
|
||||
@@ -104,7 +104,7 @@ impl core::fmt::Debug for BridgeId {
|
||||
/// Local XCM channel manager.
|
||||
pub trait LocalXcmChannelManager {
|
||||
/// Error that may be returned when suspending/resuming the bridge.
|
||||
type Error: sp_std::fmt::Debug;
|
||||
type Error: pezsp_std::fmt::Debug;
|
||||
|
||||
/// Returns true if the channel with given location is currently congested.
|
||||
///
|
||||
@@ -340,9 +340,9 @@ impl BridgeLocations {
|
||||
// a tricky helper struct that adds required `Ord` support for
|
||||
// `VersionedInteriorLocation`
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd)]
|
||||
struct EncodedVersionedInteriorLocation(sp_std::vec::Vec<u8>);
|
||||
struct EncodedVersionedInteriorLocation(pezsp_std::vec::Vec<u8>);
|
||||
impl Encode for EncodedVersionedInteriorLocation {
|
||||
fn encode(&self) -> sp_std::vec::Vec<u8> {
|
||||
fn encode(&self) -> pezsp_std::vec::Vec<u8> {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user