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:
@@ -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/>.
|
||||
|
||||
//! The code that allows to use the pallet (`pallet-xcm-bridge-hub`) as inbound
|
||||
//! The code that allows to use the pallet (`pezpallet-xcm-bridge-hub`) as inbound
|
||||
//! bridge messages dispatcher. Internally, it just forwards inbound blob to the
|
||||
//! XCM-level blob dispatcher, which pushes message to some other queue (e.g.
|
||||
//! to HRMP queue with the sibling target chain).
|
||||
@@ -27,10 +27,10 @@ use bp_messages::target_chain::{DispatchMessage, MessageDispatch};
|
||||
use bp_runtime::messages::MessageDispatchResult;
|
||||
use bp_xcm_bridge_hub::{LocalXcmChannelManager, XcmAsPlainPayload};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use frame_support::{weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
|
||||
use pallet_bridge_messages::{Config as BridgeMessagesConfig, WeightInfoExt};
|
||||
use pezframe_support::{weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, WeightInfoExt};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::SaturatedConversion;
|
||||
use pezsp_runtime::SaturatedConversion;
|
||||
use xcm::prelude::*;
|
||||
use xcm_builder::{DispatchBlob, DispatchBlobError};
|
||||
|
||||
@@ -136,8 +136,8 @@ mod tests {
|
||||
|
||||
use bp_messages::{target_chain::DispatchMessageData, LaneIdType, MessageKey};
|
||||
use bp_xcm_bridge_hub::{Bridge, BridgeLocations, BridgeState};
|
||||
use frame_support::assert_ok;
|
||||
use pallet_bridge_messages::InboundLaneStorage;
|
||||
use pezframe_support::assert_ok;
|
||||
use pezpallet_bridge_messages::InboundLaneStorage;
|
||||
use xcm_executor::traits::ConvertLocation;
|
||||
|
||||
fn bridge() -> (Box<BridgeLocations>, TestLaneIdType) {
|
||||
|
||||
@@ -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/>.
|
||||
|
||||
//! The code that allows to use the pallet (`pallet-xcm-bridge-hub`) as XCM message
|
||||
//! The code that allows to use the pallet (`pezpallet-xcm-bridge-hub`) as XCM message
|
||||
//! exporter at the sending bridge hub. Internally, it just enqueues outbound blob
|
||||
//! in the messages pallet queue.
|
||||
//!
|
||||
@@ -29,8 +29,8 @@ use bp_messages::{
|
||||
MessageNonce,
|
||||
};
|
||||
use bp_xcm_bridge_hub::{BridgeId, BridgeState, LocalXcmChannelManager, XcmAsPlainPayload};
|
||||
use frame_support::{ensure, traits::Get};
|
||||
use pallet_bridge_messages::{
|
||||
use pezframe_support::{ensure, traits::Get};
|
||||
use pezpallet_bridge_messages::{
|
||||
Config as BridgeMessagesConfig, Error, Pallet as BridgeMessagesPallet,
|
||||
};
|
||||
use xcm::prelude::*;
|
||||
@@ -225,7 +225,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/2006 we either need fishermens
|
||||
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/83 we either need fishermens
|
||||
// to watch this rule violation (suspended, but keep sending new messages), or we need a
|
||||
// hard limit for that like other XCM queues have
|
||||
|
||||
@@ -373,8 +373,8 @@ mod tests {
|
||||
|
||||
use bp_runtime::RangeInclusiveExt;
|
||||
use bp_xcm_bridge_hub::{Bridge, BridgeLocations, BridgeState};
|
||||
use frame_support::{assert_ok, traits::EnsureOrigin};
|
||||
use pallet_bridge_messages::InboundLaneStorage;
|
||||
use pezframe_support::{assert_ok, traits::EnsureOrigin};
|
||||
use pezpallet_bridge_messages::InboundLaneStorage;
|
||||
use xcm_builder::{NetworkExportTable, UnpaidRemoteExporter};
|
||||
use xcm_executor::traits::{export_xcm, ConvertLocation};
|
||||
|
||||
@@ -663,7 +663,7 @@ mod tests {
|
||||
|
||||
// check before - no messages
|
||||
assert_eq!(
|
||||
pallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
|
||||
pezpallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
|
||||
expected_lane_id
|
||||
)
|
||||
.unwrap()
|
||||
@@ -685,7 +685,7 @@ mod tests {
|
||||
// we need to set `UniversalLocation` for `sibling_teyrchain_origin` for
|
||||
// `XcmOverBridgeWrappedWithExportMessageRouterInstance`.
|
||||
ExportMessageOriginUniversalLocation::set(Some(SiblingUniversalLocation::get()));
|
||||
// send `ExportMessage(message)` by `pallet_xcm_bridge_hub_router`.
|
||||
// send `ExportMessage(message)` by `pezpallet_xcm_bridge_hub_router`.
|
||||
ExecuteXcmOverSendXcm::set_origin_for_execute(SiblingLocation::get());
|
||||
assert_ok!(send_xcm::<XcmOverBridgeWrappedWithExportMessageRouter>(
|
||||
dest.clone(),
|
||||
@@ -694,7 +694,7 @@ mod tests {
|
||||
|
||||
// check after - a message ready to be relayed
|
||||
assert_eq!(
|
||||
pallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
|
||||
pezpallet_bridge_messages::Pallet::<TestRuntime, ()>::outbound_lane_data(
|
||||
expected_lane_id
|
||||
)
|
||||
.unwrap()
|
||||
@@ -804,8 +804,8 @@ mod tests {
|
||||
// valid routable destination
|
||||
let dest = Location::new(2, BridgedUniversalDestination::get());
|
||||
|
||||
fn router_bridge_state() -> pallet_xcm_bridge_hub_router::BridgeState {
|
||||
pallet_xcm_bridge_hub_router::Bridge::<
|
||||
fn router_bridge_state() -> pezpallet_xcm_bridge_hub_router::BridgeState {
|
||||
pezpallet_xcm_bridge_hub_router::Bridge::<
|
||||
TestRuntime,
|
||||
XcmOverBridgeWrappedWithExportMessageRouterInstance,
|
||||
>::get()
|
||||
@@ -835,7 +835,7 @@ mod tests {
|
||||
|
||||
// make bridges congested with sending too much messages
|
||||
for _ in 1..(OUTBOUND_LANE_CONGESTED_THRESHOLD + 2) {
|
||||
// send `ExportMessage(message)` by `pallet_xcm_bridge_hub_router`.
|
||||
// send `ExportMessage(message)` by `pezpallet_xcm_bridge_hub_router`.
|
||||
ExecuteXcmOverSendXcm::set_origin_for_execute(origin_as_location.clone());
|
||||
assert_ok!(send_xcm::<XcmOverBridgeWrappedWithExportMessageRouter>(
|
||||
dest.clone(),
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
//! open and close bridges between local (to this pallet location) and remote XCM
|
||||
//! destinations.
|
||||
//!
|
||||
//! The `pallet_xcm_bridge_hub` pallet is used to manage (open, close) bridges between chains from
|
||||
//! The `pezpallet_xcm_bridge_hub` pallet is used to manage (open, close) bridges between chains from
|
||||
//! different consensuses. The new extrinsics `fn open_bridge` and `fn close_bridge` are introduced.
|
||||
//! Other chains can manage channels with different bridged global consensuses.
|
||||
//!
|
||||
//! # Concept of `lane` and `LaneId`
|
||||
//!
|
||||
//! There is another `pallet_bridge_messages` pallet that handles inbound/outbound lanes for
|
||||
//! There is another `pezpallet_bridge_messages` pallet that handles inbound/outbound lanes for
|
||||
//! messages. Each lane is a unique connection between two chains from different consensuses and is
|
||||
//! identified by `LaneId`. `LaneId` is generated once when a new bridge is requested by `fn
|
||||
//! open_bridge`. It is generated by `BridgeLocations::calculate_lane_id` based on the following
|
||||
@@ -48,7 +48,7 @@
|
||||
//!
|
||||
//! # Concept of `bridge` and `BridgeId`
|
||||
//!
|
||||
//! The `pallet_xcm_bridge_hub` pallet needs to store some metadata about opened bridges. The bridge
|
||||
//! The `pezpallet_xcm_bridge_hub` pallet needs to store some metadata about opened bridges. The bridge
|
||||
//! (or bridge metadata) is stored under the `BridgeId` key.
|
||||
//!
|
||||
//! `BridgeId` is generated from `bridge_origin_relative_location` and
|
||||
@@ -71,8 +71,8 @@
|
||||
//!
|
||||
//! # How to Open a Bridge?
|
||||
//!
|
||||
//! The `pallet_xcm_bridge_hub` pallet has the extrinsic `fn open_bridge` and an important
|
||||
//! configuration `pallet_xcm_bridge_hub::Config::OpenBridgeOrigin`, which translates the call's
|
||||
//! The `pezpallet_xcm_bridge_hub` pallet has the extrinsic `fn open_bridge` and an important
|
||||
//! configuration `pezpallet_xcm_bridge_hub::Config::OpenBridgeOrigin`, which translates the call's
|
||||
//! origin to the XCM `Location` and converts it to the `bridge_origin_universal_location`. With the
|
||||
//! current setup, this origin/location is expected to be either the relay chain or a sibling
|
||||
//! teyrchain as one side of the bridge. Another parameter is
|
||||
@@ -149,11 +149,11 @@ use bp_xcm_bridge_hub::BridgeLocationsError;
|
||||
pub use bp_xcm_bridge_hub::{
|
||||
Bridge, BridgeId, BridgeLocations, BridgeState, LocalXcmChannelManager,
|
||||
};
|
||||
use frame_support::{traits::fungible::MutateHold, DefaultNoBound};
|
||||
use frame_system::Config as SystemConfig;
|
||||
use pallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
|
||||
use sp_runtime::traits::Zero;
|
||||
use sp_std::{boxed::Box, vec::Vec};
|
||||
use pezframe_support::{traits::fungible::MutateHold, DefaultNoBound};
|
||||
use pezframe_system::Config as SystemConfig;
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, LanesManagerError};
|
||||
use pezsp_runtime::traits::Zero;
|
||||
use pezsp_std::{boxed::Box, vec::Vec};
|
||||
use xcm::prelude::*;
|
||||
use xcm_builder::DispatchBlob;
|
||||
use xcm_executor::traits::ConvertLocation;
|
||||
@@ -171,14 +171,14 @@ mod mock;
|
||||
/// The target that will be used when publishing logs related to this pallet.
|
||||
pub const LOG_TARGET: &str = "runtime::bridge-xcm";
|
||||
|
||||
#[frame_support::pallet]
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use frame_support::{
|
||||
pallet_prelude::*,
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
traits::{tokens::Precision, Contains},
|
||||
};
|
||||
use frame_system::pallet_prelude::{BlockNumberFor, *};
|
||||
use pezframe_system::pezpallet_prelude::{BlockNumberFor, *};
|
||||
|
||||
/// The reason for this pallet placing a hold on funds.
|
||||
#[pallet::composite_enum]
|
||||
@@ -189,20 +189,20 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::config]
|
||||
#[pallet::disable_frame_system_supertrait_check]
|
||||
#[pallet::disable_pezframe_system_supertrait_check]
|
||||
pub trait Config<I: 'static = ()>:
|
||||
BridgeMessagesConfig<Self::BridgeMessagesPalletInstance>
|
||||
{
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self, I>>
|
||||
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// Runtime's universal location.
|
||||
type UniversalLocation: Get<InteriorLocation>;
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1666 remove `ChainId` and
|
||||
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/80 remove `ChainId` and
|
||||
// replace it with the `NetworkId` - then we'll be able to use
|
||||
// `T as pallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
|
||||
// `T as pezpallet_bridge_messages::Config<T::BridgeMessagesPalletInstance>::BridgedChain::NetworkId`
|
||||
/// Bridged network as relative location of bridged `GlobalConsensus`.
|
||||
#[pallet::constant]
|
||||
type BridgedNetwork: Get<Location>;
|
||||
@@ -253,13 +253,13 @@ pub mod pallet {
|
||||
pub type BridgeOf<T, I> = Bridge<ThisChainOf<T, I>, LaneIdOf<T, I>>;
|
||||
/// An alias for this chain.
|
||||
pub type ThisChainOf<T, I> =
|
||||
pallet_bridge_messages::ThisChainOf<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
|
||||
pezpallet_bridge_messages::ThisChainOf<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
|
||||
/// An alias for lane identifier type.
|
||||
pub type LaneIdOf<T, I> =
|
||||
<T as BridgeMessagesConfig<<T as Config<I>>::BridgeMessagesPalletInstance>>::LaneId;
|
||||
/// An alias for the associated lanes manager.
|
||||
pub type LanesManagerOf<T, I> =
|
||||
pallet_bridge_messages::LanesManager<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
|
||||
pezpallet_bridge_messages::LanesManager<T, <T as Config<I>>::BridgeMessagesPalletInstance>;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
@@ -276,7 +276,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn try_state(_n: BlockNumberFor<T>) -> Result<(), sp_runtime::TryRuntimeError> {
|
||||
fn try_state(_n: BlockNumberFor<T>) -> Result<(), pezsp_runtime::TryRuntimeError> {
|
||||
Self::do_try_state()
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ pub mod pallet {
|
||||
/// The states after this call: bridge is `Opened`, outbound lane is `Opened`, inbound lane
|
||||
/// is `Opened`.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/paritytech/parity-bridges-common/issues/3046 - add benchmarks impl
|
||||
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/pezkuwichain/kurdistan-sdk/issues/87 - add benchmarks impl
|
||||
pub fn open_bridge(
|
||||
origin: OriginFor<T>,
|
||||
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
|
||||
@@ -333,7 +333,7 @@ pub mod pallet {
|
||||
/// The states after this call: everything is either `Closed`, or purged from the
|
||||
/// runtime storage.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/paritytech/parity-bridges-common/issues/3046 - add benchmarks impl
|
||||
#[pallet::weight(Weight::zero())] // TODO:(bridges-v2) - https://github.com/pezkuwichain/kurdistan-sdk/issues/87 - add benchmarks impl
|
||||
pub fn close_bridge(
|
||||
origin: OriginFor<T>,
|
||||
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
|
||||
@@ -343,7 +343,7 @@ pub mod pallet {
|
||||
let locations =
|
||||
Self::bridge_locations_from_origin(origin, bridge_destination_universal_location)?;
|
||||
|
||||
// TODO: https://github.com/paritytech/parity-bridges-common/issues/1760 - may do refund here, if
|
||||
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/81 - may do refund here, if
|
||||
// bridge/lanes are already closed + for messages that are not pruned
|
||||
|
||||
// update bridge metadata - this also guarantees that the bridge is in the proper state
|
||||
@@ -565,7 +565,7 @@ pub mod pallet {
|
||||
pub fn bridge_locations_from_origin(
|
||||
origin: OriginFor<T>,
|
||||
bridge_destination_universal_location: Box<VersionedInteriorLocation>,
|
||||
) -> Result<Box<BridgeLocations>, sp_runtime::DispatchError> {
|
||||
) -> Result<Box<BridgeLocations>, pezsp_runtime::DispatchError> {
|
||||
Self::bridge_locations(
|
||||
T::OpenBridgeOrigin::ensure_origin(origin)?,
|
||||
(*bridge_destination_universal_location)
|
||||
@@ -578,7 +578,7 @@ pub mod pallet {
|
||||
pub fn bridge_locations(
|
||||
bridge_origin_relative_location: Location,
|
||||
bridge_destination_universal_location: InteriorLocation,
|
||||
) -> Result<Box<BridgeLocations>, sp_runtime::DispatchError> {
|
||||
) -> Result<Box<BridgeLocations>, pezsp_runtime::DispatchError> {
|
||||
BridgeLocations::bridge_locations(
|
||||
T::UniversalLocation::get(),
|
||||
bridge_origin_relative_location,
|
||||
@@ -608,7 +608,7 @@ pub mod pallet {
|
||||
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
/// Returns some `NetworkId` if contains `GlobalConsensus` junction.
|
||||
fn bridged_network_id() -> Result<NetworkId, sp_runtime::DispatchError> {
|
||||
fn bridged_network_id() -> Result<NetworkId, pezsp_runtime::DispatchError> {
|
||||
match T::BridgedNetwork::get().take_first_interior() {
|
||||
Some(GlobalConsensus(network)) => Ok(network),
|
||||
_ => Err(Error::<T, I>::BridgeLocations(
|
||||
@@ -622,8 +622,8 @@ pub mod pallet {
|
||||
#[cfg(any(test, feature = "try-runtime", feature = "std"))]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
/// Ensure the correctness of the state of this pallet.
|
||||
pub fn do_try_state() -> Result<(), sp_runtime::TryRuntimeError> {
|
||||
use sp_std::collections::btree_set::BTreeSet;
|
||||
pub fn do_try_state() -> Result<(), pezsp_runtime::TryRuntimeError> {
|
||||
use pezsp_std::collections::btree_set::BTreeSet;
|
||||
|
||||
let mut lanes = BTreeSet::new();
|
||||
|
||||
@@ -640,7 +640,7 @@ pub mod pallet {
|
||||
"Invalid `LaneToBridge` configuration, probably missing or not removed laneId!"
|
||||
);
|
||||
|
||||
// check connected `pallet_bridge_messages` state.
|
||||
// check connected `pezpallet_bridge_messages` state.
|
||||
Self::do_try_state_for_messages()
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ pub mod pallet {
|
||||
pub fn do_try_state_for_bridge(
|
||||
bridge_id: BridgeId,
|
||||
bridge: BridgeOf<T, I>,
|
||||
) -> Result<T::LaneId, sp_runtime::TryRuntimeError> {
|
||||
) -> Result<T::LaneId, pezsp_runtime::TryRuntimeError> {
|
||||
tracing::info!(target: LOG_TARGET, ?bridge_id, ?bridge, "Checking `do_try_state_for_bridge`");
|
||||
|
||||
// check `BridgeId` points to the same `LaneId` and vice versa.
|
||||
@@ -657,7 +657,7 @@ pub mod pallet {
|
||||
"Found `LaneToBridge` inconsistency for bridge_id - missing mapping!"
|
||||
);
|
||||
|
||||
// check `pallet_bridge_messages` state for that `LaneId`.
|
||||
// check `pezpallet_bridge_messages` state for that `LaneId`.
|
||||
let lanes_manager = LanesManagerOf::<T, I>::new();
|
||||
ensure!(
|
||||
lanes_manager.any_state_inbound_lane(bridge.lane_id).is_ok(),
|
||||
@@ -691,10 +691,10 @@ pub mod pallet {
|
||||
Ok(bridge.lane_id)
|
||||
}
|
||||
|
||||
/// Ensure the correctness of the state of the connected `pallet_bridge_messages` instance.
|
||||
pub fn do_try_state_for_messages() -> Result<(), sp_runtime::TryRuntimeError> {
|
||||
/// Ensure the correctness of the state of the connected `pezpallet_bridge_messages` instance.
|
||||
pub fn do_try_state_for_messages() -> Result<(), pezsp_runtime::TryRuntimeError> {
|
||||
// check that all `InboundLanes` laneIds have mapping to some bridge.
|
||||
for lane_id in pallet_bridge_messages::InboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
|
||||
for lane_id in pezpallet_bridge_messages::InboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
|
||||
tracing::info!(target: LOG_TARGET, ?lane_id, "Checking `do_try_state_for_messages` for `InboundLanes`...");
|
||||
ensure!(
|
||||
LaneToBridge::<T, I>::get(lane_id).is_some(),
|
||||
@@ -703,7 +703,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
// check that all `OutboundLanes` laneIds have mapping to some bridge.
|
||||
for lane_id in pallet_bridge_messages::OutboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
|
||||
for lane_id in pezpallet_bridge_messages::OutboundLanes::<T, T::BridgeMessagesPalletInstance>::iter_keys() {
|
||||
tracing::info!(target: LOG_TARGET, ?lane_id, "Checking `do_try_state_for_messages` for `OutboundLanes`");
|
||||
ensure!(
|
||||
LaneToBridge::<T, I>::get(lane_id).is_some(),
|
||||
@@ -735,13 +735,13 @@ pub mod pallet {
|
||||
pub opened_bridges: Vec<(Location, InteriorLocation, Option<T::LaneId>)>,
|
||||
/// Dummy marker.
|
||||
#[serde(skip)]
|
||||
pub _phantom: sp_std::marker::PhantomData<(T, I)>,
|
||||
pub _phantom: pezsp_std::marker::PhantomData<(T, I)>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
|
||||
where
|
||||
T: frame_system::Config<AccountId = AccountIdOf<ThisChainOf<T, I>>>,
|
||||
T: pezframe_system::Config<AccountId = AccountIdOf<ThisChainOf<T, I>>>,
|
||||
{
|
||||
fn build(&self) {
|
||||
for (
|
||||
@@ -839,9 +839,9 @@ mod tests {
|
||||
use bp_messages::LaneIdType;
|
||||
use mock::*;
|
||||
|
||||
use frame_support::{assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec};
|
||||
use frame_system::{EventRecord, Phase};
|
||||
use sp_runtime::TryRuntimeError;
|
||||
use pezframe_support::{assert_err, assert_noop, assert_ok, traits::fungible::Mutate, BoundedVec};
|
||||
use pezframe_system::{EventRecord, Phase};
|
||||
use pezsp_runtime::TryRuntimeError;
|
||||
|
||||
fn fund_origin_sovereign_account(locations: &BridgeLocations, balance: Balance) -> AccountId {
|
||||
let bridge_owner_account =
|
||||
@@ -913,7 +913,7 @@ mod tests {
|
||||
OpenBridgeOrigin::disallowed_origin(),
|
||||
Box::new(bridged_asset_hub_universal_location().into()),
|
||||
),
|
||||
sp_runtime::DispatchError::BadOrigin,
|
||||
pezsp_runtime::DispatchError::BadOrigin,
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -1219,7 +1219,7 @@ mod tests {
|
||||
Box::new(bridged_asset_hub_universal_location().into()),
|
||||
0,
|
||||
),
|
||||
sp_runtime::DispatchError::BadOrigin,
|
||||
pezsp_runtime::DispatchError::BadOrigin,
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::{Config, Pallet, LOG_TARGET};
|
||||
use frame_support::{
|
||||
use pezframe_support::{
|
||||
traits::{Get, OnRuntimeUpgrade, StorageVersion},
|
||||
weights::Weight,
|
||||
};
|
||||
@@ -121,7 +121,7 @@ impl<
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn post_upgrade(_state: sp_std::vec::Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
|
||||
fn post_upgrade(_state: pezsp_std::vec::Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
|
||||
let bridge_origin_relative_location = SourceRelativeLocation::get();
|
||||
let bridge_destination_universal_location = BridgedUniversalLocation::get();
|
||||
let lane_id = Lane::get();
|
||||
@@ -131,12 +131,12 @@ impl<
|
||||
bridge_origin_relative_location.clone(),
|
||||
bridge_destination_universal_location.clone(),
|
||||
) else {
|
||||
return Err(sp_runtime::DispatchError::Other("Invalid locations!"));
|
||||
return Err(pezsp_runtime::DispatchError::Other("Invalid locations!"));
|
||||
};
|
||||
let Some((bridge_id, _)) = Pallet::<T, I>::bridge_by_lane_id(&lane_id) else {
|
||||
return Err(sp_runtime::DispatchError::Other("Missing bridge!"));
|
||||
return Err(pezsp_runtime::DispatchError::Other("Missing bridge!"));
|
||||
};
|
||||
frame_support::ensure!(
|
||||
pezframe_support::ensure!(
|
||||
locations.bridge_id() == &bridge_id,
|
||||
"Bridge is not stored correctly!"
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use crate as pallet_xcm_bridge_hub;
|
||||
use crate as pezpallet_xcm_bridge_hub;
|
||||
|
||||
use bp_messages::{
|
||||
target_chain::{DispatchMessage, MessageDispatch},
|
||||
@@ -25,19 +25,19 @@ use bp_messages::{
|
||||
use bp_runtime::{messages::MessageDispatchResult, Chain, ChainId, HashOf};
|
||||
use bp_xcm_bridge_hub::{BridgeId, LocalXcmChannelManager};
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
use pezframe_support::{
|
||||
assert_ok, derive_impl, parameter_types,
|
||||
traits::{EnsureOrigin, Equals, Everything, Get, OriginTrait},
|
||||
weights::RuntimeDbWeight,
|
||||
};
|
||||
use pezkuwi_teyrchain_primitives::primitives::Sibling;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header as SubstrateHeader,
|
||||
use pezsp_core::H256;
|
||||
use pezsp_runtime::{
|
||||
testing::Header as BizinikiwiHeader,
|
||||
traits::{BlakeTwo256, ConstU128, ConstU32, IdentityLookup},
|
||||
AccountId32, BuildStorage, StateVersion,
|
||||
};
|
||||
use sp_std::cell::RefCell;
|
||||
use pezsp_std::cell::RefCell;
|
||||
use xcm::{latest::PEZKUWICHAIN_GENESIS_HASH, prelude::*};
|
||||
use xcm_builder::{
|
||||
AllowUnpaidExecutionFrom, DispatchBlob, DispatchBlobError, FixedWeightBounds,
|
||||
@@ -48,7 +48,7 @@ use xcm_executor::{traits::ConvertOrigin, XcmExecutor};
|
||||
|
||||
pub type AccountId = AccountId32;
|
||||
pub type Balance = u64;
|
||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||
type Block = pezframe_system::mocking::MockBlock<TestRuntime>;
|
||||
|
||||
/// Lane identifier type used for tests.
|
||||
pub type TestLaneIdType = HashedLaneId;
|
||||
@@ -57,13 +57,13 @@ pub const SIBLING_ASSET_HUB_ID: u32 = 2001;
|
||||
pub const THIS_BRIDGE_HUB_ID: u32 = 2002;
|
||||
pub const BRIDGED_ASSET_HUB_ID: u32 = 1001;
|
||||
|
||||
frame_support::construct_runtime! {
|
||||
pezframe_support::construct_runtime! {
|
||||
pub enum TestRuntime {
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Event<T>},
|
||||
Messages: pallet_bridge_messages::{Pallet, Call, Event<T>},
|
||||
XcmOverBridge: pallet_xcm_bridge_hub::{Pallet, Call, HoldReason, Event<T>},
|
||||
XcmOverBridgeWrappedWithExportMessageRouter: pallet_xcm_bridge_hub_router = 57,
|
||||
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pallet, Event<T>},
|
||||
Messages: pezpallet_bridge_messages::{Pallet, Call, Event<T>},
|
||||
XcmOverBridge: pezpallet_xcm_bridge_hub::{Pallet, Call, HoldReason, Event<T>},
|
||||
XcmOverBridgeWrappedWithExportMessageRouter: pezpallet_xcm_bridge_hub_router = 57,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,20 +72,20 @@ parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 1;
|
||||
}
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
|
||||
impl frame_system::Config for TestRuntime {
|
||||
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
|
||||
impl pezframe_system::Config for TestRuntime {
|
||||
type AccountId = AccountId;
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
type AccountData = pezpallet_balances::AccountData<Balance>;
|
||||
type Block = Block;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
}
|
||||
|
||||
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
|
||||
impl pallet_balances::Config for TestRuntime {
|
||||
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
|
||||
impl pezpallet_balances::Config for TestRuntime {
|
||||
type AccountStore = System;
|
||||
}
|
||||
|
||||
impl pallet_bridge_messages::Config for TestRuntime {
|
||||
impl pezpallet_bridge_messages::Config for TestRuntime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = TestMessagesWeights;
|
||||
|
||||
@@ -106,7 +106,7 @@ impl pallet_bridge_messages::Config for TestRuntime {
|
||||
|
||||
pub struct TestMessagesWeights;
|
||||
|
||||
impl pallet_bridge_messages::WeightInfo for TestMessagesWeights {
|
||||
impl pezpallet_bridge_messages::WeightInfo for TestMessagesWeights {
|
||||
fn receive_single_message_proof() -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
@@ -133,7 +133,7 @@ impl pallet_bridge_messages::WeightInfo for TestMessagesWeights {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_bridge_messages::WeightInfoExt for TestMessagesWeights {
|
||||
impl pezpallet_bridge_messages::WeightInfoExt for TestMessagesWeights {
|
||||
fn expected_extra_storage_proof_size() -> u32 {
|
||||
0
|
||||
}
|
||||
@@ -164,7 +164,7 @@ parameter_types! {
|
||||
|
||||
pub const BridgeDeposit: Balance = 100_000;
|
||||
|
||||
// configuration for pallet_xcm_bridge_hub_router
|
||||
// configuration for pezpallet_xcm_bridge_hub_router
|
||||
pub BridgeHubLocation: Location = Here.into();
|
||||
pub BridgeFeeAsset: AssetId = Location::here().into();
|
||||
pub BridgeTable: Vec<NetworkExportTableItem>
|
||||
@@ -184,7 +184,7 @@ pub fn bridged_asset_hub_universal_location() -> InteriorLocation {
|
||||
BridgedUniversalDestination::get()
|
||||
}
|
||||
|
||||
impl pallet_xcm_bridge_hub::Config for TestRuntime {
|
||||
impl pezpallet_xcm_bridge_hub::Config for TestRuntime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
|
||||
type UniversalLocation = UniversalLocation;
|
||||
@@ -194,7 +194,7 @@ impl pallet_xcm_bridge_hub::Config for TestRuntime {
|
||||
type MessageExportPrice = ();
|
||||
type DestinationVersion = AlwaysLatest;
|
||||
|
||||
type ForceOrigin = frame_system::EnsureNever<()>;
|
||||
type ForceOrigin = pezframe_system::EnsureNever<()>;
|
||||
type OpenBridgeOrigin = OpenBridgeOrigin;
|
||||
type BridgeOriginAccountIdConverter = LocationToAccountId;
|
||||
|
||||
@@ -211,7 +211,7 @@ impl pallet_xcm_bridge_hub::Config for TestRuntime {
|
||||
/// A router instance simulates a scenario where the router is deployed on a different chain than
|
||||
/// the `MessageExporter`. This means that the router sends an `ExportMessage`.
|
||||
pub type XcmOverBridgeWrappedWithExportMessageRouterInstance = ();
|
||||
impl pallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageRouterInstance>
|
||||
impl pezpallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageRouterInstance>
|
||||
for TestRuntime
|
||||
{
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
@@ -224,9 +224,9 @@ impl pallet_xcm_bridge_hub_router::Config<XcmOverBridgeWrappedWithExportMessageR
|
||||
type DestinationVersion = AlwaysLatest;
|
||||
|
||||
// We convert to root `here` location with `BridgeHubLocationXcmOriginAsRoot`
|
||||
type BridgeHubOrigin = frame_system::EnsureRoot<AccountId>;
|
||||
type BridgeHubOrigin = pezframe_system::EnsureRoot<AccountId>;
|
||||
// **Note**: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which
|
||||
// calls the `ExportXcm` implementation of `pallet_xcm_bridge_hub` as the
|
||||
// calls the `ExportXcm` implementation of `pezpallet_xcm_bridge_hub` as the
|
||||
// `MessageExporter`.
|
||||
type ToBridgeHubSender = ExecuteXcmOverSendXcm;
|
||||
type LocalXcmChannelManager = TestLocalXcmChannelManager;
|
||||
@@ -257,7 +257,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = ();
|
||||
type FeeManager = ();
|
||||
// We just set `MessageExporter` as our `pallet_xcm_bridge_hub` instance.
|
||||
// We just set `MessageExporter` as our `pezpallet_xcm_bridge_hub` instance.
|
||||
type MessageExporter = (XcmOverBridge,);
|
||||
type UniversalAliases = ();
|
||||
type CallDispatcher = RuntimeCall;
|
||||
@@ -276,11 +276,11 @@ thread_local! {
|
||||
|
||||
/// The `SendXcm` implementation directly executes XCM using `XcmExecutor`.
|
||||
///
|
||||
/// We ensure that the `ExportMessage` produced by `pallet_xcm_bridge_hub_router` is compatible with
|
||||
/// the `ExportXcm` implementation of `pallet_xcm_bridge_hub`.
|
||||
/// We ensure that the `ExportMessage` produced by `pezpallet_xcm_bridge_hub_router` is compatible with
|
||||
/// the `ExportXcm` implementation of `pezpallet_xcm_bridge_hub`.
|
||||
///
|
||||
/// Note: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which calls the
|
||||
/// `ExportXcm` implementation of `pallet_xcm_bridge_hub` as `MessageExporter`.
|
||||
/// `ExportXcm` implementation of `pezpallet_xcm_bridge_hub` as `MessageExporter`.
|
||||
pub struct ExecuteXcmOverSendXcm;
|
||||
impl SendXcm for ExecuteXcmOverSendXcm {
|
||||
type Ticket = Xcm<()>;
|
||||
@@ -296,7 +296,7 @@ impl SendXcm for ExecuteXcmOverSendXcm {
|
||||
let xcm: Xcm<RuntimeCall> = ticket.into();
|
||||
|
||||
let origin = EXECUTE_XCM_ORIGIN.with(|o| o.borrow().clone().unwrap());
|
||||
let mut hash = xcm.using_encoded(sp_io::hashing::blake2_256);
|
||||
let mut hash = xcm.using_encoded(pezsp_io::hashing::blake2_256);
|
||||
let outcome = XcmExecutor::<XcmConfig>::prepare_and_execute(
|
||||
origin,
|
||||
xcm,
|
||||
@@ -345,7 +345,7 @@ thread_local! {
|
||||
}
|
||||
|
||||
pub struct BridgeHubLocationXcmOriginAsRoot<RuntimeOrigin>(
|
||||
sp_std::marker::PhantomData<RuntimeOrigin>,
|
||||
pezsp_std::marker::PhantomData<RuntimeOrigin>,
|
||||
);
|
||||
impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for BridgeHubLocationXcmOriginAsRoot<RuntimeOrigin>
|
||||
@@ -447,13 +447,13 @@ impl EnsureOrigin<RuntimeOrigin> for OpenBridgeOrigin {
|
||||
}
|
||||
|
||||
pub(crate) type OpenBridgeOriginOf<T, I> =
|
||||
<T as pallet_xcm_bridge_hub::Config<I>>::OpenBridgeOrigin;
|
||||
<T as pezpallet_xcm_bridge_hub::Config<I>>::OpenBridgeOrigin;
|
||||
|
||||
pub struct TestLocalXcmChannelManager;
|
||||
|
||||
impl TestLocalXcmChannelManager {
|
||||
pub fn make_congested() {
|
||||
frame_support::storage::unhashed::put(b"TestLocalXcmChannelManager.Congested", &true);
|
||||
pezframe_support::storage::unhashed::put(b"TestLocalXcmChannelManager.Congested", &true);
|
||||
}
|
||||
|
||||
fn suspended_key(bridge: &BridgeId) -> Vec<u8> {
|
||||
@@ -464,11 +464,11 @@ impl TestLocalXcmChannelManager {
|
||||
}
|
||||
|
||||
pub fn is_bridge_suspended(bridge: &BridgeId) -> bool {
|
||||
frame_support::storage::unhashed::get_or_default(&Self::suspended_key(bridge))
|
||||
pezframe_support::storage::unhashed::get_or_default(&Self::suspended_key(bridge))
|
||||
}
|
||||
|
||||
pub fn is_bridge_resumed(bridge: &BridgeId) -> bool {
|
||||
frame_support::storage::unhashed::get_or_default(&Self::resumed_key(bridge))
|
||||
pezframe_support::storage::unhashed::get_or_default(&Self::resumed_key(bridge))
|
||||
}
|
||||
|
||||
fn build_congestion_message(bridge: &BridgeId, is_congested: bool) -> Vec<Instruction<()>> {
|
||||
@@ -480,7 +480,7 @@ impl TestLocalXcmChannelManager {
|
||||
XcmOverBridgeWrappedWithExportMessageRouter(XcmBridgeHubRouterCall),
|
||||
}
|
||||
|
||||
sp_std::vec![
|
||||
pezsp_std::vec![
|
||||
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
|
||||
Transact {
|
||||
origin_kind: OriginKind::Xcm,
|
||||
@@ -512,7 +512,7 @@ impl TestLocalXcmChannelManager {
|
||||
);
|
||||
|
||||
if result.is_ok() {
|
||||
frame_support::storage::unhashed::put(&key, &true);
|
||||
pezframe_support::storage::unhashed::put(&key, &true);
|
||||
}
|
||||
|
||||
result.map(|_| ())
|
||||
@@ -523,7 +523,7 @@ impl LocalXcmChannelManager for TestLocalXcmChannelManager {
|
||||
type Error = SendError;
|
||||
|
||||
fn is_congested(_with: &Location) -> bool {
|
||||
frame_support::storage::unhashed::get_or_default(b"TestLocalXcmChannelManager.Congested")
|
||||
pezframe_support::storage::unhashed::get_or_default(b"TestLocalXcmChannelManager.Congested")
|
||||
}
|
||||
|
||||
fn suspend_bridge(local_origin: &Location, bridge: BridgeId) -> Result<(), Self::Error> {
|
||||
@@ -535,7 +535,7 @@ impl LocalXcmChannelManager for TestLocalXcmChannelManager {
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_xcm_bridge_hub_router::XcmChannelStatusProvider for TestLocalXcmChannelManager {
|
||||
impl pezpallet_xcm_bridge_hub_router::XcmChannelStatusProvider for TestLocalXcmChannelManager {
|
||||
fn is_congested(with: &Location) -> bool {
|
||||
<Self as LocalXcmChannelManager>::is_congested(with)
|
||||
}
|
||||
@@ -545,13 +545,13 @@ pub struct TestBlobDispatcher;
|
||||
|
||||
impl TestBlobDispatcher {
|
||||
pub fn is_dispatched() -> bool {
|
||||
frame_support::storage::unhashed::get_or_default(b"TestBlobDispatcher.Dispatched")
|
||||
pezframe_support::storage::unhashed::get_or_default(b"TestBlobDispatcher.Dispatched")
|
||||
}
|
||||
}
|
||||
|
||||
impl DispatchBlob for TestBlobDispatcher {
|
||||
fn dispatch_blob(_blob: Vec<u8>) -> Result<(), DispatchBlobError> {
|
||||
frame_support::storage::unhashed::put(b"TestBlobDispatcher.Dispatched", &true);
|
||||
pezframe_support::storage::unhashed::put(b"TestBlobDispatcher.Dispatched", &true);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -564,11 +564,11 @@ impl Chain for ThisUnderlyingChain {
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hasher = BlakeTwo256;
|
||||
type Header = SubstrateHeader;
|
||||
type Header = BizinikiwiHeader;
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type Nonce = u64;
|
||||
type Signature = sp_runtime::MultiSignature;
|
||||
type Signature = pezsp_runtime::MultiSignature;
|
||||
|
||||
const STATE_VERSION: StateVersion = StateVersion::V1;
|
||||
|
||||
@@ -588,7 +588,7 @@ impl ChainWithMessages for ThisUnderlyingChain {
|
||||
}
|
||||
|
||||
pub type BridgedHeaderHash = H256;
|
||||
pub type BridgedChainHeader = SubstrateHeader;
|
||||
pub type BridgedChainHeader = BizinikiwiHeader;
|
||||
|
||||
pub struct BridgedUnderlyingChain;
|
||||
impl Chain for BridgedUnderlyingChain {
|
||||
@@ -600,7 +600,7 @@ impl Chain for BridgedUnderlyingChain {
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type Nonce = u64;
|
||||
type Signature = sp_runtime::MultiSignature;
|
||||
type Signature = pezsp_runtime::MultiSignature;
|
||||
|
||||
const STATE_VERSION: StateVersion = StateVersion::V1;
|
||||
|
||||
@@ -633,7 +633,7 @@ pub struct TestMessageDispatch;
|
||||
|
||||
impl TestMessageDispatch {
|
||||
pub fn deactivate(lane: TestLaneIdType) {
|
||||
frame_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
|
||||
pezframe_support::storage::unhashed::put(&(b"inactive", lane).encode()[..], &false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ impl MessageDispatch for TestMessageDispatch {
|
||||
type LaneId = TestLaneIdType;
|
||||
|
||||
fn is_active(lane: Self::LaneId) -> bool {
|
||||
frame_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
|
||||
pezframe_support::storage::unhashed::take::<bool>(&(b"inactive", lane).encode()[..]) !=
|
||||
Some(false)
|
||||
}
|
||||
|
||||
@@ -662,8 +662,8 @@ impl MessageDispatch for TestMessageDispatch {
|
||||
|
||||
/// Run pallet test.
|
||||
pub fn run_test<T>(test: impl FnOnce() -> T) -> T {
|
||||
sp_io::TestExternalities::new(
|
||||
frame_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap(),
|
||||
pezsp_io::TestExternalities::new(
|
||||
pezframe_system::GenesisConfig::<TestRuntime>::default().build_storage().unwrap(),
|
||||
)
|
||||
.execute_with(test)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user