fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -90,7 +90,7 @@ update will not be enacted directly; instead it takes `X` relay blocks (a value
|
||||
by the relay chain) before the relay chain allows the update to be applied. The first Teyrchain
|
||||
block that will be included after `X` relay chain blocks needs to apply the upgrade.
|
||||
If the update is applied before the waiting period is finished, the relay chain will reject the
|
||||
Teyrchain block for inclusion. The Pezcumulus runtime pallet will provide the functionality to
|
||||
Teyrchain block for inclusion. The Pezcumulus runtime pezpallet will provide the functionality to
|
||||
register the runtime upgrade and will also make sure that the update is applied at the correct block.
|
||||
|
||||
After updating the Teyrchain runtime, a Teyrchain needs to wait a certain amount of time `Y`
|
||||
|
||||
@@ -133,7 +133,7 @@ pub enum Subcommand {
|
||||
ExportGenesisWasm(pezcumulus_client_cli::ExportGenesisWasmCommand),
|
||||
|
||||
/// Sub-commands concerned with benchmarking.
|
||||
/// The pallet benchmarking moved to the `pallet` sub-command.
|
||||
/// The pezpallet benchmarking moved to the `pezpallet` sub-command.
|
||||
#[command(subcommand)]
|
||||
Benchmark(pezframe_benchmarking_cli::BenchmarkCmd),
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ where
|
||||
// Switch on the concrete benchmark sub-command-
|
||||
match cmd {
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
BenchmarkCmd::Pallet(cmd) => {
|
||||
BenchmarkCmd::Pezpallet(cmd) => {
|
||||
let chain = cmd
|
||||
.shared_params
|
||||
.chain
|
||||
|
||||
@@ -25,9 +25,9 @@ use scale_info::{form::PortableForm, TypeDef, TypeDefPrimitive};
|
||||
use std::fmt::Display;
|
||||
use subxt_metadata::{Metadata, StorageEntryType};
|
||||
|
||||
/// Expected teyrchain system pallet runtime type name.
|
||||
/// Expected teyrchain system pezpallet runtime type name.
|
||||
pub const DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME: &str = "TeyrchainSystem";
|
||||
/// Expected frame system pallet runtime type name.
|
||||
/// Expected frame system pezpallet runtime type name.
|
||||
pub const DEFAULT_FRAME_SYSTEM_PALLET_NAME: &str = "System";
|
||||
|
||||
/// The Aura ID used by the Aura consensus
|
||||
@@ -113,7 +113,7 @@ impl RuntimeResolver for DefaultRuntimeResolver {
|
||||
None => {
|
||||
log::warn!(
|
||||
r#"⚠️ There isn't a runtime type named `System`, corresponding to the `pezframe-system`
|
||||
pallet (https://docs.rs/pezframe-system/latest/pezframe_system/). Please check Omni Node docs for runtime conventions:
|
||||
pezpallet (https://docs.rs/pezframe-system/latest/pezframe_system/). Please check Omni Node docs for runtime conventions:
|
||||
https://docs.pezkuwichain.io/sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html#runtime-conventions.
|
||||
Note: We'll assume a block number size of `u32`."#
|
||||
);
|
||||
@@ -121,9 +121,9 @@ impl RuntimeResolver for DefaultRuntimeResolver {
|
||||
},
|
||||
};
|
||||
|
||||
if !metadata_inspector.pallet_exists(DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME) {
|
||||
if !metadata_inspector.pezpallet_exists(DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME) {
|
||||
log::warn!(
|
||||
r#"⚠️ The teyrchain system pallet (https://docs.rs/crate/pezcumulus-pezpallet-parachain-system/latest) is
|
||||
r#"⚠️ The teyrchain system pezpallet (https://docs.rs/crate/pezcumulus-pezpallet-parachain-system/latest) is
|
||||
missing from the runtime’s metadata. Please check Omni Node docs for runtime conventions:
|
||||
https://docs.pezkuwichain.io/sdk/master/polkadot_sdk_docs/reference_docs/omni_node/index.html#runtime-conventions."#
|
||||
);
|
||||
@@ -201,8 +201,8 @@ mod tests {
|
||||
#[test]
|
||||
fn test_pallet_exists() {
|
||||
let metadata_inspector = MetadataInspector(pezcumulus_test_runtime_metadata());
|
||||
assert!(metadata_inspector.pallet_exists(DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME));
|
||||
assert!(metadata_inspector.pallet_exists(DEFAULT_FRAME_SYSTEM_PALLET_NAME));
|
||||
assert!(metadata_inspector.pezpallet_exists(DEFAULT_TEYRCHAIN_SYSTEM_PALLET_NAME));
|
||||
assert!(metadata_inspector.pezpallet_exists(DEFAULT_FRAME_SYSTEM_PALLET_NAME));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pezpallet-ah-ops"
|
||||
description = "Operations cleanup pallet for the post-migration Asset Hub"
|
||||
description = "Operations cleanup pezpallet for the post-migration Asset Hub"
|
||||
license = "Apache-2.0"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! The operational pallet for the Asset Hub, designed to manage and facilitate the migration of
|
||||
//! The operational pezpallet for the Asset Hub, designed to manage and facilitate the migration of
|
||||
//! subsystems such as Governance, Staking, Balances from the Relay Chain to the Asset Hub. This
|
||||
//! pallet works alongside its counterpart, `pezpallet_rc_migrator`, which handles migration
|
||||
//! pezpallet works alongside its counterpart, `pezpallet_rc_migrator`, which handles migration
|
||||
//! processes on the Relay Chain side.
|
||||
//!
|
||||
//! This pallet is responsible for controlling the initiation, progression, and completion of the
|
||||
//! This pezpallet is responsible for controlling the initiation, progression, and completion of the
|
||||
//! migration process, including managing its various stages and transferring the necessary data.
|
||||
//! The pallet directly accesses the storage of other pallets for read/write operations while
|
||||
//! The pezpallet directly accesses the storage of other pallets for read/write operations while
|
||||
//! maintaining compatibility with their existing APIs.
|
||||
//!
|
||||
//! To simplify development and avoid the need to edit the original pallets, this pallet may
|
||||
//! To simplify development and avoid the need to edit the original pallets, this pezpallet may
|
||||
//! duplicate private items such as storage entries from the original pallets. This ensures that the
|
||||
//! migration logic can be implemented without altering the original implementations.
|
||||
|
||||
@@ -38,7 +38,7 @@ mod mock;
|
||||
mod tests;
|
||||
pub mod weights;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
use codec::DecodeAll;
|
||||
@@ -56,18 +56,18 @@ use pezsp_application_crypto::ByteArray;
|
||||
use pezsp_runtime::{traits::BlockNumberProvider, AccountId32};
|
||||
use pezsp_std::prelude::*;
|
||||
|
||||
/// The log target of this pallet.
|
||||
/// The log target of this pezpallet.
|
||||
pub const LOG_TARGET: &str = "runtime::ah-ops";
|
||||
|
||||
pub type BalanceOf<T> = <T as pezpallet_balances::Config>::Balance;
|
||||
pub type DerivationIndex = u16;
|
||||
pub type ParaId = u16;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config<AccountData = AccountData<u128>, AccountId = AccountId32>
|
||||
+ pezpallet_balances::Config<Balance = u128>
|
||||
@@ -85,7 +85,7 @@ pub mod pallet {
|
||||
/// Access the block number of the Relay Chain.
|
||||
type RcBlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
|
||||
|
||||
/// The Weight information for extrinsics in this pallet.
|
||||
/// The Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ pub mod pallet {
|
||||
/// - The para_id of the lease slot.
|
||||
/// - The account that will have the balance unreserved.
|
||||
/// - The balance to be unreserved.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type RcLeaseReserve<T: Config> = StorageNMap<
|
||||
_,
|
||||
(
|
||||
@@ -127,7 +127,7 @@ pub mod pallet {
|
||||
///
|
||||
/// The value is (fund_pot, balance). The contribution pot is the second key in the
|
||||
/// `RcCrowdloanContribution` storage.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type RcCrowdloanContribution<T: Config> = StorageNMap<
|
||||
_,
|
||||
(
|
||||
@@ -148,7 +148,7 @@ pub mod pallet {
|
||||
/// - Block number after which this can be unreserved
|
||||
/// - The para_id of the crowdloan
|
||||
/// - The account that will have the balance unreserved
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type RcCrowdloanReserve<T: Config> = StorageNMap<
|
||||
_,
|
||||
(
|
||||
@@ -160,7 +160,7 @@ pub mod pallet {
|
||||
OptionQuery,
|
||||
>;
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Either no lease deposit or already unreserved.
|
||||
NoLeaseReserve,
|
||||
@@ -202,8 +202,8 @@ pub mod pallet {
|
||||
AccountIdentical,
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(crate) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// Some lease reserve could not be unreserved and needs manual cleanup.
|
||||
LeaseUnreserveRemaining {
|
||||
@@ -239,11 +239,11 @@ pub mod pallet {
|
||||
HoldReleased { account: T::AccountId, amount: BalanceOf<T>, reason: T::RuntimeHoldReason },
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Unreserve the deposit that was taken for creating a crowdloan.
|
||||
///
|
||||
/// This can be called by any signed origin. It unreserves the lease deposit on the account
|
||||
@@ -252,8 +252,8 @@ pub mod pallet {
|
||||
/// crowdloan account.
|
||||
///
|
||||
/// Solo bidder accounts that won lease auctions can use this to unreserve their amount.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::unreserve_lease_deposit())]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::unreserve_lease_deposit())]
|
||||
pub fn unreserve_lease_deposit(
|
||||
origin: OriginFor<T>,
|
||||
block: BlockNumberFor<T>,
|
||||
@@ -273,8 +273,8 @@ pub mod pallet {
|
||||
/// - Won an auction and all leases expired
|
||||
///
|
||||
/// Can be called by any signed origin.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::withdraw_crowdloan_contribution())]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::withdraw_crowdloan_contribution())]
|
||||
pub fn withdraw_crowdloan_contribution(
|
||||
origin: OriginFor<T>,
|
||||
block: BlockNumberFor<T>,
|
||||
@@ -295,8 +295,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Can be called by any signed origin. The condition that all contributions are withdrawn
|
||||
/// is in place since the reserve acts as a storage deposit.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::unreserve_crowdloan_reserve())]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::unreserve_crowdloan_reserve())]
|
||||
pub fn unreserve_crowdloan_reserve(
|
||||
origin: OriginFor<T>,
|
||||
block: BlockNumberFor<T>,
|
||||
@@ -315,8 +315,8 @@ pub mod pallet {
|
||||
/// `SovereignMigrated` will be emitted if the account was migrated successfully.
|
||||
///
|
||||
/// Callable by any signed origin.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::DbWeight::get().reads_writes(15, 15)
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(T::DbWeight::get().reads_writes(15, 15)
|
||||
.saturating_add(Weight::from_parts(0, 50_000)))]
|
||||
pub fn migrate_teyrchain_sovereign_acc(
|
||||
origin: OriginFor<T>,
|
||||
@@ -334,8 +334,8 @@ pub mod pallet {
|
||||
/// `SovereignMigrated` will be emitted if the account was migrated successfully.
|
||||
///
|
||||
/// Callable by any signed origin.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::DbWeight::get().reads_writes(15, 15)
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(T::DbWeight::get().reads_writes(15, 15)
|
||||
.saturating_add(Weight::from_parts(0, 50_000)))]
|
||||
pub fn migrate_teyrchain_sovereign_derived_acc(
|
||||
origin: OriginFor<T>,
|
||||
@@ -350,8 +350,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Force unreserve a named or unnamed reserve.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::DbWeight::get().reads_writes(10, 10)
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(T::DbWeight::get().reads_writes(10, 10)
|
||||
.saturating_add(Weight::from_parts(0, 50_000)))]
|
||||
pub fn force_unreserve(
|
||||
origin: OriginFor<T>,
|
||||
@@ -365,7 +365,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
pub fn do_unreserve_lease_deposit(
|
||||
block: BlockNumberFor<T>,
|
||||
depositor: T::AccountId,
|
||||
@@ -464,7 +464,7 @@ pub mod pallet {
|
||||
if from == to {
|
||||
return Err(Error::<T>::AccountIdentical);
|
||||
}
|
||||
pezpallet_balances::Pallet::<T>::ensure_upgraded(from); // prevent future headache
|
||||
pezpallet_balances::Pezpallet::<T>::ensure_upgraded(from); // prevent future headache
|
||||
|
||||
let (translated_acc, para_id, index) = if let Some((parent, index)) = derivation {
|
||||
let (parent_translated, para_id) =
|
||||
@@ -512,12 +512,12 @@ pub mod pallet {
|
||||
defensive_assert!(missing == 0, "Should have unreserved the full amount");
|
||||
|
||||
// Set consumer refs to zero
|
||||
let consumers = pezframe_system::Pallet::<T>::consumers(from);
|
||||
let consumers = pezframe_system::Pezpallet::<T>::consumers(from);
|
||||
pezframe_system::Account::<T>::mutate(from, |acc| {
|
||||
acc.consumers = 0;
|
||||
});
|
||||
// We dont handle sufficients and there should be none
|
||||
ensure!(pezframe_system::Pallet::<T>::sufficients(from) == 0, Error::<T>::InternalError);
|
||||
ensure!(pezframe_system::Pezpallet::<T>::sufficients(from) == 0, Error::<T>::InternalError);
|
||||
|
||||
// Sanity check
|
||||
let total = <T as Config>::Currency::total_balance(from);
|
||||
|
||||
@@ -22,7 +22,7 @@ use pezsp_runtime::traits::{BlakeTwo256, IdentityLookup};
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Runtime>;
|
||||
|
||||
// For testing the pallet, we construct a mock runtime.
|
||||
// For testing the pezpallet, we construct a mock runtime.
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Runtime {
|
||||
System: pezframe_system,
|
||||
|
||||
@@ -125,12 +125,12 @@ fn sovereign_account_translation() {
|
||||
if let Some((parent, index)) = derivation {
|
||||
let parent = AccountId32::from_str(parent).unwrap();
|
||||
let (got_to, _) =
|
||||
crate::Pallet::<AssetHub>::try_rc_sovereign_derived_to_ah(&from, &parent, index)
|
||||
crate::Pezpallet::<AssetHub>::try_rc_sovereign_derived_to_ah(&from, &parent, index)
|
||||
.unwrap();
|
||||
assert_eq!(got_to, to);
|
||||
} else {
|
||||
let (got_to, _) =
|
||||
crate::Pallet::<AssetHub>::try_translate_rc_sovereign_to_ah(&from).unwrap();
|
||||
crate::Pezpallet::<AssetHub>::try_translate_rc_sovereign_to_ah(&from).unwrap();
|
||||
assert_eq!(got_to, to);
|
||||
}
|
||||
}
|
||||
@@ -153,14 +153,14 @@ fn translate_sovereign_acc_good() {
|
||||
|
||||
// Works if the account does not exist
|
||||
hypothetically!({
|
||||
crate::Pallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
crate::Pezpallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
&from,
|
||||
&to,
|
||||
derivation_proof.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
// Also twice
|
||||
crate::Pallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
crate::Pezpallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
&from,
|
||||
&to,
|
||||
derivation_proof.clone(),
|
||||
@@ -171,14 +171,14 @@ fn translate_sovereign_acc_good() {
|
||||
// But also if it exists
|
||||
<AssetHub as crate::Config>::Currency::mint_into(&from, balance).unwrap();
|
||||
hypothetically!({
|
||||
crate::Pallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
crate::Pezpallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
&from,
|
||||
&to,
|
||||
derivation_proof.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
// Also twice
|
||||
crate::Pallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
crate::Pezpallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
&from,
|
||||
&to,
|
||||
derivation_proof.clone(),
|
||||
@@ -193,7 +193,7 @@ fn translate_sovereign_acc_good() {
|
||||
// Can also have locks
|
||||
<AssetHub as crate::Config>::Currency::set_lock(LID, &from, lock, WithdrawReasons::FEE);
|
||||
hypothetically!({
|
||||
crate::Pallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
crate::Pezpallet::<AssetHub>::do_migrate_teyrchain_sovereign_derived_acc(
|
||||
&from,
|
||||
&to,
|
||||
derivation_proof.clone(),
|
||||
@@ -225,7 +225,7 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Initially no contributions exist, so should return true
|
||||
assert!(
|
||||
crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return true when no contributions exist"
|
||||
);
|
||||
|
||||
@@ -237,7 +237,7 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Now should return false since there's a contribution
|
||||
assert!(
|
||||
!crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
!crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return false when contributions exist"
|
||||
);
|
||||
|
||||
@@ -249,7 +249,7 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Still should return false
|
||||
assert!(
|
||||
!crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
!crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return false when multiple contributions exist"
|
||||
);
|
||||
|
||||
@@ -258,7 +258,7 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Still should return false (one contribution remains)
|
||||
assert!(
|
||||
!crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
!crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return false when one contribution still exists"
|
||||
);
|
||||
|
||||
@@ -267,14 +267,14 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Now should return true again
|
||||
assert!(
|
||||
crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return true after all contributions are removed"
|
||||
);
|
||||
|
||||
// Test with different para_id - should still be true (no contributions)
|
||||
let other_para_id: u16 = 2001;
|
||||
assert!(
|
||||
crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, other_para_id),
|
||||
crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, other_para_id),
|
||||
"Should return true for different para_id with no contributions"
|
||||
);
|
||||
|
||||
@@ -286,13 +286,13 @@ fn contributions_withdrawn_works() {
|
||||
|
||||
// Original para_id should now be false
|
||||
assert!(
|
||||
!crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
!crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, para_id),
|
||||
"Should return false for para_id with contribution"
|
||||
);
|
||||
|
||||
// Different para_id should still be true
|
||||
assert!(
|
||||
crate::Pallet::<AssetHub>::contributions_withdrawn(block_number, other_para_id),
|
||||
crate::Pezpallet::<AssetHub>::contributions_withdrawn(block_number, other_para_id),
|
||||
"Should return true for different para_id"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
// frame-omni-bencher
|
||||
// v1
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --runtime=target/production/wbuild/asset-hub-pezkuwi-runtime/asset_hub_pezkuwi_runtime.wasm
|
||||
// --pallet
|
||||
// --pezpallet
|
||||
// pezpallet-ah-ops
|
||||
// --extrinsic
|
||||
// *
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! The definition of a [`FixedVelocityConsensusHook`] for consensus logic to manage
|
||||
//! block velocity.
|
||||
use super::{pallet, Aura};
|
||||
use super::{pezpallet, Aura};
|
||||
use core::{marker::PhantomData, num::NonZeroU32};
|
||||
use pezcumulus_pezpallet_teyrchain_system::{
|
||||
self as teyrchain_system,
|
||||
@@ -53,7 +53,7 @@ pub struct FixedVelocityConsensusHook<
|
||||
>(PhantomData<T>);
|
||||
|
||||
impl<
|
||||
T: pallet::Config,
|
||||
T: pezpallet::Config,
|
||||
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32,
|
||||
const V: u32,
|
||||
const C: u32,
|
||||
@@ -75,7 +75,7 @@ where
|
||||
let velocity = V.max(1);
|
||||
let relay_chain_slot = state_proof.read_slot().expect("failed to read relay chain slot");
|
||||
|
||||
let (relay_chain_slot, authored_in_relay) = match pallet::RelaySlotInfo::<T>::get() {
|
||||
let (relay_chain_slot, authored_in_relay) = match pezpallet::RelaySlotInfo::<T>::get() {
|
||||
Some((slot, authored)) if slot == relay_chain_slot => (slot, authored),
|
||||
Some((slot, _)) if slot < relay_chain_slot => (relay_chain_slot, 0),
|
||||
Some((slot, _)) => {
|
||||
@@ -89,7 +89,7 @@ where
|
||||
panic!("authored blocks limit is reached for the slot: relay_chain_slot={relay_chain_slot:?}, authored={authored_in_relay:?}, velocity={velocity:?}");
|
||||
}
|
||||
|
||||
pallet::RelaySlotInfo::<T>::put((relay_chain_slot, authored_in_relay + 1));
|
||||
pezpallet::RelaySlotInfo::<T>::put((relay_chain_slot, authored_in_relay + 1));
|
||||
|
||||
let para_slot = pezpallet_aura::CurrentSlot::<T>::get();
|
||||
|
||||
@@ -123,7 +123,7 @@ where
|
||||
}
|
||||
|
||||
impl<
|
||||
T: pallet::Config + teyrchain_system::Config,
|
||||
T: pezpallet::Config + teyrchain_system::Config,
|
||||
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32,
|
||||
const V: u32,
|
||||
const C: u32,
|
||||
@@ -141,13 +141,13 @@ impl<
|
||||
/// is more recent than the included block itself.
|
||||
pub fn can_build_upon(included_hash: T::Hash, new_slot: Slot) -> bool {
|
||||
let velocity = V.max(1);
|
||||
let (last_slot, authored_so_far) = match pallet::RelaySlotInfo::<T>::get() {
|
||||
let (last_slot, authored_so_far) = match pezpallet::RelaySlotInfo::<T>::get() {
|
||||
None => return true,
|
||||
Some(x) => x,
|
||||
};
|
||||
|
||||
let size_after_included =
|
||||
teyrchain_system::Pallet::<T>::unincluded_segment_size_after(included_hash);
|
||||
teyrchain_system::Pezpallet::<T>::unincluded_segment_size_after(included_hash);
|
||||
|
||||
// can never author when the unincluded segment is full.
|
||||
if size_after_included >= C {
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Pezcumulus extension pallet for AuRa
|
||||
//! Pezcumulus extension pezpallet for AuRa
|
||||
//!
|
||||
//! This pallet extends the Bizinikiwi AuRa pallet to make it compatible with teyrchains. It
|
||||
//! provides the [`Pallet`], the [`Config`] and the [`GenesisConfig`].
|
||||
//! This pezpallet extends the Bizinikiwi AuRa pezpallet to make it compatible with teyrchains. It
|
||||
//! provides the [`Pezpallet`], the [`Config`] and the [`GenesisConfig`].
|
||||
//!
|
||||
//! It is also required that the teyrchain runtime uses the provided [`BlockExecutor`] to properly
|
||||
//! check the constructed block on the relay chain.
|
||||
@@ -45,26 +45,26 @@ mod test;
|
||||
|
||||
pub use consensus_hook::FixedVelocityConsensusHook;
|
||||
|
||||
type Aura<T> = pezpallet_aura::Pallet<T>;
|
||||
type Aura<T> = pezpallet_aura::Pezpallet<T>;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
/// The configuration trait.
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezpallet_aura::Config + pezframe_system::Config {}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(migration::STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_finalize(_: BlockNumberFor<T>) {
|
||||
// Update to the latest AuRa authorities.
|
||||
Authorities::<T>::put(pezpallet_aura::Authorities::<T>::get());
|
||||
@@ -83,7 +83,7 @@ pub mod pallet {
|
||||
/// The authorities in AuRa are overwritten in `on_initialize` when we switch to a new session,
|
||||
/// but we require the old authorities to verify the seal when validating a PoV. This will
|
||||
/// always be updated to the latest AuRa authorities in `on_finalize`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type Authorities<T: Config> = StorageValue<
|
||||
_,
|
||||
BoundedVec<T::AuthorityId, <T as pezpallet_aura::Config>::MaxAuthorities>,
|
||||
@@ -94,17 +94,17 @@ pub mod pallet {
|
||||
///
|
||||
/// This is updated in [`FixedVelocityConsensusHook::on_state_proof`] with the current relay
|
||||
/// chain slot as provided by the relay chain state proof.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type RelaySlotInfo<T: Config> = StorageValue<_, (Slot, u32), OptionQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(pezframe_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
let authorities = pezpallet_aura::Authorities::<T>::get();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// limitations under the License.
|
||||
extern crate alloc;
|
||||
|
||||
use crate::{Config, Pallet};
|
||||
use crate::{Config, Pezpallet};
|
||||
#[cfg(feature = "try-runtime")]
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{migrations::VersionedMigration, pezpallet_prelude::StorageVersion};
|
||||
@@ -32,7 +32,7 @@ mod v0 {
|
||||
///
|
||||
/// Updated on each block initialization.
|
||||
#[storage_alias]
|
||||
pub(super) type SlotInfo<T: Config> = StorageValue<Pallet<T>, (Slot, u32), OptionQuery>;
|
||||
pub(super) type SlotInfo<T: Config> = StorageValue<Pezpallet<T>, (Slot, u32), OptionQuery>;
|
||||
}
|
||||
mod v1 {
|
||||
use super::*;
|
||||
@@ -69,6 +69,6 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
v1::UncheckedMigrationToV1<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -38,23 +38,23 @@ use pezsp_trie::{proof_size_extension::ProofSizeExt, recorder::Recorder};
|
||||
use pezsp_version::RuntimeVersion;
|
||||
use std::cell::RefCell;
|
||||
|
||||
// Test pallet that reads storage and calls storage_proof_size
|
||||
#[pezframe_support::pallet]
|
||||
// Test pezpallet that reads storage and calls storage_proof_size
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod test_pallet {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type TestStorage<T: Config> = StorageValue<_, u64, ValueQuery>;
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
|
||||
let proof_size =
|
||||
pezcumulus_primitives_proof_size_hostfunction::storage_proof_size::storage_proof_size(
|
||||
@@ -188,7 +188,7 @@ fn relay_chain_state_proof(relay_slot: u64) -> RelayChainStateProof {
|
||||
}
|
||||
|
||||
fn assert_slot_info(expected_slot: u64, expected_authored: u32) {
|
||||
let (slot, authored) = pallet::RelaySlotInfo::<Test>::get().unwrap();
|
||||
let (slot, authored) = pezpallet::RelaySlotInfo::<Test>::get().unwrap();
|
||||
assert_eq!(slot, Slot::from(expected_slot), "Slot stored in RelaySlotInfo is incorrect.");
|
||||
assert_eq!(
|
||||
authored, expected_authored,
|
||||
@@ -436,23 +436,23 @@ fn test_can_build_upon_unincluded_segment_size() {
|
||||
fn block_executor_does_not_influence_proof_size_recordings() {
|
||||
fn build_block(header: <Block as BlockT>::Header) -> <Block as BlockT>::Header {
|
||||
// Initialize the block
|
||||
pezframe_system::Pallet::<Test>::initialize(
|
||||
pezframe_system::Pezpallet::<Test>::initialize(
|
||||
&header.number,
|
||||
&header.parent_hash,
|
||||
&header.digest(),
|
||||
);
|
||||
|
||||
// We omit `teyrchain-system` as it is not important here.
|
||||
<pezframe_system::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
<crate::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
<test_pallet::Pallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
<pezframe_system::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
<crate::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
<test_pallet::Pezpallet<Test> as Hooks<_>>::on_initialize(header.number);
|
||||
|
||||
<test_pallet::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
<crate::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
<pezframe_system::Pallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
<test_pallet::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
<crate::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
<pezframe_system::Pezpallet<Test> as Hooks<_>>::on_finalize(header.number);
|
||||
|
||||
// Finalize the block
|
||||
pezframe_system::Pallet::<Test>::finalize()
|
||||
pezframe_system::Pezpallet::<Test>::finalize()
|
||||
}
|
||||
|
||||
// Create a simple executive that calls on_initialize and on_finalize
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
authors.workspace = true
|
||||
description = "Simple pallet to select collators for a teyrchain."
|
||||
description = "Simple pezpallet to select collators for a teyrchain."
|
||||
edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use super::*;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::Pallet as CollatorSelection;
|
||||
use crate::Pezpallet as CollatorSelection;
|
||||
use alloc::vec::Vec;
|
||||
use codec::Decode;
|
||||
use core::cmp;
|
||||
@@ -36,7 +36,7 @@ pub type BalanceOf<T> =
|
||||
const SEED: u32 = 0;
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
let events = pezframe_system::Pallet::<T>::events();
|
||||
let events = pezframe_system::Pezpallet::<T>::events();
|
||||
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
// compare to the last event record
|
||||
let EventRecord { event, .. } = &events[events.len() - 1];
|
||||
@@ -49,8 +49,8 @@ fn create_funded_user<T: Config>(
|
||||
balance_factor: u32,
|
||||
) -> T::AccountId {
|
||||
let user = account(string, n, SEED);
|
||||
let balance = <T as pallet::Config>::Currency::minimum_balance() * balance_factor.into();
|
||||
let _ = <T as pallet::Config>::Currency::make_free_balance_be(&user, balance);
|
||||
let balance = <T as pezpallet::Config>::Currency::minimum_balance() * balance_factor.into();
|
||||
let _ = <T as pezpallet::Config>::Currency::make_free_balance_be(&user, balance);
|
||||
user
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ fn register_validators<T: Config + session::Config>(count: u32) -> Vec<T::Accoun
|
||||
let validators = (0..count).map(|c| validator::<T>(c)).collect::<Vec<_>>();
|
||||
|
||||
for (who, keys) in validators.clone() {
|
||||
<session::Pallet<T>>::ensure_can_pay_key_deposit(&who).unwrap();
|
||||
<session::Pallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
|
||||
<session::Pezpallet<T>>::ensure_can_pay_key_deposit(&who).unwrap();
|
||||
<session::Pezpallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap();
|
||||
}
|
||||
|
||||
validators.into_iter().map(|(who, _)| who).collect()
|
||||
@@ -91,7 +91,7 @@ fn register_candidates<T: Config>(count: u32) {
|
||||
assert!(CandidacyBond::<T>::get() > 0u32.into(), "Bond cannot be zero!");
|
||||
|
||||
for who in candidates {
|
||||
<T as pallet::Config>::Currency::make_free_balance_be(
|
||||
<T as pezpallet::Config>::Currency::make_free_balance_be(
|
||||
&who,
|
||||
CandidacyBond::<T>::get() * 3u32.into(),
|
||||
);
|
||||
@@ -148,7 +148,7 @@ mod benchmarks {
|
||||
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
|
||||
// need to fill up candidates
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(c);
|
||||
// get accounts and keys for the `c` candidates
|
||||
let mut candidates = (0..c).map(|cc| validator::<T>(cc)).collect::<Vec<_>>();
|
||||
@@ -159,23 +159,23 @@ mod benchmarks {
|
||||
candidates.push((new_invulnerable.clone(), new_invulnerable_keys));
|
||||
// set their keys ...
|
||||
for (who, keys) in candidates.clone() {
|
||||
<session::Pallet<T>>::ensure_can_pay_key_deposit(&who).unwrap();
|
||||
<session::Pallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new())
|
||||
<session::Pezpallet<T>>::ensure_can_pay_key_deposit(&who).unwrap();
|
||||
<session::Pezpallet<T>>::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new())
|
||||
.unwrap();
|
||||
}
|
||||
// ... and register them.
|
||||
for (who, _) in candidates.iter() {
|
||||
let deposit = CandidacyBond::<T>::get();
|
||||
<T as pallet::Config>::Currency::make_free_balance_be(who, deposit * 1000_u32.into());
|
||||
<T as pezpallet::Config>::Currency::make_free_balance_be(who, deposit * 1000_u32.into());
|
||||
CandidateList::<T>::try_mutate(|list| {
|
||||
list.try_push(CandidateInfo { who: who.clone(), deposit }).unwrap();
|
||||
Ok::<(), BenchmarkError>(())
|
||||
})
|
||||
.unwrap();
|
||||
<T as pallet::Config>::Currency::reserve(who, deposit)?;
|
||||
<T as pezpallet::Config>::Currency::reserve(who, deposit)?;
|
||||
LastAuthoredBlock::<T>::insert(
|
||||
who.clone(),
|
||||
pezframe_system::Pallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
pezframe_system::Pezpallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ mod benchmarks {
|
||||
k: Linear<0, { T::MaxCandidates::get() }>,
|
||||
) -> Result<(), BenchmarkError> {
|
||||
let initial_bond_amount: BalanceOf<T> =
|
||||
<T as pallet::Config>::Currency::minimum_balance() * 2u32.into();
|
||||
<T as pezpallet::Config>::Currency::minimum_balance() * 2u32.into();
|
||||
CandidacyBond::<T>::put(initial_bond_amount);
|
||||
register_validators::<T>(c);
|
||||
register_candidates::<T>(c);
|
||||
@@ -242,12 +242,12 @@ mod benchmarks {
|
||||
let bond_amount = if k > 0 {
|
||||
CandidateList::<T>::mutate(|candidates| {
|
||||
for info in candidates.iter_mut().skip(kicked as usize) {
|
||||
info.deposit = <T as pallet::Config>::Currency::minimum_balance() * 3u32.into();
|
||||
info.deposit = <T as pezpallet::Config>::Currency::minimum_balance() * 3u32.into();
|
||||
}
|
||||
});
|
||||
<T as pallet::Config>::Currency::minimum_balance() * 3u32.into()
|
||||
<T as pezpallet::Config>::Currency::minimum_balance() * 3u32.into()
|
||||
} else {
|
||||
<T as pallet::Config>::Currency::minimum_balance()
|
||||
<T as pezpallet::Config>::Currency::minimum_balance()
|
||||
};
|
||||
|
||||
#[extrinsic_call]
|
||||
@@ -261,7 +261,7 @@ mod benchmarks {
|
||||
fn update_bond(
|
||||
c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>,
|
||||
) -> Result<(), BenchmarkError> {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(c);
|
||||
|
||||
register_validators::<T>(c);
|
||||
@@ -270,8 +270,8 @@ mod benchmarks {
|
||||
let caller = CandidateList::<T>::get()[0].who.clone();
|
||||
v2::whitelist!(caller);
|
||||
|
||||
let bond_amount: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() +
|
||||
<T as pallet::Config>::Currency::minimum_balance();
|
||||
let bond_amount: BalanceOf<T> = <T as pezpallet::Config>::Currency::minimum_balance() +
|
||||
<T as pezpallet::Config>::Currency::minimum_balance();
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.clone()), bond_amount);
|
||||
@@ -281,7 +281,7 @@ mod benchmarks {
|
||||
);
|
||||
assert!(
|
||||
CandidateList::<T>::get().iter().last().unwrap().deposit ==
|
||||
<T as pallet::Config>::Currency::minimum_balance() * 2u32.into()
|
||||
<T as pezpallet::Config>::Currency::minimum_balance() * 2u32.into()
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -290,18 +290,18 @@ mod benchmarks {
|
||||
// one.
|
||||
#[benchmark]
|
||||
fn register_as_candidate(c: Linear<1, { T::MaxCandidates::get() - 1 }>) {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(c + 1);
|
||||
|
||||
register_validators::<T>(c);
|
||||
register_candidates::<T>(c);
|
||||
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bond: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() * 2u32.into();
|
||||
<T as pallet::Config>::Currency::make_free_balance_be(&caller, bond);
|
||||
let bond: BalanceOf<T> = <T as pezpallet::Config>::Currency::minimum_balance() * 2u32.into();
|
||||
<T as pezpallet::Config>::Currency::make_free_balance_be(&caller, bond);
|
||||
|
||||
<session::Pallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
<session::Pallet<T>>::set_keys(
|
||||
<session::Pezpallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
<session::Pezpallet<T>>::set_keys(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
keys::<T>(c + 1),
|
||||
Vec::new(),
|
||||
@@ -318,18 +318,18 @@ mod benchmarks {
|
||||
|
||||
#[benchmark]
|
||||
fn take_candidate_slot(c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>) {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(1);
|
||||
|
||||
register_validators::<T>(c);
|
||||
register_candidates::<T>(c);
|
||||
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let bond: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() * 10u32.into();
|
||||
<T as pallet::Config>::Currency::make_free_balance_be(&caller, bond);
|
||||
let bond: BalanceOf<T> = <T as pezpallet::Config>::Currency::minimum_balance() * 10u32.into();
|
||||
<T as pezpallet::Config>::Currency::make_free_balance_be(&caller, bond);
|
||||
|
||||
<session::Pallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
<session::Pallet<T>>::set_keys(
|
||||
<session::Pezpallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
<session::Pezpallet<T>>::set_keys(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
keys::<T>(c + 1),
|
||||
Vec::new(),
|
||||
@@ -350,7 +350,7 @@ mod benchmarks {
|
||||
// worse case is the last candidate leaving.
|
||||
#[benchmark]
|
||||
fn leave_intent(c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>) {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(c);
|
||||
|
||||
register_validators::<T>(c);
|
||||
@@ -368,24 +368,24 @@ mod benchmarks {
|
||||
// worse case is paying a non-existing candidate account.
|
||||
#[benchmark]
|
||||
fn note_author() {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
<T as pallet::Config>::Currency::make_free_balance_be(
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
<T as pezpallet::Config>::Currency::make_free_balance_be(
|
||||
&<CollatorSelection<T>>::account_id(),
|
||||
<T as pallet::Config>::Currency::minimum_balance() * 4u32.into(),
|
||||
<T as pezpallet::Config>::Currency::minimum_balance() * 4u32.into(),
|
||||
);
|
||||
let author = account("author", 0, SEED);
|
||||
let new_block: BlockNumberFor<T> = 10u32.into();
|
||||
|
||||
pezframe_system::Pallet::<T>::set_block_number(new_block);
|
||||
assert!(<T as pallet::Config>::Currency::free_balance(&author) == 0u32.into());
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(new_block);
|
||||
assert!(<T as pezpallet::Config>::Currency::free_balance(&author) == 0u32.into());
|
||||
|
||||
#[block]
|
||||
{
|
||||
<CollatorSelection<T> as EventHandler<_, _>>::note_author(author.clone())
|
||||
}
|
||||
|
||||
assert!(<T as pallet::Config>::Currency::free_balance(&author) > 0u32.into());
|
||||
assert_eq!(pezframe_system::Pallet::<T>::block_number(), new_block);
|
||||
assert!(<T as pezpallet::Config>::Currency::free_balance(&author) > 0u32.into());
|
||||
assert_eq!(pezframe_system::Pezpallet::<T>::block_number(), new_block);
|
||||
}
|
||||
|
||||
// worst case for new session.
|
||||
@@ -394,9 +394,9 @@ mod benchmarks {
|
||||
r: Linear<1, { T::MaxCandidates::get() }>,
|
||||
c: Linear<1, { T::MaxCandidates::get() }>,
|
||||
) {
|
||||
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
|
||||
CandidacyBond::<T>::put(<T as pezpallet::Config>::Currency::minimum_balance());
|
||||
DesiredCandidates::<T>::put(c);
|
||||
pezframe_system::Pallet::<T>::set_block_number(0u32.into());
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(0u32.into());
|
||||
|
||||
register_validators::<T>(c);
|
||||
register_candidates::<T>(c);
|
||||
@@ -427,7 +427,7 @@ mod benchmarks {
|
||||
let min_candidates = min_candidates::<T>();
|
||||
let pre_length = CandidateList::<T>::decode_len().unwrap_or_default();
|
||||
|
||||
pezframe_system::Pallet::<T>::set_block_number(new_block);
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(new_block);
|
||||
|
||||
let current_length: u32 = CandidateList::<T>::decode_len()
|
||||
.unwrap_or_default()
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Collator Selection pallet.
|
||||
//! Collator Selection pezpallet.
|
||||
//!
|
||||
//! A pallet to manage collators in a teyrchain.
|
||||
//! A pezpallet to manage collators in a teyrchain.
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
//! The Collator Selection pallet manages the collators of a teyrchain. **Collation is _not_ a
|
||||
//! secure activity** and this pallet does not implement any game-theoretic mechanisms to meet BFT
|
||||
//! The Collator Selection pezpallet manages the collators of a teyrchain. **Collation is _not_ a
|
||||
//! secure activity** and this pezpallet does not implement any game-theoretic mechanisms to meet BFT
|
||||
//! safety assumptions of the chosen set.
|
||||
//!
|
||||
//! ## Terminology
|
||||
@@ -67,7 +67,7 @@
|
||||
//!
|
||||
//! ### Rewards
|
||||
//!
|
||||
//! The Collator Selection pallet maintains an on-chain account (the "Pot"). In each block, the
|
||||
//! The Collator Selection pezpallet maintains an on-chain account (the "Pot"). In each block, the
|
||||
//! collator who authored it receives:
|
||||
//!
|
||||
//! - Half the value of the Pot.
|
||||
@@ -85,7 +85,7 @@ extern crate alloc;
|
||||
|
||||
use core::marker::PhantomData;
|
||||
use pezframe_support::traits::TypedGet;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -100,8 +100,8 @@ pub mod weights;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::collator-selection";
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
pub use crate::weights::WeightInfo;
|
||||
use alloc::vec::Vec;
|
||||
use core::ops::Div;
|
||||
@@ -128,7 +128,7 @@ pub mod pallet {
|
||||
type BalanceOf<T> =
|
||||
<<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
|
||||
|
||||
/// A convertor from collators id. Since this pallet does not have stash/controller, this is
|
||||
/// A convertor from collators id. Since this pezpallet does not have stash/controller, this is
|
||||
/// just identity.
|
||||
pub struct IdentityCollator;
|
||||
impl<T> pezsp_runtime::traits::Convert<T, Option<T>> for IdentityCollator {
|
||||
@@ -137,8 +137,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
/// Configure the pallet by specifying the parameters and types on which it depends.
|
||||
#[pallet::config]
|
||||
/// Configure the pezpallet by specifying the parameters and types on which it depends.
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
/// Overarching event type.
|
||||
#[allow(deprecated)]
|
||||
@@ -147,31 +147,31 @@ pub mod pallet {
|
||||
/// The currency mechanism.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
|
||||
/// Origin that can dictate updating parameters of this pallet.
|
||||
/// Origin that can dictate updating parameters of this pezpallet.
|
||||
type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// Account Identifier from which the internal Pot is generated.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type PotId: Get<PalletId>;
|
||||
|
||||
/// Maximum number of candidates that we should have.
|
||||
///
|
||||
/// This does not take into account the invulnerables.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxCandidates: Get<u32>;
|
||||
|
||||
/// Minimum number eligible collators. Should always be greater than zero. This includes
|
||||
/// Invulnerable collators. This ensures that there will always be one collator who can
|
||||
/// produce a block.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MinEligibleCollators: Get<u32>;
|
||||
|
||||
/// Maximum number of invulnerables.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxInvulnerables: Get<u32>;
|
||||
|
||||
// Will be kicked if block is not produced in threshold.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type KickThreshold: Get<BlockNumberFor<Self>>;
|
||||
|
||||
/// A stable ID for a validator.
|
||||
@@ -185,13 +185,13 @@ pub mod pallet {
|
||||
/// Validate a user is registered
|
||||
type ValidatorRegistration: ValidatorRegistration<Self::ValidatorId>;
|
||||
|
||||
/// The weight information of this pallet.
|
||||
/// The weight information of this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::extra_constants]
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Gets this pallet's derived pot account.
|
||||
#[pezpallet::extra_constants]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Gets this pezpallet's derived pot account.
|
||||
fn pot_account() -> T::AccountId {
|
||||
Self::account_id()
|
||||
}
|
||||
@@ -208,12 +208,12 @@ pub mod pallet {
|
||||
pub deposit: Balance,
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// The invulnerable, permissioned collators. This list must be sorted.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Invulnerables<T: Config> =
|
||||
StorageValue<_, BoundedVec<T::AccountId, T::MaxInvulnerables>, ValueQuery>;
|
||||
|
||||
@@ -222,7 +222,7 @@ pub mod pallet {
|
||||
///
|
||||
/// This list is sorted in ascending order by deposit and when the deposits are equal, the least
|
||||
/// recently updated is considered greater.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type CandidateList<T: Config> = StorageValue<
|
||||
_,
|
||||
BoundedVec<CandidateInfo<T::AccountId, BalanceOf<T>>, T::MaxCandidates>,
|
||||
@@ -230,23 +230,23 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// Last block authored by collator.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastAuthoredBlock<T: Config> =
|
||||
StorageMap<_, Twox64Concat, T::AccountId, BlockNumberFor<T>, ValueQuery>;
|
||||
|
||||
/// Desired number of candidates.
|
||||
///
|
||||
/// This should ideally always be less than [`Config::MaxCandidates`] for weights to be correct.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type DesiredCandidates<T> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
/// Fixed amount to deposit to become a collator.
|
||||
///
|
||||
/// When a collator calls `leave_intent` they immediately receive the deposit back.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type CandidacyBond<T> = StorageValue<_, BalanceOf<T>, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub invulnerables: Vec<T::AccountId>,
|
||||
@@ -254,7 +254,7 @@ pub mod pallet {
|
||||
pub desired_candidates: u32,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
let duplicate_invulnerables = self
|
||||
@@ -282,8 +282,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// New Invulnerables were set.
|
||||
NewInvulnerables { invulnerables: Vec<T::AccountId> },
|
||||
@@ -308,9 +308,9 @@ pub mod pallet {
|
||||
InvalidInvulnerableSkipped { account_id: T::AccountId },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The pallet has too many candidates.
|
||||
/// The pezpallet has too many candidates.
|
||||
TooManyCandidates,
|
||||
/// Leaving would result in too few candidates.
|
||||
TooFewEligibleCollators,
|
||||
@@ -346,8 +346,8 @@ pub mod pallet {
|
||||
InvalidUnreserve,
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn integrity_test() {
|
||||
assert!(T::MinEligibleCollators::get() > 0, "chain must require at least one collator");
|
||||
assert!(
|
||||
@@ -363,8 +363,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set the list of invulnerable (fixed) collators. These collators must do some
|
||||
/// preparation, namely to have registered session keys.
|
||||
///
|
||||
@@ -378,8 +378,8 @@ pub mod pallet {
|
||||
/// `new`, they should be removed with `remove_invulnerable_candidate` after execution.
|
||||
///
|
||||
/// Must be called by the `UpdateOrigin`.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::set_invulnerables(new.len() as u32))]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(T::WeightInfo::set_invulnerables(new.len() as u32))]
|
||||
pub fn set_invulnerables(origin: OriginFor<T>, new: Vec<T::AccountId>) -> DispatchResult {
|
||||
T::UpdateOrigin::ensure_origin(origin)?;
|
||||
|
||||
@@ -450,8 +450,8 @@ pub mod pallet {
|
||||
/// there should be no other way to have more candidates than the desired number.
|
||||
///
|
||||
/// The origin for this call must be the `UpdateOrigin`.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::set_desired_candidates())]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(T::WeightInfo::set_desired_candidates())]
|
||||
pub fn set_desired_candidates(
|
||||
origin: OriginFor<T>,
|
||||
max: u32,
|
||||
@@ -473,8 +473,8 @@ pub mod pallet {
|
||||
/// back.
|
||||
///
|
||||
/// The origin for this call must be the `UpdateOrigin`.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::WeightInfo::set_candidacy_bond(
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(T::WeightInfo::set_candidacy_bond(
|
||||
T::MaxCandidates::get(),
|
||||
T::MaxCandidates::get()
|
||||
))]
|
||||
@@ -519,8 +519,8 @@ pub mod pallet {
|
||||
/// registered session keys and (b) be able to reserve the `CandidacyBond`.
|
||||
///
|
||||
/// This call is not available to `Invulnerable` collators.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::WeightInfo::register_as_candidate(T::MaxCandidates::get()))]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(T::WeightInfo::register_as_candidate(T::MaxCandidates::get()))]
|
||||
pub fn register_as_candidate(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -549,7 +549,7 @@ pub mod pallet {
|
||||
T::Currency::reserve(&who, deposit)?;
|
||||
LastAuthoredBlock::<T>::insert(
|
||||
who.clone(),
|
||||
pezframe_system::Pallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
pezframe_system::Pezpallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
);
|
||||
candidates
|
||||
.try_insert(0, CandidateInfo { who: who.clone(), deposit })
|
||||
@@ -569,8 +569,8 @@ pub mod pallet {
|
||||
///
|
||||
/// This call will fail if the total number of candidates would drop below
|
||||
/// `MinEligibleCollators`.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::WeightInfo::leave_intent(T::MaxCandidates::get()))]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(T::WeightInfo::leave_intent(T::MaxCandidates::get()))]
|
||||
pub fn leave_intent(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
|
||||
let who = ensure_signed(origin)?;
|
||||
ensure!(
|
||||
@@ -588,8 +588,8 @@ pub mod pallet {
|
||||
/// registered session keys. If `who` is a candidate, they will be removed.
|
||||
///
|
||||
/// The origin for this call must be the `UpdateOrigin`.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::WeightInfo::add_invulnerable(
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(T::WeightInfo::add_invulnerable(
|
||||
T::MaxInvulnerables::get().saturating_sub(1),
|
||||
T::MaxCandidates::get()
|
||||
))]
|
||||
@@ -641,8 +641,8 @@ pub mod pallet {
|
||||
/// be sorted.
|
||||
///
|
||||
/// The origin for this call must be the `UpdateOrigin`.
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(T::WeightInfo::remove_invulnerable(T::MaxInvulnerables::get()))]
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight(T::WeightInfo::remove_invulnerable(T::MaxInvulnerables::get()))]
|
||||
pub fn remove_invulnerable(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult {
|
||||
T::UpdateOrigin::ensure_origin(origin)?;
|
||||
|
||||
@@ -669,8 +669,8 @@ pub mod pallet {
|
||||
///
|
||||
/// This call will fail if `origin` is not a collator candidate, the updated bond is lower
|
||||
/// than the minimum candidacy bond, and/or the amount cannot be reserved.
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(T::WeightInfo::update_bond(T::MaxCandidates::get()))]
|
||||
#[pezpallet::call_index(7)]
|
||||
#[pezpallet::weight(T::WeightInfo::update_bond(T::MaxCandidates::get()))]
|
||||
pub fn update_bond(
|
||||
origin: OriginFor<T>,
|
||||
new_deposit: BalanceOf<T>,
|
||||
@@ -731,8 +731,8 @@ pub mod pallet {
|
||||
/// This call will fail if the caller is already a collator candidate or invulnerable, the
|
||||
/// caller does not have registered session keys, the target is not a collator candidate,
|
||||
/// and/or the `deposit` amount cannot be reserved.
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(T::WeightInfo::take_candidate_slot(T::MaxCandidates::get()))]
|
||||
#[pezpallet::call_index(8)]
|
||||
#[pezpallet::weight(T::WeightInfo::take_candidate_slot(T::MaxCandidates::get()))]
|
||||
pub fn take_candidate_slot(
|
||||
origin: OriginFor<T>,
|
||||
deposit: BalanceOf<T>,
|
||||
@@ -803,7 +803,7 @@ pub mod pallet {
|
||||
LastAuthoredBlock::<T>::remove(target_info.who.clone());
|
||||
LastAuthoredBlock::<T>::insert(
|
||||
who.clone(),
|
||||
pezframe_system::Pallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
pezframe_system::Pezpallet::<T>::block_number() + T::KickThreshold::get(),
|
||||
);
|
||||
|
||||
Self::deposit_event(Event::CandidateReplaced { old: target, new: who, deposit });
|
||||
@@ -811,7 +811,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Get a unique, inaccessible account ID from the `PotId`.
|
||||
pub fn account_id() -> T::AccountId {
|
||||
T::PotId::get().into_account_truncating()
|
||||
@@ -872,7 +872,7 @@ pub mod pallet {
|
||||
///
|
||||
/// Return value is the number of candidates left in the list.
|
||||
pub fn kick_stale_candidates(candidates: impl IntoIterator<Item = T::AccountId>) -> u32 {
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
let kick_threshold = T::KickThreshold::get();
|
||||
let min_collators = T::MinEligibleCollators::get();
|
||||
candidates
|
||||
@@ -907,9 +907,9 @@ pub mod pallet {
|
||||
.expect("filter_map operation can't result in a bounded vec larger than its original; qed")
|
||||
}
|
||||
|
||||
/// Ensure the correctness of the state of this pallet.
|
||||
/// Ensure the correctness of the state of this pezpallet.
|
||||
///
|
||||
/// This should be valid before or after each state transition of this pallet.
|
||||
/// This should be valid before or after each state transition of this pezpallet.
|
||||
///
|
||||
/// # Invariants
|
||||
///
|
||||
@@ -924,7 +924,7 @@ pub mod pallet {
|
||||
|
||||
pezframe_support::ensure!(
|
||||
desired_candidates <= T::MaxCandidates::get(),
|
||||
"Shouldn't demand more candidates than the pallet config allows."
|
||||
"Shouldn't demand more candidates than the pezpallet config allows."
|
||||
);
|
||||
|
||||
pezframe_support::ensure!(
|
||||
@@ -940,7 +940,7 @@ pub mod pallet {
|
||||
/// Keep track of number of authored blocks per authority, uncles are counted as well since
|
||||
/// they're a valid proof of being online.
|
||||
impl<T: Config + pezpallet_authorship::Config>
|
||||
pezpallet_authorship::EventHandler<T::AccountId, BlockNumberFor<T>> for Pallet<T>
|
||||
pezpallet_authorship::EventHandler<T::AccountId, BlockNumberFor<T>> for Pezpallet<T>
|
||||
{
|
||||
fn note_author(author: T::AccountId) {
|
||||
let pot = Self::account_id();
|
||||
@@ -952,9 +952,9 @@ pub mod pallet {
|
||||
// `reward` is half of pot account minus ED, this should never fail.
|
||||
let _success = T::Currency::transfer(&pot, &author, reward, KeepAlive);
|
||||
debug_assert!(_success.is_ok());
|
||||
LastAuthoredBlock::<T>::insert(author, pezframe_system::Pallet::<T>::block_number());
|
||||
LastAuthoredBlock::<T>::insert(author, pezframe_system::Pezpallet::<T>::block_number());
|
||||
|
||||
pezframe_system::Pallet::<T>::register_extra_weight_unchecked(
|
||||
pezframe_system::Pezpallet::<T>::register_extra_weight_unchecked(
|
||||
T::WeightInfo::note_author(),
|
||||
DispatchClass::Mandatory,
|
||||
);
|
||||
@@ -962,12 +962,12 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Play the role of the session manager.
|
||||
impl<T: Config> SessionManager<T::AccountId> for Pallet<T> {
|
||||
impl<T: Config> SessionManager<T::AccountId> for Pezpallet<T> {
|
||||
fn new_session(index: SessionIndex) -> Option<Vec<T::AccountId>> {
|
||||
log::info!(
|
||||
"assembling new collators for new session {} at #{:?}",
|
||||
index,
|
||||
<pezframe_system::Pallet<T>>::block_number(),
|
||||
<pezframe_system::Pezpallet<T>>::block_number(),
|
||||
);
|
||||
|
||||
// The `expect` below is safe because the list is a `BoundedVec` with a max size of
|
||||
@@ -985,7 +985,7 @@ pub mod pallet {
|
||||
let removed = candidates_len_before.saturating_sub(active_candidates_count);
|
||||
let result = Self::assemble_collators();
|
||||
|
||||
pezframe_system::Pallet::<T>::register_extra_weight_unchecked(
|
||||
pezframe_system::Pezpallet::<T>::register_extra_weight_unchecked(
|
||||
T::WeightInfo::new_session(removed, candidates_len_before),
|
||||
DispatchClass::Mandatory,
|
||||
);
|
||||
@@ -1008,6 +1008,6 @@ where
|
||||
{
|
||||
type Type = <R as pezframe_system::Config>::AccountId;
|
||||
fn get() -> Self::Type {
|
||||
<crate::Pallet<R>>::account_id()
|
||||
<crate::Pezpallet<R>>::account_id()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ pub mod v2 {
|
||||
1,
|
||||
2,
|
||||
UncheckedMigrationToV2<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
#[storage_alias]
|
||||
pub type Candidates<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
BoundedVec<CandidateInfo<<T as pezframe_system::Config>::AccountId, <<T as Config>::Currency as Currency<<T as pezframe_system::Config>::AccountId>>::Balance>, <T as Config>::MaxCandidates>,
|
||||
ValueQuery,
|
||||
>;
|
||||
@@ -127,14 +127,14 @@ pub mod v1 {
|
||||
pub struct MigrateToV1<T>(PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let on_chain_version = Pallet::<T>::on_chain_storage_version();
|
||||
let on_chain_version = Pezpallet::<T>::on_chain_storage_version();
|
||||
if on_chain_version == 0 {
|
||||
let invulnerables_len = Invulnerables::<T>::get().to_vec().len();
|
||||
Invulnerables::<T>::mutate(|invulnerables| {
|
||||
invulnerables.sort();
|
||||
});
|
||||
|
||||
StorageVersion::new(1).put::<Pallet<T>>();
|
||||
StorageVersion::new(1).put::<Pezpallet<T>>();
|
||||
log::info!(
|
||||
target: LOG_TARGET,
|
||||
"Sorted {} Invulnerables, upgraded storage to version 1",
|
||||
@@ -179,7 +179,7 @@ pub mod v1 {
|
||||
"after migration, there should be the same number of invulnerables"
|
||||
);
|
||||
|
||||
let on_chain_version = Pallet::<T>::on_chain_storage_version();
|
||||
let on_chain_version = Pezpallet::<T>::on_chain_storage_version();
|
||||
pezframe_support::ensure!(on_chain_version >= 1, "must_upgrade");
|
||||
|
||||
Ok(())
|
||||
@@ -204,7 +204,7 @@ mod tests {
|
||||
fn migrate_to_v2_with_new_candidates() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let storage_version = StorageVersion::new(1);
|
||||
storage_version.put::<Pallet<Test>>();
|
||||
storage_version.put::<Pezpallet<Test>>();
|
||||
|
||||
let one = 1u64;
|
||||
let two = 2u64;
|
||||
@@ -252,7 +252,7 @@ mod tests {
|
||||
// Run migration
|
||||
v2::MigrationToV2::<Test>::on_runtime_upgrade();
|
||||
|
||||
let new_storage_version = StorageVersion::get::<Pallet<Test>>();
|
||||
let new_storage_version = StorageVersion::get::<Pezpallet<Test>>();
|
||||
assert_eq!(new_storage_version, 2);
|
||||
|
||||
// 10 should have been unreserved from the old candidacy
|
||||
@@ -270,7 +270,7 @@ mod tests {
|
||||
fn migrate_to_v2_without_new_candidates() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let storage_version = StorageVersion::new(1);
|
||||
storage_version.put::<Pallet<Test>>();
|
||||
storage_version.put::<Pezpallet<Test>>();
|
||||
|
||||
let one = 1u64;
|
||||
let two = 2u64;
|
||||
@@ -306,7 +306,7 @@ mod tests {
|
||||
// Run migration
|
||||
v2::MigrationToV2::<Test>::on_runtime_upgrade();
|
||||
|
||||
let new_storage_version = StorageVersion::get::<Pallet<Test>>();
|
||||
let new_storage_version = StorageVersion::get::<Pezpallet<Test>>();
|
||||
assert_eq!(new_storage_version, 2);
|
||||
|
||||
// Nothing changes deposit-wise
|
||||
|
||||
@@ -26,7 +26,7 @@ use pezsp_runtime::{testing::UintAuthorityId, traits::OpaqueKeys, BuildStorage,
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Test>;
|
||||
|
||||
// Configure a mock runtime to test the pallet.
|
||||
// Configure a mock runtime to test the pezpallet.
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ version = "0.7.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
description = "Migrates messages from the old DMP queue pallet."
|
||||
description = "Migrates messages from the old DMP queue pezpallet."
|
||||
license = "Apache-2.0"
|
||||
documentation = "https://docs.rs/pezcumulus-pezpallet-dmp-queue"
|
||||
homepage = { workspace = true }
|
||||
|
||||
@@ -38,7 +38,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
|
||||
assert_last_event::<T>(Event::Exported { page: 0 }.into());
|
||||
@@ -55,7 +55,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
|
||||
assert_last_event::<T>(Event::Exported { page: 0 }.into());
|
||||
@@ -73,7 +73,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
|
||||
assert_last_event::<T>(Event::ExportedOverweight { index: 0 }.into());
|
||||
@@ -91,17 +91,17 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
|
||||
assert_last_event::<T>(Event::ExportOverweightFailed { index: 0 }.into());
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Runtime);
|
||||
impl_benchmark_test_suite!(Pezpallet, crate::mock::new_test_ext(), crate::mock::Runtime);
|
||||
}
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
let events = pezframe_system::Pallet::<T>::events();
|
||||
let events = pezframe_system::Pezpallet::<T>::events();
|
||||
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
let pezframe_system::EventRecord { event, .. } = events.last().expect("Event expected");
|
||||
assert_eq!(event, &system_event.into());
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! This pallet used to implement a message queue for downward messages from the relay-chain.
|
||||
//! This pezpallet used to implement a message queue for downward messages from the relay-chain.
|
||||
//!
|
||||
//! It is now deprecated and has been refactored to simply drain any remaining messages into
|
||||
//! something implementing `HandleMessage`. It proceeds in the state of
|
||||
//! [`MigrationState`] one by one by their listing in the source code. The pallet can be removed
|
||||
//! [`MigrationState`] one by one by their listing in the source code. The pezpallet can be removed
|
||||
//! from the runtime once `Completed` was emitted.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(deprecated)] // The pallet itself is deprecated.
|
||||
#![allow(deprecated)] // The pezpallet itself is deprecated.
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use migration::*;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
mod benchmarking;
|
||||
mod migration;
|
||||
@@ -40,11 +40,11 @@ pub use weights::WeightInfo;
|
||||
pub type MaxDmpMessageLenOf<T> =
|
||||
<<T as Config>::DmpSink as pezframe_support::traits::HandleMessage>::MaxMessageLen;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
#[pezframe_support::pezpallet]
|
||||
#[deprecated(
|
||||
note = "`pezcumulus-pezpallet-dmp-queue` will be removed after November 2024. It can be removed once its lazy migration completed. See <https://github.com/pezkuwichain/kurdistan-sdk/issues/101>."
|
||||
)]
|
||||
pub mod pallet {
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::{pezpallet_prelude::*, traits::HandleMessage, weights::WeightMeter};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
@@ -52,11 +52,11 @@ pub mod pallet {
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
/// The overarching event type of the runtime.
|
||||
#[allow(deprecated)]
|
||||
@@ -65,15 +65,15 @@ pub mod pallet {
|
||||
/// The sink for all DMP messages that the lazy migration will use.
|
||||
type DmpSink: HandleMessage;
|
||||
|
||||
/// Weight info for this pallet (only needed for the lazy migration).
|
||||
/// Weight info for this pezpallet (only needed for the lazy migration).
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
/// The migration state of this pallet.
|
||||
#[pallet::storage]
|
||||
/// The migration state of this pezpallet.
|
||||
#[pezpallet::storage]
|
||||
pub type MigrationStatus<T> = StorageValue<_, MigrationState, ValueQuery>;
|
||||
|
||||
/// The lazy-migration state of the pallet.
|
||||
/// The lazy-migration state of the pezpallet.
|
||||
#[derive(
|
||||
codec::Encode, codec::Decode, Debug, PartialEq, Eq, Clone, MaxEncodedLen, TypeInfo,
|
||||
)]
|
||||
@@ -96,7 +96,7 @@ pub mod pallet {
|
||||
CompletedOverweightExport,
|
||||
/// The storage cleanup started.
|
||||
StartedCleanup { cursor: Option<BoundedVec<u8, ConstU32<1024>>> },
|
||||
/// The migration finished. The pallet can now be removed from the runtime.
|
||||
/// The migration finished. The pezpallet can now be removed from the runtime.
|
||||
Completed,
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// The export of pages started.
|
||||
StartedExport,
|
||||
@@ -137,21 +137,21 @@ pub mod pallet {
|
||||
/// The export of overweight messages completed.
|
||||
CompletedOverweightExport,
|
||||
|
||||
/// The cleanup of remaining pallet storage started.
|
||||
/// The cleanup of remaining pezpallet storage started.
|
||||
StartedCleanup,
|
||||
|
||||
/// Some debris was cleaned up.
|
||||
CleanedSome { keys_removed: u32 },
|
||||
|
||||
/// The cleanup of remaining pallet storage completed.
|
||||
/// The cleanup of remaining pezpallet storage completed.
|
||||
Completed { error: bool },
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {}
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn integrity_test() {
|
||||
let w = Self::on_idle_weight();
|
||||
assert!(w != Weight::zero());
|
||||
@@ -244,7 +244,7 @@ pub mod pallet {
|
||||
MigrationState::StartedCleanup { cursor } => {
|
||||
log::debug!(target: LOG, "Cleaning up");
|
||||
let hashed_prefix =
|
||||
twox_128(<Pallet<T> as PalletInfoAccess>::name().as_bytes());
|
||||
twox_128(<Pezpallet<T> as PalletInfoAccess>::name().as_bytes());
|
||||
|
||||
let result = pezframe_support::storage::unhashed::clear_prefix(
|
||||
&hashed_prefix,
|
||||
@@ -253,7 +253,7 @@ pub mod pallet {
|
||||
);
|
||||
Self::deposit_event(Event::CleanedSome { keys_removed: result.backend });
|
||||
|
||||
// GOTCHA! We deleted *all* pallet storage; hence we also our own
|
||||
// GOTCHA! We deleted *all* pezpallet storage; hence we also our own
|
||||
// `MigrationState`. BUT we insert it back:
|
||||
if let Some(unbound_cursor) = result.maybe_cursor {
|
||||
if let Ok(cursor) = unbound_cursor.try_into() {
|
||||
@@ -273,7 +273,7 @@ pub mod pallet {
|
||||
}
|
||||
},
|
||||
MigrationState::Completed => {
|
||||
log::debug!(target: LOG, "Idle; you can remove this pallet");
|
||||
log::debug!(target: LOG, "Idle; you can remove this pezpallet");
|
||||
},
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// The worst-case weight of [`Self::on_idle`].
|
||||
pub fn on_idle_weight() -> Weight {
|
||||
<T as crate::Config>::WeightInfo::on_idle_good_msg()
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Migrates the storage from the previously deleted DMP pallet.
|
||||
//! Migrates the storage from the previously deleted DMP pezpallet.
|
||||
|
||||
use crate::*;
|
||||
use alloc::vec::Vec;
|
||||
@@ -41,12 +41,12 @@ pub type PageCounter = u32;
|
||||
|
||||
/// The old `PageIndex` storage item.
|
||||
#[storage_alias]
|
||||
pub type PageIndex<T: Config> = StorageValue<Pallet<T>, PageIndexData, ValueQuery>;
|
||||
pub type PageIndex<T: Config> = StorageValue<Pezpallet<T>, PageIndexData, ValueQuery>;
|
||||
|
||||
/// The old `Pages` storage item.
|
||||
#[storage_alias]
|
||||
pub type Pages<T: Config> = StorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Blake2_128Concat,
|
||||
PageCounter,
|
||||
Vec<(RelayBlockNumber, Vec<u8>)>,
|
||||
@@ -56,7 +56,7 @@ pub type Pages<T: Config> = StorageMap<
|
||||
/// The old `Overweight` storage item.
|
||||
#[storage_alias]
|
||||
pub type Overweight<T: Config> = CountedStorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Blake2_128Concat,
|
||||
OverweightIndex,
|
||||
(RelayBlockNumber, Vec<u8>),
|
||||
@@ -70,7 +70,7 @@ pub(crate) mod testing_only {
|
||||
///
|
||||
/// Note that the alias type is wrong on purpose.
|
||||
#[storage_alias]
|
||||
pub type Configuration<T: Config> = StorageValue<Pallet<T>, u32>;
|
||||
pub type Configuration<T: Config> = StorageValue<Pezpallet<T>, u32>;
|
||||
}
|
||||
|
||||
/// Migrates a single page to the `DmpSink`.
|
||||
|
||||
@@ -23,7 +23,7 @@ use pezsp_runtime::traits::IdentityLookup;
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Runtime>;
|
||||
|
||||
// Configure a mock runtime to test the pallet.
|
||||
// Configure a mock runtime to test the pezpallet.
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// Executed Command:
|
||||
// ./target/release/pezkuwi-teyrchain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --pallet
|
||||
// pezpallet
|
||||
// --pezpallet
|
||||
// pezcumulus-pezpallet-dmp-queue
|
||||
// --chain
|
||||
// asset-hub-kusama-dev
|
||||
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "FRAME sessions pallet benchmarking"
|
||||
description = "FRAME sessions pezpallet benchmarking"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/pezcumulus-pezpallet-session-benchmarking"
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Benchmarks for the Session Pallet.
|
||||
Benchmarks for the Session Pezpallet.
|
||||
|
||||
License: Apache-2.0
|
||||
|
||||
@@ -22,7 +22,7 @@ use codec::Decode;
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_system::RawOrigin;
|
||||
use pezpallet_session::*;
|
||||
pub struct Pallet<T: Config>(pezpallet_session::Pallet<T>);
|
||||
pub struct Pezpallet<T: Config>(pezpallet_session::Pezpallet<T>);
|
||||
pub trait Config: pezpallet_session::Config {}
|
||||
|
||||
#[benchmarks]
|
||||
@@ -32,10 +32,10 @@ mod benchmarks {
|
||||
#[benchmark]
|
||||
fn set_keys() -> Result<(), BenchmarkError> {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
pezframe_system::Pallet::<T>::inc_providers(&caller);
|
||||
pezframe_system::Pezpallet::<T>::inc_providers(&caller);
|
||||
let keys = T::Keys::decode(&mut pezsp_runtime::traits::TrailingZeroInput::zeroes()).unwrap();
|
||||
let proof: Vec<u8> = vec![0, 1, 2, 3];
|
||||
<pezpallet_session::Pallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
<pezpallet_session::Pezpallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller), keys, proof);
|
||||
@@ -46,11 +46,11 @@ mod benchmarks {
|
||||
#[benchmark]
|
||||
fn purge_keys() -> Result<(), BenchmarkError> {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
pezframe_system::Pallet::<T>::inc_providers(&caller);
|
||||
pezframe_system::Pezpallet::<T>::inc_providers(&caller);
|
||||
let keys = T::Keys::decode(&mut pezsp_runtime::traits::TrailingZeroInput::zeroes()).unwrap();
|
||||
let proof: Vec<u8> = vec![0, 1, 2, 3];
|
||||
<pezpallet_session::Pallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
let _t = pezpallet_session::Pallet::<T>::set_keys(
|
||||
<pezpallet_session::Pezpallet<T>>::ensure_can_pay_key_deposit(&caller).unwrap();
|
||||
let _t = pezpallet_session::Pezpallet::<T>::set_keys(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
keys,
|
||||
proof,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Benchmarks for the Session Pallet.
|
||||
//! Benchmarks for the Session Pezpallet.
|
||||
// This is separated into its own crate due to cyclic dependency issues.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
@@ -22,14 +22,14 @@ use alloc::vec::Vec;
|
||||
use pezcumulus_pezpallet_teyrchain_system as teyrchain_system;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
use pezkuwi_primitives::PersistedValidationData;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config + teyrchain_system::Config + pezpallet_sudo::Config
|
||||
{
|
||||
@@ -37,18 +37,18 @@ pub mod pallet {
|
||||
type RuntimeEvent: From<Event> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// In case of a scheduled migration, this storage field contains the custom head data to be
|
||||
/// applied.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type PendingCustomValidationHeadData<T: Config> =
|
||||
StorageValue<_, Vec<u8>, OptionQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event {
|
||||
/// The custom validation head data has been scheduled to apply.
|
||||
CustomValidationHeadDataStored,
|
||||
@@ -57,16 +57,16 @@ pub mod pallet {
|
||||
CustomValidationHeadDataApplied,
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// CustomHeadData is not stored in storage.
|
||||
NoCustomHeadData,
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight({0})]
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight({0})]
|
||||
pub fn schedule_migration(
|
||||
origin: OriginFor<T>,
|
||||
code: Vec<u8>,
|
||||
@@ -74,13 +74,13 @@ pub mod pallet {
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
teyrchain_system::Pallet::<T>::schedule_code_upgrade(code)?;
|
||||
teyrchain_system::Pezpallet::<T>::schedule_code_upgrade(code)?;
|
||||
Self::store_pending_custom_validation_head_data(head_data);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set a custom head data that should only be applied when upgradeGoAheadSignal from
|
||||
/// the Relay Chain is GoAhead
|
||||
fn store_pending_custom_validation_head_data(head_data: Vec<u8>) {
|
||||
@@ -92,16 +92,16 @@ pub mod pallet {
|
||||
/// the relay chain.
|
||||
fn set_pending_custom_validation_head_data() {
|
||||
if let Some(head_data) = <PendingCustomValidationHeadData<T>>::take() {
|
||||
teyrchain_system::Pallet::<T>::set_custom_validation_head_data(head_data);
|
||||
teyrchain_system::Pezpallet::<T>::set_custom_validation_head_data(head_data);
|
||||
Self::deposit_event(Event::CustomValidationHeadDataApplied);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> teyrchain_system::OnSystemEvent for Pallet<T> {
|
||||
impl<T: Config> teyrchain_system::OnSystemEvent for Pezpallet<T> {
|
||||
fn on_validation_data(_data: &PersistedValidationData) {}
|
||||
fn on_validation_code_applied() {
|
||||
crate::Pallet::<T>::set_pending_custom_validation_head_data();
|
||||
crate::Pezpallet::<T>::set_pending_custom_validation_head_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ name = "pezcumulus-pezpallet-teyrchain-system"
|
||||
version = "0.7.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Base pallet for pezcumulus-based teyrchains"
|
||||
description = "Base pezpallet for pezcumulus-based teyrchains"
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -3,7 +3,7 @@ name = "pezcumulus-pezpallet-teyrchain-system-proc-macro"
|
||||
version = "0.6.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Proc macros provided by the teyrchain-system pallet"
|
||||
description = "Proc macros provided by the teyrchain-system pezpallet"
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Benchmarking for the teyrchain-system pallet.
|
||||
//! Benchmarking for the teyrchain-system pezpallet.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
@@ -44,7 +44,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::enqueue_inbound_downward_messages(
|
||||
Pezpallet::<T>::enqueue_inbound_downward_messages(
|
||||
head,
|
||||
InboundDownwardMessages::new(msgs).into_abridged(&mut usize::MAX.clone()),
|
||||
);
|
||||
@@ -65,7 +65,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite! {
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(),
|
||||
crate::mock::Test
|
||||
}
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
//! `pezcumulus-pezpallet-teyrchain-system` is a base pallet for Pezcumulus-based teyrchains.
|
||||
//! `pezcumulus-pezpallet-teyrchain-system` is a base pezpallet for Pezcumulus-based teyrchains.
|
||||
//!
|
||||
//! This pallet handles low-level details of being a teyrchain. Its responsibilities include:
|
||||
//! This pezpallet handles low-level details of being a teyrchain. Its responsibilities include:
|
||||
//!
|
||||
//! - ingestion of the teyrchain validation data;
|
||||
//! - ingestion and dispatch of incoming downward and lateral messages;
|
||||
//! - coordinating upgrades with the Relay Chain; and
|
||||
//! - communication of teyrchain outputs, such as sent messages, signaling an upgrade, etc.
|
||||
//!
|
||||
//! Users must ensure that they register this pallet as an inherent provider.
|
||||
//! Users must ensure that they register this pezpallet as an inherent provider.
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
@@ -109,7 +109,7 @@ pub use pezcumulus_pezpallet_teyrchain_system_proc_macro::register_validate_bloc
|
||||
pub use relay_state_snapshot::{MessagingStateSnapshot, RelayChainStateProof};
|
||||
pub use unincluded_segment::{Ancestor, UsedBandwidth};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
const LOG_TARGET: &str = "teyrchain-system";
|
||||
|
||||
@@ -185,19 +185,19 @@ pub mod ump_constants {
|
||||
pub const THRESHOLD_FACTOR: u32 = 2;
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezcumulus_primitives_core::CoreInfoExistsAtMaxOnce;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(migration::STORAGE_VERSION)]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config<OnSetCode = TeyrchainSetCode<Self>> {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
@@ -207,7 +207,7 @@ pub mod pallet {
|
||||
type OnSystemEvent: OnSystemEvent;
|
||||
|
||||
/// Returns the teyrchain ID we are running with.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type SelfParaId: Get<ParaId>;
|
||||
|
||||
/// The place where outbound XCMP messages come from. This is queried in `finalize_block`.
|
||||
@@ -224,7 +224,7 @@ pub mod pallet {
|
||||
|
||||
/// The message handler that will be invoked when messages are received via XCMP.
|
||||
///
|
||||
/// This should normally link to the XCMP Queue pallet.
|
||||
/// This should normally link to the XCMP Queue pezpallet.
|
||||
type XcmpMessageHandler: XcmpMessageHandler;
|
||||
|
||||
/// The weight we reserve at the beginning of the block for processing XCMP messages.
|
||||
@@ -265,8 +265,8 @@ pub mod pallet {
|
||||
type RelayParentOffset: Get<u32>;
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
/// Handles actually sending upward messages by moving them from `PendingUpwardMessages` to
|
||||
/// `UpwardMessages`. Decreases the delivery fee factor if after sending messages, the queue
|
||||
/// total size is less than the threshold (see [`ump_constants::THRESHOLD_FACTOR`]).
|
||||
@@ -363,7 +363,7 @@ pub mod pallet {
|
||||
*up = up.split_off(num as usize);
|
||||
|
||||
if let Some(core_info) =
|
||||
CumulusDigestItem::find_core_info(&pezframe_system::Pallet::<T>::digest())
|
||||
CumulusDigestItem::find_core_info(&pezframe_system::Pezpallet::<T>::digest())
|
||||
{
|
||||
PendingUpwardSignals::<T>::append(
|
||||
UMPSignal::SelectCore(core_info.selector, core_info.claim_queue_offset)
|
||||
@@ -403,7 +403,7 @@ pub mod pallet {
|
||||
as usize;
|
||||
|
||||
// Note: this internally calls the `GetChannelInfo` implementation for this
|
||||
// pallet, which draws on the `RelevantMessagingState`. That in turn has
|
||||
// pezpallet, which draws on the `RelevantMessagingState`. That in turn has
|
||||
// been adjusted above to reflect the correct limits in all channels.
|
||||
let outbound_messages =
|
||||
T::OutboundXcmpMessageSource::take_outbound_messages(maximum_channels)
|
||||
@@ -470,7 +470,7 @@ pub mod pallet {
|
||||
{
|
||||
<UnincludedSegment<T>>::mutate(|chain| {
|
||||
if let Some(ancestor) = chain.last_mut() {
|
||||
let parent = pezframe_system::Pallet::<T>::parent_hash();
|
||||
let parent = pezframe_system::Pezpallet::<T>::parent_hash();
|
||||
// Ancestor is the latest finalized block, thus current parent is
|
||||
// its output head.
|
||||
ancestor.replace_para_head_hash(parent);
|
||||
@@ -536,7 +536,7 @@ pub mod pallet {
|
||||
|
||||
// We need to ensure that `CoreInfo` digest exists only once.
|
||||
match CumulusDigestItem::core_info_exists_at_max_once(
|
||||
&pezframe_system::Pallet::<T>::digest(),
|
||||
&pezframe_system::Pezpallet::<T>::digest(),
|
||||
) {
|
||||
CoreInfoExistsAtMaxOnce::Once(core_info) => {
|
||||
assert_eq!(
|
||||
@@ -556,8 +556,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set the current validation data.
|
||||
///
|
||||
/// This should be invoked exactly once per block. It will panic at the finalization
|
||||
@@ -567,8 +567,8 @@ pub mod pallet {
|
||||
///
|
||||
/// As a side effect, this function upgrades the current validation function
|
||||
/// if the appropriate time has come.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight((0, DispatchClass::Mandatory))]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight((0, DispatchClass::Mandatory))]
|
||||
// TODO: This weight should be corrected. Currently the weight is registered manually in the
|
||||
// call with `register_extra_weight_unchecked`.
|
||||
pub fn set_validation_data(
|
||||
@@ -636,7 +636,7 @@ pub mod pallet {
|
||||
// Deposit a log indicating the relay-parent storage root.
|
||||
// TODO: remove this in favor of the relay-parent's hash after
|
||||
// https://github.com/pezkuwichain/kurdistan-sdk/issues/92
|
||||
pezframe_system::Pallet::<T>::deposit_log(
|
||||
pezframe_system::Pezpallet::<T>::deposit_log(
|
||||
pezcumulus_primitives_core::rpsr_digest::relay_parent_storage_root_item(
|
||||
vfp.relay_parent_storage_root,
|
||||
vfp.relay_parent_number,
|
||||
@@ -669,7 +669,7 @@ pub mod pallet {
|
||||
);
|
||||
let validation_code = <PendingValidationCode<T>>::take();
|
||||
|
||||
pezframe_system::Pallet::<T>::update_code_in_storage(&validation_code);
|
||||
pezframe_system::Pezpallet::<T>::update_code_in_storage(&validation_code);
|
||||
<T::OnSystemEvent as OnSystemEvent>::on_validation_code_applied();
|
||||
Self::deposit_event(Event::ValidationFunctionApplied {
|
||||
relay_chain_block_num: vfp.relay_parent_number,
|
||||
@@ -719,7 +719,7 @@ pub mod pallet {
|
||||
vfp.relay_parent_number,
|
||||
));
|
||||
|
||||
pezframe_system::Pallet::<T>::register_extra_weight_unchecked(
|
||||
pezframe_system::Pezpallet::<T>::register_extra_weight_unchecked(
|
||||
total_weight,
|
||||
DispatchClass::Mandatory,
|
||||
);
|
||||
@@ -727,8 +727,8 @@ pub mod pallet {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight((1_000, DispatchClass::Operational))]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight((1_000, DispatchClass::Operational))]
|
||||
pub fn sudo_send_upward_message(
|
||||
origin: OriginFor<T>,
|
||||
message: UpwardMessage,
|
||||
@@ -738,12 +738,12 @@ pub mod pallet {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// WARNING: call indices 2 and 3 were used in a former version of this pallet. Using them
|
||||
// again will require to bump the transaction version of runtimes using this pallet.
|
||||
// WARNING: call indices 2 and 3 were used in a former version of this pezpallet. Using them
|
||||
// again will require to bump the transaction version of runtimes using this pezpallet.
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// The validation function has been scheduled to apply.
|
||||
ValidationFunctionStored,
|
||||
@@ -759,7 +759,7 @@ pub mod pallet {
|
||||
UpwardMessageSent { message_hash: Option<XcmHash> },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Attempt to upgrade validation function while existing upgrade pending.
|
||||
OverlappingUpgrades,
|
||||
@@ -781,14 +781,14 @@ pub mod pallet {
|
||||
/// relay-chain state.
|
||||
///
|
||||
/// The segment length is limited by the capacity returned from the [`ConsensusHook`] configured
|
||||
/// in the pallet.
|
||||
#[pallet::storage]
|
||||
/// in the pezpallet.
|
||||
#[pezpallet::storage]
|
||||
pub type UnincludedSegment<T: Config> = StorageValue<_, Vec<Ancestor<T::Hash>>, ValueQuery>;
|
||||
|
||||
/// Storage field that keeps track of bandwidth used by the unincluded segment along with the
|
||||
/// latest HRMP watermark. Used for limiting the acceptance of new blocks with
|
||||
/// respect to relay chain constraints.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type AggregatedUnincludedSegment<T: Config> =
|
||||
StorageValue<_, SegmentTracker<T::Hash>, OptionQuery>;
|
||||
|
||||
@@ -798,31 +798,31 @@ pub mod pallet {
|
||||
/// As soon as the relay chain gives us the go-ahead signal, we will overwrite the
|
||||
/// [`:code`][pezsp_core::storage::well_known_keys::CODE] which will result the next block process
|
||||
/// with the new validation code. This concludes the upgrade process.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type PendingValidationCode<T: Config> = StorageValue<_, Vec<u8>, ValueQuery>;
|
||||
|
||||
/// Validation code that is set by the teyrchain and is to be communicated to collator and
|
||||
/// consequently the relay-chain.
|
||||
///
|
||||
/// This will be cleared in `on_initialize` of each new block if no other pallet already set
|
||||
/// This will be cleared in `on_initialize` of each new block if no other pezpallet already set
|
||||
/// the value.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type NewValidationCode<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
|
||||
|
||||
/// The [`PersistedValidationData`] set for this block.
|
||||
///
|
||||
/// This value is expected to be set only once by the [`Pallet::set_validation_data`] inherent.
|
||||
#[pallet::storage]
|
||||
/// This value is expected to be set only once by the [`Pezpallet::set_validation_data`] inherent.
|
||||
#[pezpallet::storage]
|
||||
pub type ValidationData<T: Config> = StorageValue<_, PersistedValidationData>;
|
||||
|
||||
/// Were the validation data set to notify the relay chain?
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type DidSetValidationCode<T: Config> = StorageValue<_, bool, ValueQuery>;
|
||||
|
||||
/// The relay chain block number associated with the last teyrchain block.
|
||||
///
|
||||
/// This is updated in `on_finalize`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastRelayChainBlockNumber<T: Config> =
|
||||
StorageValue<_, RelayChainBlockNumber, ValueQuery>;
|
||||
|
||||
@@ -833,7 +833,7 @@ pub mod pallet {
|
||||
/// This storage item is a mirror of the corresponding value for the current teyrchain from the
|
||||
/// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is
|
||||
/// set after the inherent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type UpgradeRestrictionSignal<T: Config> =
|
||||
StorageValue<_, Option<relay_chain::UpgradeRestriction>, ValueQuery>;
|
||||
|
||||
@@ -842,7 +842,7 @@ pub mod pallet {
|
||||
/// This storage item is a mirror of the corresponding value for the current teyrchain from the
|
||||
/// relay-chain. This value is ephemeral which means it doesn't hit the storage. This value is
|
||||
/// set after the inherent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type UpgradeGoAhead<T: Config> =
|
||||
StorageValue<_, Option<relay_chain::UpgradeGoAhead>, ValueQuery>;
|
||||
|
||||
@@ -852,7 +852,7 @@ pub mod pallet {
|
||||
/// before processing of the inherent, e.g. in `on_initialize` this data may be stale.
|
||||
///
|
||||
/// This data is also absent from the genesis.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type RelayStateProof<T: Config> = StorageValue<_, pezsp_trie::StorageProof>;
|
||||
|
||||
/// The snapshot of some state related to messaging relevant to the current teyrchain as per
|
||||
@@ -862,7 +862,7 @@ pub mod pallet {
|
||||
/// before processing of the inherent, e.g. in `on_initialize` this data may be stale.
|
||||
///
|
||||
/// This data is also absent from the genesis.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type RelevantMessagingState<T: Config> = StorageValue<_, MessagingStateSnapshot>;
|
||||
|
||||
/// The teyrchain host configuration that was obtained from the relay parent.
|
||||
@@ -871,98 +871,98 @@ pub mod pallet {
|
||||
/// before processing of the inherent, e.g. in `on_initialize` this data may be stale.
|
||||
///
|
||||
/// This data is also absent from the genesis.
|
||||
#[pallet::storage]
|
||||
#[pallet::disable_try_decode_storage]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::disable_try_decode_storage]
|
||||
pub type HostConfiguration<T: Config> = StorageValue<_, AbridgedHostConfiguration>;
|
||||
|
||||
/// The last downward message queue chain head we have observed.
|
||||
///
|
||||
/// This value is loaded before and saved after processing inbound downward messages carried
|
||||
/// by the system inherent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastDmqMqcHead<T: Config> = StorageValue<_, MessageQueueChain, ValueQuery>;
|
||||
|
||||
/// The message queue chain heads we have observed per each channel incoming channel.
|
||||
///
|
||||
/// This value is loaded before and saved after processing inbound downward messages carried
|
||||
/// by the system inherent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastHrmpMqcHeads<T: Config> =
|
||||
StorageValue<_, BTreeMap<ParaId, MessageQueueChain>, ValueQuery>;
|
||||
|
||||
/// Number of downward messages processed in a block.
|
||||
///
|
||||
/// This will be cleared in `on_initialize` of each new block.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ProcessedDownwardMessages<T: Config> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
/// The last processed downward message.
|
||||
///
|
||||
/// We need to keep track of this to filter the messages that have been already processed.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastProcessedDownwardMessage<T: Config> = StorageValue<_, InboundMessageId>;
|
||||
|
||||
/// HRMP watermark that was set in a block.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpWatermark<T: Config> = StorageValue<_, relay_chain::BlockNumber, ValueQuery>;
|
||||
|
||||
/// The last processed HRMP message.
|
||||
///
|
||||
/// We need to keep track of this to filter the messages that have been already processed.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type LastProcessedHrmpMessage<T: Config> = StorageValue<_, InboundMessageId>;
|
||||
|
||||
/// HRMP messages that were sent in a block.
|
||||
///
|
||||
/// This will be cleared in `on_initialize` of each new block.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpOutboundMessages<T: Config> =
|
||||
StorageValue<_, Vec<OutboundHrmpMessage>, ValueQuery>;
|
||||
|
||||
/// Upward messages that were sent in a block.
|
||||
///
|
||||
/// This will be cleared in `on_initialize` for each new block.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type UpwardMessages<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
|
||||
|
||||
/// Upward messages that are still pending and not yet sent to the relay chain.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type PendingUpwardMessages<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
|
||||
|
||||
/// Upward signals that are still pending and not yet sent to the relay chain.
|
||||
///
|
||||
/// This will be cleared in `on_finalize` for each block.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type PendingUpwardSignals<T: Config> = StorageValue<_, Vec<UpwardMessage>, ValueQuery>;
|
||||
|
||||
/// The factor to multiply the base delivery fee by for UMP.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type UpwardDeliveryFeeFactor<T: Config> =
|
||||
StorageValue<_, FixedU128, ValueQuery, GetMinFeeFactor<Pallet<T>>>;
|
||||
StorageValue<_, FixedU128, ValueQuery, GetMinFeeFactor<Pezpallet<T>>>;
|
||||
|
||||
/// The number of HRMP messages we observed in `on_initialize` and thus used that number for
|
||||
/// announcing the weight of `on_initialize` and `on_finalize`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type AnnouncedHrmpMessagesPerCandidate<T: Config> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
/// The weight we reserve at the beginning of the block for processing XCMP messages. This
|
||||
/// overrides the amount set in the Config trait.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ReservedXcmpWeightOverride<T: Config> = StorageValue<_, Weight>;
|
||||
|
||||
/// The weight we reserve at the beginning of the block for processing DMP messages. This
|
||||
/// overrides the amount set in the Config trait.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ReservedDmpWeightOverride<T: Config> = StorageValue<_, Weight>;
|
||||
|
||||
/// A custom head data that should be returned as result of `validate_block`.
|
||||
///
|
||||
/// See `Pallet::set_custom_validation_head_data` for more information.
|
||||
#[pallet::storage]
|
||||
/// See `Pezpallet::set_custom_validation_head_data` for more information.
|
||||
#[pezpallet::storage]
|
||||
pub type CustomValidationHeadData<T: Config> = StorageValue<_, Vec<u8>, OptionQuery>;
|
||||
|
||||
#[pallet::inherent]
|
||||
impl<T: Config> ProvideInherent for Pallet<T> {
|
||||
#[pezpallet::inherent]
|
||||
impl<T: Config> ProvideInherent for Pezpallet<T> {
|
||||
type Call = Call<T>;
|
||||
type Error = pezsp_inherents::MakeFatalError<()>;
|
||||
const INHERENT_IDENTIFIER: InherentIdentifier =
|
||||
@@ -998,14 +998,14 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(pezframe_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
// TODO: Remove after https://github.com/pezkuwichain/kurdistan-sdk/issues/93
|
||||
@@ -1014,7 +1014,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Get the unincluded segment size after the given hash.
|
||||
///
|
||||
/// If the unincluded segment doesn't contain the given hash, this returns the
|
||||
@@ -1028,7 +1028,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> FeeTracker for Pallet<T> {
|
||||
impl<T: Config> FeeTracker for Pezpallet<T> {
|
||||
type Id = ();
|
||||
|
||||
fn get_fee_factor(_id: Self::Id) -> FixedU128 {
|
||||
@@ -1040,14 +1040,14 @@ impl<T: Config> FeeTracker for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> ListChannelInfos for Pallet<T> {
|
||||
impl<T: Config> ListChannelInfos for Pezpallet<T> {
|
||||
fn outgoing_channels() -> Vec<ParaId> {
|
||||
let Some(state) = RelevantMessagingState::<T>::get() else { return Vec::new() };
|
||||
state.egress_channels.into_iter().map(|(id, _)| id).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> GetChannelInfo for Pallet<T> {
|
||||
impl<T: Config> GetChannelInfo for Pezpallet<T> {
|
||||
fn get_channel_status(id: ParaId) -> ChannelStatus {
|
||||
// Note, that we are using `relevant_messaging_state` which may be from the previous
|
||||
// block, in case this is called from `on_initialize`, i.e. before the inherent with
|
||||
@@ -1104,7 +1104,7 @@ impl<T: Config> GetChannelInfo for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// The bandwidth limit per block that applies when receiving messages from the relay chain via
|
||||
/// DMP or XCMP.
|
||||
///
|
||||
@@ -1151,7 +1151,7 @@ impl<T: Config> Pallet<T> {
|
||||
Call::set_validation_data { data, inbound_messages_data }
|
||||
}
|
||||
|
||||
/// Enqueue all inbound downward messages relayed by the collator into the MQ pallet.
|
||||
/// Enqueue all inbound downward messages relayed by the collator into the MQ pezpallet.
|
||||
///
|
||||
/// Checks if the sequence of the messages is valid, dispatches them and communicates the
|
||||
/// number of processed messages to the collator via a storage update.
|
||||
@@ -1352,7 +1352,7 @@ impl<T: Config> Pallet<T> {
|
||||
(Some(h), true) => {
|
||||
assert_eq!(
|
||||
h,
|
||||
pezframe_system::Pallet::<T>::parent_hash(),
|
||||
pezframe_system::Pezpallet::<T>::parent_hash(),
|
||||
"expected parent to be included"
|
||||
);
|
||||
|
||||
@@ -1362,7 +1362,7 @@ impl<T: Config> Pallet<T> {
|
||||
(None, true) => {
|
||||
// All this logic is essentially a workaround to support collators which
|
||||
// might still not provide the included block with the state proof.
|
||||
pezframe_system::Pallet::<T>::parent_hash()
|
||||
pezframe_system::Pezpallet::<T>::parent_hash()
|
||||
},
|
||||
(None, false) => panic!("included head not present in relay storage proof"),
|
||||
};
|
||||
@@ -1540,7 +1540,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Open HRMP channel for using it in benchmarks or tests.
|
||||
///
|
||||
/// The caller assumes that the pallet will accept regular outbound message to the sibling
|
||||
/// The caller assumes that the pezpallet will accept regular outbound message to the sibling
|
||||
/// `target_teyrchain` after this call. No other assumptions are made.
|
||||
#[cfg(any(feature = "runtime-benchmarks", feature = "std"))]
|
||||
pub fn open_outbound_hrmp_channel_for_benchmarks_or_tests(target_teyrchain: ParaId) {
|
||||
@@ -1564,7 +1564,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Open HRMP channel for using it in benchmarks or tests.
|
||||
///
|
||||
/// The caller assumes that the pallet will accept regular outbound message to the sibling
|
||||
/// The caller assumes that the pezpallet will accept regular outbound message to the sibling
|
||||
/// `target_teyrchain` after this call. No other assumptions are made.
|
||||
#[cfg(any(feature = "runtime-benchmarks", feature = "std"))]
|
||||
pub fn open_custom_outbound_hrmp_channel_for_benchmarks_or_tests(
|
||||
@@ -1615,11 +1615,11 @@ impl<T: Config> Pallet<T> {
|
||||
pub struct TeyrchainSetCode<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> pezframe_system::SetCode<T> for TeyrchainSetCode<T> {
|
||||
fn set_code(code: Vec<u8>) -> DispatchResult {
|
||||
Pallet::<T>::schedule_code_upgrade(code)
|
||||
Pezpallet::<T>::schedule_code_upgrade(code)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Puts a message in the `PendingUpwardMessages` storage item.
|
||||
/// The message will be later sent in `on_finalize`.
|
||||
/// Checks host configuration to see if message is too big.
|
||||
@@ -1681,7 +1681,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> UpwardMessageSender for Pallet<T> {
|
||||
impl<T: Config> UpwardMessageSender for Pezpallet<T> {
|
||||
fn send_upward_message(message: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> {
|
||||
Self::send_upward_message(message)
|
||||
}
|
||||
@@ -1723,7 +1723,7 @@ impl<T: Config> UpwardMessageSender for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> InspectMessageQueues for Pallet<T> {
|
||||
impl<T: Config> InspectMessageQueues for Pezpallet<T> {
|
||||
fn clear_messages() {
|
||||
PendingUpwardMessages::<T>::kill();
|
||||
}
|
||||
@@ -1751,7 +1751,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl<T: Config> pezkuwi_runtime_teyrchains::EnsureForTeyrchain for Pallet<T> {
|
||||
impl<T: Config> pezkuwi_runtime_teyrchains::EnsureForTeyrchain for Pezpallet<T> {
|
||||
fn ensure(para_id: ParaId) {
|
||||
if let ChannelStatus::Closed = Self::get_channel_status(para_id) {
|
||||
Self::open_outbound_hrmp_channel_for_benchmarks_or_tests(para_id)
|
||||
@@ -1805,7 +1805,7 @@ pub trait RelaychainStateProvider {
|
||||
/// data.
|
||||
///
|
||||
/// When validation data is not available (e.g. within `on_initialize`), it will fallback to use
|
||||
/// [`Pallet::last_relay_block_number()`].
|
||||
/// [`Pezpallet::last_relay_block_number()`].
|
||||
///
|
||||
/// **NOTE**: This has been deprecated, please use [`RelaychainDataProvider`]
|
||||
#[deprecated = "Use `RelaychainDataProvider` instead"]
|
||||
@@ -1819,7 +1819,7 @@ pub type RelaychainBlockNumberProvider<T> = RelaychainDataProvider<T>;
|
||||
/// - [`current_relay_chain_state`](Self::current_relay_chain_state): Will return the default value
|
||||
/// of [`RelayChainState`].
|
||||
/// - [`current_block_number`](Self::current_block_number): Will return
|
||||
/// [`Pallet::last_relay_block_number()`].
|
||||
/// [`Pezpallet::last_relay_block_number()`].
|
||||
pub struct RelaychainDataProvider<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> {
|
||||
@@ -1828,7 +1828,7 @@ impl<T: Config> BlockNumberProvider for RelaychainDataProvider<T> {
|
||||
fn current_block_number() -> relay_chain::BlockNumber {
|
||||
ValidationData::<T>::get()
|
||||
.map(|d| d.relay_parent_number)
|
||||
.unwrap_or_else(|| Pallet::<T>::last_relay_block_number())
|
||||
.unwrap_or_else(|| Pezpallet::<T>::last_relay_block_number())
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{Config, Pallet, ReservedDmpWeightOverride, ReservedXcmpWeightOverride};
|
||||
use crate::{Config, Pezpallet, ReservedDmpWeightOverride, ReservedXcmpWeightOverride};
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
traits::{Get, OnRuntimeUpgrade, StorageVersion},
|
||||
@@ -24,25 +24,25 @@ use pezframe_support::{
|
||||
/// The in-code storage version.
|
||||
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
|
||||
|
||||
/// Migrates the pallet storage to the most recent version.
|
||||
/// Migrates the pezpallet storage to the most recent version.
|
||||
pub struct Migration<T: Config>(PhantomData<T>);
|
||||
|
||||
impl<T: Config> OnRuntimeUpgrade for Migration<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let mut weight: Weight = T::DbWeight::get().reads(2);
|
||||
|
||||
if StorageVersion::get::<Pallet<T>>() == 0 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() == 0 {
|
||||
weight = weight
|
||||
.saturating_add(v1::migrate::<T>())
|
||||
.saturating_add(T::DbWeight::get().writes(1));
|
||||
StorageVersion::new(1).put::<Pallet<T>>();
|
||||
StorageVersion::new(1).put::<Pezpallet<T>>();
|
||||
}
|
||||
|
||||
if StorageVersion::get::<Pallet<T>>() == 1 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() == 1 {
|
||||
weight = weight
|
||||
.saturating_add(v2::migrate::<T>())
|
||||
.saturating_add(T::DbWeight::get().writes(1));
|
||||
StorageVersion::new(2).put::<Pallet<T>>();
|
||||
StorageVersion::new(2).put::<Pezpallet<T>>();
|
||||
}
|
||||
|
||||
weight
|
||||
@@ -78,13 +78,13 @@ mod v2 {
|
||||
/// V1: `LastUpgrade` block number is removed from the storage since the upgrade
|
||||
/// mechanism now uses signals instead of block offsets.
|
||||
mod v1 {
|
||||
use crate::{Config, Pallet};
|
||||
use crate::{Config, Pezpallet};
|
||||
#[allow(deprecated)]
|
||||
use pezframe_support::{migration::remove_storage_prefix, pezpallet_prelude::*};
|
||||
|
||||
pub fn migrate<T: Config>() -> Weight {
|
||||
#[allow(deprecated)]
|
||||
remove_storage_prefix(<Pallet<T>>::name().as_bytes(), b"LastUpgrade", b"");
|
||||
remove_storage_prefix(<Pezpallet<T>>::name().as_bytes(), b"LastUpgrade", b"");
|
||||
T::DbWeight::get().writes(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ impl XcmpMessageSource for FromThreadLocal {
|
||||
let mut result = Vec::new();
|
||||
SENT_MESSAGES.with(|ms| {
|
||||
ms.borrow_mut().retain(|m| {
|
||||
let status = <Pallet<Test> as GetChannelInfo>::get_channel_status(m.0);
|
||||
let status = <Pezpallet<Test> as GetChannelInfo>::get_channel_status(m.0);
|
||||
let (max_size_now, max_size_ever) = match status {
|
||||
ChannelStatus::Ready(now, ever) => (now, ever),
|
||||
ChannelStatus::Closed => return false, // drop message
|
||||
|
||||
@@ -44,7 +44,7 @@ fn block_tests_run_on_drop() {
|
||||
BlockTests::new().add(123, || panic!("if this test passes, block tests run properly"));
|
||||
}
|
||||
|
||||
/// Test that ensures that the teyrchain-system pallet accepts both the legacy
|
||||
/// Test that ensures that the teyrchain-system pezpallet accepts both the legacy
|
||||
/// and versioned inherent format.
|
||||
#[test]
|
||||
fn test_inherent_compatibility() {
|
||||
@@ -565,7 +565,7 @@ fn inherent_messages_are_compressed() {
|
||||
|
||||
#[test]
|
||||
fn check_hrmp_message_metadata_works_with_known_channel() {
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut None,
|
||||
(1, 1000.into()),
|
||||
@@ -578,7 +578,7 @@ fn check_hrmp_message_metadata_works_with_known_channel() {
|
||||
doesn't have a channel opened to this teyrchain"
|
||||
)]
|
||||
fn check_hrmp_message_metadata_panics_on_unknown_channel() {
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut None,
|
||||
(1, 2000.into()),
|
||||
@@ -587,13 +587,13 @@ fn check_hrmp_message_metadata_panics_on_unknown_channel() {
|
||||
|
||||
#[test]
|
||||
fn check_hrmp_message_metadata_works_when_correctly_ordered() {
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut None,
|
||||
(1, 1000.into()),
|
||||
);
|
||||
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut Some((0, 1000.into())),
|
||||
(1, 1000.into()),
|
||||
@@ -601,22 +601,22 @@ fn check_hrmp_message_metadata_works_when_correctly_ordered() {
|
||||
|
||||
// Test chained checks
|
||||
let mut prev = None;
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(0, 1000.into()),
|
||||
);
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(1, 1000.into()),
|
||||
);
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(1, 1000.into()),
|
||||
);
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(2, 1000.into()),
|
||||
@@ -626,7 +626,7 @@ fn check_hrmp_message_metadata_works_when_correctly_ordered() {
|
||||
#[test]
|
||||
#[should_panic(expected = "[HRMP] Messages order violation")]
|
||||
fn check_hrmp_message_metadata_panics_on_unordered_sent_at() {
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut Some((1, 1000.into())),
|
||||
(0, 1000.into()),
|
||||
@@ -638,12 +638,12 @@ fn check_hrmp_message_metadata_panics_on_unordered_sent_at() {
|
||||
fn chained_check_hrmp_message_metadata_panics_on_unordered_sent_at() {
|
||||
// Test chained checks
|
||||
let mut prev = None;
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(1, 1000.into()),
|
||||
);
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(0, 1000.into()),
|
||||
@@ -653,7 +653,7 @@ fn chained_check_hrmp_message_metadata_panics_on_unordered_sent_at() {
|
||||
#[test]
|
||||
#[should_panic(expected = "[HRMP] Messages order violation")]
|
||||
fn check_hrmp_message_metadata_panics_on_unordered_para_id() {
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut Some((1, 2000.into())),
|
||||
(1, 1000.into()),
|
||||
@@ -665,12 +665,12 @@ fn check_hrmp_message_metadata_panics_on_unordered_para_id() {
|
||||
fn chained_check_hrmp_message_metadata_panics_on_unordered_para_id() {
|
||||
// Test chained checks
|
||||
let mut prev = None;
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default()), (2000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(1, 2000.into()),
|
||||
);
|
||||
Pallet::<Test>::check_hrmp_message_metadata(
|
||||
Pezpallet::<Test>::check_hrmp_message_metadata(
|
||||
&[(1000.into(), Default::default())],
|
||||
&mut prev,
|
||||
(1, 1000.into()),
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
// Executed Command:
|
||||
// ./target/release/pezkuwi-teyrchain
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --chain
|
||||
// westmint-dev
|
||||
// --pallet
|
||||
// --pezpallet
|
||||
// pezcumulus_pezpallet_teyrchain_system
|
||||
// --extrinsic
|
||||
// *
|
||||
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
license = "Apache-2.0"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
description = "pallet and transaction extensions for accurate proof size reclaim"
|
||||
description = "pezpallet and transaction extensions for accurate proof size reclaim"
|
||||
documentation = "https://docs.rs/pezcumulus-pezpallet-weight-reclaim"
|
||||
|
||||
[lints]
|
||||
|
||||
@@ -67,5 +67,5 @@ mod bench {
|
||||
);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::setup_test_ext_default(), crate::tests::Test);
|
||||
impl_benchmark_test_suite!(Pezpallet, crate::tests::setup_test_ext_default(), crate::tests::Test);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Pallet and transaction extensions to reclaim PoV proof size weight after an extrinsic has been
|
||||
//! Pezpallet and transaction extensions to reclaim PoV proof size weight after an extrinsic has been
|
||||
//! applied.
|
||||
//!
|
||||
//! This crate provides:
|
||||
//! * [`StorageWeightReclaim`] transaction extension: it must wrap the whole transaction extension
|
||||
//! pipeline.
|
||||
//! * The pallet required for the transaction extensions weight information and benchmarks.
|
||||
//! * The pezpallet required for the transaction extensions weight information and benchmarks.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
@@ -48,21 +48,21 @@ pub mod benchmarks;
|
||||
mod tests;
|
||||
mod weights;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
const LOG_TARGET: &'static str = "runtime::storage_reclaim_pallet";
|
||||
|
||||
/// Pallet to use alongside the transaction extension [`StorageWeightReclaim`], the pallet provides
|
||||
/// Pezpallet to use alongside the transaction extension [`StorageWeightReclaim`], the pezpallet provides
|
||||
/// weight information and benchmarks.
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
@@ -301,6 +301,6 @@ where
|
||||
) -> Result<(), TransactionValidityError> {
|
||||
S::bare_post_dispatch(info, post_info, len, result)?;
|
||||
|
||||
pezframe_system::Pallet::<T>::reclaim_weight(info, post_info)
|
||||
pezframe_system::Pezpallet::<T>::reclaim_weight(info, post_info)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +97,10 @@ mod runtime {
|
||||
pub struct Test;
|
||||
|
||||
#[runtime::pezpallet_index(0)]
|
||||
pub type System = pezframe_system::Pallet<Test>;
|
||||
pub type System = pezframe_system::Pezpallet<Test>;
|
||||
|
||||
#[runtime::pezpallet_index(1)]
|
||||
pub type WeightReclaim = crate::Pallet<Test>;
|
||||
pub type WeightReclaim = crate::Pezpallet<Test>;
|
||||
}
|
||||
|
||||
pub struct MockWeightInfo;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
// Executed Command:
|
||||
// ./target/release/teyrchain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --pallet
|
||||
// pezpallet
|
||||
// --pezpallet
|
||||
// pezcumulus-pezpallet-weight-reclaim
|
||||
// --chain
|
||||
// dev
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Pallet for stuff specific to teyrchains' usage of XCM. Right now that's just the origin
|
||||
//! Pezpallet for stuff specific to teyrchains' usage of XCM. Right now that's just the origin
|
||||
//! used by teyrchains when receiving `Transact` messages from other teyrchains or the Relay chain
|
||||
//! which must be natively represented.
|
||||
|
||||
@@ -22,21 +22,21 @@
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use pezcumulus_primitives_core::ParaId;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{traits::BadOrigin, RuntimeDebug};
|
||||
use xcm::latest::{ExecuteXcm, Outcome};
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// The module configuration trait.
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
@@ -45,7 +45,7 @@ pub mod pallet {
|
||||
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pezpallet::event]
|
||||
pub enum Event<T: Config> {
|
||||
/// Downward message is invalid XCM.
|
||||
/// \[ id \]
|
||||
@@ -70,7 +70,7 @@ pub mod pallet {
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
)]
|
||||
#[pallet::origin]
|
||||
#[pezpallet::origin]
|
||||
pub enum Origin {
|
||||
/// It comes from the (parent) relay chain.
|
||||
Relay,
|
||||
@@ -78,8 +78,8 @@ pub mod pallet {
|
||||
SiblingTeyrchain(ParaId),
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {}
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {}
|
||||
|
||||
impl From<ParaId> for Origin {
|
||||
fn from(id: ParaId) -> Origin {
|
||||
|
||||
@@ -37,7 +37,7 @@ mod benchmarks {
|
||||
#[benchmark]
|
||||
fn set_config_with_u32() {
|
||||
#[extrinsic_call]
|
||||
Pallet::<T>::update_resume_threshold(RawOrigin::Root, 1);
|
||||
Pezpallet::<T>::update_resume_threshold(RawOrigin::Root, 1);
|
||||
}
|
||||
|
||||
/// Add a XCMP message of `n` bytes to the message queue.
|
||||
@@ -57,7 +57,7 @@ mod benchmarks {
|
||||
let fp_before = T::XcmpQueue::footprint(0.into());
|
||||
#[block]
|
||||
{
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&[msg.as_bounded_slice()],
|
||||
true,
|
||||
@@ -94,7 +94,7 @@ mod benchmarks {
|
||||
let fp_before = T::XcmpQueue::footprint(0.into());
|
||||
#[block]
|
||||
{
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&msgs,
|
||||
true,
|
||||
@@ -121,7 +121,7 @@ mod benchmarks {
|
||||
mock::EnqueuedMessages::set(vec![]);
|
||||
}
|
||||
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&[BoundedVec::try_from(vec![0; n as usize]).unwrap().as_bounded_slice()],
|
||||
true,
|
||||
@@ -132,7 +132,7 @@ mod benchmarks {
|
||||
let fp_before = T::XcmpQueue::footprint(0.into());
|
||||
#[block]
|
||||
{
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&[BoundedVec::new().as_bounded_slice()],
|
||||
true,
|
||||
@@ -172,7 +172,7 @@ mod benchmarks {
|
||||
let fp_before = T::XcmpQueue::footprint(0.into());
|
||||
#[block]
|
||||
{
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&msgs.iter().map(|msg| msg.as_bounded_slice()).collect::<Vec<_>>(),
|
||||
true,
|
||||
@@ -197,7 +197,7 @@ mod benchmarks {
|
||||
});
|
||||
}
|
||||
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&[BoundedVec::try_from(vec![
|
||||
0;
|
||||
@@ -219,7 +219,7 @@ mod benchmarks {
|
||||
let fp_before = T::XcmpQueue::footprint(0.into());
|
||||
#[block]
|
||||
{
|
||||
assert_ok!(Pallet::<T>::enqueue_xcmp_messages(
|
||||
assert_ok!(Pezpallet::<T>::enqueue_xcmp_messages(
|
||||
0.into(),
|
||||
&msgs.iter().map(|msg| msg.as_bounded_slice()).collect::<Vec<_>>(),
|
||||
true,
|
||||
@@ -241,7 +241,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
ChannelSignal::decode_all(&mut &data[..]).unwrap();
|
||||
Pallet::<T>::suspend_channel(para);
|
||||
Pezpallet::<T>::suspend_channel(para);
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
@@ -259,12 +259,12 @@ mod benchmarks {
|
||||
let para = 123.into();
|
||||
let data = ChannelSignal::Resume.encode();
|
||||
|
||||
Pallet::<T>::suspend_channel(para);
|
||||
Pezpallet::<T>::suspend_channel(para);
|
||||
|
||||
#[block]
|
||||
{
|
||||
ChannelSignal::decode_all(&mut &data[..]).unwrap();
|
||||
Pallet::<T>::resume_channel(para);
|
||||
Pezpallet::<T>::resume_channel(para);
|
||||
}
|
||||
|
||||
assert!(
|
||||
@@ -286,7 +286,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::take_first_concatenated_xcm(&mut &data[..], &mut WeightMeter::new())
|
||||
Pezpallet::<T>::take_first_concatenated_xcm(&mut &data[..], &mut WeightMeter::new())
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,9 +333,9 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
Pezpallet::<T>::on_idle(0u32.into(), Weight::MAX);
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
impl_benchmark_test_suite!(Pezpallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{pallet, OutboundState};
|
||||
use crate::{pezpallet, OutboundState};
|
||||
use pezcumulus_primitives_core::ParaId;
|
||||
use xcm::latest::prelude::*;
|
||||
|
||||
@@ -34,7 +34,7 @@ impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
|
||||
// if the inbound channel with recipient is suspended, it means that we are unable to
|
||||
// receive congestion reports from the `with` location. So we assume the pipeline is
|
||||
// congested too.
|
||||
if pallet::Pallet::<Runtime>::is_inbound_channel_suspended(sibling_para_id) {
|
||||
if pezpallet::Pezpallet::<Runtime>::is_inbound_channel_suspended(sibling_para_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ impl<Runtime: crate::Config> OutXcmpChannelStatusProvider<Runtime> {
|
||||
|
||||
// let's find the channel's state with the sibling teyrchain,
|
||||
let Some((outbound_state, queued_pages)) =
|
||||
pallet::Pallet::<Runtime>::outbound_channel_state(sibling_para_id)
|
||||
pezpallet::Pezpallet::<Runtime>::outbound_channel_state(sibling_para_id)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
@@ -97,5 +97,5 @@ impl<Runtime: crate::Config> bp_xcm_bridge_hub_router::XcmChannelStatusProvider
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pub fn suspend_channel_for_benchmarks<T: crate::Config>(target: ParaId) {
|
||||
pallet::Pallet::<T>::suspend_channel(target)
|
||||
pezpallet::Pezpallet::<T>::suspend_channel(target)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! A pallet which uses the XCMP transport layer to handle both incoming and outgoing XCM message
|
||||
//! A pezpallet which uses the XCMP transport layer to handle both incoming and outgoing XCM message
|
||||
//! sending and dispatch, queuing, signalling and backpressure. To do so, it implements:
|
||||
//! * `XcmpMessageHandler`
|
||||
//! * `XcmpMessageSource`
|
||||
@@ -81,7 +81,7 @@ use xcm::{latest::prelude::*, VersionedLocation, VersionedXcm, WrapVersion, MAX_
|
||||
use xcm_builder::InspectMessageQueues;
|
||||
use xcm_executor::traits::ConvertOrigin;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Index used to identify overweight XCMs.
|
||||
pub type OverweightIndex = u64;
|
||||
@@ -102,17 +102,17 @@ pub mod delivery_fee_constants {
|
||||
pub const THRESHOLD_FACTOR: u32 = 2;
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::{pezpallet_prelude::*, Twox64Concat};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(migration::STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
@@ -125,7 +125,7 @@ pub mod pallet {
|
||||
|
||||
/// Enqueue an inbound horizontal message for later processing.
|
||||
///
|
||||
/// This defines the maximal message length via [`crate::MaxXcmpMessageLenOf`]. The pallet
|
||||
/// This defines the maximal message length via [`crate::MaxXcmpMessageLenOf`]. The pezpallet
|
||||
/// assumes that this hook will eventually process all the pushed messages.
|
||||
type XcmpQueue: EnqueueMessage<ParaId>
|
||||
+ QueueFootprintQuery<ParaId, MaxMessageLen = MaxXcmpMessageLenOf<Self>>;
|
||||
@@ -135,7 +135,7 @@ pub mod pallet {
|
||||
/// Any further channel suspensions will fail and messages may get dropped without further
|
||||
/// notice. Choosing a high value (1000) is okay; the trade-off that is described in
|
||||
/// [`InboundXcmpSuspended`] still applies at that scale.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxInboundSuspended: Get<u32>;
|
||||
|
||||
/// Maximal number of outbound XCMP channels that can have messages queued at the same time.
|
||||
@@ -146,7 +146,7 @@ pub mod pallet {
|
||||
/// since otherwise the congestion control protocol will not work as intended and messages
|
||||
/// may be dropped. This value increases the PoV and should therefore not be picked too
|
||||
/// high. Governance needs to pay attention to not open more channels than this value.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxActiveOutboundChannels: Get<u32>;
|
||||
|
||||
/// The maximal page size for HRMP message pages.
|
||||
@@ -154,7 +154,7 @@ pub mod pallet {
|
||||
/// A lower limit can be set dynamically, but this is the hard-limit for the PoV worst case
|
||||
/// benchmarking. The limit for the size of a message is slightly below this, since some
|
||||
/// overhead is incurred for encoding the format.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxPageSize: Get<u32>;
|
||||
|
||||
/// The origin that is allowed to resume or suspend the XCMP queue.
|
||||
@@ -167,17 +167,17 @@ pub mod pallet {
|
||||
/// The price for delivering an XCM to a sibling teyrchain destination.
|
||||
type PriceForSiblingDelivery: PriceForMessageDelivery<Id = ParaId>;
|
||||
|
||||
/// The weight information of this pallet.
|
||||
/// The weight information of this pezpallet.
|
||||
type WeightInfo: WeightInfoExt;
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Suspends all XCM executions for the XCMP queue, regardless of the sender's origin.
|
||||
///
|
||||
/// - `origin`: Must pass `ControllerOrigin`.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))]
|
||||
pub fn suspend_xcm_execution(origin: OriginFor<T>) -> DispatchResult {
|
||||
T::ControllerOrigin::ensure_origin(origin)?;
|
||||
|
||||
@@ -196,8 +196,8 @@ pub mod pallet {
|
||||
/// Note that this function doesn't change the status of the in/out bound channels.
|
||||
///
|
||||
/// - `origin`: Must pass `ControllerOrigin`.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight((T::DbWeight::get().writes(1), DispatchClass::Operational,))]
|
||||
pub fn resume_xcm_execution(origin: OriginFor<T>) -> DispatchResult {
|
||||
T::ControllerOrigin::ensure_origin(origin)?;
|
||||
|
||||
@@ -216,8 +216,8 @@ pub mod pallet {
|
||||
///
|
||||
/// - `origin`: Must pass `Root`.
|
||||
/// - `new`: Desired value for `QueueConfigData.suspend_value`
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))]
|
||||
pub fn update_suspend_threshold(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -232,8 +232,8 @@ pub mod pallet {
|
||||
///
|
||||
/// - `origin`: Must pass `Root`.
|
||||
/// - `new`: Desired value for `QueueConfigData.drop_threshold`
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_u32(),DispatchClass::Operational,))]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight((T::WeightInfo::set_config_with_u32(),DispatchClass::Operational,))]
|
||||
pub fn update_drop_threshold(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -248,8 +248,8 @@ pub mod pallet {
|
||||
///
|
||||
/// - `origin`: Must pass `Root`.
|
||||
/// - `new`: Desired value for `QueueConfigData.resume_threshold`
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))]
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight((T::WeightInfo::set_config_with_u32(), DispatchClass::Operational,))]
|
||||
pub fn update_resume_threshold(origin: OriginFor<T>, new: u32) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
@@ -260,8 +260,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn integrity_test() {
|
||||
assert!(!T::MaxPageSize::get().is_zero(), "MaxPageSize too low");
|
||||
|
||||
@@ -290,14 +290,14 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// An HRMP message was sent to a sibling teyrchain.
|
||||
XcmpMessageSent { message_hash: XcmHash },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Setting the queue config failed since one of its values was invalid.
|
||||
BadQueueConfig,
|
||||
@@ -319,7 +319,7 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE: The PoV benchmarking cannot know this and will over-estimate, but the actual proof
|
||||
/// will be smaller.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type InboundXcmpSuspended<T: Config> =
|
||||
StorageValue<_, BoundedBTreeSet<ParaId, T::MaxInboundSuspended>, ValueQuery>;
|
||||
|
||||
@@ -329,7 +329,7 @@ pub mod pallet {
|
||||
/// than 65535 items. Queue indices for normal messages begin at one; zero is reserved in
|
||||
/// case of the need to send a high-priority signal message this block.
|
||||
/// The bool is true if there is a signal message waiting to be sent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type OutboundXcmpStatus<T: Config> = StorageValue<
|
||||
_,
|
||||
BoundedVec<OutboundChannelDetails, T::MaxActiveOutboundChannels>,
|
||||
@@ -337,7 +337,7 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// The messages outbound in a given XCMP channel.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type OutboundXcmpMessages<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
@@ -349,22 +349,22 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// Any signal messages waiting to be sent.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type SignalMessages<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, ParaId, WeakBoundedVec<u8, T::MaxPageSize>, ValueQuery>;
|
||||
|
||||
/// The configuration which controls the dynamics of the outbound queue.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type QueueConfig<T: Config> = StorageValue<_, QueueConfigData, ValueQuery>;
|
||||
|
||||
/// Whether or not the XCMP queue is suspended from executing incoming XCMs or not.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type QueueSuspended<T: Config> = StorageValue<_, bool, ValueQuery>;
|
||||
|
||||
/// The factor to multiply the base delivery fee by.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type DeliveryFeeFactor<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, FixedU128, ValueQuery, GetMinFeeFactor<Pallet<T>>>;
|
||||
StorageMap<_, Twox64Concat, ParaId, FixedU128, ValueQuery, GetMinFeeFactor<Pezpallet<T>>>;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
|
||||
@@ -458,7 +458,7 @@ pub enum ChannelSignal {
|
||||
Resume,
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Place a message `fragment` on the outgoing XCMP queue for `recipient`.
|
||||
///
|
||||
/// Format is the type of aggregate message that the `fragment` may be safely encoded and
|
||||
@@ -818,7 +818,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> OnQueueChanged<ParaId> for Pallet<T> {
|
||||
impl<T: Config> OnQueueChanged<ParaId> for Pezpallet<T> {
|
||||
// Suspends/Resumes the queue when certain thresholds are reached.
|
||||
fn on_queue_changed(para: ParaId, fp: QueueFootprint) {
|
||||
let QueueConfigData { resume_threshold, suspend_threshold, .. } = <QueueConfig<T>>::get();
|
||||
@@ -861,7 +861,7 @@ impl<T: Config> OnQueueChanged<ParaId> for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> QueuePausedQuery<ParaId> for Pallet<T> {
|
||||
impl<T: Config> QueuePausedQuery<ParaId> for Pezpallet<T> {
|
||||
fn is_paused(para: &ParaId) -> bool {
|
||||
if !QueueSuspended::<T>::get() {
|
||||
return false;
|
||||
@@ -897,7 +897,7 @@ enum XcmEncoding {
|
||||
Double,
|
||||
}
|
||||
|
||||
impl<T: Config> XcmpMessageHandler for Pallet<T> {
|
||||
impl<T: Config> XcmpMessageHandler for Pezpallet<T> {
|
||||
fn handle_xcmp_messages<'a, I: Iterator<Item = (ParaId, RelayBlockNumber, &'a [u8])>>(
|
||||
iter: I,
|
||||
max_weight: Weight,
|
||||
@@ -1014,7 +1014,7 @@ impl<T: Config> XcmpMessageHandler for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> XcmpMessageSource for Pallet<T> {
|
||||
impl<T: Config> XcmpMessageSource for Pezpallet<T> {
|
||||
fn take_outbound_messages(maximum_channels: usize) -> Vec<(ParaId, Vec<u8>)> {
|
||||
let mut statuses = <OutboundXcmpStatus<T>>::get();
|
||||
let old_statuses_len = statuses.len();
|
||||
@@ -1151,7 +1151,7 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
|
||||
}
|
||||
|
||||
/// Xcm sender for sending to a sibling teyrchain.
|
||||
impl<T: Config> SendXcm for Pallet<T> {
|
||||
impl<T: Config> SendXcm for Pezpallet<T> {
|
||||
type Ticket = (ParaId, VersionedXcm<()>);
|
||||
|
||||
fn validate(
|
||||
@@ -1199,7 +1199,7 @@ impl<T: Config> SendXcm for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> InspectMessageQueues for Pallet<T> {
|
||||
impl<T: Config> InspectMessageQueues for Pezpallet<T> {
|
||||
fn clear_messages() {
|
||||
// Best effort.
|
||||
let _ = OutboundXcmpMessages::<T>::clear(u32::MAX, None);
|
||||
@@ -1248,7 +1248,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> FeeTracker for Pallet<T> {
|
||||
impl<T: Config> FeeTracker for Pezpallet<T> {
|
||||
type Id = ParaId;
|
||||
|
||||
fn get_fee_factor(id: Self::Id) -> FixedU128 {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
pub mod v5;
|
||||
|
||||
use crate::{Config, OverweightIndex, Pallet, QueueConfig, QueueConfigData, DEFAULT_POV_SIZE};
|
||||
use crate::{Config, OverweightIndex, Pezpallet, QueueConfig, QueueConfigData, DEFAULT_POV_SIZE};
|
||||
use alloc::vec::Vec;
|
||||
use pezcumulus_primitives_core::XcmpMessageFormat;
|
||||
use pezframe_support::{
|
||||
@@ -37,7 +37,7 @@ mod v1 {
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type QueueConfig<T: Config> = StorageValue<Pallet<T>, QueueConfigData, ValueQuery>;
|
||||
pub(crate) type QueueConfig<T: Config> = StorageValue<Pezpallet<T>, QueueConfigData, ValueQuery>;
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
pub struct QueueConfigData {
|
||||
@@ -67,7 +67,7 @@ pub mod v2 {
|
||||
use super::*;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type QueueConfig<T: Config> = StorageValue<Pallet<T>, QueueConfigData, ValueQuery>;
|
||||
pub(crate) type QueueConfig<T: Config> = StorageValue<Pezpallet<T>, QueueConfigData, ValueQuery>;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
|
||||
pub struct QueueConfigData {
|
||||
@@ -136,7 +136,7 @@ pub mod v2 {
|
||||
1,
|
||||
2,
|
||||
UncheckedMigrationToV2<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
}
|
||||
@@ -148,12 +148,12 @@ pub mod v3 {
|
||||
/// Status of the inbound XCMP channels.
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type InboundXcmpStatus<T: Config> =
|
||||
StorageValue<Pallet<T>, Vec<InboundChannelDetails>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, Vec<InboundChannelDetails>, OptionQuery>;
|
||||
|
||||
/// Inbound aggregate XCMP messages. It can only be one per ParaId/block.
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type InboundXcmpMessages<T: Config> = StorageDoubleMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Blake2_128Concat,
|
||||
ParaId,
|
||||
Twox64Concat,
|
||||
@@ -164,7 +164,7 @@ pub mod v3 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type QueueConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, v2::QueueConfigData, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, v2::QueueConfigData, ValueQuery>;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo)]
|
||||
pub struct InboundChannelDetails {
|
||||
@@ -187,14 +187,14 @@ pub mod v3 {
|
||||
Suspended,
|
||||
}
|
||||
|
||||
/// Migrates the pallet storage to v3.
|
||||
/// Migrates the pezpallet storage to v3.
|
||||
pub struct UncheckedMigrationToV3<T: Config>(PhantomData<T>);
|
||||
|
||||
impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrationToV3<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
#[pezframe_support::storage_alias]
|
||||
type Overweight<T: Config> =
|
||||
CountedStorageMap<Pallet<T>, Twox64Concat, OverweightIndex, ParaId>;
|
||||
CountedStorageMap<Pezpallet<T>, Twox64Concat, OverweightIndex, ParaId>;
|
||||
let overweight_messages = Overweight::<T>::initialize_counter() as u64;
|
||||
|
||||
T::DbWeight::get().reads_writes(overweight_messages, 1)
|
||||
@@ -208,7 +208,7 @@ pub mod v3 {
|
||||
2,
|
||||
3,
|
||||
UncheckedMigrationToV3<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -311,7 +311,7 @@ pub mod v4 {
|
||||
3,
|
||||
4,
|
||||
UncheckedMigrationToV4<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ mod tests {
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let storage_version = StorageVersion::new(1);
|
||||
storage_version.put::<Pallet<Test>>();
|
||||
storage_version.put::<Pezpallet<Test>>();
|
||||
|
||||
pezframe_support::storage::unhashed::put_raw(
|
||||
&crate::QueueConfig::<Test>::hashed_key(),
|
||||
@@ -364,7 +364,7 @@ mod tests {
|
||||
fn test_migration_to_v4() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let storage_version = StorageVersion::new(3);
|
||||
storage_version.put::<Pallet<Test>>();
|
||||
storage_version.put::<Pezpallet<Test>>();
|
||||
|
||||
let v2 = v2::QueueConfigData {
|
||||
drop_threshold: 5,
|
||||
@@ -393,7 +393,7 @@ mod tests {
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let storage_version = StorageVersion::new(3);
|
||||
storage_version.put::<Pallet<Test>>();
|
||||
storage_version.put::<Pezpallet<Test>>();
|
||||
|
||||
let v2 = v2::QueueConfigData {
|
||||
drop_threshold: 100,
|
||||
|
||||
@@ -35,7 +35,7 @@ pub type MigrateV4ToV5<T> = pezframe_support::migrations::VersionedMigration<
|
||||
4,
|
||||
5,
|
||||
unversioned::UncheckedMigrateV4ToV5<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -45,11 +45,11 @@ mod v4 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(super) type OutboundXcmpStatus<T: Config> =
|
||||
StorageValue<Pallet<T>, Vec<OutboundChannelDetails>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, Vec<OutboundChannelDetails>, ValueQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(super) type OutboundXcmpMessages<T: Config> = StorageDoubleMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Blake2_128Concat,
|
||||
ParaId,
|
||||
Twox64Concat,
|
||||
@@ -60,7 +60,7 @@ mod v4 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(super) type SignalMessages<T: Config> =
|
||||
StorageMap<Pallet<T>, Blake2_128Concat, ParaId, Vec<u8>, ValueQuery>;
|
||||
StorageMap<Pezpallet<T>, Blake2_128Concat, ParaId, Vec<u8>, ValueQuery>;
|
||||
}
|
||||
|
||||
// Private module to hide the migration.
|
||||
|
||||
@@ -35,16 +35,16 @@ use xcm_executor::traits::ConvertOrigin;
|
||||
|
||||
type Block = pezframe_system::mocking::MockBlock<Test>;
|
||||
|
||||
// Configure a mock runtime to test the pallet.
|
||||
// Configure a mock runtime to test the pezpallet.
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
System: pezframe_system::{Pezpallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pezpallet, Call, Storage, Config<T>, Event<T>},
|
||||
TeyrchainSystem: pezcumulus_pezpallet_teyrchain_system::{
|
||||
Pallet, Call, Config<T>, Storage, Inherent, Event<T>,
|
||||
Pezpallet, Call, Config<T>, Storage, Inherent, Event<T>,
|
||||
},
|
||||
XcmpQueue: xcmp_queue::{Pallet, Call, Storage, Event<T>},
|
||||
XcmpQueue: xcmp_queue::{Pezpallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -233,7 +233,7 @@ impl Config for Test {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ChannelInfo = MockedChannelInfo;
|
||||
type VersionWrapper = ();
|
||||
type XcmpQueue = EnqueueToLocalStorage<Pallet<Test>>;
|
||||
type XcmpQueue = EnqueueToLocalStorage<Pezpallet<Test>>;
|
||||
type MaxInboundSuspended = ConstU32<1_000>;
|
||||
type MaxActiveOutboundChannels = ConstU32<128>;
|
||||
// Most on-chain HRMP channels are configured to use 102400 bytes of max message size, so we
|
||||
|
||||
@@ -545,7 +545,7 @@ fn xcm_enqueueing_backpressure_works() {
|
||||
});
|
||||
assert_eq!(EnqueuedMessages::get().len(), 5);
|
||||
|
||||
mock::EnqueueToLocalStorage::<Pallet<Test>>::sweep_queue(para);
|
||||
mock::EnqueueToLocalStorage::<Pezpallet<Test>>::sweep_queue(para);
|
||||
XcmpQueue::handle_xcmp_messages(once((para, 1, page.as_slice())), Weight::MAX);
|
||||
// Got resumed:
|
||||
assert!(InboundXcmpSuspended::<Test>::get().is_empty());
|
||||
@@ -747,7 +747,7 @@ fn hrmp_signals_are_prioritized() {
|
||||
let mut msg_wrapper = Some(message.clone());
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
pezframe_system::Pallet::<Test>::set_block_number(1);
|
||||
pezframe_system::Pezpallet::<Test>::set_block_number(1);
|
||||
<XcmpQueue as SendXcm>::validate(&mut dest_wrapper, &mut msg_wrapper).unwrap();
|
||||
|
||||
// check wrapper were consumed
|
||||
@@ -770,11 +770,11 @@ fn hrmp_signals_are_prioritized() {
|
||||
assert_eq!(taken, vec![]);
|
||||
|
||||
// Enqueue some messages
|
||||
let num_events = pezframe_system::Pallet::<Test>::events().len();
|
||||
let num_events = pezframe_system::Pezpallet::<Test>::events().len();
|
||||
for _ in 0..256 {
|
||||
assert_ok!(send_xcm::<XcmpQueue>(dest.into(), message.clone()));
|
||||
}
|
||||
assert_eq!(num_events + 256, pezframe_system::Pallet::<Test>::events().len());
|
||||
assert_eq!(num_events + 256, pezframe_system::Pezpallet::<Test>::events().len());
|
||||
|
||||
// Without a signal we get the messages in order:
|
||||
let mut expected_msg = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
||||
@@ -1099,8 +1099,8 @@ fn verify_fee_factor_increase_and_decrease() {
|
||||
xcmp_message.extend(versioned_xcm.encode());
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
let initial = Pallet::<Test>::MIN_FEE_FACTOR;
|
||||
assert_eq!(Pallet::<Test>::get_fee_factor(sibling_para_id), initial);
|
||||
let initial = Pezpallet::<Test>::MIN_FEE_FACTOR;
|
||||
assert_eq!(Pezpallet::<Test>::get_fee_factor(sibling_para_id), initial);
|
||||
|
||||
// Open channel so messages can actually be sent
|
||||
TeyrchainSystem::open_custom_outbound_hrmp_channel_for_benchmarks_or_tests(
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// Executed Command:
|
||||
// ./target/release/pezkuwi-teyrchain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --pallet
|
||||
// pezpallet
|
||||
// --pezpallet
|
||||
// pezcumulus-pezpallet-xcmp-queue
|
||||
// --chain
|
||||
// asset-hub-zagros-dev
|
||||
|
||||
@@ -368,7 +368,7 @@ pub fn extract_relay_parent(digest: &Digest) -> Option<relay_chain::Hash> {
|
||||
/// <https://github.com/pezkuwichain/kurdistan-sdk/issues/92> via
|
||||
/// <https://github.com/pezkuwichain/kurdistan-sdk/issues/169>.
|
||||
///
|
||||
/// Runtimes using the teyrchain-system pallet are expected to produce this digest item,
|
||||
/// Runtimes using the teyrchain-system pezpallet are expected to produce this digest item,
|
||||
/// but will stop as soon as they are able to provide the relay-parent hash directly.
|
||||
///
|
||||
/// The relay-chain storage root is, in practice, a unique identifier of a block
|
||||
|
||||
@@ -197,14 +197,14 @@ where
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
"Benchmarked storage weight smaller than consumed storage weight. extrinsic: {} benchmarked: {benchmarked_weight} consumed: {consumed_weight} unspent: {unspent}",
|
||||
pezframe_system::Pallet::<T>::extrinsic_index().unwrap_or(0)
|
||||
pezframe_system::Pezpallet::<T>::extrinsic_index().unwrap_or(0)
|
||||
);
|
||||
current.accrue(Weight::from_parts(0, storage_size_diff), info.class)
|
||||
} else {
|
||||
log::trace!(
|
||||
target: LOG_TARGET,
|
||||
"Reclaiming storage weight. extrinsic: {} benchmarked: {benchmarked_weight} consumed: {consumed_weight} unspent: {unspent}",
|
||||
pezframe_system::Pallet::<T>::extrinsic_index().unwrap_or(0)
|
||||
pezframe_system::Pezpallet::<T>::extrinsic_index().unwrap_or(0)
|
||||
);
|
||||
current.reduce(Weight::from_parts(0, storage_size_diff), info.class)
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ mod tests;
|
||||
/// `UpwardMessageSender` trait impl into a `SendXcm` trait impl.
|
||||
///
|
||||
/// NOTE: This is a pretty dumb "just send it" router; we will probably want to introduce queuing
|
||||
/// to UMP eventually and when we do, the pallet which implements the queuing will be responsible
|
||||
/// to UMP eventually and when we do, the pezpallet which implements the queuing will be responsible
|
||||
/// for the `SendXcm` implementation.
|
||||
pub struct ParentAsUmp<T, W, P>(PhantomData<(T, W, P)>);
|
||||
impl<T, W, P> SendXcm for ParentAsUmp<T, W, P>
|
||||
|
||||
@@ -367,7 +367,7 @@ type ConsensusHook = pezcumulus_pezpallet_aura_ext::FixedVelocityConsensusHook<
|
||||
>;
|
||||
impl pezcumulus_pezpallet_teyrchain_system::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type SelfParaId = teyrchain_info::Pallet<Runtime>;
|
||||
type SelfParaId = teyrchain_info::Pezpallet<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type OnSystemEvent = ();
|
||||
type OutboundXcmpMessageSource = ();
|
||||
|
||||
@@ -14,42 +14,42 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezcumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/// A special pallet that exposes dispatchables that are only useful for testing.
|
||||
pub use pallet::*;
|
||||
/// A special pezpallet that exposes dispatchables that are only useful for testing.
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Some key that we set in genesis and only read in [`TestOnRuntimeUpgrade`] to ensure that
|
||||
/// [`OnRuntimeUpgrade`] works as expected.
|
||||
pub const TEST_RUNTIME_UPGRADE_KEY: &[u8] = b"+test_runtime_upgrade_key+";
|
||||
|
||||
#[pezframe_support::pallet(dev_mode)]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet(dev_mode)]
|
||||
pub mod pezpallet {
|
||||
use crate::test_pallet::TEST_RUNTIME_UPGRADE_KEY;
|
||||
use alloc::vec;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + pezcumulus_pezpallet_teyrchain_system::Config {}
|
||||
|
||||
/// A simple storage map for testing purposes.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type TestMap<T: Config> = StorageMap<_, Twox64Concat, u32, (), ValueQuery>;
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// A test dispatchable for setting a custom head data in `validate_block`.
|
||||
#[pallet::weight(0)]
|
||||
#[pezpallet::weight(0)]
|
||||
pub fn set_custom_validation_head_data(
|
||||
_: OriginFor<T>,
|
||||
custom_header: alloc::vec::Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
pezcumulus_pezpallet_teyrchain_system::Pallet::<T>::set_custom_validation_head_data(
|
||||
pezcumulus_pezpallet_teyrchain_system::Pezpallet::<T>::set_custom_validation_head_data(
|
||||
custom_header,
|
||||
);
|
||||
Ok(())
|
||||
@@ -58,7 +58,7 @@ pub mod pallet {
|
||||
/// A dispatchable that first reads two values from two different child tries, asserts they
|
||||
/// are the expected values (if the values exist in the state) and then writes two different
|
||||
/// values to these child tries.
|
||||
#[pallet::weight(0)]
|
||||
#[pezpallet::weight(0)]
|
||||
pub fn read_and_write_child_tries(_: OriginFor<T>) -> DispatchResult {
|
||||
let key = &b"hello"[..];
|
||||
let first_trie = &b"first"[..];
|
||||
@@ -91,7 +91,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Stores `()` in `TestMap` for keys from 0 up to `max_key`.
|
||||
#[pallet::weight(0)]
|
||||
#[pezpallet::weight(0)]
|
||||
pub fn store_values_in_map(_: OriginFor<T>, max_key: u32) -> DispatchResult {
|
||||
for i in 0..=max_key {
|
||||
TestMap::<T>::insert(i, ());
|
||||
@@ -100,7 +100,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Removes the value associated with `key` from `TestMap`.
|
||||
#[pallet::weight(0)]
|
||||
#[pezpallet::weight(0)]
|
||||
pub fn remove_value_from_map(_: OriginFor<T>, key: u32) -> DispatchResult {
|
||||
TestMap::<T>::remove(key);
|
||||
Ok(())
|
||||
@@ -108,13 +108,13 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[derive(pezframe_support::DefaultNoBound)]
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
pezsp_io::storage::set(TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]);
|
||||
|
||||
@@ -71,7 +71,7 @@ fn benchmark_block_validation(c: &mut Criterion) {
|
||||
group.sample_size(20);
|
||||
group.measurement_time(Duration::from_secs(120));
|
||||
|
||||
// In the first iteration we want to initialize the glutton pallet.
|
||||
// In the first iteration we want to initialize the glutton pezpallet.
|
||||
let mut is_first = true;
|
||||
for (compute_ratio, storage_ratio) in &[(One::one(), Zero::zero()), (One::one(), One::one())] {
|
||||
let teyrchain_block =
|
||||
|
||||
@@ -216,7 +216,7 @@ pub fn get_wasm_module() -> Box<dyn pezsc_executor_common::wasm_runtime::WasmMod
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a block containing setup extrinsics for the glutton pallet.
|
||||
/// Create a block containing setup extrinsics for the glutton pezpallet.
|
||||
pub fn set_glutton_parameters(
|
||||
client: &TestClient,
|
||||
initialize: bool,
|
||||
@@ -233,7 +233,7 @@ pub fn set_glutton_parameters(
|
||||
|
||||
let mut extrinsics = vec![];
|
||||
if initialize {
|
||||
// Initialize the pallet
|
||||
// Initialize the pezpallet
|
||||
extrinsics.push(construct_extrinsic(
|
||||
client,
|
||||
SudoCall::sudo {
|
||||
|
||||
@@ -35,7 +35,7 @@ use xcm_executor::traits::ConvertLocation;
|
||||
pub type AccountIdOf<T> = <T as pezframe_system::Config>::AccountId;
|
||||
|
||||
/// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type.
|
||||
pub type NegativeImbalance<T> = <pezpallet_balances::Pallet<T> as Currency<
|
||||
pub type NegativeImbalance<T> = <pezpallet_balances::Pezpallet<T> as Currency<
|
||||
<T as pezframe_system::Config>::AccountId,
|
||||
>>::NegativeImbalance;
|
||||
|
||||
@@ -52,16 +52,16 @@ where
|
||||
<R as pezframe_system::Config>::RuntimeEvent: From<pezpallet_balances::Event<R>>,
|
||||
{
|
||||
fn on_nonzero_unbalanced(amount: NegativeImbalance<R>) {
|
||||
let staking_pot = <pezpallet_collator_selection::Pallet<R>>::account_id();
|
||||
let staking_pot = <pezpallet_collator_selection::Pezpallet<R>>::account_id();
|
||||
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
|
||||
<pezpallet_balances::Pallet<R>>::resolve_creating(&staking_pot, amount);
|
||||
<pezpallet_balances::Pezpallet<R>>::resolve_creating(&staking_pot, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/// Fungible implementation of `OnUnbalanced` that deals with the fees by combining tip and fee and
|
||||
/// passing the result on to `ToStakingPot`.
|
||||
pub struct DealWithFees<R>(PhantomData<R>);
|
||||
impl<R> OnUnbalanced<fungible::Credit<R::AccountId, pezpallet_balances::Pallet<R>>> for DealWithFees<R>
|
||||
impl<R> OnUnbalanced<fungible::Credit<R::AccountId, pezpallet_balances::Pezpallet<R>>> for DealWithFees<R>
|
||||
where
|
||||
R: pezpallet_balances::Config + pezpallet_collator_selection::Config,
|
||||
AccountIdOf<R>: From<pezkuwi_primitives::AccountId> + Into<pezkuwi_primitives::AccountId>,
|
||||
@@ -69,14 +69,14 @@ where
|
||||
{
|
||||
fn on_unbalanceds(
|
||||
mut fees_then_tips: impl Iterator<
|
||||
Item = fungible::Credit<R::AccountId, pezpallet_balances::Pallet<R>>,
|
||||
Item = fungible::Credit<R::AccountId, pezpallet_balances::Pezpallet<R>>,
|
||||
>,
|
||||
) {
|
||||
if let Some(mut fees) = fees_then_tips.next() {
|
||||
if let Some(tips) = fees_then_tips.next() {
|
||||
tips.merge_into(&mut fees);
|
||||
}
|
||||
ResolveTo::<StakingPotAccountId<R>, pezpallet_balances::Pallet<R>>::on_unbalanced(fees)
|
||||
ResolveTo::<StakingPotAccountId<R>, pezpallet_balances::Pezpallet<R>>::on_unbalanced(fees)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,17 +84,17 @@ where
|
||||
/// A `HandleCredit` implementation that naively transfers the fees to the block author.
|
||||
/// Will drop and burn the assets in case the transfer fails.
|
||||
pub struct AssetsToBlockAuthor<R, I>(PhantomData<(R, I)>);
|
||||
impl<R, I> HandleCredit<AccountIdOf<R>, pezpallet_assets::Pallet<R, I>> for AssetsToBlockAuthor<R, I>
|
||||
impl<R, I> HandleCredit<AccountIdOf<R>, pezpallet_assets::Pezpallet<R, I>> for AssetsToBlockAuthor<R, I>
|
||||
where
|
||||
I: 'static,
|
||||
R: pezpallet_authorship::Config + pezpallet_assets::Config<I>,
|
||||
AccountIdOf<R>: From<pezkuwi_primitives::AccountId> + Into<pezkuwi_primitives::AccountId>,
|
||||
{
|
||||
fn handle_credit(credit: fungibles::Credit<AccountIdOf<R>, pezpallet_assets::Pallet<R, I>>) {
|
||||
fn handle_credit(credit: fungibles::Credit<AccountIdOf<R>, pezpallet_assets::Pezpallet<R, I>>) {
|
||||
use pezframe_support::traits::fungibles::Balanced;
|
||||
if let Some(author) = pezpallet_authorship::Pallet::<R>::author() {
|
||||
if let Some(author) = pezpallet_authorship::Pezpallet::<R>::author() {
|
||||
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
|
||||
let _ = pezpallet_assets::Pallet::<R, I>::resolve(&author, credit).defensive();
|
||||
let _ = pezpallet_assets::Pezpallet::<R, I>::resolve(&author, credit).defensive();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ impl<T: Get<Location>> ContainsPair<Asset, Location> for AssetsFrom<T> {
|
||||
|
||||
/// Type alias to conveniently refer to the `Currency::Balance` associated type.
|
||||
pub type BalanceOf<T> =
|
||||
<pezpallet_balances::Pallet<T> as Currency<<T as pezframe_system::Config>::AccountId>>::Balance;
|
||||
<pezpallet_balances::Pezpallet<T> as Currency<<T as pezframe_system::Config>::AccountId>>::Balance;
|
||||
|
||||
/// Implements `OnUnbalanced::on_unbalanced` to teleport slashed assets to relay chain treasury
|
||||
/// account.
|
||||
@@ -171,9 +171,9 @@ where
|
||||
};
|
||||
let treasury_account: AccountIdOf<T> = TreasuryAccount::get();
|
||||
|
||||
<pezpallet_balances::Pallet<T>>::resolve_creating(&root_account, amount);
|
||||
<pezpallet_balances::Pezpallet<T>>::resolve_creating(&root_account, amount);
|
||||
|
||||
let result = <pezpallet_xcm::Pallet<T>>::limited_teleport_assets(
|
||||
let result = <pezpallet_xcm::Pezpallet<T>>::limited_teleport_assets(
|
||||
<<T as pezframe_system::Config>::RuntimeOrigin>::root(),
|
||||
Box::new(Parent.into()),
|
||||
Box::new(
|
||||
@@ -216,9 +216,9 @@ mod tests {
|
||||
pezframe_support::construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
CollatorSelection: pezpallet_collator_selection::{Pallet, Call, Storage, Event<T>},
|
||||
System: pezframe_system::{Pezpallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pezpallet, Call, Storage, Config<T>, Event<T>},
|
||||
CollatorSelection: pezpallet_collator_selection::{Pezpallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -312,11 +312,11 @@ mod tests {
|
||||
fn test_fees_and_tip_split() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let fee =
|
||||
<pezpallet_balances::Pallet<Test> as pezframe_support::traits::fungible::Balanced<
|
||||
<pezpallet_balances::Pezpallet<Test> as pezframe_support::traits::fungible::Balanced<
|
||||
AccountId,
|
||||
>>::issue(10);
|
||||
let tip =
|
||||
<pezpallet_balances::Pallet<Test> as pezframe_support::traits::fungible::Balanced<
|
||||
<pezpallet_balances::Pezpallet<Test> as pezframe_support::traits::fungible::Balanced<
|
||||
AccountId,
|
||||
>>::issue(20);
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ mod constants {
|
||||
pezkuwi_primitives::MAX_POV_SIZE as u64,
|
||||
);
|
||||
|
||||
/// Treasury pallet id of the local chain, used to convert into AccountId
|
||||
/// Treasury pezpallet id of the local chain, used to convert into AccountId
|
||||
pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry");
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ pub mod benchmarks {
|
||||
/// the payout made by [`LocalPay`].
|
||||
///
|
||||
/// ### Parameters:
|
||||
/// - `PalletId`: The ID of the assets registry pallet.
|
||||
/// - `PalletId`: The ID of the assets registry pezpallet.
|
||||
/// - `AssetId`: The ID of the asset that will be created for the benchmark within `PalletId`.
|
||||
pub struct LocalPayArguments<PalletId = ConstU8<0>>(PhantomData<PalletId>);
|
||||
impl<PalletId: Get<u8>>
|
||||
|
||||
@@ -35,7 +35,7 @@ pub struct AssetFeeAsExistentialDepositMultiplier<
|
||||
impl<CurrencyBalance, Runtime, WeightToFee, BalanceConverter, AssetInstance>
|
||||
pezcumulus_primitives_utility::ChargeWeightInFungibles<
|
||||
AccountIdOf<Runtime>,
|
||||
pezpallet_assets::Pallet<Runtime, AssetInstance>,
|
||||
pezpallet_assets::Pezpallet<Runtime, AssetInstance>,
|
||||
> for AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter, AssetInstance>
|
||||
where
|
||||
Runtime: pezpallet_assets::Config<AssetInstance>,
|
||||
@@ -52,12 +52,12 @@ where
|
||||
>>::Error: core::fmt::Debug,
|
||||
{
|
||||
fn charge_weight_in_fungibles(
|
||||
asset_id: <pezpallet_assets::Pallet<Runtime, AssetInstance> as Inspect<
|
||||
asset_id: <pezpallet_assets::Pezpallet<Runtime, AssetInstance> as Inspect<
|
||||
AccountIdOf<Runtime>,
|
||||
>>::AssetId,
|
||||
weight: Weight,
|
||||
) -> Result<
|
||||
<pezpallet_assets::Pallet<Runtime, AssetInstance> as Inspect<AccountIdOf<Runtime>>>::Balance,
|
||||
<pezpallet_assets::Pezpallet<Runtime, AssetInstance> as Inspect<AccountIdOf<Runtime>>>::Balance,
|
||||
XcmError,
|
||||
> {
|
||||
let amount = WeightToFee::weight_to_fee(&weight);
|
||||
@@ -97,7 +97,7 @@ impl<SystemTeyrchainMatcher: Contains<Location>, Runtime: teyrchain_info::Config
|
||||
for RelayOrOtherSystemTeyrchains<SystemTeyrchainMatcher, Runtime>
|
||||
{
|
||||
fn contains(l: &Location) -> bool {
|
||||
let self_para_id: u32 = teyrchain_info::Pallet::<Runtime>::get().into();
|
||||
let self_para_id: u32 = teyrchain_info::Pezpallet::<Runtime>::get().into();
|
||||
if let (0, [Teyrchain(para_id)]) = l.unpack() {
|
||||
if *para_id == self_para_id {
|
||||
return false;
|
||||
|
||||
@@ -65,7 +65,7 @@ use bp_messages::{
|
||||
MessageKey, OutboundLaneData,
|
||||
};
|
||||
pub use bp_xcm_bridge_hub::XcmBridgeHubCall;
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, LaneIdOf, OutboundLanes, Pallet};
|
||||
use pezpallet_bridge_messages::{Config as BridgeMessagesConfig, LaneIdOf, OutboundLanes, Pezpallet};
|
||||
pub use pezpallet_bridge_messages::{
|
||||
Instance1 as BridgeMessagesInstance1, Instance2 as BridgeMessagesInstance2,
|
||||
Instance3 as BridgeMessagesInstance3,
|
||||
@@ -112,7 +112,7 @@ where
|
||||
OutboundLanes::<S, SI>::get(lane).unwrap().latest_received_nonce;
|
||||
|
||||
(latest_received_nonce + 1..=latest_generated_nonce).for_each(|nonce| {
|
||||
let encoded_payload: Vec<u8> = Pallet::<S, SI>::outbound_message_data(lane, nonce)
|
||||
let encoded_payload: Vec<u8> = Pezpallet::<S, SI>::outbound_message_data(lane, nonce)
|
||||
.expect("Bridge message does not exist")
|
||||
.into();
|
||||
let payload = Vec::<u8>::decode(&mut &encoded_payload[..])
|
||||
@@ -371,7 +371,7 @@ macro_rules! impl_send_transact_helpers_for_relay_chain {
|
||||
let destination: $crate::impls::Location = <Self as RelayChain>::child_location_of(recipient);
|
||||
let xcm = $crate::impls::xcm_transact_unpaid_execution(call, $crate::impls::OriginKind::Superuser);
|
||||
|
||||
$crate::impls::dmp::Pallet::<<Self as $crate::impls::Chain>::Runtime>::make_teyrchain_reachable(recipient);
|
||||
$crate::impls::dmp::Pezpallet::<<Self as $crate::impls::Chain>::Runtime>::make_teyrchain_reachable(recipient);
|
||||
|
||||
// Send XCM `Transact`
|
||||
$crate::impls::assert_ok!(<Self as [<$chain RelayPallet>]>::XcmPallet::send(
|
||||
@@ -600,7 +600,7 @@ macro_rules! impl_assets_helpers_for_system_teyrchain {
|
||||
( $chain:ident, $relay_chain:ident ) => {
|
||||
$crate::impls::paste::paste! {
|
||||
impl<N: $crate::impls::Network> $chain<N> {
|
||||
/// Returns the encoded call for `force_create` from the assets pallet
|
||||
/// Returns the encoded call for `force_create` from the assets pezpallet
|
||||
pub fn force_create_asset_call(
|
||||
asset_id: u32,
|
||||
owner: $crate::impls::AccountId,
|
||||
@@ -622,7 +622,7 @@ macro_rules! impl_assets_helpers_for_system_teyrchain {
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Returns a `VersionedXcm` for `force_create` from the assets pallet
|
||||
/// Returns a `VersionedXcm` for `force_create` from the assets pezpallet
|
||||
pub fn force_create_asset_xcm(
|
||||
origin_kind: $crate::impls::OriginKind,
|
||||
asset_id: u32,
|
||||
@@ -634,7 +634,7 @@ macro_rules! impl_assets_helpers_for_system_teyrchain {
|
||||
$crate::impls::xcm_transact_unpaid_execution(call, origin_kind)
|
||||
}
|
||||
|
||||
/// Force create and mint assets making use of the assets pallet
|
||||
/// Force create and mint assets making use of the assets pezpallet
|
||||
pub fn force_create_and_mint_asset(
|
||||
id: u32,
|
||||
min_balance: u128,
|
||||
@@ -744,7 +744,7 @@ macro_rules! impl_assets_helpers_for_teyrchain {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mint assets making use of the assets pallet
|
||||
/// Mint assets making use of the assets pezpallet
|
||||
pub fn mint_asset(
|
||||
signed_origin: <Self as $crate::impls::Chain>::RuntimeOrigin,
|
||||
id: u32,
|
||||
@@ -776,7 +776,7 @@ macro_rules! impl_assets_helpers_for_teyrchain {
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns the encoded call for `create` from the assets pallet
|
||||
/// Returns the encoded call for `create` from the assets pezpallet
|
||||
pub fn create_asset_call(
|
||||
asset_id: u32,
|
||||
min_balance: $crate::impls::Balance,
|
||||
@@ -898,7 +898,7 @@ macro_rules! impl_foreign_assets_helpers_for_teyrchain {
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns the encoded call for `create` from the foreign assets pallet
|
||||
/// Returns the encoded call for `create` from the foreign assets pezpallet
|
||||
pub fn create_foreign_asset_call(
|
||||
asset_id: $asset_id_type,
|
||||
min_balance: $crate::impls::Balance,
|
||||
@@ -954,7 +954,7 @@ macro_rules! impl_xcm_helpers_for_teyrchain {
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_bridge_helpers_for_chain {
|
||||
( $chain:ident, $pallet:ident, $pezpallet_xcm:ident, $runtime_call_wrapper:path ) => {
|
||||
( $chain:ident, $pezpallet:ident, $pezpallet_xcm:ident, $runtime_call_wrapper:path ) => {
|
||||
$crate::impls::paste::paste! {
|
||||
impl<N: $crate::impls::Network> $chain<N> {
|
||||
/// Open bridge with `dest`.
|
||||
@@ -985,7 +985,7 @@ macro_rules! impl_bridge_helpers_for_chain {
|
||||
};
|
||||
|
||||
// Send XCM `Transact` with `open_bridge` call
|
||||
$crate::impls::assert_ok!(<Self as [<$chain $pallet>]>::$pezpallet_xcm::send(
|
||||
$crate::impls::assert_ok!(<Self as [<$chain $pezpallet>]>::$pezpallet_xcm::send(
|
||||
root_origin,
|
||||
bx!(bridge_location.into()),
|
||||
bx!(xcm),
|
||||
|
||||
@@ -27,7 +27,7 @@ pub use pezpallet_xcm;
|
||||
pub use pezframe_support::assert_ok;
|
||||
|
||||
// Pezkuwi
|
||||
pub use pezkuwi_runtime_teyrchains::dmp::Pallet as Dmp;
|
||||
pub use pezkuwi_runtime_teyrchains::dmp::Pezpallet as Dmp;
|
||||
pub use xcm::{
|
||||
latest::AssetTransferFilter,
|
||||
prelude::{
|
||||
@@ -354,7 +354,7 @@ macro_rules! test_teyrchain_is_trusted_teleporter_for_relay {
|
||||
let sender = [<$sender_para Sender>]::get();
|
||||
// Mint assets to `$sender_para` to succeed with teleport.
|
||||
<$sender_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
$crate::macros::assert_ok!(<<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
$crate::macros::assert_ok!(<<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Mutate<_>>::mint_into(&sender, $amount + 10_000_000_000));
|
||||
|
||||
});
|
||||
@@ -370,8 +370,8 @@ macro_rules! test_teyrchain_is_trusted_teleporter_for_relay {
|
||||
// Else we'd get a `NotWithdrawable` error since it tries to reduce the check account balance, which
|
||||
// would be 0.
|
||||
<$receiver_relay as $crate::macros::TestExt>::execute_with(|| {
|
||||
let check_account = <$receiver_relay as [<$receiver_relay Pallet>]>::XcmPallet::check_account();
|
||||
$crate::macros::assert_ok!(<<$receiver_relay as [<$receiver_relay Pallet>]>::Balances
|
||||
let check_account = <$receiver_relay as [<$receiver_relay Pezpallet>]>::XcmPallet::check_account();
|
||||
$crate::macros::assert_ok!(<<$receiver_relay as [<$receiver_relay Pezpallet>]>::Balances
|
||||
as $crate::macros::Mutate<_>>::mint_into(&check_account, $amount));
|
||||
});
|
||||
|
||||
@@ -443,14 +443,14 @@ macro_rules! test_teyrchain_is_trusted_teleporter_for_relay {
|
||||
<$receiver_relay as $crate::macros::TestExt>::reset_ext();
|
||||
// Mint assets to `$sender_para` to succeed with teleport.
|
||||
<$sender_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
$crate::macros::assert_ok!(<<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
$crate::macros::assert_ok!(<<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Mutate<_>>::mint_into(&sender, $amount + 10_000_000_000));
|
||||
});
|
||||
|
||||
// Since we reset everything, we need to mint funds into the checking account again.
|
||||
<$receiver_relay as $crate::macros::TestExt>::execute_with(|| {
|
||||
let check_account = <$receiver_relay as [<$receiver_relay Pallet>]>::XcmPallet::check_account();
|
||||
$crate::macros::assert_ok!(<<$receiver_relay as [<$receiver_relay Pallet>]>::Balances
|
||||
let check_account = <$receiver_relay as [<$receiver_relay Pezpallet>]>::XcmPallet::check_account();
|
||||
$crate::macros::assert_ok!(<<$receiver_relay as [<$receiver_relay Pezpallet>]>::Balances
|
||||
as $crate::macros::Mutate<_>>::mint_into(&check_account, $amount));
|
||||
});
|
||||
|
||||
@@ -523,7 +523,7 @@ macro_rules! test_chain_can_claim_assets {
|
||||
<$sender_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
// Assets are trapped for whatever reason.
|
||||
// The possible reasons for this might differ from runtime to runtime, so here we just drop them directly.
|
||||
<<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm as $crate::macros::DropAssets>::drop_assets(
|
||||
<<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm as $crate::macros::DropAssets>::drop_assets(
|
||||
&beneficiary,
|
||||
$assets.clone().into(),
|
||||
&$crate::macros::XcmContext { origin: None, message_id: [0u8; 32], topic: None },
|
||||
@@ -539,25 +539,25 @@ macro_rules! test_chain_can_claim_assets {
|
||||
]
|
||||
);
|
||||
|
||||
let balance_before = <<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
let balance_before = <<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Currency<_>>::free_balance(&sender);
|
||||
|
||||
// Different origin or different assets won't work.
|
||||
let other_origin = <$sender_para as $crate::macros::Chain>::RuntimeOrigin::signed([<$sender_para Receiver>]::get());
|
||||
assert!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::claim_assets(
|
||||
assert!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::claim_assets(
|
||||
other_origin,
|
||||
Box::new(versioned_assets.clone().into()),
|
||||
Box::new(beneficiary.clone().into()),
|
||||
).is_err());
|
||||
let other_versioned_assets: $crate::macros::VersionedAssets = $crate::macros::Assets::new().into();
|
||||
assert!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::claim_assets(
|
||||
assert!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::claim_assets(
|
||||
origin.clone(),
|
||||
Box::new(other_versioned_assets.into()),
|
||||
Box::new(beneficiary.clone().into()),
|
||||
).is_err());
|
||||
|
||||
// Assets will be claimed to `beneficiary`, which is the same as `sender`.
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::claim_assets(
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::claim_assets(
|
||||
origin.clone(),
|
||||
Box::new(versioned_assets.clone().into()),
|
||||
Box::new(beneficiary.clone().into()),
|
||||
@@ -573,23 +573,23 @@ macro_rules! test_chain_can_claim_assets {
|
||||
);
|
||||
|
||||
// After claiming the assets, the balance has increased.
|
||||
let balance_after = <<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
let balance_after = <<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Currency<_>>::free_balance(&sender);
|
||||
assert_eq!(balance_after, balance_before + $amount);
|
||||
|
||||
// Claiming the assets again doesn't work.
|
||||
assert!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::claim_assets(
|
||||
assert!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::claim_assets(
|
||||
origin.clone(),
|
||||
Box::new(versioned_assets.clone().into()),
|
||||
Box::new(beneficiary.clone().into()),
|
||||
).is_err());
|
||||
|
||||
let balance = <<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
let balance = <<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Currency<_>>::free_balance(&sender);
|
||||
assert_eq!(balance, balance_after);
|
||||
|
||||
// You can also claim assets and send them to a different account.
|
||||
<<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm as $crate::macros::DropAssets>::drop_assets(
|
||||
<<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm as $crate::macros::DropAssets>::drop_assets(
|
||||
&beneficiary,
|
||||
$assets.clone().into(),
|
||||
&$crate::macros::XcmContext { origin: None, message_id: [0u8; 32], topic: None },
|
||||
@@ -597,14 +597,14 @@ macro_rules! test_chain_can_claim_assets {
|
||||
let receiver = [<$sender_para Receiver>]::get();
|
||||
let other_beneficiary: $crate::macros::Location =
|
||||
$crate::macros::Junction::AccountId32 { network: Some($network_id), id: receiver.clone().into() }.into();
|
||||
let balance_before = <<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
let balance_before = <<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Currency<_>>::free_balance(&receiver);
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::claim_assets(
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::claim_assets(
|
||||
origin.clone(),
|
||||
Box::new(versioned_assets.clone().into()),
|
||||
Box::new(other_beneficiary.clone().into()),
|
||||
));
|
||||
let balance_after = <<$sender_para as [<$sender_para Pallet>]>::Balances
|
||||
let balance_after = <<$sender_para as [<$sender_para Pezpallet>]>::Balances
|
||||
as $crate::macros::Currency<_>>::free_balance(&receiver);
|
||||
assert_eq!(balance_after, balance_before + $amount);
|
||||
});
|
||||
@@ -811,11 +811,11 @@ macro_rules! test_can_estimate_and_pay_exact_fees {
|
||||
|
||||
// Actually run the extrinsic.
|
||||
let sender_assets_before = <$sender_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
type ForeignAssets = <$sender_para as [<$sender_para Pallet>]>::ForeignAssets;
|
||||
type ForeignAssets = <$sender_para as [<$sender_para Pezpallet>]>::ForeignAssets;
|
||||
<ForeignAssets as $crate::macros::Inspect<_>>::balance($asset_id.clone().into(), &sender)
|
||||
});
|
||||
let receiver_assets_before = <$receiver_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
type ForeignAssets = <$receiver_para as [<$receiver_para Pallet>]>::ForeignAssets;
|
||||
type ForeignAssets = <$receiver_para as [<$receiver_para Pezpallet>]>::ForeignAssets;
|
||||
<ForeignAssets as $crate::macros::Inspect<_>>::balance($asset_id.clone().into(), &beneficiary_id)
|
||||
});
|
||||
|
||||
@@ -831,11 +831,11 @@ macro_rules! test_can_estimate_and_pay_exact_fees {
|
||||
test.assert();
|
||||
|
||||
let sender_assets_after = <$sender_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
type ForeignAssets = <$sender_para as [<$sender_para Pallet>]>::ForeignAssets;
|
||||
type ForeignAssets = <$sender_para as [<$sender_para Pezpallet>]>::ForeignAssets;
|
||||
<ForeignAssets as $crate::macros::Inspect<_>>::balance($asset_id.clone().into(), &sender)
|
||||
});
|
||||
let receiver_assets_after = <$receiver_para as $crate::macros::TestExt>::execute_with(|| {
|
||||
type ForeignAssets = <$receiver_para as [<$receiver_para Pallet>]>::ForeignAssets;
|
||||
type ForeignAssets = <$receiver_para as [<$receiver_para Pezpallet>]>::ForeignAssets;
|
||||
<ForeignAssets as $crate::macros::Inspect<_>>::balance($asset_id.into(), &beneficiary_id)
|
||||
});
|
||||
|
||||
@@ -870,7 +870,7 @@ macro_rules! test_dry_run_transfer_across_pk_bridge {
|
||||
type Runtime = <$sender_asset_hub as $crate::macros::Chain>::Runtime;
|
||||
type RuntimeCall = <$sender_asset_hub as $crate::macros::Chain>::RuntimeCall;
|
||||
type OriginCaller = <$sender_asset_hub as $crate::macros::Chain>::OriginCaller;
|
||||
type Balances = <$sender_asset_hub as [<$sender_asset_hub Pallet>]>::Balances;
|
||||
type Balances = <$sender_asset_hub as [<$sender_asset_hub Pezpallet>]>::Balances;
|
||||
|
||||
// Give some initial funds.
|
||||
<Balances as $crate::macros::Mutate<_>>::set_balance(&who, initial_balance);
|
||||
@@ -914,8 +914,8 @@ macro_rules! test_xcm_fee_querying_apis_work_for_asset_hub {
|
||||
<$asset_hub as $crate::macros::TestExt>::execute_with(|| {
|
||||
// Setup a pool between USDT and ZGR.
|
||||
type RuntimeOrigin = <$asset_hub as $crate::macros::Chain>::RuntimeOrigin;
|
||||
type Assets = <$asset_hub as [<$asset_hub Pallet>]>::Assets;
|
||||
type AssetConversion = <$asset_hub as [<$asset_hub Pallet>]>::AssetConversion;
|
||||
type Assets = <$asset_hub as [<$asset_hub Pezpallet>]>::Assets;
|
||||
type AssetConversion = <$asset_hub as [<$asset_hub Pezpallet>]>::AssetConversion;
|
||||
let wnd = $crate::macros::Location::new(1, []);
|
||||
let usdt = $crate::macros::Location::new(0, [$crate::macros::PalletInstance($crate::macros::ASSETS_PALLET_ID),
|
||||
$crate::macros::GeneralIndex($crate::macros::USDT_ID.into())]);
|
||||
@@ -1036,7 +1036,7 @@ macro_rules! test_cross_chain_alias {
|
||||
]);
|
||||
|
||||
let signed_origin = <$sender_para as $crate::macros::Chain>::RuntimeOrigin::signed(account.into());
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pallet>]>::PezkuwiXcm::execute(
|
||||
$crate::macros::assert_ok!(<$sender_para as [<$sender_para Pezpallet>]>::PezkuwiXcm::execute(
|
||||
signed_origin,
|
||||
Box::new($crate::macros::VersionedXcm::from(xcm_message.into())),
|
||||
$crate::macros::Weight::MAX
|
||||
@@ -1089,7 +1089,7 @@ macro_rules! create_pool_with_native_on {
|
||||
let native_asset: $crate::macros::Location = $crate::macros::Parent.into();
|
||||
|
||||
if $is_foreign {
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pallet>]>::ForeignAssets::mint(
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pezpallet>]>::ForeignAssets::mint(
|
||||
signed_owner.clone(),
|
||||
$asset.clone().into(),
|
||||
owner.clone().into(),
|
||||
@@ -1100,7 +1100,7 @@ macro_rules! create_pool_with_native_on {
|
||||
Some($crate::macros::GeneralIndex(id)) => *id as u32,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pallet>]>::Assets::mint(
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pezpallet>]>::Assets::mint(
|
||||
signed_owner.clone(),
|
||||
asset_id.into(),
|
||||
owner.clone().into(),
|
||||
@@ -1108,7 +1108,7 @@ macro_rules! create_pool_with_native_on {
|
||||
));
|
||||
}
|
||||
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::create_pool(
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::create_pool(
|
||||
signed_owner.clone(),
|
||||
Box::new(native_asset.clone()),
|
||||
Box::new($asset.clone()),
|
||||
@@ -1121,7 +1121,7 @@ macro_rules! create_pool_with_native_on {
|
||||
]
|
||||
);
|
||||
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::add_liquidity(
|
||||
$crate::macros::assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::add_liquidity(
|
||||
signed_owner,
|
||||
Box::new(native_asset),
|
||||
Box::new($asset),
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ macro_rules! create_pool_with_roc_on {
|
||||
let signed_owner = <$chain as Chain>::RuntimeOrigin::signed(owner.clone());
|
||||
let roc_location: Location = Parent.into();
|
||||
if $is_foreign {
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::ForeignAssets::mint(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::ForeignAssets::mint(
|
||||
signed_owner.clone(),
|
||||
$asset_id.clone().into(),
|
||||
owner.clone().into(),
|
||||
@@ -58,7 +58,7 @@ macro_rules! create_pool_with_roc_on {
|
||||
Some(GeneralIndex(id)) => *id as u32,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::Assets::mint(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::Assets::mint(
|
||||
signed_owner.clone(),
|
||||
asset_id.into(),
|
||||
owner.clone().into(),
|
||||
@@ -66,7 +66,7 @@ macro_rules! create_pool_with_roc_on {
|
||||
));
|
||||
}
|
||||
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::create_pool(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::create_pool(
|
||||
signed_owner.clone(),
|
||||
Box::new(roc_location.clone()),
|
||||
Box::new($asset_id.clone()),
|
||||
@@ -79,7 +79,7 @@ macro_rules! create_pool_with_roc_on {
|
||||
]
|
||||
);
|
||||
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::add_liquidity(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::add_liquidity(
|
||||
signed_owner,
|
||||
Box::new(roc_location),
|
||||
Box::new($asset_id),
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ fn spend_roc_on_asset_hub() {
|
||||
|
||||
// Assert events triggered by xcm pay program:
|
||||
// 1. treasury asset transferred to spend beneficiary;
|
||||
// 2. response to Relay Chain Treasury pallet instance sent back;
|
||||
// 2. response to Relay Chain Treasury pezpallet instance sent back;
|
||||
// 3. XCM program completed;
|
||||
assert_expected_events!(
|
||||
AssetHubPezkuwichain,
|
||||
@@ -229,7 +229,7 @@ fn create_and_claim_treasury_spend_in_usdt() {
|
||||
|
||||
// assert events triggered by xcm pay program
|
||||
// 1. treasury asset transferred to spend beneficiary
|
||||
// 2. response to Relay Chain treasury pallet instance sent back
|
||||
// 2. response to Relay Chain treasury pezpallet instance sent back
|
||||
// 3. XCM program completed
|
||||
assert_expected_events!(
|
||||
AssetHubPezkuwichain,
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ fn create_and_claim_treasury_spend() {
|
||||
|
||||
// assert events triggered by xcm pay program
|
||||
// 1. treasury asset transferred to spend beneficiary
|
||||
// 2. response to the Fellowship treasury pallet instance sent back
|
||||
// 2. response to the Fellowship treasury pezpallet instance sent back
|
||||
// 3. XCM program completed
|
||||
assert_expected_events!(
|
||||
AssetHubZagros,
|
||||
|
||||
+6
-6
@@ -36,7 +36,7 @@ macro_rules! foreign_balance_on {
|
||||
( $chain:ident, $id:expr, $who:expr ) => {
|
||||
emulated_integration_tests_common::impls::paste::paste! {
|
||||
<$chain>::execute_with(|| {
|
||||
type ForeignAssets = <$chain as [<$chain Pallet>]>::ForeignAssets;
|
||||
type ForeignAssets = <$chain as [<$chain Pezpallet>]>::ForeignAssets;
|
||||
<ForeignAssets as pezframe_support::traits::fungibles::Inspect<_>>::balance($id, $who)
|
||||
})
|
||||
}
|
||||
@@ -48,7 +48,7 @@ macro_rules! assets_balance_on {
|
||||
( $chain:ident, $id:expr, $who:expr ) => {
|
||||
emulated_integration_tests_common::impls::paste::paste! {
|
||||
<$chain>::execute_with(|| {
|
||||
type Assets = <$chain as [<$chain Pallet>]>::Assets;
|
||||
type Assets = <$chain as [<$chain Pezpallet>]>::Assets;
|
||||
<Assets as pezframe_support::traits::fungibles::Inspect<_>>::balance($id, $who)
|
||||
})
|
||||
}
|
||||
@@ -78,7 +78,7 @@ macro_rules! create_pool_with_wnd_on {
|
||||
let signed_owner = <$chain as Chain>::RuntimeOrigin::signed(owner.clone());
|
||||
let wnd_location: Location = Parent.into();
|
||||
if $is_foreign {
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::ForeignAssets::mint(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::ForeignAssets::mint(
|
||||
signed_owner.clone(),
|
||||
$asset_id.clone().into(),
|
||||
owner.clone().into(),
|
||||
@@ -89,7 +89,7 @@ macro_rules! create_pool_with_wnd_on {
|
||||
Some(GeneralIndex(id)) => *id as u32,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::Assets::mint(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::Assets::mint(
|
||||
signed_owner.clone(),
|
||||
asset_id.into(),
|
||||
owner.clone().into(),
|
||||
@@ -97,7 +97,7 @@ macro_rules! create_pool_with_wnd_on {
|
||||
));
|
||||
}
|
||||
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::create_pool(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::create_pool(
|
||||
signed_owner.clone(),
|
||||
Box::new(wnd_location.clone()),
|
||||
Box::new($asset_id.clone()),
|
||||
@@ -110,7 +110,7 @@ macro_rules! create_pool_with_wnd_on {
|
||||
]
|
||||
);
|
||||
|
||||
assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::add_liquidity(
|
||||
assert_ok!(<$chain as [<$chain Pezpallet>]>::AssetConversion::add_liquidity(
|
||||
signed_owner,
|
||||
Box::new(wnd_location),
|
||||
Box::new($asset_id),
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Tests for the validation of `pezpallet_xcm::Pallet::<T>::transfer_assets`.
|
||||
//! Tests for the validation of `pezpallet_xcm::Pezpallet::<T>::transfer_assets`.
|
||||
//! See the `pezpallet_xcm::transfer_assets_validation` module for more information.
|
||||
|
||||
use crate::imports::*;
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ fn create_and_claim_treasury_spend() {
|
||||
|
||||
// assert events triggered by xcm pay program
|
||||
// 1. treasury asset transferred to spend beneficiary
|
||||
// 2. response to Relay Chain treasury pallet instance sent back
|
||||
// 2. response to Relay Chain treasury pezpallet instance sent back
|
||||
// 3. XCM program completed
|
||||
assert_expected_events!(
|
||||
AssetHubZagros,
|
||||
|
||||
+2
-2
@@ -154,7 +154,7 @@ fn fellowship_treasury_spend() {
|
||||
|
||||
// Assert events triggered by xcm pay program:
|
||||
// 1. treasury asset transferred to spend beneficiary;
|
||||
// 2. response to Relay Chain Treasury pallet instance sent back;
|
||||
// 2. response to Relay Chain Treasury pezpallet instance sent back;
|
||||
// 3. XCM program completed;
|
||||
assert_expected_events!(
|
||||
AssetHubZagros,
|
||||
@@ -228,7 +228,7 @@ fn fellowship_treasury_spend() {
|
||||
|
||||
// Assert events triggered by xcm pay program:
|
||||
// 1. treasury asset transferred to spend beneficiary;
|
||||
// 2. response to Relay Chain Treasury pallet instance sent back;
|
||||
// 2. response to Relay Chain Treasury pezpallet instance sent back;
|
||||
// 3. XCM program completed;
|
||||
assert_expected_events!(
|
||||
AssetHubZagros,
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ fn transact_hardcoded_weights_are_sane() {
|
||||
|
||||
let config = CoretimePezkuwichain::ext_wrapper(|| {
|
||||
Configuration::<<CoretimePezkuwichain as Chain>::Runtime>::get()
|
||||
.expect("Pallet was configured earlier.")
|
||||
.expect("Pezpallet was configured earlier.")
|
||||
});
|
||||
|
||||
// Now run up to the block before the sale is rotated.
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ fn transact_hardcoded_weights_are_sane() {
|
||||
|
||||
let config = CoretimeZagros::ext_wrapper(|| {
|
||||
Configuration::<<CoretimeZagros as Chain>::Runtime>::get()
|
||||
.expect("Pallet was configured earlier.")
|
||||
.expect("Pezpallet was configured earlier.")
|
||||
});
|
||||
|
||||
// Now run up to the block before the sale is rotated.
|
||||
|
||||
+6
-6
@@ -52,9 +52,9 @@ teyrchains-common = { workspace = true, default-features = true }
|
||||
# Snowbridge
|
||||
pezsnowbridge-inbound-queue-primitives = { workspace = true }
|
||||
pezsnowbridge-outbound-queue-primitives = { workspace = true }
|
||||
snowbridge-pezpallet-inbound-queue-fixtures = { workspace = true, default-features = true }
|
||||
snowbridge-pezpallet-outbound-queue = { workspace = true }
|
||||
snowbridge-pezpallet-system = { workspace = true }
|
||||
pezsnowbridge-pezpallet-inbound-queue-fixtures = { workspace = true, default-features = true }
|
||||
pezsnowbridge-pezpallet-outbound-queue = { workspace = true }
|
||||
pezsnowbridge-pezpallet-system = { workspace = true }
|
||||
|
||||
[features]
|
||||
runtime-benchmarks = [
|
||||
@@ -73,9 +73,9 @@ runtime-benchmarks = [
|
||||
"pezkuwichain-zagros-system-emulated-network/runtime-benchmarks",
|
||||
"pezsnowbridge-inbound-queue-primitives/runtime-benchmarks",
|
||||
"pezsnowbridge-outbound-queue-primitives/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-inbound-queue-fixtures/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-system/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-inbound-queue-fixtures/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-outbound-queue/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"testnet-teyrchains-constants/runtime-benchmarks",
|
||||
"teyrchains-common/runtime-benchmarks",
|
||||
+1
-1
@@ -36,7 +36,7 @@ fn register_pezkuwichain_asset_on_wah_from_rah() {
|
||||
],
|
||||
);
|
||||
|
||||
// Encoded `create_asset` call to be executed in Zagros Asset Hub ForeignAssets pallet.
|
||||
// Encoded `create_asset` call to be executed in Zagros Asset Hub ForeignAssets pezpallet.
|
||||
let call = AssetHubZagros::create_foreign_asset_call(
|
||||
bridged_asset_at_wah.clone(),
|
||||
ASSET_MIN_BALANCE,
|
||||
+14
-14
@@ -57,13 +57,13 @@ teyrchains-common = { workspace = true, default-features = true }
|
||||
pezsnowbridge-core = { workspace = true }
|
||||
pezsnowbridge-inbound-queue-primitives = { workspace = true }
|
||||
pezsnowbridge-outbound-queue-primitives = { workspace = true }
|
||||
snowbridge-pezpallet-inbound-queue = { workspace = true }
|
||||
snowbridge-pezpallet-inbound-queue-fixtures = { workspace = true }
|
||||
snowbridge-pezpallet-inbound-queue-v2 = { workspace = true }
|
||||
snowbridge-pezpallet-outbound-queue = { workspace = true }
|
||||
snowbridge-pezpallet-outbound-queue-v2 = { workspace = true }
|
||||
snowbridge-pezpallet-system = { workspace = true }
|
||||
snowbridge-pezpallet-system-v2 = { workspace = true }
|
||||
pezsnowbridge-pezpallet-inbound-queue = { workspace = true }
|
||||
pezsnowbridge-pezpallet-inbound-queue-fixtures = { workspace = true }
|
||||
pezsnowbridge-pezpallet-inbound-queue-v2 = { workspace = true }
|
||||
pezsnowbridge-pezpallet-outbound-queue = { workspace = true }
|
||||
pezsnowbridge-pezpallet-outbound-queue-v2 = { workspace = true }
|
||||
pezsnowbridge-pezpallet-system = { workspace = true }
|
||||
pezsnowbridge-pezpallet-system-v2 = { workspace = true }
|
||||
|
||||
[features]
|
||||
runtime-benchmarks = [
|
||||
@@ -86,13 +86,13 @@ runtime-benchmarks = [
|
||||
"pezsnowbridge-core/runtime-benchmarks",
|
||||
"pezsnowbridge-inbound-queue-primitives/runtime-benchmarks",
|
||||
"pezsnowbridge-outbound-queue-primitives/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-inbound-queue-fixtures/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-inbound-queue-v2/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-inbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-outbound-queue-v2/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-outbound-queue/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-system-v2/runtime-benchmarks",
|
||||
"snowbridge-pezpallet-system/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-inbound-queue-fixtures/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-inbound-queue-v2/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-inbound-queue/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-outbound-queue-v2/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-outbound-queue/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-system-v2/runtime-benchmarks",
|
||||
"pezsnowbridge-pezpallet-system/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"testnet-teyrchains-constants/runtime-benchmarks",
|
||||
+1
-1
@@ -57,7 +57,7 @@ fn register_asset_on_rah_from_wah(bridged_asset_at_rah: Location) {
|
||||
AssetHubZagros::para_id(),
|
||||
);
|
||||
|
||||
// Encoded `create_asset` call to be executed in Pezkuwichain Asset Hub ForeignAssets pallet.
|
||||
// Encoded `create_asset` call to be executed in Pezkuwichain Asset Hub ForeignAssets pezpallet.
|
||||
let call = AssetHubPezkuwichain::create_foreign_asset_call(
|
||||
bridged_asset_at_rah.clone(),
|
||||
ASSET_MIN_BALANCE,
|
||||
+13
-13
@@ -51,7 +51,7 @@ use pezsnowbridge_inbound_queue_primitives::{
|
||||
v1::{Command, Destination, MessageV1, VersionedMessage},
|
||||
EventFixture,
|
||||
};
|
||||
use snowbridge_pezpallet_inbound_queue_fixtures::send_native_eth::make_send_native_eth_message;
|
||||
use pezsnowbridge_pezpallet_inbound_queue_fixtures::send_native_eth::make_send_native_eth_message;
|
||||
use pezsp_core::{H160, H256};
|
||||
use testnet_teyrchains_constants::zagros::snowbridge::EthereumNetwork;
|
||||
use xcm_builder::ExternalConsensusLocationsConverterFor;
|
||||
@@ -403,8 +403,8 @@ fn send_eth_asset_from_asset_hub_to_ethereum_and_back() {
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![
|
||||
RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageAccepted {..}) => {},
|
||||
RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued {..}) => {},
|
||||
RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageAccepted {..}) => {},
|
||||
RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued {..}) => {},
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -703,7 +703,7 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
|
||||
// Outbound Queue
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -844,7 +844,7 @@ fn transfer_relay_token() {
|
||||
// Check that a message was sent to Ethereum to create the agent
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumSystem(snowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumSystem(pezsnowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -901,7 +901,7 @@ fn transfer_relay_token() {
|
||||
// Outbound Queue
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
|
||||
// Send relay token back to AH
|
||||
@@ -1068,7 +1068,7 @@ fn transfer_ah_token() {
|
||||
// Outbound Queue
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
|
||||
let message = VersionedMessage::V1(MessageV1 {
|
||||
@@ -1426,7 +1426,7 @@ fn send_weth_from_ethereum_to_ahw_to_ahr_back_to_ahw_and_ethereum() {
|
||||
// Outbound Queue
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -1558,7 +1558,7 @@ fn transfer_penpal_native_asset() {
|
||||
type RuntimeEvent = <BridgeHubZagros as Chain>::RuntimeEvent;
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1771,7 +1771,7 @@ fn transfer_penpal_teleport_enabled_asset() {
|
||||
type RuntimeEvent = <BridgeHubZagros as Chain>::RuntimeEvent;
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2125,7 +2125,7 @@ fn transfer_roc_from_ah_with_transfer_and_then() {
|
||||
// Outbound Queue
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2222,7 +2222,7 @@ fn register_pna_in_v5_while_transfer_in_v4_should_work() {
|
||||
// Check that a message was sent to Ethereum to create the agent
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumSystem(snowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumSystem(pezsnowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2288,7 +2288,7 @@ fn register_pna_in_v5_while_transfer_in_v4_should_work() {
|
||||
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(snowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumOutboundQueue(pezsnowbridge_pezpallet_outbound_queue::Event::MessageQueued{ .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
+3
-3
@@ -75,7 +75,7 @@ pub fn register_relay_token_on_bh() {
|
||||
));
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumSystem(snowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumSystem(pezsnowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -390,7 +390,7 @@ pub fn register_pal_on_bh() {
|
||||
));
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumSystem(snowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumSystem(pezsnowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -519,7 +519,7 @@ pub fn register_roc_on_bh() {
|
||||
));
|
||||
assert_expected_events!(
|
||||
BridgeHubZagros,
|
||||
vec![RuntimeEvent::EthereumSystem(snowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
vec![RuntimeEvent::EthereumSystem(pezsnowbridge_pezpallet_system::Event::RegisterToken { .. }) => {},]
|
||||
);
|
||||
});
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ use crate::{imports::*, tests::snowbridge_common::*};
|
||||
use pezbridge_hub_zagros_runtime::xcm_config::LocationToAccountId;
|
||||
use emulated_integration_tests_common::snowbridge::{SEPOLIA_ID, WETH};
|
||||
use pezsnowbridge_core::AssetMetadata;
|
||||
use snowbridge_pezpallet_system::Error;
|
||||
use pezsnowbridge_pezpallet_system::Error;
|
||||
use testnet_teyrchains_constants::zagros::snowbridge::EthereumNetwork;
|
||||
use xcm_executor::traits::ConvertLocation;
|
||||
|
||||
+2
-2
@@ -210,7 +210,7 @@ fn send_token_v2() {
|
||||
reward_kind: *reward_kind == BridgeReward::Snowbridge,
|
||||
reward_balance: *reward_balance == relayer_reward,
|
||||
},
|
||||
RuntimeEvent::EthereumInboundQueueV2(snowbridge_pezpallet_inbound_queue_v2::Event::MessageReceived { message_id, .. }) => {
|
||||
RuntimeEvent::EthereumInboundQueueV2(pezsnowbridge_pezpallet_inbound_queue_v2::Event::MessageReceived { message_id, .. }) => {
|
||||
message_id: *message_id == topic_id,
|
||||
},
|
||||
]
|
||||
@@ -1059,7 +1059,7 @@ pub fn add_tip_from_asset_hub_user_origin() {
|
||||
assert!(
|
||||
events.iter().any(|event| matches!(
|
||||
event,
|
||||
RuntimeEvent::EthereumSystemV2(snowbridge_pezpallet_system_v2::Event::TipProcessed { sender, message_id, success, ..})
|
||||
RuntimeEvent::EthereumSystemV2(pezsnowbridge_pezpallet_system_v2::Event::TipProcessed { sender, message_id, success, ..})
|
||||
if *sender == relayer &&*message_id == tip_message_id.clone() && *success, // expect success
|
||||
)),
|
||||
"tip added event found"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user