feat: Rebrand Polkadot/Substrate references to PezkuwiChain

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

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

This is a significant step towards fully customizing the SDK for the PezkuwiChain ecosystem.
This commit is contained in:
2025-12-14 00:04:10 +03:00
parent e4778b4576
commit 379cb741ed
9082 changed files with 997824 additions and 997542 deletions
@@ -24,7 +24,7 @@ use crate::{
mock::MockGenesisConfig,
paras::{ParaGenesisArgs, ParaKind},
};
use sp_runtime::Perbill;
use pezsp_runtime::Perbill;
use pezkuwi_primitives::{Balance, HeadData, ValidationCode};
@@ -35,11 +35,11 @@ use crate::{
};
use alloc::{vec, vec::Vec};
use frame_support::{defensive, pallet_prelude::*};
use frame_system::pallet_prelude::*;
use pallet_broker::CoreAssignment;
use pezframe_support::{defensive, pezpallet_prelude::*};
use pezframe_system::pezpallet_prelude::*;
use pezpallet_broker::CoreAssignment;
use pezkuwi_primitives::CoreIndex;
use sp_runtime::traits::{One, Saturating};
use pezsp_runtime::traits::{One, Saturating};
pub use pallet::*;
@@ -204,7 +204,7 @@ impl<N> From<Schedule<N>> for WorkState<N> {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -213,7 +213,7 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + on_demand::Config {}
pub trait Config: pezframe_system::Config + configuration::Config + on_demand::Config {}
/// Scheduled assignment sets.
///
@@ -256,7 +256,7 @@ pub mod pallet {
impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
fn pop_assignment_for_core(core_idx: CoreIndex) -> Option<Assignment> {
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
CoreDescriptors::<T>::mutate(core_idx, |core_state| {
Self::ensure_workload(now, core_idx, core_state);
@@ -402,7 +402,7 @@ impl<T: Config> Pallet<T> {
/// Inserting arbitrarily causes a `DispatchError::DisallowedInsert` error.
// With this restriction this function allows for O(1) complexity. It could easily be lifted, if
// need be and in fact an implementation is available
// [here](https://github.com/paritytech/polkadot-sdk/pull/1694/commits/c0c23b01fd2830910cde92c11960dad12cdff398#diff-0c85a46e448de79a5452395829986ee8747e17a857c27ab624304987d2dde8baR386).
// [here](https://github.com/pezkuwichain/kurdistan-sdk/issues/107/commits/c0c23b01fd2830910cde92c11960dad12cdff398#diff-0c85a46e448de79a5452395829986ee8747e17a857c27ab624304987d2dde8baR386).
// The problem is that insertion complexity then depends on the size of the existing queue,
// which makes determining weights hard and could lead to issues like overweight blocks (at
// least in theory).
@@ -461,7 +461,7 @@ impl<T: Config> Pallet<T> {
impl<T: Config> AssignCoretime for Pallet<T> {
fn assign_coretime(id: ParaId) -> DispatchResult {
let current_block = frame_system::Pallet::<T>::block_number();
let current_block = pezframe_system::Pallet::<T>::block_number();
// Add a new core and assign the para to it.
let mut config = configuration::ActiveConfig::<T>::get();
@@ -473,7 +473,7 @@ impl<T: Config> AssignCoretime for Pallet<T> {
configuration::Pallet::<T>::force_set_active_config(config);
let begin = current_block + One::one();
let assignment = vec![(pallet_broker::CoreAssignment::Task(id.into()), PartsOf57600::FULL)];
let assignment = vec![(pezpallet_broker::CoreAssignment::Task(id.into()), PartsOf57600::FULL)];
Pallet::<T>::assign_core(CoreIndex(core), begin, assignment, None)
}
}
@@ -26,8 +26,8 @@ use crate::{
paras::{ParaGenesisArgs, ParaKind},
scheduler::common::Assignment,
};
use frame_support::{assert_noop, assert_ok, pallet_prelude::*};
use pallet_broker::TaskId;
use pezframe_support::{assert_noop, assert_ok, pezpallet_prelude::*};
use pezpallet_broker::TaskId;
use pezkuwi_primitives::{BlockNumber, Id as ParaId, SessionIndex, ValidationCode};
fn schedule_blank_para(id: ParaId, parakind: ParaKind) {
+13 -13
View File
@@ -30,8 +30,8 @@ use alloc::{
vec::Vec,
};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
ApprovedPeerId, AvailabilityBitfield, BackedCandidate, CandidateCommitments,
CandidateDescriptorV2, CandidateHash, ClaimQueueOffset,
@@ -42,8 +42,8 @@ use pezkuwi_primitives::{
ValidDisputeStatementKind, ValidationCode, ValidatorId, ValidatorIndex, ValidityAttestation,
UMP_SEPARATOR,
};
use sp_core::H256;
use sp_runtime::{
use pezsp_core::H256;
use pezsp_runtime::{
traits::{Header as HeaderT, One, TrailingZeroInput, Zero},
RuntimeAppPublic,
};
@@ -54,15 +54,15 @@ fn mock_validation_code() -> ValidationCode {
/// Grab an account, seeded by a name and index.
///
/// This is directly from frame-benchmarking. Copy/pasted so we can use it when not compiling with
/// This is directly from pezframe-benchmarking. Copy/pasted so we can use it when not compiling with
/// "features = runtime-benchmarks".
fn account<AccountId: Decode>(name: &'static str, index: u32, seed: u32) -> AccountId {
let entropy = (name, index, seed).using_encoded(sp_io::hashing::blake2_256);
let entropy = (name, index, seed).using_encoded(pezsp_io::hashing::blake2_256);
AccountId::decode(&mut TrailingZeroInput::new(&entropy[..]))
.expect("infinite input; no invalid input; qed")
}
pub fn generate_validator_pairs<T: frame_system::Config>(
pub fn generate_validator_pairs<T: pezframe_system::Config>(
validator_count: u32,
) -> Vec<(T::AccountId, ValidatorId)> {
(0..validator_count)
@@ -422,12 +422,12 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
/// way.
fn run_to_block(to: u32) {
let to = to.into();
while frame_system::Pallet::<T>::block_number() < to {
let b = frame_system::Pallet::<T>::block_number();
while pezframe_system::Pallet::<T>::block_number() < to {
let b = pezframe_system::Pallet::<T>::block_number();
initializer::Pallet::<T>::on_finalize(b);
let b = b + One::one();
frame_system::Pallet::<T>::set_block_number(b);
pezframe_system::Pallet::<T>::set_block_number(b);
initializer::Pallet::<T>::on_initialize(b);
}
}
@@ -452,7 +452,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
)
.unwrap();
paras::Pallet::<T>::add_trusted_validation_code(
frame_system::Origin::<T>::Root.into(),
pezframe_system::Origin::<T>::Root.into(),
validation_code,
)
.unwrap();
@@ -504,8 +504,8 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
let block_number = BlockNumberFor::<T>::from(block + 1);
let header = Self::header(block_number);
frame_system::Pallet::<T>::reset_events();
frame_system::Pallet::<T>::initialize(&header.number(), &header.hash(), header.digest());
pezframe_system::Pallet::<T>::reset_events();
pezframe_system::Pallet::<T>::initialize(&header.number(), &header.hash(), header.digest());
initializer::Pallet::<T>::on_initialize(*header.number());
assert_eq!(shared::CurrentSessionIndex::<T>::get(), target_session);
+22 -22
View File
@@ -21,8 +21,8 @@
use crate::shared;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use frame_support::{pallet_prelude::*, DefaultNoBound};
use frame_system::pallet_prelude::*;
use pezframe_support::{pezpallet_prelude::*, DefaultNoBound};
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
ApprovalVotingParams, AsyncBackingParams, Balance, ExecutorParamError, ExecutorParams,
NodeFeatures, SessionIndex, LEGACY_MIN_BACKING_VOTES, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE,
@@ -31,7 +31,7 @@ use pezkuwi_primitives::{
use pezkuwi_teyrchain_primitives::primitives::{
MAX_HORIZONTAL_MESSAGE_NUM, MAX_UPWARD_MESSAGE_NUM,
};
use sp_runtime::{traits::Zero, Perbill, Percent};
use pezsp_runtime::{traits::Zero, Perbill, Percent};
#[cfg(test)]
mod tests;
@@ -46,7 +46,7 @@ use pezkuwi_primitives::SchedulerParams;
const LOG_TARGET: &str = "runtime::configuration";
// This value is derived from network layer limits. See `sc_network::MAX_RESPONSE_SIZE` and
// This value is derived from network layer limits. See `pezsc_network::MAX_RESPONSE_SIZE` and
// `pezkuwi_node_network_protocol::POV_RESPONSE_SIZE`.
const POV_SIZE_HARD_LIMIT: u32 = 16 * 1024 * 1024;
@@ -59,7 +59,7 @@ pub(crate) const MAX_VALIDATION_CODE_COMPRESSION_RATIO: u32 = 10;
Encode,
Decode,
PartialEq,
sp_core::RuntimeDebug,
pezsp_core::RuntimeDebug,
scale_info::TypeInfo,
serde::Serialize,
serde::Deserialize,
@@ -135,7 +135,7 @@ pub struct HostConfiguration<BlockNumber> {
/// revert [`validation_upgrade_delay`](Self::validation_upgrade_delay) many blocks back and
/// still find the new code in the storage by hash.
///
/// [#4601]: https://github.com/paritytech/polkadot/issues/4601
/// [#4601]: https://github.com/pezkuwichain/kurdistan-sdk/issues/151
pub validation_upgrade_delay: BlockNumber,
/// Asynchronous backing parameters.
pub async_backing_params: AsyncBackingParams,
@@ -507,26 +507,26 @@ impl WeightInfo for TestWeightInfo {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
/// The in-code storage version.
///
/// v0-v1: <https://github.com/paritytech/polkadot/pull/3575>
/// v1-v2: <https://github.com/paritytech/polkadot/pull/4420>
/// v2-v3: <https://github.com/paritytech/polkadot/pull/6091>
/// v3-v4: <https://github.com/paritytech/polkadot/pull/6345>
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937>
/// + <https://github.com/paritytech/polkadot/pull/6961>
/// + <https://github.com/paritytech/polkadot/pull/6934>
/// v5-v6: <https://github.com/paritytech/polkadot/pull/6271> (remove UMP dispatch queue)
/// v6-v7: <https://github.com/paritytech/polkadot/pull/7396>
/// v7-v8: <https://github.com/paritytech/polkadot/pull/6969>
/// v8-v9: <https://github.com/paritytech/polkadot/pull/7577>
/// v9-v10: <https://github.com/paritytech/polkadot-sdk/pull/2177>
/// v10-11: <https://github.com/paritytech/polkadot-sdk/pull/1191>
/// v11-12: <https://github.com/paritytech/polkadot-sdk/pull/3181>
/// v0-v1: <https://github.com/pezkuwichain/kurdistan-sdk/issues/174>
/// v1-v2: <https://github.com/pezkuwichain/kurdistan-sdk/issues/175>
/// v2-v3: <https://github.com/pezkuwichain/kurdistan-sdk/issues/178>
/// v3-v4: <https://github.com/pezkuwichain/kurdistan-sdk/issues/180>
/// v4-v5: <https://github.com/pezkuwichain/kurdistan-sdk/issues/182>
/// + <https://github.com/pezkuwichain/kurdistan-sdk/issues/183>
/// + <https://github.com/pezkuwichain/kurdistan-sdk/issues/181>
/// v5-v6: <https://github.com/pezkuwichain/kurdistan-sdk/issues/179> (remove UMP dispatch queue)
/// v6-v7: <https://github.com/pezkuwichain/kurdistan-sdk/issues/185>
/// v7-v8: <https://github.com/pezkuwichain/kurdistan-sdk/issues/184>
/// v8-v9: <https://github.com/pezkuwichain/kurdistan-sdk/issues/186>
/// v9-v10: <https://github.com/pezkuwichain/kurdistan-sdk/issues/110>
/// v10-11: <https://github.com/pezkuwichain/kurdistan-sdk/issues/100>
/// v11-12: <https://github.com/pezkuwichain/kurdistan-sdk/issues/112>
const STORAGE_VERSION: StorageVersion = StorageVersion::new(12);
#[pallet::pallet]
@@ -535,7 +535,7 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + shared::Config {
pub trait Config: pezframe_system::Config + shared::Config {
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
@@ -16,10 +16,10 @@
#![cfg(feature = "runtime-benchmarks")]
use crate::configuration::*;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezkuwi_primitives::{ExecutorParam, ExecutorParams, PvfExecKind, PvfPrepKind};
use sp_runtime::traits::One;
use pezsp_runtime::traits::One;
#[benchmarks]
mod benchmarks {
@@ -18,17 +18,17 @@
use crate::configuration::{Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{Defensive, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
AsyncBackingParams, Balance, ExecutorParams, NodeFeatures, SessionIndex,
LEGACY_MIN_BACKING_VOTES, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
};
use sp_runtime::Perbill;
use pezsp_runtime::Perbill;
use super::v9::V9HostConfiguration;
// All configuration of the runtime with respect to paras.
@@ -137,11 +137,11 @@ impl<BlockNumber: Default + From<u32>> Default for V10HostConfiguration<BlockNum
mod v9 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V9HostConfiguration<BlockNumberFor<T>>)>,
@@ -152,11 +152,11 @@ mod v9 {
mod v10 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V10HostConfiguration<BlockNumberFor<T>>)>,
@@ -167,7 +167,7 @@ mod v10 {
pub struct VersionUncheckedMigrateToV10<T>(core::marker::PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade() for HostConfiguration MigrateToV10");
Ok(Vec::new())
}
@@ -177,7 +177,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade() for HostConfiguration MigrateToV10");
ensure!(
Pallet::<T>::on_chain_storage_version() >= StorageVersion::new(10),
@@ -188,12 +188,12 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10<T> {
}
}
pub type MigrateToV10<T> = frame_support::migrations::VersionedMigration<
pub type MigrateToV10<T> = pezframe_support::migrations::VersionedMigration<
9,
10,
VersionUncheckedMigrateToV10<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
// Unusual formatting is justified:
@@ -18,20 +18,20 @@
use crate::configuration::{self, Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
use pezframe_support::{
migrations::VersionedMigration,
pallet_prelude::*,
pezpallet_prelude::*,
traits::{Defensive, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
ApprovalVotingParams, AsyncBackingParams, ExecutorParams, NodeFeatures, SessionIndex,
LEGACY_MIN_BACKING_VOTES, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
};
use pezkuwi_core_primitives::Balance;
use sp_arithmetic::Perbill;
use pezsp_arithmetic::Perbill;
use super::v10::V10HostConfiguration;
@@ -142,11 +142,11 @@ impl<BlockNumber: Default + From<u32>> Default for V11HostConfiguration<BlockNum
mod v10 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V10HostConfiguration<BlockNumberFor<T>>)>,
@@ -157,11 +157,11 @@ mod v10 {
mod v11 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V11HostConfiguration<BlockNumberFor<T>>)>,
@@ -174,13 +174,13 @@ pub type MigrateToV11<T> = VersionedMigration<
11,
UncheckedMigrateToV11<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
pub struct UncheckedMigrateToV11<T>(core::marker::PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV11<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade() for HostConfiguration MigrateToV11");
Ok(Vec::new())
}
@@ -195,7 +195,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV11<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade() for HostConfiguration MigrateToV11");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 11,
@@ -18,26 +18,26 @@
use crate::configuration::{self, migration::v11::V11HostConfiguration, Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
use pezframe_support::{
migrations::VersionedMigration,
pallet_prelude::*,
pezpallet_prelude::*,
traits::{Defensive, UncheckedOnRuntimeUpgrade},
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::SchedulerParams;
use sp_core::Get;
use sp_staking::SessionIndex;
use pezsp_core::Get;
use pezsp_staking::SessionIndex;
type V12HostConfiguration<BlockNumber> = configuration::HostConfiguration<BlockNumber>;
mod v11 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V11HostConfiguration<BlockNumberFor<T>>)>,
@@ -48,11 +48,11 @@ mod v11 {
mod v12 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V12HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V12HostConfiguration<BlockNumberFor<T>>)>,
@@ -65,14 +65,14 @@ pub type MigrateToV12<T> = VersionedMigration<
12,
UncheckedMigrateToV12<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
pub struct UncheckedMigrateToV12<T>(core::marker::PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV12<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade() for HostConfiguration MigrateToV12");
Ok(Vec::new())
}
@@ -87,7 +87,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV12<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade() for HostConfiguration MigrateToV12");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 12,
@@ -183,7 +183,7 @@ fn migrate_to_v12<T: Config>() -> Weight {
#[cfg(test)]
mod tests {
use pezkuwi_primitives::LEGACY_MIN_BACKING_VOTES;
use sp_arithmetic::Perbill;
use pezsp_arithmetic::Perbill;
use super::*;
use crate::mock::{new_test_ext, Test};
@@ -18,8 +18,8 @@
use crate::configuration::{Config, Pallet};
use alloc::vec::Vec;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{AsyncBackingParams, Balance, ExecutorParams, SessionIndex};
@@ -122,11 +122,11 @@ impl<BlockNumber: Default + From<u32>> Default for V6HostConfiguration<BlockNumb
mod v6 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V6HostConfiguration<BlockNumberFor<T>>)>,
@@ -18,15 +18,15 @@
use crate::configuration::{self, Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{Defensive, StorageVersion},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{AsyncBackingParams, Balance, ExecutorParams, SessionIndex};
use frame_support::traits::OnRuntimeUpgrade;
use pezframe_support::traits::OnRuntimeUpgrade;
use super::v6::V6HostConfiguration;
@@ -127,11 +127,11 @@ impl<BlockNumber: Default + From<u32>> Default for V7HostConfiguration<BlockNumb
mod v6 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V6HostConfiguration<BlockNumberFor<T>>)>,
@@ -142,11 +142,11 @@ mod v6 {
mod v7 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V7HostConfiguration<BlockNumberFor<T>>)>,
@@ -157,7 +157,7 @@ mod v7 {
pub struct MigrateToV7<T>(core::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV7<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade()");
Ok(Vec::new())
}
@@ -178,7 +178,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV7<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade()");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 7,
@@ -18,18 +18,18 @@
use crate::configuration::{self, Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{Defensive, StorageVersion},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
AsyncBackingParams, Balance, ExecutorParams, SessionIndex, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
};
use sp_runtime::Perbill;
use pezsp_runtime::Perbill;
use frame_support::traits::OnRuntimeUpgrade;
use pezframe_support::traits::OnRuntimeUpgrade;
use super::v7::V7HostConfiguration;
/// All configuration of the runtime with respect to paras.
@@ -134,11 +134,11 @@ impl<BlockNumber: Default + From<u32>> Default for V8HostConfiguration<BlockNumb
mod v7 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V7HostConfiguration<BlockNumberFor<T>>)>,
@@ -149,11 +149,11 @@ mod v7 {
mod v8 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V8HostConfiguration<BlockNumberFor<T>>)>,
@@ -164,7 +164,7 @@ mod v8 {
pub struct MigrateToV8<T>(core::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV8<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade() for HostConfiguration MigrateToV8");
Ok(Vec::new())
}
@@ -185,7 +185,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV8<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade() for HostConfiguration MigrateToV8");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 8,
@@ -18,19 +18,19 @@
use crate::configuration::{self, Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{Defensive, StorageVersion},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
AsyncBackingParams, Balance, ExecutorParams, SessionIndex, LEGACY_MIN_BACKING_VOTES,
ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
};
use sp_runtime::Perbill;
use pezsp_runtime::Perbill;
use frame_support::traits::OnRuntimeUpgrade;
use pezframe_support::traits::OnRuntimeUpgrade;
use super::v8::V8HostConfiguration;
/// All configuration of the runtime with respect to paras.
@@ -137,11 +137,11 @@ impl<BlockNumber: Default + From<u32>> Default for V9HostConfiguration<BlockNumb
mod v8 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V8HostConfiguration<BlockNumberFor<T>>)>,
@@ -152,11 +152,11 @@ mod v8 {
mod v9 {
use super::*;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type ActiveConfig<T: Config> =
StorageValue<Pallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
pub(crate) type PendingConfigs<T: Config> = StorageValue<
Pallet<T>,
Vec<(SessionIndex, V9HostConfiguration<BlockNumberFor<T>>)>,
@@ -167,7 +167,7 @@ mod v9 {
pub struct MigrateToV9<T>(core::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV9<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running pre_upgrade() for HostConfiguration MigrateToV9");
Ok(Vec::new())
}
@@ -188,7 +188,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV9<T> {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::configuration::LOG_TARGET, "Running post_upgrade() for HostConfiguration MigrateToV9");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 9,
@@ -20,7 +20,7 @@ use crate::{
mock::{new_test_ext, Configuration, MockGenesisConfig, ParasShared, RuntimeOrigin, Test},
};
use bitvec::{bitvec, prelude::Lsb0};
use frame_support::{assert_err, assert_ok};
use pezframe_support::{assert_err, assert_ok};
fn on_new_session(session_index: SessionIndex) -> (HostConfiguration<u32>, HostConfiguration<u32>) {
ParasShared::set_session_index(session_index);
@@ -513,7 +513,7 @@ fn verify_externally_accessible() {
ActiveConfig::<Test>::put(ground_truth.clone());
// Extract the active config via the well known key.
let raw_active_config = sp_io::storage::get(well_known_keys::ACTIVE_CONFIG)
let raw_active_config = pezsp_io::storage::get(well_known_keys::ACTIVE_CONFIG)
.expect("config must be present in storage under ACTIVE_CONFIG");
let abridged_config = AbridgedHostConfiguration::decode(&mut &raw_active_config[..])
.expect("HostConfiguration must be decodable into AbridgedHostConfiguration");
@@ -539,7 +539,7 @@ fn verify_externally_accessible() {
#[test]
fn active_config_hrmp_channel_size_and_capacity_ratio_works() {
frame_support::parameter_types! {
pezframe_support::parameter_types! {
pub Ratio100: Percent = Percent::from_percent(100);
pub Ratio50: Percent = Percent::from_percent(50);
}
@@ -19,9 +19,9 @@
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use frame_benchmarking::v2::*;
use frame_support::traits::OriginTrait;
use pallet_broker::CoreIndex as BrokerCoreIndex;
use pezframe_benchmarking::v2::*;
use pezframe_support::traits::OriginTrait;
use pezpallet_broker::CoreIndex as BrokerCoreIndex;
#[benchmarks]
mod benchmarks {
@@ -30,12 +30,12 @@ mod benchmarks {
#[benchmark]
fn request_revenue_at() {
let root_origin = <T as frame_system::Config>::RuntimeOrigin::root();
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
let mhr = <T as on_demand::Config>::MaxHistoricalRevenue::get();
frame_system::Pallet::<T>::set_block_number((mhr + 2).into());
pezframe_system::Pallet::<T>::set_block_number((mhr + 2).into());
let minimum_balance = <T as on_demand::Config>::Currency::minimum_balance();
let rev: BoundedVec<
<<T as on_demand::Config>::Currency as frame_support::traits::Currency<
<<T as on_demand::Config>::Currency as pezframe_support::traits::Currency<
T::AccountId,
>>::Balance,
T::MaxHistoricalRevenue,
@@ -51,17 +51,17 @@ mod benchmarks {
);
#[extrinsic_call]
_(root_origin as <T as frame_system::Config>::RuntimeOrigin, mhr + 1)
_(root_origin as <T as pezframe_system::Config>::RuntimeOrigin, mhr + 1)
}
#[benchmark]
fn request_core_count() {
// Setup
let root_origin = <T as frame_system::Config>::RuntimeOrigin::root();
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
#[extrinsic_call]
_(
root_origin as <T as frame_system::Config>::RuntimeOrigin,
root_origin as <T as pezframe_system::Config>::RuntimeOrigin,
// random core count
100,
)
@@ -70,7 +70,7 @@ mod benchmarks {
#[benchmark]
fn assign_core(s: Linear<1, 100>) {
// Setup
let root_origin = <T as frame_system::Config>::RuntimeOrigin::root();
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
// Use parameterized assignment count
let mut assignments: Vec<(CoreAssignment, PartsOf57600)> = vec![0u16; s as usize - 1]
@@ -89,7 +89,7 @@ mod benchmarks {
#[extrinsic_call]
_(
root_origin as <T as frame_system::Config>::RuntimeOrigin,
root_origin as <T as pezframe_system::Config>::RuntimeOrigin,
core_index,
BlockNumberFor::<T>::from(5u32),
assignments,
@@ -100,10 +100,10 @@ mod benchmarks {
#[benchmark]
fn credit_account() {
// Setup
let root_origin = <T as frame_system::Config>::RuntimeOrigin::root();
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
let who: T::AccountId = whitelisted_caller();
#[extrinsic_call]
_(root_origin as <T as frame_system::Config>::RuntimeOrigin, who, 1_000_000u32.into())
_(root_origin as <T as pezframe_system::Config>::RuntimeOrigin, who, 1_000_000u32.into())
}
}
@@ -30,18 +30,18 @@ mod v_coretime {
use codec::Encode;
use core::{iter, result};
#[cfg(feature = "try-runtime")]
use frame_support::ensure;
use frame_support::{
use pezframe_support::ensure;
use pezframe_support::{
traits::{OnRuntimeUpgrade, PalletInfoAccess, StorageVersion},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pallet_broker::{CoreAssignment, CoreMask, ScheduleItem};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezpallet_broker::{CoreAssignment, CoreMask, ScheduleItem};
use pezkuwi_primitives::{CoreIndex, Id as ParaId};
use pezkuwi_teyrchain_primitives::primitives::IsSystem;
use sp_arithmetic::traits::SaturatedConversion;
use sp_core::Get;
use sp_runtime::BoundedVec;
use pezsp_arithmetic::traits::SaturatedConversion;
use pezsp_core::Get;
use pezsp_runtime::BoundedVec;
use xcm::prelude::{
send_xcm, Instruction, Junction, Location, SendError, SendXcm, WeightLimit, Xcm,
};
@@ -77,7 +77,7 @@ mod v_coretime {
let storage_version_key = StorageVersion::storage_key::<assigner_coretime::Pallet<T>>();
loop {
match sp_io::storage::next_key(&next_key) {
match pezsp_io::storage::next_key(&next_key) {
// StorageVersion is initialized before, so we need to ignore it.
Some(key) if &key == &storage_version_key => {
next_key = key;
@@ -112,7 +112,7 @@ mod v_coretime {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
if Self::already_migrated() {
return Ok(Vec::new());
}
@@ -130,7 +130,7 @@ mod v_coretime {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
if state.is_empty() {
return Ok(());
}
@@ -165,7 +165,7 @@ mod v_coretime {
>() -> Weight {
let legacy_paras = LegacyLease::get_all_teyrchains_with_leases();
let legacy_count = legacy_paras.len() as u32;
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
for (core, para_id) in legacy_paras.into_iter().enumerate() {
let r = assigner_coretime::Pallet::<T>::assign_core(
CoreIndex(core as u32),
+16 -16
View File
@@ -20,16 +20,16 @@
use alloc::{vec, vec::Vec};
use core::result;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{defensive_prelude::*, Currency},
};
use frame_system::pallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
pub use pallet::*;
use pallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
use pezpallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
use pezkuwi_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId};
use sp_arithmetic::traits::SaturatedConversion;
use sp_runtime::traits::TryConvert;
use pezsp_arithmetic::traits::SaturatedConversion;
use pezsp_runtime::traits::TryConvert;
use xcm::prelude::*;
use xcm_executor::traits::TransactAsset;
@@ -72,7 +72,7 @@ impl WeightInfo for TestWeightInfo {
/// Shorthand for the Balance type the runtime is using.
pub type BalanceOf<T> = <<T as on_demand::Config>::Currency as Currency<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
>>::Balance;
/// Broker pallet index on the coretime chain. Used to
@@ -89,9 +89,9 @@ enum BrokerRuntimePallets {
#[derive(Encode, Decode)]
enum CoretimeCalls {
#[codec(index = 1)]
Reserve(pallet_broker::Schedule),
Reserve(pezpallet_broker::Schedule),
#[codec(index = 3)]
SetLease(pallet_broker::TaskId, pallet_broker::Timeslice),
SetLease(pezpallet_broker::TaskId, pezpallet_broker::Timeslice),
#[codec(index = 19)]
NotifyCoreCount(u16),
#[codec(index = 20)]
@@ -100,11 +100,11 @@ enum CoretimeCalls {
SwapLeases(ParaId, ParaId),
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use crate::configuration;
use sp_runtime::traits::TryConvert;
use pezsp_runtime::traits::TryConvert;
use xcm::latest::InteriorLocation;
use xcm_executor::traits::TransactAsset;
@@ -115,11 +115,11 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + assigner_coretime::Config + on_demand::Config {
type RuntimeOrigin: From<<Self as frame_system::Config>::RuntimeOrigin>
pub trait Config: pezframe_system::Config + assigner_coretime::Config + on_demand::Config {
type RuntimeOrigin: From<<Self as pezframe_system::Config>::RuntimeOrigin>
+ Into<result::Result<Origin, <Self as Config>::RuntimeOrigin>>;
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// The ParaId of the coretime chain.
#[pallet::constant]
type BrokerId: Get<u32>;
@@ -242,7 +242,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
/// Ensure the origin is one of Root or the `para` itself.
fn ensure_root_or_para(
origin: <T as frame_system::Config>::RuntimeOrigin,
origin: <T as pezframe_system::Config>::RuntimeOrigin,
id: ParaId,
) -> DispatchResult {
if let Ok(caller_id) = ensure_teyrchain(<T as Config>::RuntimeOrigin::from(origin.clone()))
@@ -287,7 +287,7 @@ impl<T: Config> Pallet<T> {
/// The Relay-chain must be configured to ensure that only a single revenue information
/// destination exists.
pub fn notify_revenue(until: BlockNumber) -> DispatchResult {
let now = <frame_system::Pallet<T>>::block_number();
let now = <pezframe_system::Pallet<T>>::block_number();
let until_bnf: BlockNumberFor<T> = until.into();
// When cannot be in the future.
+12 -12
View File
@@ -23,8 +23,8 @@ use alloc::{collections::btree_set::BTreeSet, vec::Vec};
use bitvec::{bitvec, order::Lsb0 as BitOrderLsb0};
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::cmp::Ordering;
use frame_support::{ensure, weights::Weight};
use frame_system::pallet_prelude::*;
use pezframe_support::{ensure, weights::Weight};
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
byzantine_threshold, supermajority_threshold, ApprovalVote, ApprovalVoteMultipleCandidates,
CandidateHash, CheckedDisputeStatementSet, CheckedMultiDisputeStatementSet, CompactStatement,
@@ -34,7 +34,7 @@ use pezkuwi_primitives::{
};
use pezkuwi_runtime_metrics::get_current_time;
use scale_info::TypeInfo;
use sp_runtime::{
use pezsp_runtime::{
traits::{AppVerify, One, Saturating, Zero},
DispatchError, RuntimeDebug, SaturatedConversion,
};
@@ -194,7 +194,7 @@ pub trait DisputesHandler<BlockNumber: Ord> {
) -> Result<(), ()> {
// TODO: Consider trade-of to avoid `O(n * log(n))` average lookups of `included_state`
// TODO: instead make a single pass and store the values lazily.
// TODO: https://github.com/paritytech/polkadot/issues/4527
// TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/150
let n = statement_sets.len();
statement_sets.sort_by(dispute_ordering_compare::<Self, BlockNumber>);
@@ -366,15 +366,15 @@ impl WeightInfo for TestWeightInfo {
}
pub use pallet::*;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + session_info::Config {
pub trait Config: pezframe_system::Config + configuration::Config + session_info::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RewardValidators: RewardValidators;
type SlashingHandler: SlashingHandler<BlockNumberFor<Self>>;
@@ -890,7 +890,7 @@ impl<T: Config> Pallet<T> {
BackersOnDisputes::<T>::remove_prefix(to_prune, None);
// This is larger, and will be extracted to the `shared` pallet for more proper
// pruning. TODO: https://github.com/paritytech/polkadot/issues/3469
// pruning. TODO: https://github.com/pezkuwichain/kurdistan-sdk/issues/145
#[allow(deprecated)]
Included::<T>::remove_prefix(to_prune, None);
}
@@ -945,7 +945,7 @@ impl<T: Config> Pallet<T> {
// Dispute statement sets on any dispute which concluded
// before this point are to be rejected.
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let oldest_accepted = now.saturating_sub(post_conclusion_acceptance_period);
// Load session info to access validators
@@ -1063,7 +1063,7 @@ impl<T: Config> Pallet<T> {
) -> Result<bool, DispatchError> {
// Dispute statement sets on any dispute which concluded
// before this point are to be rejected.
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let oldest_accepted = now.saturating_sub(dispute_post_conclusion_acceptance_period);
let set = set.as_ref();
@@ -1253,7 +1253,7 @@ impl<T: Config> Pallet<T> {
// block X+1.
let revert = revert_to + One::one();
Self::deposit_event(Event::Revert(revert));
frame_system::Pallet::<T>::deposit_log(
pezframe_system::Pallet::<T>::deposit_log(
ConsensusLog::Revert(revert.saturated_into()).into(),
);
}
@@ -16,9 +16,9 @@
use super::*;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use sp_runtime::traits::One;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezsp_runtime::traits::One;
#[benchmarks]
mod benchmarks {
@@ -16,14 +16,14 @@
//! Storage migration(s) related to disputes pallet
use frame_support::traits::StorageVersion;
use pezframe_support::traits::StorageVersion;
pub mod v1 {
use super::*;
use crate::disputes::{Config, Pallet};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, weights::Weight,
use pezframe_support::{
pezpallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, weights::Weight,
};
use pezkuwi_primitives::SessionIndex;
@@ -51,7 +51,7 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(
target: crate::disputes::LOG_TARGET,
"SpamSlots before migration: {}",
@@ -65,7 +65,7 @@ pub mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(_state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::disputes::LOG_TARGET, "Running post_upgrade()");
ensure!(
StorageVersion::get::<Pallet<T>>() >= 1,
@@ -30,7 +30,7 @@
//!
//! Past session slashing edgecase:
//!
//! The `offences` pallet from Substrate provides us with a way to do both.
//! The `offences` pallet from Bizinikiwi provides us with a way to do both.
//! Currently, the interface expects us to provide staking information including
//! nominator exposure in order to submit an offence.
//!
@@ -50,12 +50,12 @@
//! offender and submit it to the runtime to produce an offence.
use crate::{disputes, initializer::ValidatorSetCount, session_info::IdentificationTuple};
use frame_support::{
use pezframe_support::{
dispatch::Pays,
traits::{Defensive, Get, KeyOwnerProofSystem, ValidatorSet, ValidatorSetWithIdentification},
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use alloc::{
boxed::Box,
@@ -68,7 +68,7 @@ use pezkuwi_primitives::{
CandidateHash, DisputeOffenceKind, SessionIndex, ValidatorId, ValidatorIndex,
};
use scale_info::TypeInfo;
use sp_runtime::{
use pezsp_runtime::{
traits::Convert,
transaction_validity::{
InvalidTransaction, TransactionPriority, TransactionSource, TransactionValidity,
@@ -76,8 +76,8 @@ use sp_runtime::{
},
KeyTypeId, Perbill,
};
use sp_session::{GetSessionNumber, GetValidatorCount};
use sp_staking::offence::{Kind, Offence, OffenceError, ReportOffence};
use pezsp_session::{GetSessionNumber, GetValidatorCount};
use pezsp_staking::offence::{Kind, Offence, OffenceError, ReportOffence};
const LOG_TARGET: &str = "runtime::teyrchains::slashing";
@@ -349,7 +349,7 @@ pub trait HandleReports<T: Config> {
fn submit_unsigned_slashing_report(
dispute_proof: DisputeProof,
key_owner_proof: T::KeyOwnerProof,
) -> Result<(), sp_runtime::TryRuntimeError>;
) -> Result<(), pezsp_runtime::TryRuntimeError>;
}
impl<T: Config> HandleReports<T> for () {
@@ -371,7 +371,7 @@ impl<T: Config> HandleReports<T> for () {
fn submit_unsigned_slashing_report(
_dispute_proof: DisputeProof,
_key_owner_proof: T::KeyOwnerProof,
) -> Result<(), sp_runtime::TryRuntimeError> {
) -> Result<(), pezsp_runtime::TryRuntimeError> {
Ok(())
}
}
@@ -388,14 +388,14 @@ impl WeightInfo for TestWeightInfo {
}
pub use pallet::*;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
pub trait Config: frame_system::Config + crate::disputes::Config {
pub trait Config: pezframe_system::Config + crate::disputes::Config {
/// The proof of key ownership, used for validating slashing reports.
/// The proof must include the session index and validator count of the
/// session at which the offence occurred.
@@ -675,7 +675,7 @@ impl<I, R, L> Default for SlashingReportHandler<I, R, L> {
impl<T, R, L> HandleReports<T> for SlashingReportHandler<T::KeyOwnerIdentification, R, L>
where
T: Config + frame_system::offchain::CreateBare<Call<T>>,
T: Config + pezframe_system::offchain::CreateBare<Call<T>>,
R: ReportOffence<
T::AccountId,
T::KeyOwnerIdentification,
@@ -706,8 +706,8 @@ where
fn submit_unsigned_slashing_report(
dispute_proof: DisputeProof,
key_owner_proof: <T as Config>::KeyOwnerProof,
) -> Result<(), sp_runtime::TryRuntimeError> {
use frame_system::offchain::{CreateBare, SubmitTransaction};
) -> Result<(), pezsp_runtime::TryRuntimeError> {
use pezframe_system::offchain::{CreateBare, SubmitTransaction};
let session_index = dispute_proof.time_slot.session_index;
let validator_index = dispute_proof.validator_index.0;
@@ -738,7 +738,7 @@ where
validator_index,
kind,
);
Err(sp_runtime::DispatchError::Other(""))
Err(pezsp_runtime::DispatchError::Other(""))
},
}
}
@@ -18,13 +18,13 @@ use super::*;
use crate::{disputes::SlashingHandler, initializer, shared};
use codec::Decode;
use frame_benchmarking::v2::*;
use frame_support::traits::{OnFinalize, OnInitialize};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use pallet_staking::testing_utils::create_validators;
use pezframe_benchmarking::v2::*;
use pezframe_support::traits::{OnFinalize, OnInitialize};
use pezframe_system::{pezpallet_prelude::BlockNumberFor, RawOrigin};
use pezpallet_staking::testing_utils::create_validators;
use pezkuwi_primitives::{Hash, TEYRCHAIN_KEY_TYPE_ID};
use sp_runtime::traits::{One, OpaqueKeys, StaticLookup};
use sp_session::MembershipProof;
use pezsp_runtime::traits::{One, OpaqueKeys, StaticLookup};
use pezsp_session::MembershipProof;
// Candidate hash of the disputed candidate.
const CANDIDATE_HASH: CandidateHash = CandidateHash(Hash::zero());
@@ -35,9 +35,9 @@ pub const fn max_validators_for<T: super::Config>() -> u32 {
}
pub trait Config:
pallet_session::Config
+ pallet_session::historical::Config
+ pallet_staking::Config
pezpallet_session::Config
+ pezpallet_session::historical::Config
+ pezpallet_staking::Config
+ super::Config
+ shared::Config
+ initializer::Config
@@ -48,7 +48,7 @@ fn setup_validator_set<T>(n: u32) -> (SessionIndex, MembershipProof, ValidatorId
where
T: Config,
{
pallet_staking::ValidatorCount::<T>::put(n);
pezpallet_staking::ValidatorCount::<T>::put(n);
let balance_factor = 1000;
// create validators and set random session keys
@@ -56,13 +56,13 @@ where
use rand::{RngCore, SeedableRng};
let validator = T::Lookup::lookup(who).unwrap();
let controller = pallet_staking::Pallet::<T>::bonded(&validator).unwrap();
let controller = pezpallet_staking::Pallet::<T>::bonded(&validator).unwrap();
let keys = {
const SESSION_KEY_LEN: usize = 32;
let key_ids = T::Keys::key_ids();
let mut keys_len = key_ids.len() * SESSION_KEY_LEN;
if key_ids.contains(&sp_core::crypto::key_types::BEEFY) {
if key_ids.contains(&pezsp_core::crypto::key_types::BEEFY) {
// BEEFY key is 33 bytes long, not 32.
keys_len += 1;
}
@@ -76,21 +76,21 @@ where
let proof: Vec<u8> = vec![];
whitelist_account!(controller);
pallet_session::Pallet::<T>::ensure_can_pay_key_deposit(&controller).unwrap();
pallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(controller).into(), keys, proof)
pezpallet_session::Pallet::<T>::ensure_can_pay_key_deposit(&controller).unwrap();
pezpallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(controller).into(), keys, proof)
.expect("session::set_keys should work");
}
pallet_session::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
pezpallet_session::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
initializer::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
// signal to `pallet-staking`'s `ElectionProvider` to be ready asap.
use frame_election_provider_support::ElectionProvider;
<<T as pallet_staking::Config>::ElectionProvider as ElectionProvider>::asap();
// signal to `pezpallet-staking`'s `ElectionProvider` to be ready asap.
use pezframe_election_provider_support::ElectionProvider;
<<T as pezpallet_staking::Config>::ElectionProvider as ElectionProvider>::asap();
// skip sessions until the new validator set is enacted
while pallet_session::Pallet::<T>::validators().len() < n as usize {
pallet_session::Pallet::<T>::rotate_session();
while pezpallet_session::Pallet::<T>::validators().len() < n as usize {
pezpallet_session::Pallet::<T>::rotate_session();
}
initializer::Pallet::<T>::on_finalize(BlockNumberFor::<T>::one());
@@ -99,11 +99,11 @@ where
let session_info = session_info.unwrap();
let validator_id = session_info.validators.get(ValidatorIndex::from(0)).unwrap().clone();
let key = (TEYRCHAIN_KEY_TYPE_ID, validator_id.clone());
let key_owner_proof = pallet_session::historical::Pallet::<T>::prove(key).unwrap();
let key_owner_proof = pezpallet_session::historical::Pallet::<T>::prove(key).unwrap();
// rotate a session to make sure `key_owner_proof` is historical
initializer::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
pallet_session::Pallet::<T>::rotate_session();
pezpallet_session::Pallet::<T>::rotate_session();
initializer::Pallet::<T>::on_finalize(BlockNumberFor::<T>::one());
let idx = crate::shared::CurrentSessionIndex::<T>::get();
@@ -24,13 +24,13 @@ use crate::{
REWARD_VALIDATORS,
},
};
use frame_support::{
use pezframe_support::{
assert_err, assert_noop, assert_ok,
traits::{OnFinalize, OnInitialize},
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::BlockNumber;
use sp_core::{crypto::CryptoType, Pair};
use pezsp_core::{crypto::CryptoType, Pair};
const VOTE_FOR: VoteKind = VoteKind::ExplicitValid;
const VOTE_AGAINST: VoteKind = VoteKind::Invalid;
@@ -384,7 +384,7 @@ fn test_initializer_on_new_session() {
new_test_ext(mock_genesis_config).execute_with(|| {
let v0 = <ValidatorId as CryptoType>::Pair::generate().0;
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
Pallet::<Test>::note_included(0, candidate_hash, 0);
Pallet::<Test>::note_included(1, candidate_hash, 1);
Pallet::<Test>::note_included(2, candidate_hash, 2);
@@ -414,8 +414,8 @@ fn test_initializer_on_new_session() {
#[test]
fn test_provide_data_duplicate_error() {
new_test_ext(Default::default()).execute_with(|| {
let candidate_hash_1 = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_2 = CandidateHash(sp_core::H256::repeat_byte(2));
let candidate_hash_1 = CandidateHash(pezsp_core::H256::repeat_byte(1));
let candidate_hash_2 = CandidateHash(pezsp_core::H256::repeat_byte(2));
let mut stmts = vec![
DisputeStatementSet {
@@ -460,8 +460,8 @@ fn test_provide_multi_dispute_is_providing() {
}
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 1;
let stmts = vec![DisputeStatementSet {
candidate_hash,
@@ -519,7 +519,7 @@ fn test_disputes_with_missing_backing_votes_are_rejected() {
}
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let session = 1;
let stmts = vec![DisputeStatementSet {
@@ -571,8 +571,8 @@ fn test_freeze_on_note_included() {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 3;
// v0 votes for 3
@@ -636,8 +636,8 @@ fn test_freeze_provided_against_supermajority_for_included() {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 3;
// v0 votes for 3
@@ -709,8 +709,8 @@ fn test_freeze_provided_against_byzantine_threshold_for_included() {
run_to_block(6, |b| Some((true, b, active_set.clone(), Some(active_set.clone()))));
// A candidate which will be disputed
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 3;
// A byzantine threshold of INVALID
@@ -768,7 +768,7 @@ fn test_freeze_provided_against_byzantine_threshold_for_included() {
// Now include one more block
run_to_block(7, |b| Some((true, b, active_set.clone(), Some(active_set.clone()))));
Pallet::<Test>::note_included(3, CandidateHash(sp_core::H256::repeat_byte(2)), 3);
Pallet::<Test>::note_included(3, CandidateHash(pezsp_core::H256::repeat_byte(2)), 3);
// And generate enough votes to reach supermajority of invalid votes
let stmts = vec![DisputeStatementSet {
@@ -816,7 +816,7 @@ fn test_freeze_provided_against_byzantine_threshold_for_included() {
mod unconfirmed_disputes {
use super::*;
use assert_matches::assert_matches;
use sp_runtime::ModuleError;
use pezsp_runtime::ModuleError;
// Shared initialization code between `test_unconfirmed_are_ignored` and
// `test_unconfirmed_disputes_cause_block_import_error`
@@ -865,7 +865,7 @@ mod unconfirmed_disputes {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
// v0 votes for 4, v1 votes against 4.
DisputeStatementSet {
@@ -970,8 +970,8 @@ fn test_provide_multi_dispute_success_and_other() {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 3;
// v0 and v1 vote for 3, v6 votes against
@@ -1262,8 +1262,8 @@ fn test_punish_post_conclusion() {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let inclusion_parent = sp_core::H256::repeat_byte(0xff);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let inclusion_parent = pezsp_core::H256::repeat_byte(0xff);
let session = 3;
let stmts = vec![DisputeStatementSet {
@@ -1465,10 +1465,10 @@ fn test_check_signature() {
let session = 0;
let wrong_session = 1;
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let wrong_candidate_hash = CandidateHash(sp_core::H256::repeat_byte(2));
let inclusion_parent = sp_core::H256::repeat_byte(3);
let wrong_inclusion_parent = sp_core::H256::repeat_byte(4);
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let wrong_candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(2));
let inclusion_parent = pezsp_core::H256::repeat_byte(3);
let wrong_inclusion_parent = pezsp_core::H256::repeat_byte(4);
let statement_1 = DisputeStatement::Valid(ValidDisputeStatementKind::Explicit);
let statement_2 =
@@ -1902,9 +1902,9 @@ fn deduplication_and_sorting_works() {
))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_b = CandidateHash(sp_core::H256::repeat_byte(2));
let candidate_hash_c = CandidateHash(sp_core::H256::repeat_byte(3));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let candidate_hash_b = CandidateHash(pezsp_core::H256::repeat_byte(2));
let candidate_hash_c = CandidateHash(pezsp_core::H256::repeat_byte(3));
let create_explicit_statement = |vidx: ValidatorIndex,
validator: &<ValidatorId as CryptoType>::Pair,
@@ -2017,7 +2017,7 @@ fn filter_removes_duplicates_within_set() {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload =
ExplicitDisputeStatement { valid: true, candidate_hash, session: 1 }.signing_payload();
@@ -2109,7 +2109,7 @@ fn filter_bad_signatures_correctly_detects_single_sided() {
))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload = |c_hash: &CandidateHash, valid| {
ExplicitDisputeStatement { valid, candidate_hash: *c_hash, session: 1 }
@@ -2155,7 +2155,7 @@ fn filter_removes_session_out_of_bounds() {
Some((true, b, vec![(&0, v0.public())], Some(vec![(&0, v0.public())])))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload =
ExplicitDisputeStatement { valid: true, candidate_hash, session: 1 }.signing_payload();
@@ -2200,8 +2200,8 @@ fn filter_removes_concluded_ancient() {
Some((true, b, vec![(&0, v0.public())], Some(vec![(&0, v0.public())])))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_b = CandidateHash(sp_core::H256::repeat_byte(2));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let candidate_hash_b = CandidateHash(pezsp_core::H256::repeat_byte(2));
Disputes::<Test>::insert(
&1,
@@ -2290,7 +2290,7 @@ fn filter_removes_duplicate_statements_sets() {
))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload =
ExplicitDisputeStatement { valid: true, candidate_hash: candidate_hash_a, session: 1 }
@@ -2352,7 +2352,7 @@ fn filter_ignores_single_sided() {
Some((true, b, vec![(&0, v0.public())], Some(vec![(&0, v0.public())])))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload =
ExplicitDisputeStatement { valid: true, candidate_hash: candidate_hash_a, session: 1 }
@@ -2386,7 +2386,7 @@ fn import_ignores_single_sided() {
Some((true, b, vec![(&0, v0.public())], Some(vec![(&0, v0.public())])))
});
let candidate_hash_a = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash_a = CandidateHash(pezsp_core::H256::repeat_byte(1));
let payload =
ExplicitDisputeStatement { valid: true, candidate_hash: candidate_hash_a, session: 1 }
+7 -7
View File
@@ -48,11 +48,11 @@ use crate::{
};
use alloc::vec::Vec;
use core::fmt;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{DownwardMessage, Hash, Id as ParaId, InboundDownwardMessage};
use sp_core::MAX_POSSIBLE_ALLOCATION;
use sp_runtime::{
use pezsp_core::MAX_POSSIBLE_ALLOCATION;
use pezsp_runtime::{
traits::{BlakeTwo256, Hash as HashT, SaturatedConversion},
FixedU128,
};
@@ -108,7 +108,7 @@ impl fmt::Debug for ProcessedDownwardMessagesAcceptanceErr {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -117,7 +117,7 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + paras::Config {}
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {}
/// The downward messages addressed for a certain para.
#[pallet::storage]
@@ -220,7 +220,7 @@ impl<T: Config> Pallet<T> {
Self::can_queue_downward_message(config, &para, &msg)?;
let inbound =
InboundDownwardMessage { msg, sent_at: frame_system::Pallet::<T>::block_number() };
InboundDownwardMessage { msg, sent_at: pezframe_system::Pallet::<T>::block_number() };
// obtain the new link in the MQC and update the head.
DownwardMessageQueueHeads::<T>::mutate(para, |head| {
+4 -4
View File
@@ -20,10 +20,10 @@ use crate::{
mock::{new_test_ext, Dmp, MockGenesisConfig, Paras, System, Test},
};
use codec::Encode;
use frame_support::assert_ok;
use pezframe_support::assert_ok;
use hex_literal::hex;
use pezkuwi_primitives::BlockNumber;
use sp_arithmetic::traits::Saturating;
use pezsp_arithmetic::traits::Saturating;
pub(crate) fn run_to_block(to: BlockNumber, new_session: Option<Vec<BlockNumber>>) {
while System::block_number() < to {
@@ -255,12 +255,12 @@ fn verify_dmq_mqc_head_is_externally_accessible() {
new_test_ext(default_genesis_config()).execute_with(|| {
register_paras(&[a]);
let head = sp_io::storage::get(&well_known_keys::dmq_mqc_head(a));
let head = pezsp_io::storage::get(&well_known_keys::dmq_mqc_head(a));
assert_eq!(head, None);
queue_downward_message(a, vec![1, 2, 3]).unwrap();
let head = sp_io::storage::get(&well_known_keys::dmq_mqc_head(a));
let head = pezsp_io::storage::get(&well_known_keys::dmq_mqc_head(a));
assert_eq!(
head,
Some(
+10 -10
View File
@@ -25,15 +25,15 @@ use alloc::{
};
use codec::{Decode, Encode};
use core::{fmt, mem};
use frame_support::{pallet_prelude::*, traits::ReservableCurrency, DefaultNoBound};
use frame_system::pallet_prelude::*;
use pezframe_support::{pezpallet_prelude::*, traits::ReservableCurrency, DefaultNoBound};
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
Balance, Hash, HrmpChannelId, Id as ParaId, InboundHrmpMessage, OutboundHrmpMessage,
SessionIndex,
};
use pezkuwi_teyrchain_primitives::primitives::{HorizontalMessages, IsSystem};
use scale_info::TypeInfo;
use sp_runtime::{
use pezsp_runtime::{
traits::{AccountIdConversion, BlakeTwo256, Hash as HashT, UniqueSaturatedInto, Zero},
ArithmeticError,
};
@@ -246,7 +246,7 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -256,18 +256,18 @@ pub mod pallet {
#[pallet::config]
pub trait Config:
frame_system::Config + configuration::Config + paras::Config + dmp::Config
pezframe_system::Config + configuration::Config + paras::Config + dmp::Config
{
/// The outer event type.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type RuntimeOrigin: From<crate::Origin>
+ From<<Self as frame_system::Config>::RuntimeOrigin>
+ From<<Self as pezframe_system::Config>::RuntimeOrigin>
+ Into<Result<crate::Origin, <Self as Config>::RuntimeOrigin>>;
/// The origin that can perform "force" actions on channels.
type ChannelManager: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
type ChannelManager: EnsureOrigin<<Self as pezframe_system::Config>::RuntimeOrigin>;
/// An interface for reserving deposits for opening channels.
///
@@ -284,7 +284,7 @@ pub mod pallet {
/// notifications to the channel-related teyrchains, while the `WrapVersion` implementation
/// attempts to wrap them into the most suitable XCM version for the destination teyrchain.
///
/// NOTE: For example, `pallet_xcm` provides an accurate implementation (recommended), or
/// NOTE: For example, `pezpallet_xcm` provides an accurate implementation (recommended), or
/// the default `()` implementation uses the latest XCM version for all teyrchains.
type VersionWrapper: xcm::WrapVersion;
@@ -1374,7 +1374,7 @@ impl<T: Config> Pallet<T> {
/// Process the outbound HRMP messages by putting them into the appropriate recipient queues.
pub(crate) fn queue_outbound_hrmp(sender: ParaId, out_hrmp_msgs: HorizontalMessages) {
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
for out_msg in out_hrmp_msgs {
let channel_id = HrmpChannelId { sender, recipient: out_msg.recipient };
@@ -22,11 +22,11 @@ use crate::{
paras::{Pallet as Paras, ParaKind, TeyrchainsCache},
shared::Pallet as Shared,
};
use frame_benchmarking::{v2::*, whitelisted_caller};
use frame_support::{assert_ok, traits::Currency};
use pezframe_benchmarking::{v2::*, whitelisted_caller};
use pezframe_support::{assert_ok, traits::Currency};
type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
<<T as Config>::Currency as Currency<<T as pezframe_system::Config>::AccountId>>::Balance;
fn register_teyrchain_with_balance<T: Config>(id: ParaId, balance: BalanceOf<T>) {
let mut teyrchains = TeyrchainsCache::new();
@@ -43,16 +43,16 @@ fn register_teyrchain_with_balance<T: Config>(id: ParaId, balance: BalanceOf<T>)
}
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
let events = pezframe_system::Pallet::<T>::events();
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}
fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
let events = pezframe_system::Pallet::<T>::events();
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
assert!(events.iter().any(|record| record.event == system_event));
}
@@ -76,7 +76,7 @@ fn establish_para_connection<T: Config>(
until: TeyrchainSetupStep,
) -> [(ParaId, crate::Origin); 2]
where
<T as frame_system::Config>::RuntimeOrigin: From<crate::Origin>,
<T as pezframe_system::Config>::RuntimeOrigin: From<crate::Origin>,
{
let config = configuration::ActiveConfig::<T>::get();
let ed = T::Currency::minimum_balance();
@@ -153,7 +153,7 @@ const _: () = {
assert!(HRMP_MAX_OUTBOUND_CHANNELS_BOUND < PREFIX_0);
};
#[benchmarks(where <T as frame_system::Config>::RuntimeOrigin: From<crate::Origin>)]
#[benchmarks(where <T as pezframe_system::Config>::RuntimeOrigin: From<crate::Origin>)]
mod benchmarks {
use super::*;
@@ -225,15 +225,15 @@ mod benchmarks {
) {
// first, update the configs to support this many open channels...
assert_ok!(Configuration::<T>::set_hrmp_max_teyrchain_outbound_channels(
frame_system::RawOrigin::Root.into(),
pezframe_system::RawOrigin::Root.into(),
e + 1
));
assert_ok!(Configuration::<T>::set_hrmp_max_teyrchain_inbound_channels(
frame_system::RawOrigin::Root.into(),
pezframe_system::RawOrigin::Root.into(),
i + 1
));
assert_ok!(Configuration::<T>::set_max_downward_message_size(
frame_system::RawOrigin::Root.into(),
pezframe_system::RawOrigin::Root.into(),
1024
));
// .. and enact it.
@@ -276,7 +276,7 @@ mod benchmarks {
assert_eq!(HrmpChannels::<T>::iter().count() as u32, i + e);
#[extrinsic_call]
_(frame_system::Origin::<T>::Root, para, i, e);
_(pezframe_system::Origin::<T>::Root, para, i, e);
// all in all, all of them must be gone by now.
assert_eq!(HrmpChannels::<T>::iter().count() as u32, 0);
@@ -301,7 +301,7 @@ mod benchmarks {
assert_eq!(HrmpOpenChannelRequestsList::<T>::decode_len().unwrap_or_default() as u32, c);
#[extrinsic_call]
_(frame_system::Origin::<T>::Root, c);
_(pezframe_system::Origin::<T>::Root, c);
assert_eq!(HrmpOpenChannelRequestsList::<T>::decode_len().unwrap_or_default() as u32, 0);
}
@@ -323,7 +323,7 @@ mod benchmarks {
assert_eq!(HrmpCloseChannelRequestsList::<T>::decode_len().unwrap_or_default() as u32, c);
#[extrinsic_call]
_(frame_system::Origin::<T>::Root, c);
_(pezframe_system::Origin::<T>::Root, c);
assert_eq!(HrmpCloseChannelRequestsList::<T>::decode_len().unwrap_or_default() as u32, 0);
}
@@ -429,7 +429,7 @@ mod benchmarks {
assert!(HrmpChannels::<T>::get(&channel_id).is_none());
#[extrinsic_call]
_(frame_system::Origin::<T>::Root, sender_id, recipient_id, capacity, message_size);
_(pezframe_system::Origin::<T>::Root, sender_id, recipient_id, capacity, message_size);
assert_last_event::<T>(
Event::<T>::HrmpChannelForceOpened {
@@ -458,7 +458,7 @@ mod benchmarks {
let message_size = config.hrmp_channel_max_message_size;
#[extrinsic_call]
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
_(pezframe_system::RawOrigin::Signed(caller), sender_id, recipient_id);
assert_last_event::<T>(
Event::<T>::HrmpSystemChannelOpened {
@@ -506,7 +506,7 @@ mod benchmarks {
let _ = T::Currency::reserve(&recipient_id.into_account_truncating(), recipient_deposit);
#[extrinsic_call]
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
_(pezframe_system::RawOrigin::Signed(caller), sender_id, recipient_id);
assert_last_event::<T>(
Event::<T>::OpenChannelDepositsUpdated { sender: sender_id, recipient: recipient_id }
+7 -7
View File
@@ -27,9 +27,9 @@ use crate::{
},
shared,
};
use frame_support::{assert_noop, assert_ok};
use pezframe_support::{assert_noop, assert_ok};
use pezkuwi_primitives::{BlockNumber, InboundDownwardMessage};
use sp_runtime::traits::BadOrigin;
use pezsp_runtime::traits::BadOrigin;
use std::collections::BTreeMap;
pub(crate) fn run_to_block(to: BlockNumber, new_session: Option<Vec<BlockNumber>>) {
@@ -682,7 +682,7 @@ fn verify_externally_accessible() {
// decode it into the abridged version.
assert!(channel_exists(para_a, para_b));
let raw_hrmp_channel =
sp_io::storage::get(&well_known_keys::hrmp_channels(HrmpChannelId {
pezsp_io::storage::get(&well_known_keys::hrmp_channels(HrmpChannelId {
sender: para_a,
recipient: para_b,
}))
@@ -703,7 +703,7 @@ fn verify_externally_accessible() {
);
let raw_ingress_index =
sp_io::storage::get(&well_known_keys::hrmp_ingress_channel_index(para_b))
pezsp_io::storage::get(&well_known_keys::hrmp_ingress_channel_index(para_b))
.expect("the ingress index must be present for para_b");
let ingress_index = <Vec<ParaId>>::decode(&mut &raw_ingress_index[..])
.expect("ingress index should be decodable as a list of para ids");
@@ -711,7 +711,7 @@ fn verify_externally_accessible() {
// Now, verify that we can access and decode the egress index.
let raw_egress_index =
sp_io::storage::get(&well_known_keys::hrmp_egress_channel_index(para_a))
pezsp_io::storage::get(&well_known_keys::hrmp_egress_channel_index(para_a))
.expect("the egress index must be present for para_a");
let egress_index = <Vec<ParaId>>::decode(&mut &raw_egress_index[..])
.expect("egress index should be decodable as a list of para ids");
@@ -731,7 +731,7 @@ fn charging_deposits() {
assert_noop!(
Hrmp::init_open_channel(para_a, para_b, 2, 8),
pallet_balances::Error::<Test, _>::InsufficientBalance
pezpallet_balances::Error::<Test, _>::InsufficientBalance
);
});
@@ -744,7 +744,7 @@ fn charging_deposits() {
assert_noop!(
Hrmp::accept_open_channel(para_b, para_a),
pallet_balances::Error::<Test, _>::InsufficientBalance
pezpallet_balances::Error::<Test, _>::InsufficientBalance
);
});
}
@@ -15,8 +15,8 @@
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
use bitvec::{bitvec, prelude::Lsb0};
use frame_benchmarking::v2::*;
use pallet_message_queue as mq;
use pezframe_benchmarking::v2::*;
use pezpallet_message_queue as mq;
use pezkuwi_primitives::{
CandidateCommitments, CommittedCandidateReceiptV2 as CommittedCandidateReceipt, HrmpChannelId,
OutboundHrmpMessage, SessionIndex,
@@ -17,8 +17,8 @@ pub mod v0 {
use crate::inclusion::{Config, Pallet};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use codec::{Decode, Encode};
use frame_support::{storage_alias, Twox64Concat};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_support::{storage_alias, Twox64Concat};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
AvailabilityBitfield, CandidateCommitments, CandidateDescriptorV2 as CandidateDescriptor,
CandidateHash, CoreIndex, GroupIndex, Id as ParaId, ValidatorIndex,
@@ -48,7 +48,7 @@ pub mod v0 {
Pallet<T>,
Twox64Concat,
ParaId,
CandidatePendingAvailability<<T as frame_system::Config>::Hash, BlockNumberFor<T>>,
CandidatePendingAvailability<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
>;
#[storage_alias]
@@ -74,13 +74,13 @@ mod v1 {
PendingAvailability as V1PendingAvailability,
};
use alloc::{collections::vec_deque::VecDeque, vec::Vec};
use frame_support::{traits::UncheckedOnRuntimeUpgrade, weights::Weight};
use sp_core::Get;
use pezframe_support::{traits::UncheckedOnRuntimeUpgrade, weights::Weight};
use pezsp_core::Get;
#[cfg(feature = "try-runtime")]
use codec::{Decode, Encode};
#[cfg(feature = "try-runtime")]
use frame_support::{
use pezframe_support::{
ensure,
traits::{GetStorageVersion, StorageVersion},
};
@@ -89,7 +89,7 @@ mod v1 {
impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::inclusion::LOG_TARGET, "Running pre_upgrade() for inclusion MigrateToV1");
let candidates_before_upgrade = V0PendingAvailability::<T>::iter().count();
let commitments_before_upgrade = V0PendingAvailabilityCommitments::<T>::iter().count();
@@ -155,7 +155,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: crate::inclusion::LOG_TARGET, "Running post_upgrade() for inclusion MigrateToV1");
ensure!(
Pallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
@@ -197,12 +197,12 @@ mod v1 {
/// - merges the `PendingAvailabilityCommitments` into the `CandidatePendingAvailability`
/// storage
/// - removes the `AvailabilityBitfields` storage, which was never read.
pub type MigrateToV1<T> = frame_support::migrations::VersionedMigration<
pub type MigrateToV1<T> = pezframe_support::migrations::VersionedMigration<
0,
1,
VersionUncheckedMigrateToV1<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
}
@@ -216,7 +216,7 @@ mod tests {
},
mock::{new_test_ext, MockGenesisConfig, Test},
};
use frame_support::traits::UncheckedOnRuntimeUpgrade;
use pezframe_support::traits::UncheckedOnRuntimeUpgrade;
use pezkuwi_primitives::{AvailabilityBitfield, Id as ParaId};
use pezkuwi_primitives_test_helpers::{
dummy_candidate_commitments, dummy_candidate_descriptor_v2, dummy_hash,
+11 -11
View File
@@ -35,14 +35,14 @@ use alloc::{
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::fmt;
use frame_support::{
use pezframe_support::{
defensive,
pallet_prelude::*,
pezpallet_prelude::*,
traits::{EnqueueMessage, Footprint, QueueFootprint, QueueFootprintQuery},
BoundedSlice,
};
use frame_system::pallet_prelude::*;
use pallet_message_queue::OnQueueChanged;
use pezframe_system::pezpallet_prelude::*;
use pezpallet_message_queue::OnQueueChanged;
use pezkuwi_primitives::{
effective_minimum_backing_votes, skip_ump_signals, supermajority_threshold, well_known_keys,
BackedCandidate, CandidateCommitments, CandidateDescriptorV2 as CandidateDescriptor,
@@ -52,7 +52,7 @@ use pezkuwi_primitives::{
ValidatorIndex, ValidityAttestation,
};
use scale_info::TypeInfo;
use sp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating};
use pezsp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating};
pub use pallet::*;
@@ -268,7 +268,7 @@ impl From<u32> for AggregateMessageOrigin {
pub type MaxUmpMessageLenOf<T> =
<<T as Config>::MessageQueue as EnqueueMessage<AggregateMessageOrigin>>::MaxMessageLen;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -280,7 +280,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config:
frame_system::Config
pezframe_system::Config
+ shared::Config
+ paras::Config
+ dmp::Config
@@ -289,7 +289,7 @@ pub mod pallet {
+ scheduler::Config
{
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
type DisputesHandler: disputes::DisputesHandler<BlockNumberFor<Self>>;
type RewardValidators: RewardValidators;
@@ -647,7 +647,7 @@ impl<T: Config> Pallet<T> {
return Ok(Default::default());
}
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let validators = shared::ActiveValidatorKeys::<T>::get();
// Collect candidate receipts with backers.
@@ -880,7 +880,7 @@ impl<T: Config> Pallet<T> {
if let Some(new_code) = commitments.new_validation_code {
// Block number of candidate's inclusion.
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
paras::Pallet::<T>::schedule_code_upgrade(
receipt.descriptor.para_id(),
@@ -1235,7 +1235,7 @@ impl<T: Config> CandidateCheckContext<T> {
pub(crate) fn verify_backed_candidate(
&self,
allowed_relay_parents: &AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>,
backed_candidate_receipt: &CommittedCandidateReceipt<<T as frame_system::Config>::Hash>,
backed_candidate_receipt: &CommittedCandidateReceipt<<T as pezframe_system::Config>::Hash>,
parent_head_data: HeadData,
) -> Result<BlockNumberFor<T>, Error<T>> {
let para_id = backed_candidate_receipt.descriptor.para_id();
@@ -33,17 +33,17 @@ use pezkuwi_primitives::{
use assert_matches::assert_matches;
use codec::DecodeAll;
use frame_support::assert_noop;
use pezframe_support::assert_noop;
use pezkuwi_primitives::{
BlockNumber, CandidateCommitments, CollatorId, CollatorSignature,
CompactStatement as Statement, Hash, MutateDescriptorV2, SignedAvailabilityBitfield,
SignedStatement, ValidationCode, ValidatorId, ValidityAttestation, TEYRCHAIN_KEY_TYPE_ID,
};
use pezkuwi_primitives_test_helpers::{dummy_validation_code, CandidateDescriptor};
use sc_keystore::LocalKeystore;
use sp_core::ByteArray;
use sp_keyring::Sr25519Keyring;
use sp_keystore::{Keystore, KeystorePtr};
use pezsc_keystore::LocalKeystore;
use pezsp_core::ByteArray;
use pezsp_keyring::Sr25519Keyring;
use pezsp_keystore::{Keystore, KeystorePtr};
use std::sync::Arc;
fn default_config() -> HostConfiguration<BlockNumber> {
@@ -349,7 +349,7 @@ impl TestCandidateBuilder {
}
pub(crate) fn make_vdata_hash(para_id: ParaId) -> Option<Hash> {
let relay_parent_number = frame_system::Pallet::<Test>::block_number() - 1;
let relay_parent_number = pezframe_system::Pallet::<Test>::block_number() - 1;
make_vdata_hash_with_block_number(para_id, relay_parent_number)
}
@@ -371,7 +371,7 @@ fn simple_sanitize_bitfields(
disputed_bitfield: DisputedBitfield,
expected_bits: usize,
) -> SignedAvailabilityBitfields {
let parent_hash = frame_system::Pallet::<Test>::parent_hash();
let parent_hash = pezframe_system::Pallet::<Test>::parent_hash();
let session_index = shared::CurrentSessionIndex::<Test>::get();
let validators = shared::ActiveValidatorKeys::<Test>::get();
+14 -14
View File
@@ -27,11 +27,11 @@ use crate::{
};
use alloc::vec::Vec;
use codec::{Decode, Encode};
use frame_support::{
use pezframe_support::{
traits::{OneSessionHandler, Randomness},
weights::Weight,
};
use frame_system::limits::BlockWeights;
use pezframe_system::limits::BlockWeights;
use pezkuwi_primitives::{BlockNumber, ConsensusLog, SessionIndex, ValidatorId};
use scale_info::TypeInfo;
@@ -103,11 +103,11 @@ impl WeightInfo for () {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::pallet]
#[pallet::without_storage_info]
@@ -115,7 +115,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config:
frame_system::Config
pezframe_system::Config
+ configuration::Config
+ shared::Config
+ paras::Config
@@ -129,7 +129,7 @@ pub mod pallet {
/// A randomness beacon.
type Randomness: Randomness<Self::Hash, BlockNumberFor<Self>>;
/// An origin which is allowed to force updates to teyrchains.
type ForceOrigin: EnsureOrigin<<Self as frame_system::Config>::RuntimeOrigin>;
type ForceOrigin: EnsureOrigin<<Self as pezframe_system::Config>::RuntimeOrigin>;
/// Temporary hack to call `Coretime::on_new_session` on chains that support `Coretime` or
/// to disable it on the ones that don't support it. Can be removed and replaced by a simple
/// bound to `coretime::Config` once all chains support it.
@@ -225,14 +225,14 @@ pub mod pallet {
#[pallet::call_index(0)]
#[pallet::weight((
<T as Config>::WeightInfo::force_approve(
frame_system::Pallet::<T>::digest().logs.len() as u32,
pezframe_system::Pallet::<T>::digest().logs.len() as u32,
),
DispatchClass::Operational,
))]
pub fn force_approve(origin: OriginFor<T>, up_to: BlockNumber) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
frame_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(up_to).into());
pezframe_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(up_to).into());
Ok(())
}
}
@@ -247,7 +247,7 @@ impl<T: Config> Pallet<T> {
let random_seed = {
let mut buf = [0u8; 32];
// TODO: audit usage of randomness API
// https://github.com/paritytech/polkadot/issues/2601
// https://github.com/pezkuwichain/kurdistan-sdk/issues/139
let (random_hash, _) = T::Randomness::random(&b"paras"[..]);
let len = core::cmp::min(32, random_hash.as_ref().len());
buf[..len].copy_from_slice(&random_hash.as_ref()[..len]);
@@ -312,7 +312,7 @@ impl<T: Config> Pallet<T> {
}
}
// Allow to trigger `on_new_session` in tests, this is needed as long as `pallet_session` is not
// Allow to trigger `on_new_session` in tests, this is needed as long as `pezpallet_session` is not
// implemented in mock.
#[cfg(any(test, feature = "runtime-benchmarks"))]
pub(crate) fn test_trigger_on_new_session<'a, I: 'a>(
@@ -332,11 +332,11 @@ impl<T: Config> Pallet<T> {
}
}
impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
type Public = ValidatorId;
}
impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
type Key = ValidatorId;
fn on_genesis_session<'a, I: 'a>(validators: I)
@@ -350,7 +350,7 @@ impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pal
where
I: Iterator<Item = (&'a T::AccountId, Self::Key)>,
{
let session_index = pallet_session::Pallet::<T>::current_index();
let session_index = pezpallet_session::Pallet::<T>::current_index();
Pallet::<T>::on_new_session(changed, session_index, validators, Some(queued));
}
@@ -15,10 +15,10 @@
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
use super::*;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezkuwi_primitives::ConsensusLog;
use sp_runtime::DigestItem;
use pezsp_runtime::DigestItem;
// Random large number for the digest
const DIGEST_MAX_LEN: u32 = 65536;
@@ -30,14 +30,14 @@ mod benchmarks {
#[benchmark]
fn force_approve(d: Linear<0, DIGEST_MAX_LEN>) -> Result<(), BenchmarkError> {
for _ in 0..d {
frame_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(d).into());
pezframe_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(d).into());
}
#[extrinsic_call]
_(RawOrigin::Root, d + 1);
assert_eq!(
frame_system::Pallet::<T>::digest().logs.last().unwrap(),
pezframe_system::Pallet::<T>::digest().logs.last().unwrap(),
&DigestItem::from(ConsensusLog::ForceApprove(d + 1)),
);
@@ -23,7 +23,7 @@ use crate::{
use pezkuwi_primitives::{HeadData, Id as ParaId};
use pezkuwi_primitives_test_helpers::dummy_validation_code;
use frame_support::{
use pezframe_support::{
assert_ok,
traits::{OnFinalize, OnInitialize},
};
+2 -2
View File
@@ -57,8 +57,8 @@ extern crate alloc;
pub use origin::{ensure_teyrchain, Origin};
pub use paras::{ParaLifecycle, UpgradeStrategy};
use pezkuwi_primitives::{HeadData, Id as ParaId, ValidationCode};
use sp_arithmetic::traits::Saturating;
use sp_runtime::{traits::Get, DispatchResult, FixedU128};
use pezsp_arithmetic::traits::Saturating;
use pezsp_runtime::{traits::Get, DispatchResult, FixedU128};
/// Trait for tracking message delivery fees on a transport protocol.
pub trait FeeTracker {
+48 -48
View File
@@ -25,11 +25,11 @@ use crate::{
scheduler::common::AssignmentProvider,
session_info, shared, ParaId,
};
use frame_support::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezkuwi_primitives::CoreIndex;
use codec::Decode;
use frame_support::{
use pezframe_support::{
assert_ok, derive_impl,
dispatch::GetDispatchInfo,
parameter_types,
@@ -39,15 +39,15 @@ use frame_support::{
weights::{Weight, WeightMeter},
PalletId,
};
use frame_support_test::TestRandomness;
use frame_system::{limits, EnsureRoot};
use pezframe_support_test::TestRandomness;
use pezframe_system::{limits, EnsureRoot};
use pezkuwi_primitives::{
AuthorityDiscoveryId, Balance, BlockNumber, CandidateHash, Moment, SessionIndex, UpwardMessage,
ValidationCode, ValidatorIndex,
};
use sp_core::{ConstU32, H256};
use sp_io::TestExternalities;
use sp_runtime::{
use pezsp_core::{ConstU32, H256};
use pezsp_io::TestExternalities;
use pezsp_runtime::{
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
transaction_validity::TransactionPriority,
BuildStorage, FixedU128, Perbill, Permill,
@@ -62,15 +62,15 @@ use xcm::{
IntoVersion, VersionedXcm, WrapVersion,
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlockU32<Test>;
type UncheckedExtrinsic = pezframe_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = pezframe_system::mocking::MockBlockU32<Test>;
frame_support::construct_runtime!(
pezframe_support::construct_runtime!(
pub enum Test
{
System: frame_system,
Balances: pallet_balances,
MessageQueue: pallet_message_queue,
System: pezframe_system,
Balances: pezpallet_balances,
MessageQueue: pezpallet_message_queue,
Paras: paras,
Configuration: configuration,
ParasShared: shared,
@@ -87,11 +87,11 @@ frame_support::construct_runtime!(
TeyrchainsOrigin: origin,
SessionInfo: session_info,
Disputes: disputes,
Babe: pallet_babe,
Babe: pezpallet_babe,
}
);
impl<C> frame_system::offchain::CreateTransactionBase<C> for Test
impl<C> pezframe_system::offchain::CreateTransactionBase<C> for Test
where
RuntimeCall: From<C>,
{
@@ -99,7 +99,7 @@ where
type RuntimeCall = RuntimeCall;
}
impl<C> frame_system::offchain::CreateBare<C> for Test
impl<C> pezframe_system::offchain::CreateBare<C> for Test
where
RuntimeCall: From<C>,
{
@@ -109,8 +109,8 @@ where
}
parameter_types! {
pub static BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(
pub static BlockWeights: pezframe_system::limits::BlockWeights =
pezframe_system::limits::BlockWeights::simple_max(
Weight::from_parts(4 * 1024 * 1024, u64::MAX),
);
pub static BlockLength: limits::BlockLength = limits::BlockLength::max_with_normal_ratio(u32::MAX, Perbill::from_percent(75));
@@ -118,9 +118,9 @@ parameter_types! {
pub type AccountId = u64;
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Test {
type BaseCallFilter = pezframe_support::traits::Everything;
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
type DbWeight = ();
@@ -135,7 +135,7 @@ impl frame_system::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u128>;
type AccountData = pezpallet_balances::AccountData<u128>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
@@ -148,8 +148,8 @@ parameter_types! {
pub static ExistentialDeposit: u64 = 1;
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for Test {
#[derive_impl(pezpallet_balances::config_preludes::TestDefaultConfig)]
impl pezpallet_balances::Config for Test {
type Balance = Balance;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -162,17 +162,17 @@ parameter_types! {
pub const MaxAuthorities: u32 = 100_000;
}
impl pallet_babe::Config for Test {
impl pezpallet_babe::Config for Test {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type EpochChangeTrigger = pezpallet_babe::ExternalTrigger;
type DisabledValidators = ();
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
type KeyOwnerProof = sp_core::Void;
type KeyOwnerProof = pezsp_core::Void;
type EquivocationReportSystem = ();
}
@@ -180,7 +180,7 @@ parameter_types! {
pub const MinimumPeriod: Moment = 6_000 / 2;
}
impl pallet_timestamp::Config for Test {
impl pezpallet_timestamp::Config for Test {
type Moment = Moment;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
@@ -189,7 +189,7 @@ impl pallet_timestamp::Config for Test {
impl crate::initializer::Config for Test {
type Randomness = TestRandomness<Self>;
type ForceOrigin = frame_system::EnsureRoot<u64>;
type ForceOrigin = pezframe_system::EnsureRoot<u64>;
type WeightInfo = ();
type CoretimeOnNewSession = Coretime;
}
@@ -199,7 +199,7 @@ impl crate::configuration::Config for Test {
}
pub struct MockDisabledValidators {}
impl frame_support::traits::DisabledValidators for MockDisabledValidators {
impl pezframe_support::traits::DisabledValidators for MockDisabledValidators {
/// Returns true if the given validator is disabled.
fn is_disabled(index: u32) -> bool {
disabled_validators().iter().any(|v| *v == index)
@@ -225,7 +225,7 @@ parameter_types! {
/// is more to satisfy type requirements rather than to test anything.
pub struct TestNextSessionRotation;
impl frame_support::traits::EstimateNextSessionRotation<u32> for TestNextSessionRotation {
impl pezframe_support::traits::EstimateNextSessionRotation<u32> for TestNextSessionRotation {
fn average_session_length() -> u32 {
10
}
@@ -286,8 +286,8 @@ impl TestUsesOnlyStoredVersionWrapper {
impl crate::hrmp::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type ChannelManager = frame_system::EnsureRoot<u64>;
type Currency = pallet_balances::Pallet<Test>;
type ChannelManager = pezframe_system::EnsureRoot<u64>;
type Currency = pezpallet_balances::Pallet<Test>;
type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem;
type VersionWrapper = TestUsesOnlyStoredVersionWrapper;
type WeightInfo = crate::hrmp::TestWeightInfo;
@@ -352,7 +352,7 @@ impl crate::scheduler::Config for Test {
}
pub struct TestMessageQueueWeight;
impl pallet_message_queue::WeightInfo for TestMessageQueueWeight {
impl pezpallet_message_queue::WeightInfo for TestMessageQueueWeight {
fn ready_ring_knit() -> Weight {
Weight::zero()
}
@@ -393,7 +393,7 @@ parameter_types! {
pub type MessageQueueSize = u32;
impl pallet_message_queue::Config for Test {
impl pezpallet_message_queue::Config for Test {
type Size = MessageQueueSize;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = TestMessageQueueWeight;
@@ -510,7 +510,7 @@ pub mod mock_assigner {
use super::*;
pub use pallet::*;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -519,7 +519,7 @@ pub mod mock_assigner {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + paras::Config {}
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {}
#[pallet::storage]
pub(super) type MockAssignmentQueue<T: Config> =
@@ -567,14 +567,14 @@ pub mod mock_assigner {
impl mock_assigner::pallet::Config for Test {}
pub struct FoolIdentificationOf;
impl sp_runtime::traits::Convert<AccountId, Option<()>> for FoolIdentificationOf {
impl pezsp_runtime::traits::Convert<AccountId, Option<()>> for FoolIdentificationOf {
fn convert(_: AccountId) -> Option<()> {
Some(())
}
}
pub struct ValidatorIdOf;
impl sp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf {
impl pezsp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf {
fn convert(a: AccountId) -> Option<AccountId> {
Some(a)
}
@@ -684,10 +684,10 @@ impl inclusion::RewardValidators for TestRewardValidators {
/// Create a new set of test externalities.
pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
use sp_keystore::{testing::MemoryKeystore, KeystoreExt, KeystorePtr};
use pezsp_keystore::{testing::MemoryKeystore, KeystoreExt, KeystorePtr};
use std::sync::Arc;
sp_tracing::try_init_simple();
pezsp_tracing::try_init_simple();
BACKING_REWARDS.with(|r| r.borrow_mut().clear());
AVAILABILITY_REWARDS.with(|r| r.borrow_mut().clear());
@@ -704,16 +704,16 @@ pub fn new_test_ext(state: MockGenesisConfig) -> TestExternalities {
#[derive(Default)]
pub struct MockGenesisConfig {
pub system: frame_system::GenesisConfig<Test>,
pub system: pezframe_system::GenesisConfig<Test>,
pub configuration: crate::configuration::GenesisConfig<Test>,
pub paras: crate::paras::GenesisConfig<Test>,
}
pub fn assert_last_event(generic_event: RuntimeEvent) {
let events = frame_system::Pallet::<Test>::events();
let system_event: <Test as frame_system::Config>::RuntimeEvent = generic_event.into();
let events = pezframe_system::Pallet::<Test>::events();
let system_event: <Test as pezframe_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}
@@ -721,11 +721,11 @@ pub fn assert_last_events<E>(generic_events: E)
where
E: DoubleEndedIterator<Item = RuntimeEvent> + ExactSizeIterator,
{
for (i, (got, want)) in frame_system::Pallet::<Test>::events()
for (i, (got, want)) in pezframe_system::Pallet::<Test>::events()
.into_iter()
.rev()
.map(|e| e.event)
.zip(generic_events.rev().map(<Test as frame_system::Config>::RuntimeEvent::from))
.zip(generic_events.rev().map(<Test as pezframe_system::Config>::RuntimeEvent::from))
.rev()
.enumerate()
{
@@ -761,7 +761,7 @@ pub(crate) fn deregister_teyrchain(id: ParaId) {
/// Calls `schedule_para_cleanup` in a new storage transactions, since it assumes rollback on error.
pub(crate) fn try_deregister_teyrchain(id: ParaId) -> crate::DispatchResult {
frame_support::storage::transactional::with_storage_layer(|| Paras::schedule_para_cleanup(id))
pezframe_support::storage::transactional::with_storage_layer(|| Paras::schedule_para_cleanup(id))
}
pub(crate) fn set_disabled_validators(disabled: Vec<u32>) {
@@ -26,9 +26,9 @@ use crate::{
};
use alloc::vec;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use sp_runtime::traits::Bounded;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezsp_runtime::traits::Bounded;
use pezkuwi_primitives::{
HeadData, Id as ParaId, SessionIndex, ValidationCode, ON_DEMAND_DEFAULT_QUEUE_MAX_SIZE,
@@ -16,8 +16,8 @@
//! A module that is responsible for migration of storage.
use super::*;
use frame_support::{
migrations::VersionedMigration, pallet_prelude::ValueQuery, storage_alias,
use pezframe_support::{
migrations::VersionedMigration, pezpallet_prelude::ValueQuery, storage_alias,
traits::UncheckedOnRuntimeUpgrade, weights::Weight,
};
@@ -88,7 +88,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<alloc::vec::Vec<u8>, pezsp_runtime::TryRuntimeError> {
let n: u32 = v0::OnDemandQueue::<T>::get().len() as u32;
log::info!(
@@ -100,7 +100,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: alloc::vec::Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(state: alloc::vec::Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::info!(target: LOG_TARGET, "Running post_upgrade()");
ensure!(
@@ -136,7 +136,7 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
1,
v1::UncheckedMigrateToV1<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
#[cfg(test)]
+10 -10
View File
@@ -31,7 +31,7 @@
//! occupying multiple cores in on-demand, we will likely add a separate order type, where the
//! intent can be made explicit.
use sp_runtime::traits::Zero;
use pezsp_runtime::traits::Zero;
mod benchmarking;
pub mod migration;
mod mock_helpers;
@@ -45,8 +45,8 @@ mod tests;
use crate::{configuration, paras, scheduler::common::Assignment};
use alloc::collections::BinaryHeap;
use core::mem::take;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{
defensive_prelude::*,
Currency,
@@ -55,9 +55,9 @@ use frame_support::{
},
PalletId,
};
use frame_system::{pallet_prelude::*, Pallet as System};
use pezframe_system::{pezpallet_prelude::*, Pallet as System};
use pezkuwi_primitives::{CoreIndex, Id as ParaId};
use sp_runtime::{
use pezsp_runtime::{
traits::{AccountIdConversion, One, SaturatedConversion},
FixedPointNumber, FixedPointOperand, FixedU128, Perbill, Saturating,
};
@@ -102,7 +102,7 @@ enum PaymentType {
Balance,
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -115,10 +115,10 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + paras::Config {
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {
/// The runtime's definition of an event.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// The runtime's definition of a Currency.
type Currency: Currency<Self::AccountId>;
@@ -454,7 +454,7 @@ where
/// Events:
/// - `OnDemandOrderPlaced`
fn do_place_order(
sender: <T as frame_system::Config>::AccountId,
sender: <T as pezframe_system::Config>::AccountId,
max_amount: BalanceOf<T>,
para_id: ParaId,
existence_requirement: ExistenceRequirement,
@@ -743,7 +743,7 @@ where
/// Collect the revenue from the `when` blockheight
pub fn claim_revenue_until(when: BlockNumberFor<T>) -> BalanceOf<T> {
let now = <frame_system::Pallet<T>>::block_number();
let now = <pezframe_system::Pallet<T>>::block_number();
let mut amount: BalanceOf<T> = BalanceOf::<T>::zero();
Revenue::<T>::mutate(|revenue| {
while !revenue.is_empty() {
@@ -31,10 +31,10 @@ use crate::{
paras::{ParaGenesisArgs, ParaKind},
};
use core::cmp::{Ord, Ordering};
use frame_support::{assert_noop, assert_ok};
use pallet_balances::Error as BalancesError;
use pezframe_support::{assert_noop, assert_ok};
use pezpallet_balances::Error as BalancesError;
use pezkuwi_primitives::{BlockNumber, SessionIndex, ValidationCode, ON_DEMAND_MAX_QUEUE_MAX_SIZE};
use sp_runtime::traits::BadOrigin;
use pezsp_runtime::traits::BadOrigin;
fn schedule_blank_para(id: ParaId, parakind: ParaKind) {
let validation_code: ValidationCode = vec![1, 2, 3].into();
@@ -19,16 +19,16 @@
use super::{alloc, pallet::Config};
use alloc::collections::BinaryHeap;
use core::cmp::{Ord, Ordering, PartialOrd};
use frame_support::{
pallet_prelude::{Decode, Encode, RuntimeDebug, TypeInfo},
use pezframe_support::{
pezpallet_prelude::{Decode, Encode, RuntimeDebug, TypeInfo},
traits::Currency,
};
use pezkuwi_primitives::{CoreIndex, Id as ParaId, ON_DEMAND_MAX_QUEUE_MAX_SIZE};
use sp_runtime::FixedU128;
use pezsp_runtime::FixedU128;
/// Shorthand for the Balance type the runtime is using.
pub type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
<<T as Config>::Currency as Currency<<T as pezframe_system::Config>::AccountId>>::Balance;
/// Meta data for full queue.
///
+4 -4
View File
@@ -18,7 +18,7 @@
use core::result;
use pezkuwi_primitives::Id as ParaId;
use sp_runtime::traits::BadOrigin;
use pezsp_runtime::traits::BadOrigin;
pub use pallet::*;
@@ -39,16 +39,16 @@ where
///
/// This module fulfills only the single purpose of housing the `Origin` in `construct_runtime`.
// ideally, though, the `construct_runtime` should support a free-standing origin.
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
pub trait Config: pezframe_system::Config {}
/// Origin for the teyrchains.
#[pallet::origin]
@@ -17,13 +17,13 @@
use super::*;
use crate::configuration::HostConfiguration;
use alloc::vec;
use frame_benchmarking::v2::*;
use frame_support::traits::fungible::Mutate;
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use pezframe_benchmarking::v2::*;
use pezframe_support::traits::fungible::Mutate;
use pezframe_system::{pezpallet_prelude::BlockNumberFor, RawOrigin};
use pezkuwi_primitives::{
HeadData, Id as ParaId, ValidationCode, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE,
};
use sp_runtime::traits::{One, Saturating};
use pezsp_runtime::traits::{One, Saturating};
pub mod mmr_setup;
mod pvf_check;
@@ -37,10 +37,10 @@ use self::pvf_check::{VoteCause, VoteOutcome};
const SAMPLE_SIZE: u32 = 1024;
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
let events = pezframe_system::Pallet::<T>::events();
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
}
@@ -141,10 +141,10 @@ mod benchmarks {
let new_head = HeadData(vec![0; s as usize]);
let old_code_hash = ValidationCode(vec![0]).hash();
CurrentCodeHash::<T>::insert(&para_id, old_code_hash);
frame_system::Pallet::<T>::set_block_number(10u32.into());
pezframe_system::Pallet::<T>::set_block_number(10u32.into());
// schedule an expired code upgrade for this `para_id` so that force_note_new_head would use
// the worst possible code path
let expired = frame_system::Pallet::<T>::block_number().saturating_sub(One::one());
let expired = pezframe_system::Pallet::<T>::block_number().saturating_sub(One::one());
let config = HostConfiguration::<BlockNumberFor<T>>::default();
generate_disordered_pruning::<T>();
Pallet::<T>::schedule_code_upgrade(
@@ -256,8 +256,8 @@ mod benchmarks {
let para_id = ParaId::from(1000);
let old_code_hash = ValidationCode(vec![0]).hash();
CurrentCodeHash::<T>::insert(&para_id, old_code_hash);
frame_system::Pallet::<T>::set_block_number(10u32.into());
let inclusion = frame_system::Pallet::<T>::block_number().saturating_add(10u32.into());
pezframe_system::Pallet::<T>::set_block_number(10u32.into());
let inclusion = pezframe_system::Pallet::<T>::block_number().saturating_add(10u32.into());
let config = HostConfiguration::<BlockNumberFor<T>>::default();
Pallet::<T>::schedule_code_upgrade(
para_id,
@@ -297,7 +297,7 @@ mod benchmarks {
Event::CodeAuthorized {
para_id,
code_hash: new_code_hash,
expire_at: frame_system::Pallet::<T>::block_number().saturating_add(valid_period),
expire_at: pezframe_system::Pallet::<T>::block_number().saturating_add(valid_period),
}
.into(),
);
@@ -308,7 +308,7 @@ mod benchmarks {
let code = ValidationCode(vec![0; c as usize]);
let para_id = ParaId::from(1000);
let expire_at =
frame_system::Pallet::<T>::block_number().saturating_add(BlockNumberFor::<T>::from(c));
pezframe_system::Pallet::<T>::block_number().saturating_add(BlockNumberFor::<T>::from(c));
AuthorizedCodeHash::<T>::insert(
&para_id,
AuthorizedCodeHashAndExpiry::from((code.hash(), expire_at)),
@@ -17,8 +17,8 @@
//! Implements benchmarking setup for the `merkle-mountain-range` pallet.
use crate::paras::*;
use pallet_mmr::BenchmarkHelper;
use sp_std::vec;
use pezpallet_mmr::BenchmarkHelper;
use pezsp_std::vec;
/// Struct to setup benchmarks for the `merkle-mountain-range` pallet.
pub struct MmrSetup<T>(core::marker::PhantomData<T>);
@@ -18,10 +18,10 @@
use crate::{configuration, paras::*, shared::Pallet as ParasShared};
use alloc::{vec, vec::Vec};
use frame_support::assert_ok;
use frame_system::RawOrigin;
use pezframe_support::assert_ok;
use pezframe_system::RawOrigin;
use pezkuwi_primitives::{HeadData, Id as ParaId, ValidationCode, ValidatorId, ValidatorIndex};
use sp_application_crypto::RuntimeAppPublic;
use pezsp_application_crypto::RuntimeAppPublic;
// Constants for the benchmarking
const SESSION_INDEX: SessionIndex = 1;
+29 -29
View File
@@ -117,19 +117,19 @@ use alloc::{collections::btree_set::BTreeSet, vec::Vec};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use codec::{Decode, Encode};
use core::{cmp, mem};
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{EnsureOriginWithArg, EstimateNextSessionRotation},
DefaultNoBound,
};
use frame_system::pallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
ConsensusLog, HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, UpgradeGoAhead,
UpgradeRestriction, ValidationCode, ValidationCodeHash, ValidatorSignature, MIN_CODE_SIZE,
};
use scale_info::{Type, TypeInfo};
use sp_core::RuntimeDebug;
use sp_runtime::{
use pezsp_core::RuntimeDebug;
use pezsp_runtime::{
traits::{AppVerify, One, Saturating},
DispatchResult, SaturatedConversion,
};
@@ -398,7 +398,7 @@ pub(crate) enum PvfCheckCause<BlockNumber> {
/// instead of its relay parent -- in order to keep PVF available in case of chain
/// reversions.
///
/// See https://github.com/paritytech/polkadot/issues/4601 for detailed explanation.
/// See https://github.com/pezkuwichain/kurdistan-sdk/issues/151 for detailed explanation.
included_at: BlockNumber,
/// Whether or not the upgrade should be enacted directly.
///
@@ -638,14 +638,14 @@ impl WeightInfo for TestWeightInfo {
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
use frame_support::traits::{
use pezframe_support::traits::{
fungible::{Inspect, Mutate},
tokens::{Fortitude, Precision, Preservation},
};
use sp_runtime::transaction_validity::{
use pezsp_runtime::transaction_validity::{
InvalidTransaction, TransactionPriority, TransactionSource, TransactionValidity,
ValidTransaction,
};
@@ -658,13 +658,13 @@ pub mod pallet {
#[pallet::config]
pub trait Config:
frame_system::Config
pezframe_system::Config
+ configuration::Config
+ shared::Config
+ frame_system::offchain::CreateBare<Call<Self>>
+ pezframe_system::offchain::CreateBare<Call<Self>>
{
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
#[pallet::constant]
type UnsignedPriority: Get<TransactionPriority>;
@@ -1037,7 +1037,7 @@ pub mod pallet {
new_head: HeadData,
) -> DispatchResult {
ensure_root(origin)?;
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
Self::note_new_head(para, new_head, now);
Self::deposit_event(Event::NewHeadNoted(para));
Ok(())
@@ -1094,7 +1094,7 @@ pub mod pallet {
let cfg = configuration::ActiveConfig::<T>::get();
Self::enact_pvf_accepted(
frame_system::Pallet::<T>::block_number(),
pezframe_system::Pallet::<T>::block_number(),
&code_hash,
&vote.causes,
vote.age,
@@ -1204,7 +1204,7 @@ pub mod pallet {
PvfCheckOutcome::Accepted => {
let cfg = configuration::ActiveConfig::<T>::get();
Self::enact_pvf_accepted(
frame_system::Pallet::<T>::block_number(),
pezframe_system::Pallet::<T>::block_number(),
&stmt.subject,
&active_vote.causes,
active_vote.age,
@@ -1302,7 +1302,7 @@ pub mod pallet {
// The requested para must be a valid para (neither onboarding nor offboarding).
ensure!(Self::is_valid_para(para), Error::<T>::NotRegistered);
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let expire_at = now.saturating_add(valid_period);
// Insert the authorized code hash and ensure it overwrites the existing one for a para.
@@ -1347,7 +1347,7 @@ pub mod pallet {
cooldown_until: BlockNumberFor<T>,
) -> BalanceOf<T> {
let time_left =
cooldown_until.saturating_sub(frame_system::Pallet::<T>::block_number());
cooldown_until.saturating_sub(pezframe_system::Pallet::<T>::block_number());
BalanceOf::<T>::from(time_left).saturating_mul(T::CooldownRemovalMultiplier::get())
}
@@ -1420,7 +1420,7 @@ pub mod pallet {
Call::apply_authorized_force_set_current_code { para, new_code } =>
match Self::validate_code_is_authorized(new_code, para) {
Ok(authorized_code) => {
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let longevity = authorized_code.expire_at.saturating_sub(now);
ValidTransaction::with_tag_prefix("ApplyAuthorizedForceSetCurrentCode")
@@ -1482,7 +1482,7 @@ impl<T: Config> Pallet<T> {
ensure!(new_code.0.len() >= MIN_CODE_SIZE as usize, Error::<T>::InvalidCode);
ensure!(new_code.0.len() <= config.max_code_size as usize, Error::<T>::InvalidCode);
let current_block = frame_system::Pallet::<T>::block_number();
let current_block = pezframe_system::Pallet::<T>::block_number();
// Schedule the upgrade with a delay just like if a teyrchain triggered the upgrade.
let upgrade_block = current_block.saturating_add(config.validation_upgrade_delay);
Self::schedule_code_upgrade(id, new_code, upgrade_block, &config, upgrade_strategy);
@@ -1556,7 +1556,7 @@ impl<T: Config> Pallet<T> {
fn apply_actions_queue(session: SessionIndex) -> Vec<ParaId> {
let actions = ActionsQueue::<T>::take(session);
let mut teyrchains = TeyrchainsCache::new();
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let mut outgoing = Vec::new();
for para in actions {
@@ -1977,7 +1977,7 @@ impl<T: Config> Pallet<T> {
let expected_at = expected_at.saturated_into();
let log = ConsensusLog::ParaScheduleUpgradeCode(id, *code_hash, expected_at);
frame_system::Pallet::<T>::deposit_log(log.into());
pezframe_system::Pallet::<T>::deposit_log(log.into());
weight
}
@@ -2078,7 +2078,7 @@ impl<T: Config> Pallet<T> {
//
// This is only an intermediate solution and should be fixed in foreseeable future.
//
// [soaking issue]: https://github.com/paritytech/polkadot/issues/3918
// [soaking issue]: https://github.com/pezkuwichain/kurdistan-sdk/issues/146
let validation_code =
mem::replace(&mut genesis_data.validation_code, ValidationCode(Vec::new()));
UpcomingParasGenesis::<T>::insert(&id, genesis_data);
@@ -2307,13 +2307,13 @@ impl<T: Config> Pallet<T> {
// The code is known and there is no active PVF vote for it meaning it is
// already checked -- fast track the PVF checking into the accepted state.
weight += T::DbWeight::get().reads(1);
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
weight += Self::enact_pvf_accepted(now, &code_hash, &[cause], 0, cfg);
} else {
// PVF is not being pre-checked and it is not known. Start a new pre-checking
// process.
weight += T::DbWeight::get().reads_writes(3, 2);
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let n_validators = shared::ActiveValidatorKeys::<T>::get().len();
PvfActiveVoteMap::<T>::insert(
&code_hash,
@@ -2401,10 +2401,10 @@ impl<T: Config> Pallet<T> {
CurrentCodeHash::<T>::insert(&id, &new_code_hash);
let log = ConsensusLog::ParaUpgradeCode(id, new_code_hash);
<frame_system::Pallet<T>>::deposit_log(log.into());
<pezframe_system::Pallet<T>>::deposit_log(log.into());
// `now` is only used for registering pruning as part of `fn note_past_code`
let now = <frame_system::Pallet<T>>::block_number();
let now = <pezframe_system::Pallet<T>>::block_number();
let weight = if let Some(prior_code_hash) = maybe_prior_code_hash {
Self::note_past_code(id, at, now, prior_code_hash)
@@ -2420,7 +2420,7 @@ impl<T: Config> Pallet<T> {
fn do_force_set_current_code_update(para: ParaId, new_code: ValidationCode) {
let new_code_hash = new_code.hash();
Self::increase_code_ref(&new_code_hash, &new_code);
Self::set_current_code(para, new_code_hash, frame_system::Pallet::<T>::block_number());
Self::set_current_code(para, new_code_hash, pezframe_system::Pallet::<T>::block_number());
Self::deposit_event(Event::CurrentCodeUpdated(para));
}
@@ -2440,7 +2440,7 @@ impl<T: Config> Pallet<T> {
stmt: PvfCheckStatement,
signature: ValidatorSignature,
) {
use frame_system::offchain::SubmitTransaction;
use pezframe_system::offchain::SubmitTransaction;
let xt = T::create_bare(Call::include_pvf_check_statement { stmt, signature }.into());
if let Err(e) = SubmitTransaction::<T, Call<T>>::submit_transaction(xt) {
@@ -2601,7 +2601,7 @@ impl<T: Config> Pallet<T> {
para: &ParaId,
) -> Result<AuthorizedCodeHashAndExpiry<BlockNumberFor<T>>, Error<T>> {
let authorized = AuthorizedCodeHash::<T>::get(para).ok_or(Error::<T>::NothingAuthorized)?;
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
ensure!(authorized.expire_at > now, Error::<T>::InvalidBlockNumber);
ensure!(authorized.code_hash == code.hash(), Error::<T>::Unauthorized);
Ok(authorized)
+22 -22
View File
@@ -15,15 +15,15 @@
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
use super::*;
use frame_support::{
use pezframe_support::{
assert_err, assert_noop, assert_ok, assert_storage_noop, traits::UnfilteredDispatchable,
};
use pezkuwi_primitives::{BlockNumber, SchedulerParams, TEYRCHAIN_KEY_TYPE_ID};
use pezkuwi_primitives_test_helpers::{dummy_head_data, dummy_validation_code, validator_pubkeys};
use sc_keystore::LocalKeystore;
use sp_keyring::Sr25519Keyring;
use sp_keystore::{Keystore, KeystorePtr};
use sp_runtime::TokenError;
use pezsc_keystore::LocalKeystore;
use pezsp_keyring::Sr25519Keyring;
use pezsp_keystore::{Keystore, KeystorePtr};
use pezsp_runtime::TokenError;
use std::sync::Arc;
use crate::{
@@ -140,8 +140,8 @@ fn check_code_is_not_stored(validation_code: &ValidationCode) {
/// An utility for checking that certain events were deposited.
struct EventValidator {
events: Vec<
frame_system::EventRecord<
<Test as frame_system::Config>::RuntimeEvent,
pezframe_system::EventRecord<
<Test as pezframe_system::Config>::RuntimeEvent,
pezkuwi_primitives::Hash,
>,
>,
@@ -153,8 +153,8 @@ impl EventValidator {
}
fn started(&mut self, code: &ValidationCode, id: ParaId) -> &mut Self {
self.events.push(frame_system::EventRecord {
phase: frame_system::Phase::Initialization,
self.events.push(pezframe_system::EventRecord {
phase: pezframe_system::Phase::Initialization,
event: Event::PvfCheckStarted(code.hash(), id).into(),
topics: vec![],
});
@@ -162,8 +162,8 @@ impl EventValidator {
}
fn rejected(&mut self, code: &ValidationCode, id: ParaId) -> &mut Self {
self.events.push(frame_system::EventRecord {
phase: frame_system::Phase::Initialization,
self.events.push(pezframe_system::EventRecord {
phase: pezframe_system::Phase::Initialization,
event: Event::PvfCheckRejected(code.hash(), id).into(),
topics: vec![],
});
@@ -171,8 +171,8 @@ impl EventValidator {
}
fn accepted(&mut self, code: &ValidationCode, id: ParaId) -> &mut Self {
self.events.push(frame_system::EventRecord {
phase: frame_system::Phase::Initialization,
self.events.push(pezframe_system::EventRecord {
phase: pezframe_system::Phase::Initialization,
event: Event::PvfCheckAccepted(code.hash(), id).into(),
topics: vec![],
});
@@ -180,7 +180,7 @@ impl EventValidator {
}
fn check(&self) {
assert_eq!(&frame_system::Pallet::<Test>::events(), &self.events);
assert_eq!(&pezframe_system::Pallet::<Test>::events(), &self.events);
}
}
@@ -943,7 +943,7 @@ fn full_teyrchain_cleanup_storage() {
// For that run to block #7 and submit a new head.
assert_eq!(expected_at, 7);
run_to_block(7, None);
assert_eq!(frame_system::Pallet::<Test>::block_number(), 7);
assert_eq!(pezframe_system::Pallet::<Test>::block_number(), 7);
Paras::note_new_head(para_id, Default::default(), expected_at);
AuthorizedCodeHash::<Test>::insert(
&para_id,
@@ -1829,10 +1829,10 @@ fn verify_upgrade_go_ahead_signal_is_externally_accessible() {
let a = ParaId::from(2020);
new_test_ext(Default::default()).execute_with(|| {
assert!(sp_io::storage::get(&well_known_keys::upgrade_go_ahead_signal(a)).is_none());
assert!(pezsp_io::storage::get(&well_known_keys::upgrade_go_ahead_signal(a)).is_none());
UpgradeGoAheadSignal::<Test>::insert(&a, UpgradeGoAhead::GoAhead);
assert_eq!(
sp_io::storage::get(&well_known_keys::upgrade_go_ahead_signal(a)).unwrap(),
pezsp_io::storage::get(&well_known_keys::upgrade_go_ahead_signal(a)).unwrap(),
vec![1u8],
);
});
@@ -1845,10 +1845,10 @@ fn verify_upgrade_restriction_signal_is_externally_accessible() {
let a = ParaId::from(2020);
new_test_ext(Default::default()).execute_with(|| {
assert!(sp_io::storage::get(&well_known_keys::upgrade_restriction_signal(a)).is_none());
assert!(pezsp_io::storage::get(&well_known_keys::upgrade_restriction_signal(a)).is_none());
UpgradeRestrictionSignal::<Test>::insert(&a, UpgradeRestriction::Present);
assert_eq!(
sp_io::storage::get(&well_known_keys::upgrade_restriction_signal(a)).unwrap(),
pezsp_io::storage::get(&well_known_keys::upgrade_restriction_signal(a)).unwrap(),
vec![0],
);
});
@@ -1863,7 +1863,7 @@ fn verify_para_head_is_externally_accessible() {
new_test_ext(Default::default()).execute_with(|| {
Heads::<Test>::insert(&a, expected_head_data.clone());
let encoded = sp_io::storage::get(&well_known_keys::para_head(a)).unwrap();
let encoded = pezsp_io::storage::get(&well_known_keys::para_head(a)).unwrap();
let head_data = HeadData::decode(&mut encoded.as_ref());
assert_eq!(head_data, Ok(expected_head_data));
});
@@ -2308,7 +2308,7 @@ fn apply_authorized_force_set_current_code_works() {
);
// cannot apply obsolete authorization
frame_system::Pallet::<Test>::set_block_number(valid_period + 5 + 10);
pezframe_system::Pallet::<Test>::set_block_number(valid_period + 5 + 10);
assert_eq!(
apply_code(RuntimeOrigin::signed(1), para_a, code_1.clone(),),
(
@@ -2316,7 +2316,7 @@ fn apply_authorized_force_set_current_code_works() {
Err(Error::<Test>::InvalidBlockNumber.into())
),
);
frame_system::Pallet::<Test>::set_block_number(5);
pezframe_system::Pallet::<Test>::set_block_number(5);
// ok - can apply authorized code
let (validate_unsigned, dispatch_result) =
@@ -19,8 +19,8 @@ use super::*;
use crate::{inclusion, ParaId};
use alloc::collections::btree_map::BTreeMap;
use core::cmp::{max, min};
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
use pezkuwi_primitives::{node_features::FeatureIndex, GroupIndex};
@@ -38,16 +38,16 @@ use alloc::{
};
use bitvec::prelude::BitVec;
use core::result::Result;
use frame_support::{
use pezframe_support::{
defensive,
dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
inherent::{InherentData, InherentIdentifier, MakeFatalError, ProvideInherent},
pallet_prelude::*,
pezpallet_prelude::*,
traits::Randomness,
};
use frame_system::pallet_prelude::*;
use pallet_babe::{self, ParentBlockRandomness};
use pezframe_system::pezpallet_prelude::*;
use pezpallet_babe::{self, ParentBlockRandomness};
use pezkuwi_primitives::{
effective_minimum_backing_votes, node_features::FeatureIndex, BackedCandidate,
CandidateDescriptorVersion, CandidateHash, CandidateReceiptV2 as CandidateReceipt,
@@ -59,7 +59,7 @@ use pezkuwi_primitives::{
};
use rand::{seq::SliceRandom, SeedableRng};
use scale_info::TypeInfo;
use sp_runtime::traits::{Header as HeaderT, One};
use pezsp_runtime::traits::{Header as HeaderT, One};
mod misc;
mod weights;
@@ -103,7 +103,7 @@ impl DisputedBitfield {
pub use pallet::*;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -112,9 +112,9 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
#[pallet::disable_frame_system_supertrait_check]
#[pallet::disable_pezframe_system_supertrait_check]
pub trait Config:
inclusion::Config + scheduler::Config + initializer::Config + pallet_babe::Config
inclusion::Config + scheduler::Config + initializer::Config + pezpallet_babe::Config
{
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
@@ -282,7 +282,7 @@ impl<T: Config> Pallet<T> {
) -> Result<(TeyrchainsInherentData<HeaderFor<T>>, PostDispatchInfo), DispatchErrorWithPostInfo>
{
#[cfg(feature = "runtime-metrics")]
sp_io::init_tracing();
pezsp_io::init_tracing();
let TeyrchainsInherentData {
mut bitfields,
@@ -299,14 +299,14 @@ impl<T: Config> Pallet<T> {
disputes.len()
);
let parent_hash = frame_system::Pallet::<T>::parent_hash();
let parent_hash = pezframe_system::Pallet::<T>::parent_hash();
ensure!(
parent_header.hash().as_ref() == parent_hash.as_ref(),
Error::<T>::InvalidParentHeader,
);
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let config = configuration::ActiveConfig::<T>::get();
// Before anything else, update the allowed relay-parents.
@@ -353,7 +353,7 @@ impl<T: Config> Pallet<T> {
// to subtract BlockWeights::base_block to reduce chances of becoming overweight.
let max_block_weight = {
let dispatch_class = DispatchClass::Mandatory;
let max_block_weight_full = <T as frame_system::Config>::BlockWeights::get();
let max_block_weight_full = <T as pezframe_system::Config>::BlockWeights::get();
log::debug!(target: LOG_TARGET, "Max block weight: {}", max_block_weight_full.max_block);
// Get max block weight for the mandatory class if defined, otherwise total max weight
// of the block.
@@ -364,7 +364,7 @@ impl<T: Config> Pallet<T> {
.unwrap_or(max_block_weight_full.max_block);
log::debug!(target: LOG_TARGET, "Used max block time weight: {}", max_weight);
let max_block_size_full = <T as frame_system::Config>::BlockLength::get();
let max_block_size_full = <T as pezframe_system::Config>::BlockLength::get();
let max_block_size = max_block_size_full.max.get(dispatch_class);
log::debug!(target: LOG_TARGET, "Used max block size: {}", max_block_size);
@@ -832,7 +832,7 @@ pub(crate) fn apply_weight_limit<T: Config + inclusion::Config>(
max_consumable_weight.checked_sub(&total_bitfields_weight)
{
let (acc_candidate_weight, chained_indices) =
random_sel::<Vec<BackedCandidate<<T as frame_system::Config>::Hash>>, _>(
random_sel::<Vec<BackedCandidate<<T as pezframe_system::Config>::Hash>>, _>(
rng,
&chained_candidates,
preferred_chain_indices,
@@ -1257,7 +1257,7 @@ fn filter_backed_statements_from_disabled_validators<
>(
backed_candidates_with_core: &mut BTreeMap<
ParaId,
Vec<(BackedCandidate<<T as frame_system::Config>::Hash>, CoreIndex)>,
Vec<(BackedCandidate<<T as pezframe_system::Config>::Hash>, CoreIndex)>,
>,
allowed_relay_parents: &AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>,
) {
@@ -55,8 +55,8 @@ mod enter {
use alloc::collections::btree_map::BTreeMap;
use assert_matches::assert_matches;
use core::panic;
use frame_support::assert_ok;
use frame_system::limits;
use pezframe_support::assert_ok;
use pezframe_system::limits;
use pezkuwi_primitives::{
ApprovedPeerId, AvailabilityBitfield, CandidateDescriptorV2, ClaimQueueOffset, CollatorId,
CollatorSignature, CommittedCandidateReceiptV2, CoreSelector, InternalVersion,
@@ -65,8 +65,8 @@ mod enter {
use pezkuwi_primitives_test_helpers::CandidateDescriptor;
use pretty_assertions::assert_eq;
use rstest::rstest;
use sp_core::ByteArray;
use sp_runtime::Perbill;
use pezsp_core::ByteArray;
use pezsp_runtime::Perbill;
struct TestConfig {
dispute_statements: BTreeMap<u32, u32>,
@@ -78,7 +78,7 @@ mod enter {
unavailable_cores: Vec<u32>,
v2_descriptor: bool,
approved_peer_signal: Option<ApprovedPeerId>,
candidate_modifier: Option<CandidateModifier<<Test as frame_system::Config>::Hash>>,
candidate_modifier: Option<CandidateModifier<<Test as pezframe_system::Config>::Hash>>,
}
fn make_inherent_data(
@@ -631,7 +631,7 @@ mod enter {
DisputeStatement, DisputeStatementSet, ExplicitDisputeStatement,
InvalidDisputeStatementKind, ValidDisputeStatementKind,
};
use sp_core::{crypto::CryptoType, Pair};
use pezsp_core::{crypto::CryptoType, Pair};
new_test_ext(Default::default()).execute_with(|| {
let v0 = <ValidatorId as CryptoType>::Pair::generate().0;
@@ -684,7 +684,7 @@ mod enter {
.collect::<Vec<CheckedDisputeStatementSet>>()
};
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(1));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(1));
let statements = generate_votes(3, candidate_hash);
set_scrapable_on_chain_disputes::<Test>(3, statements);
assert_matches!(pallet::OnChainVotes::<Test>::get(), Some(ScrapedOnChainVotes {
@@ -703,7 +703,7 @@ mod enter {
))
});
let candidate_hash = CandidateHash(sp_core::H256::repeat_byte(2));
let candidate_hash = CandidateHash(pezsp_core::H256::repeat_byte(2));
let statements = generate_votes(7, candidate_hash);
set_scrapable_on_chain_disputes::<Test>(7, statements);
assert_matches!(pallet::OnChainVotes::<Test>::get(), Some(ScrapedOnChainVotes {
@@ -770,7 +770,7 @@ mod enter {
clear_dispute_storage::<Test>();
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
multi_dispute_inherent_data,
));
@@ -793,7 +793,7 @@ mod enter {
// Ensure that when dispute data establishes an over weight block that we adequately
// filter out disputes according to our prioritization rule
fn limit_dispute_data() {
sp_tracing::try_init_simple();
pezsp_tracing::try_init_simple();
new_test_ext(MockGenesisConfig::default()).execute_with(|| {
// Create the inherent data for this block
let dispute_statements = BTreeMap::new();
@@ -842,7 +842,7 @@ mod enter {
clear_dispute_storage::<Test>();
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
limit_inherent_data,
));
@@ -927,7 +927,7 @@ mod enter {
clear_dispute_storage::<Test>();
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
limit_inherent_data,
));
@@ -1017,7 +1017,7 @@ mod enter {
clear_dispute_storage::<Test>();
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
limit_inherent_data
));
@@ -1093,7 +1093,7 @@ mod enter {
// we still can import it.
#[test]
fn overweight_candidates_enactment_is_fine() {
sp_tracing::try_init_simple();
pezsp_tracing::try_init_simple();
new_test_ext(MockGenesisConfig::default()).execute_with(|| {
use crate::inclusion::WeightInfo as _;
@@ -1109,7 +1109,7 @@ mod enter {
// The number of candidates is chosen to go over the weight limit
// of the mock runtime together with the `enact_candidate`s weight.
let num_candidates = 5u32;
let max_weight = <Test as frame_system::Config>::BlockWeights::get().max_block;
let max_weight = <Test as pezframe_system::Config>::BlockWeights::get().max_block;
assert!(<Test as inclusion::Config>::WeightInfo::enact_candidate(0, 0, 0)
.saturating_mul(u64::from(num_candidates))
.any_gt(max_weight));
@@ -1167,15 +1167,15 @@ mod enter {
scheduler::ClaimQueue::<Test>::set(cores);
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
limit_inherent_data,
));
});
}
fn max_block_weight_proof_size_adjusted() -> Weight {
let raw_weight = <Test as frame_system::Config>::BlockWeights::get().max_block;
let block_length = <Test as frame_system::Config>::BlockLength::get();
let raw_weight = <Test as pezframe_system::Config>::BlockWeights::get().max_block;
let block_length = <Test as pezframe_system::Config>::BlockLength::get();
raw_weight.set_proof_size(*block_length.max.get(DispatchClass::Mandatory) as u64)
}
@@ -1313,7 +1313,7 @@ mod enter {
clear_dispute_storage::<Test>();
assert_ok!(Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
limit_inherent_data,
));
});
@@ -1326,7 +1326,7 @@ mod enter {
Perbill::from_percent(75),
));
// Virtually no time based limit:
BlockWeights::set(frame_system::limits::BlockWeights::simple_max(Weight::from_parts(
BlockWeights::set(pezframe_system::limits::BlockWeights::simple_max(Weight::from_parts(
u64::MAX,
u64::MAX,
)));
@@ -1396,7 +1396,7 @@ mod enter {
Perbill::from_percent(75),
));
// Virtually no time based limit:
BlockWeights::set(frame_system::limits::BlockWeights::simple_max(Weight::from_parts(
BlockWeights::set(pezframe_system::limits::BlockWeights::simple_max(Weight::from_parts(
u64::MAX,
u64::MAX,
)));
@@ -1474,7 +1474,7 @@ mod enter {
Perbill::from_percent(75),
));
// Virtually no time based limit:
BlockWeights::set(frame_system::limits::BlockWeights::simple_max(Weight::from_parts(
BlockWeights::set(pezframe_system::limits::BlockWeights::simple_max(Weight::from_parts(
u64::MAX,
u64::MAX,
)));
@@ -1726,7 +1726,7 @@ mod enter {
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
.unwrap();
let dispatch_error = Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
expected_para_inherent_data,
)
.unwrap_err()
@@ -1786,7 +1786,7 @@ mod enter {
assert_eq!(filtered_para_inherend_data.backed_candidates.len(), 0);
let dispatch_error = Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
unfiltered_para_inherent_data,
)
.unwrap_err()
@@ -1854,7 +1854,7 @@ mod enter {
.unwrap();
let dispatch_error = Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
unfiltered_para_inherent_data,
)
.unwrap_err()
@@ -1919,7 +1919,7 @@ mod enter {
.unwrap();
let dispatch_error = Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
unfiltered_para_inherent_data,
)
.unwrap_err()
@@ -1979,7 +1979,7 @@ mod enter {
.unwrap();
let dispatch_error = Pallet::<Test>::enter(
frame_system::RawOrigin::None.into(),
pezframe_system::RawOrigin::None.into(),
unfiltered_para_inherent_data,
)
.unwrap_err()
@@ -2040,7 +2040,7 @@ mod enter {
// * 5 v2 candidate descriptors.
assert_eq!(inherent_data.backed_candidates.len(), 5);
Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), inherent_data).unwrap();
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
});
}
@@ -2099,7 +2099,7 @@ mod enter {
// * 5 v2 candidate descriptors.
assert_eq!(inherent_data.backed_candidates.len(), 5);
Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), inherent_data).unwrap();
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
});
}
@@ -2264,7 +2264,7 @@ mod enter {
expected_inherent_data
);
Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), inherent_data).unwrap_err();
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap_err();
});
}
@@ -2343,7 +2343,7 @@ mod enter {
);
assert_eq!(
Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), inherent_data)
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
.unwrap_err()
.error,
Error::<Test>::InherentDataFilteredDuringExecution.into()
@@ -2375,15 +2375,15 @@ mod sanitizers {
ValidatorIndex,
};
use rstest::rstest;
use sp_core::crypto::UncheckedFrom;
use pezsp_core::crypto::UncheckedFrom;
use crate::mock::Test;
use pezkuwi_primitives::TEYRCHAIN_KEY_TYPE_ID;
use sc_keystore::LocalKeystore;
use sp_keystore::{Keystore, KeystorePtr};
use pezsc_keystore::LocalKeystore;
use pezsp_keystore::{Keystore, KeystorePtr};
use std::sync::Arc;
fn validator_pubkeys(val_ids: &[sp_keyring::Sr25519Keyring]) -> Vec<ValidatorId> {
fn validator_pubkeys(val_ids: &[pezsp_keyring::Sr25519Keyring]) -> Vec<ValidatorId> {
val_ids.iter().map(|v| v.public().into()).collect()
}
@@ -2400,10 +2400,10 @@ mod sanitizers {
let signing_context = SigningContext { parent_hash, session_index };
let validators = vec![
sp_keyring::Sr25519Keyring::Alice,
sp_keyring::Sr25519Keyring::Bob,
sp_keyring::Sr25519Keyring::Charlie,
sp_keyring::Sr25519Keyring::Dave,
pezsp_keyring::Sr25519Keyring::Alice,
pezsp_keyring::Sr25519Keyring::Bob,
pezsp_keyring::Sr25519Keyring::Charlie,
pezsp_keyring::Sr25519Keyring::Dave,
];
for validator in validators.iter() {
Keystore::sr25519_generate_new(
@@ -2663,15 +2663,15 @@ mod sanitizers {
let signing_context = SigningContext { parent_hash: relay_parent, session_index };
let validators = vec![
sp_keyring::Sr25519Keyring::Alice,
sp_keyring::Sr25519Keyring::Bob,
sp_keyring::Sr25519Keyring::Charlie,
sp_keyring::Sr25519Keyring::Dave,
sp_keyring::Sr25519Keyring::Eve,
sp_keyring::Sr25519Keyring::Ferdie,
sp_keyring::Sr25519Keyring::One,
sp_keyring::Sr25519Keyring::Two,
sp_keyring::Sr25519Keyring::AliceStash,
pezsp_keyring::Sr25519Keyring::Alice,
pezsp_keyring::Sr25519Keyring::Bob,
pezsp_keyring::Sr25519Keyring::Charlie,
pezsp_keyring::Sr25519Keyring::Dave,
pezsp_keyring::Sr25519Keyring::Eve,
pezsp_keyring::Sr25519Keyring::Ferdie,
pezsp_keyring::Sr25519Keyring::One,
pezsp_keyring::Sr25519Keyring::Two,
pezsp_keyring::Sr25519Keyring::AliceStash,
];
for validator in validators.iter() {
Keystore::sr25519_generate_new(
@@ -2858,14 +2858,14 @@ mod sanitizers {
let signing_context = SigningContext { parent_hash: relay_parent, session_index };
let validators = vec![
sp_keyring::Sr25519Keyring::Alice,
sp_keyring::Sr25519Keyring::Bob,
sp_keyring::Sr25519Keyring::Charlie,
sp_keyring::Sr25519Keyring::Dave,
sp_keyring::Sr25519Keyring::Eve,
sp_keyring::Sr25519Keyring::Ferdie,
sp_keyring::Sr25519Keyring::One,
sp_keyring::Sr25519Keyring::Two,
pezsp_keyring::Sr25519Keyring::Alice,
pezsp_keyring::Sr25519Keyring::Bob,
pezsp_keyring::Sr25519Keyring::Charlie,
pezsp_keyring::Sr25519Keyring::Dave,
pezsp_keyring::Sr25519Keyring::Eve,
pezsp_keyring::Sr25519Keyring::Ferdie,
pezsp_keyring::Sr25519Keyring::One,
pezsp_keyring::Sr25519Keyring::Two,
];
for validator in validators.iter() {
Keystore::sr25519_generate_new(
@@ -3389,15 +3389,15 @@ mod sanitizers {
let signing_context = SigningContext { parent_hash: relay_parent, session_index };
let validators = vec![
sp_keyring::Sr25519Keyring::Alice,
sp_keyring::Sr25519Keyring::Bob,
sp_keyring::Sr25519Keyring::Charlie,
sp_keyring::Sr25519Keyring::Dave,
sp_keyring::Sr25519Keyring::Eve,
sp_keyring::Sr25519Keyring::Ferdie,
sp_keyring::Sr25519Keyring::One,
sp_keyring::Sr25519Keyring::Two,
sp_keyring::Sr25519Keyring::AliceStash,
pezsp_keyring::Sr25519Keyring::Alice,
pezsp_keyring::Sr25519Keyring::Bob,
pezsp_keyring::Sr25519Keyring::Charlie,
pezsp_keyring::Sr25519Keyring::Dave,
pezsp_keyring::Sr25519Keyring::Eve,
pezsp_keyring::Sr25519Keyring::Ferdie,
pezsp_keyring::Sr25519Keyring::One,
pezsp_keyring::Sr25519Keyring::Two,
pezsp_keyring::Sr25519Keyring::AliceStash,
];
for validator in validators.iter() {
Keystore::sr25519_generate_new(
@@ -3911,12 +3911,12 @@ mod sanitizers {
let signing_context = SigningContext { parent_hash: relay_parent, session_index };
let validators = vec![
sp_keyring::Sr25519Keyring::Alice,
sp_keyring::Sr25519Keyring::Bob,
sp_keyring::Sr25519Keyring::Charlie,
sp_keyring::Sr25519Keyring::Dave,
sp_keyring::Sr25519Keyring::Eve,
sp_keyring::Sr25519Keyring::Ferdie,
pezsp_keyring::Sr25519Keyring::Alice,
pezsp_keyring::Sr25519Keyring::Bob,
pezsp_keyring::Sr25519Keyring::Charlie,
pezsp_keyring::Sr25519Keyring::Dave,
pezsp_keyring::Sr25519Keyring::Eve,
pezsp_keyring::Sr25519Keyring::Ferdie,
];
for validator in validators.iter() {
Keystore::sr25519_generate_new(
@@ -90,7 +90,7 @@ impl WeightInfo for TestWeightInfo {
}
pub fn paras_inherent_total_weight<T: Config>(
backed_candidates: &[BackedCandidate<<T as frame_system::Config>::Hash>],
backed_candidates: &[BackedCandidate<<T as pezframe_system::Config>::Hash>],
bitfields: &UncheckedSignedAvailabilityBitfields,
disputes: &MultiDisputeStatementSet,
) -> Weight {
@@ -182,7 +182,7 @@ pub fn enact_candidates_max_weight<T: Config>(
)
}
pub fn backed_candidate_weight<T: frame_system::Config + Config>(
pub fn backed_candidate_weight<T: pezframe_system::Config + Config>(
candidate: &BackedCandidate<T::Hash>,
) -> Weight {
set_proof_size_to_tx_size(
@@ -198,7 +198,7 @@ pub fn backed_candidate_weight<T: frame_system::Config + Config>(
)
}
pub fn backed_candidates_weight<T: frame_system::Config + Config>(
pub fn backed_candidates_weight<T: pezframe_system::Config + Config>(
candidates: &[BackedCandidate<T::Hash>],
) -> Weight {
candidates
@@ -15,7 +15,7 @@
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
//! An implementation of the `RewardValidators` trait used by `inclusion` that employs
//! `pallet-staking` to compute the rewards.
//! `pezpallet-staking` to compute the rewards.
//!
//! Based on <https://research.web3.foundation/en/latest/polkadot/overview/2-token-economics.html>
//! which doesn't currently mention availability bitfields. As such, we don't reward them
@@ -23,7 +23,7 @@
use crate::{session_info, shared};
use alloc::collections::btree_set::BTreeSet;
use frame_support::traits::{Defensive, RewardsReporter, ValidatorSet};
use pezframe_support::traits::{Defensive, RewardsReporter, ValidatorSet};
use pezkuwi_primitives::{SessionIndex, ValidatorIndex};
/// The amount of era points given by backing a candidate that is included.
@@ -31,7 +31,7 @@ pub const BACKING_POINTS: u32 = 20;
/// The amount of era points given by dispute voting on a candidate.
pub const DISPUTE_STATEMENT_POINTS: u32 = 20;
/// Rewards validators for participating in teyrchains with era points in pallet-staking.
/// Rewards validators for participating in teyrchains with era points in pezpallet-staking.
pub struct RewardValidatorsWithEraPoints<C, R>(core::marker::PhantomData<(C, R)>);
impl<C, R> RewardValidatorsWithEraPoints<C, R>
@@ -26,8 +26,8 @@ use alloc::{
vec,
vec::Vec,
};
use frame_support::traits::{GetStorageVersion, StorageVersion};
use frame_system::pallet_prelude::*;
use pezframe_support::traits::{GetStorageVersion, StorageVersion};
use pezframe_system::pezpallet_prelude::*;
use pezkuwi_primitives::{
async_backing::{
AsyncBackingParams, BackingState, CandidatePendingAvailability, Constraints,
@@ -40,7 +40,7 @@ use pezkuwi_primitives::{
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
};
use sp_runtime::traits::One;
use pezsp_runtime::traits::One;
/// Implementation for the `validators` function of the runtime API.
pub fn validators<T: initializer::Config>() -> Vec<ValidatorId> {
@@ -52,7 +52,7 @@ pub fn validator_groups<T: initializer::Config>(
) -> (Vec<Vec<ValidatorIndex>>, GroupRotationInfo<BlockNumberFor<T>>) {
// This formula needs to be the same as the one we use
// when populating group_responsible in `availability_cores`
let now = frame_system::Pallet::<T>::block_number() + One::one();
let now = pezframe_system::Pallet::<T>::block_number() + One::one();
let groups = scheduler::ValidatorGroups::<T>::get();
let rotation_info = scheduler::Pallet::<T>::group_rotation_info(now);
@@ -122,12 +122,12 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, Bl
}
/// Returns current block number being processed and the corresponding root hash.
fn current_relay_parent<T: frame_system::Config>(
) -> (BlockNumberFor<T>, <T as frame_system::Config>::Hash) {
fn current_relay_parent<T: pezframe_system::Config>(
) -> (BlockNumberFor<T>, <T as pezframe_system::Config>::Hash) {
use codec::Decode as _;
let state_version = frame_system::Pallet::<T>::runtime_version().state_version();
let relay_parent_number = frame_system::Pallet::<T>::block_number();
let relay_parent_storage_root = T::Hash::decode(&mut &sp_io::storage::root(state_version)[..])
let state_version = pezframe_system::Pallet::<T>::runtime_version().state_version();
let relay_parent_number = pezframe_system::Pallet::<T>::block_number();
let relay_parent_storage_root = T::Hash::decode(&mut &pezsp_io::storage::root(state_version)[..])
.expect("storage root must decode to the Hash type; qed");
(relay_parent_number, relay_parent_storage_root)
}
@@ -207,7 +207,7 @@ pub fn check_validation_outputs<T: initializer::Config>(
para_id: ParaId,
outputs: pezkuwi_primitives::CandidateCommitments,
) -> bool {
let relay_parent_number = frame_system::Pallet::<T>::block_number();
let relay_parent_number = pezframe_system::Pallet::<T>::block_number();
inclusion::Pallet::<T>::check_validation_outputs_for_runtime_api(
para_id,
relay_parent_number,
@@ -230,7 +230,7 @@ pub fn session_index_for_child<T: initializer::Config>() -> SessionIndex {
/// Implementation for the `AuthorityDiscoveryApi::authorities()` function of the runtime API.
/// It is a heavy call, but currently only used for authority discovery, so it is fine.
/// Gets next, current and some historical authority ids using `session_info` module.
pub fn relevant_authority_ids<T: initializer::Config + pallet_authority_discovery::Config>(
pub fn relevant_authority_ids<T: initializer::Config + pezpallet_authority_discovery::Config>(
) -> Vec<AuthorityDiscoveryId> {
let current_session_index = session_index_for_child::<T>();
let earliest_stored_session = session_info::EarliestStoredSession::<T>::get();
@@ -238,8 +238,8 @@ pub fn relevant_authority_ids<T: initializer::Config + pallet_authority_discover
// Due to `max_validators`, the `SessionInfo` stores only the validators who are actively
// selected to participate in teyrchain consensus. We'd like all authorities for the current
// and next sessions to be used in authority-discovery. The two sets likely have large overlap.
let mut authority_ids = pallet_authority_discovery::Pallet::<T>::current_authorities().to_vec();
authority_ids.extend(pallet_authority_discovery::Pallet::<T>::next_authorities().to_vec());
let mut authority_ids = pezpallet_authority_discovery::Pallet::<T>::current_authorities().to_vec();
authority_ids.extend(pezpallet_authority_discovery::Pallet::<T>::next_authorities().to_vec());
// Due to disputes, we'd like to remain connected to authorities of the previous few sessions.
// For this, we don't need anyone other than the validators actively participating in consensus.
@@ -281,11 +281,11 @@ pub fn candidate_pending_availability<T: initializer::Config>(
pub fn candidate_events<T, F>(extract_event: F) -> Vec<CandidateEvent<T::Hash>>
where
T: initializer::Config,
F: Fn(<T as frame_system::Config>::RuntimeEvent) -> Option<inclusion::Event<T>>,
F: Fn(<T as pezframe_system::Config>::RuntimeEvent) -> Option<inclusion::Event<T>>,
{
use inclusion::Event as RawEvent;
frame_system::Pallet::<T>::read_events_no_consensus()
pezframe_system::Pallet::<T>::read_events_no_consensus()
.into_iter()
.filter_map(|record| extract_event(record.event))
.filter_map(|event| {
@@ -422,7 +422,7 @@ pub fn backing_constraints<T: initializer::Config>(
// clears the buffer.
//
// Thus, minimum relay parent is ensured to have asynchronous backing enabled.
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
// Use the right storage depending on version to ensure #64 doesn't cause issues with this
// migration.
+8 -8
View File
@@ -41,14 +41,14 @@ use alloc::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque},
vec::Vec,
};
use frame_support::{pallet_prelude::*, traits::Defensive};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_support::{pezpallet_prelude::*, traits::Defensive};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
pub use pezkuwi_core_primitives::v2::BlockNumber;
use pezkuwi_primitives::{
CoreIndex, GroupIndex, GroupRotationInfo, Id as ParaId, ScheduledCore, SchedulerParams,
ValidatorIndex,
};
use sp_runtime::traits::One;
use pezsp_runtime::traits::One;
pub mod common;
@@ -63,7 +63,7 @@ const LOG_TARGET: &str = "runtime::teyrchains::scheduler";
pub mod migration;
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -75,7 +75,7 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + paras::Config {
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {
type AssignmentProvider: AssignmentProvider<BlockNumberFor<Self>>;
}
@@ -190,7 +190,7 @@ impl<T: Config> Pallet<T> {
Self::maybe_resize_claim_queue();
Self::populate_claim_queue_after_session_change();
let now = frame_system::Pallet::<T>::block_number() + One::one();
let now = pezframe_system::Pallet::<T>::block_number() + One::one();
SessionStartBlock::<T>::set(now);
}
@@ -250,7 +250,7 @@ impl<T: Config> Pallet<T> {
pub(crate) fn availability_timeout_predicate(
) -> impl Fn(BlockNumberFor<T>) -> AvailabilityTimeoutStatus<BlockNumberFor<T>> {
let config = configuration::ActiveConfig::<T>::get();
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let rotation_info = Self::group_rotation_info(now);
let next_rotation = rotation_info.next_rotation_at();
@@ -278,7 +278,7 @@ impl<T: Config> Pallet<T> {
/// this function returns false.
pub(crate) fn availability_timeout_check_required() -> bool {
let config = configuration::ActiveConfig::<T>::get();
let now = frame_system::Pallet::<T>::block_number() + One::one();
let now = pezframe_system::Pallet::<T>::block_number() + One::one();
let rotation_info = Self::group_rotation_info(now);
let current_window =
@@ -17,7 +17,7 @@
//! Common traits and types used by the scheduler and assignment providers.
use scale_info::TypeInfo;
use sp_runtime::{
use pezsp_runtime::{
codec::{Decode, Encode},
RuntimeDebug,
};
@@ -18,8 +18,8 @@
use super::*;
use alloc::vec::Vec;
use frame_support::{
migrations::VersionedMigration, pallet_prelude::ValueQuery, storage_alias,
use pezframe_support::{
migrations::VersionedMigration, pezpallet_prelude::ValueQuery, storage_alias,
traits::UncheckedOnRuntimeUpgrade, weights::Weight,
};
@@ -105,11 +105,11 @@ mod v0 {
// - Items are `Option` for some weird reason.
// - Assignments only consist of `ParaId`, `Assignment` is a concrete type (Same as V0Assignment).
mod v1 {
use frame_support::{
pallet_prelude::ValueQuery, storage_alias, traits::UncheckedOnRuntimeUpgrade,
use pezframe_support::{
pezpallet_prelude::ValueQuery, storage_alias, traits::UncheckedOnRuntimeUpgrade,
weights::Weight,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use super::*;
use crate::scheduler;
@@ -173,7 +173,7 @@ mod v1 {
v0::ParathreadQueue::<T>::kill();
v0::ParathreadClaimIndex::<T>::kill();
let now = frame_system::Pallet::<T>::block_number();
let now = pezframe_system::Pallet::<T>::block_number();
let scheduled = v0::Scheduled::<T>::take();
let sched_len = scheduled.len() as u64;
for core_assignment in scheduled {
@@ -221,7 +221,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
let n: u32 = v0::Scheduled::<T>::get().len() as u32 +
v0::AvailabilityCores::<T>::get().iter().filter(|c| c.is_some()).count() as u32;
@@ -234,7 +234,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
log::info!(target: crate::scheduler::LOG_TARGET, "Running post_upgrade()");
ensure!(
@@ -265,7 +265,7 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
1,
v1::UncheckedMigrateToV1<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
pub(crate) mod v2 {
@@ -371,7 +371,7 @@ pub(crate) mod v2 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
log::trace!(
target: crate::scheduler::LOG_TARGET,
"ClaimQueue before migration: {}",
@@ -384,7 +384,7 @@ pub(crate) mod v2 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
log::trace!(target: crate::scheduler::LOG_TARGET, "Running post_upgrade()");
let old_len = u32::from_be_bytes(state.try_into().unwrap());
@@ -404,7 +404,7 @@ pub type MigrateV1ToV2<T> = VersionedMigration<
2,
v2::UncheckedMigrateToV2<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
/// Migration for TTL and availability timeout retries removal.
@@ -452,7 +452,7 @@ mod v3 {
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::DispatchError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::DispatchError> {
log::trace!(
target: crate::scheduler::LOG_TARGET,
"ClaimQueue before migration: {}",
@@ -465,7 +465,7 @@ mod v3 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::DispatchError> {
log::trace!(target: crate::scheduler::LOG_TARGET, "Running post_upgrade()");
let old_len = u32::from_be_bytes(state.try_into().unwrap());
@@ -490,5 +490,5 @@ pub type MigrateV2ToV3<T> = VersionedMigration<
3,
v3::UncheckedMigrateToV3<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
@@ -17,9 +17,9 @@
use super::*;
use alloc::collections::btree_map::BTreeMap;
use frame_support::assert_ok;
use pezframe_support::assert_ok;
use pezkuwi_primitives::{BlockNumber, SchedulerParams, SessionIndex, ValidationCode, ValidatorId};
use sp_keyring::Sr25519Keyring;
use pezsp_keyring::Sr25519Keyring;
use crate::{
configuration::HostConfiguration,
+11 -11
View File
@@ -25,11 +25,11 @@ use crate::{
util::{take_active_subset, take_active_subset_and_inactive},
};
use alloc::vec::Vec;
use frame_support::{
pallet_prelude::*,
use pezframe_support::{
pezpallet_prelude::*,
traits::{OneSessionHandler, ValidatorSet, ValidatorSetWithIdentification},
};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
AssignmentId, AuthorityDiscoveryId, ExecutorParams, SessionIndex, SessionInfo,
};
@@ -43,7 +43,7 @@ mod tests;
/// A type for representing the validator account id in a session.
pub type AccountId<T> = <<T as Config>::ValidatorSet as ValidatorSet<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
>>::ValidatorId;
/// A tuple of `(AccountId, Identification)` where `Identification`
@@ -51,11 +51,11 @@ pub type AccountId<T> = <<T as Config>::ValidatorSet as ValidatorSet<
pub type IdentificationTuple<T> = (
AccountId<T>,
<<T as Config>::ValidatorSet as ValidatorSetWithIdentification<
<T as frame_system::Config>::AccountId,
<T as pezframe_system::Config>::AccountId,
>>::Identification,
);
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -66,7 +66,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config:
frame_system::Config
pezframe_system::Config
+ configuration::Config
+ shared::Config
+ paras::Config
@@ -115,9 +115,9 @@ pub trait AuthorityDiscoveryConfig {
fn authorities() -> Vec<AuthorityDiscoveryId>;
}
impl<T: pallet_authority_discovery::Config> AuthorityDiscoveryConfig for T {
impl<T: pezpallet_authority_discovery::Config> AuthorityDiscoveryConfig for T {
fn authorities() -> Vec<AuthorityDiscoveryId> {
pallet_authority_discovery::Pallet::<T>::current_authorities().to_vec()
pezpallet_authority_discovery::Pallet::<T>::current_authorities().to_vec()
}
}
@@ -202,11 +202,11 @@ impl<T: Config> Pallet<T> {
pub(crate) fn initializer_finalize() {}
}
impl<T: Config> sp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
type Public = AssignmentId;
}
impl<T: pallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
type Key = AssignmentId;
fn on_genesis_session<'a, I: 'a>(_validators: I)
@@ -16,7 +16,7 @@
//! A module that is responsible for migration of storage.
use frame_support::traits::StorageVersion;
use pezframe_support::traits::StorageVersion;
/// The in-code storage version.
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
@@ -25,7 +25,7 @@ use crate::{
util::take_active_subset,
};
use pezkuwi_primitives::{BlockNumber, SchedulerParams, ValidatorId, ValidatorIndex};
use sp_keyring::Sr25519Keyring;
use pezsp_keyring::Sr25519Keyring;
fn run_to_block(
to: BlockNumber,
+6 -6
View File
@@ -23,12 +23,12 @@ use alloc::{
collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque},
vec::Vec,
};
use frame_support::{pallet_prelude::*, traits::DisabledValidators};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_support::{pezpallet_prelude::*, traits::DisabledValidators};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{
transpose_claim_queue, CoreIndex, Id, SessionIndex, ValidatorId, ValidatorIndex,
};
use sp_runtime::traits::AtLeast32BitUnsigned;
use pezsp_runtime::traits::AtLeast32BitUnsigned;
use rand::{seq::SliceRandom, SeedableRng};
use rand_chacha::ChaCha20Rng;
@@ -144,7 +144,7 @@ impl<Hash: PartialEq + Copy, BlockNumber: AtLeast32BitUnsigned + Copy>
}
}
#[frame_support::pallet]
#[pezframe_support::pallet]
pub mod pallet {
use super::*;
@@ -156,8 +156,8 @@ pub mod pallet {
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {
type DisabledValidators: frame_support::traits::DisabledValidators;
pub trait Config: pezframe_system::Config {
type DisabledValidators: pezframe_support::traits::DisabledValidators;
}
/// The current session index.
@@ -13,8 +13,8 @@
use super::*;
use codec::{Decode, Encode};
use frame_support::{
pallet_prelude::ValueQuery, traits::UncheckedOnRuntimeUpgrade, weights::Weight,
use pezframe_support::{
pezpallet_prelude::ValueQuery, traits::UncheckedOnRuntimeUpgrade, weights::Weight,
};
#[cfg(feature = "try-runtime")]
@@ -24,13 +24,13 @@ pub mod v0 {
use super::*;
use alloc::collections::vec_deque::VecDeque;
use frame_support::storage_alias;
use pezframe_support::storage_alias;
/// All allowed relay-parents storage at version 0.
#[storage_alias]
pub(crate) type AllowedRelayParents<T: Config> = StorageValue<
Pallet<T>,
super::v0::AllowedRelayParentsTracker<<T as frame_system::Config>::Hash, BlockNumberFor<T>>,
super::v0::AllowedRelayParentsTracker<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
ValueQuery,
>;
@@ -91,7 +91,7 @@ mod v1 {
use super::*;
#[cfg(feature = "try-runtime")]
use frame_support::{
use pezframe_support::{
ensure,
traits::{GetStorageVersion, StorageVersion},
};
@@ -100,7 +100,7 @@ mod v1 {
impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
fn pre_upgrade() -> Result<Vec<u8>, pezsp_runtime::TryRuntimeError> {
log::trace!(target: LOG_TARGET, "Running pre_upgrade() for shared MigrateToV1");
let bytes = u32::to_ne_bytes(v0::AllowedRelayParents::<T>::get().buffer.len() as u32);
@@ -121,7 +121,7 @@ mod v1 {
}
#[cfg(feature = "try-runtime")]
fn post_upgrade(state: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> {
fn post_upgrade(state: Vec<u8>) -> Result<(), pezsp_runtime::TryRuntimeError> {
log::trace!(target: LOG_TARGET, "Running post_upgrade() for shared MigrateToV1");
ensure!(
Pallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
@@ -147,19 +147,19 @@ mod v1 {
}
/// Migrate shared module storage to v1.
pub type MigrateToV1<T> = frame_support::migrations::VersionedMigration<
pub type MigrateToV1<T> = pezframe_support::migrations::VersionedMigration<
0,
1,
v1::VersionUncheckedMigrateToV1<T>,
Pallet<T>,
<T as frame_system::Config>::DbWeight,
<T as pezframe_system::Config>::DbWeight,
>;
#[cfg(test)]
mod tests {
use super::{v1::VersionUncheckedMigrateToV1, *};
use crate::mock::{new_test_ext, MockGenesisConfig, Test};
use frame_support::traits::UncheckedOnRuntimeUpgrade;
use pezframe_support::traits::UncheckedOnRuntimeUpgrade;
use pezkuwi_primitives::Hash;
#[test]
@@ -23,7 +23,7 @@ use crate::{
use assert_matches::assert_matches;
use pezkuwi_primitives::Hash;
use pezkuwi_primitives_test_helpers::validator_pubkeys;
use sp_keyring::Sr25519Keyring;
use pezsp_keyring::Sr25519Keyring;
#[test]
fn tracker_earliest_block_number() {
+14 -14
View File
@@ -25,9 +25,9 @@ use crate::{
MockGenesisConfig, ParaInclusion, Processed, System, Test, *,
},
};
use frame_support::{
use pezframe_support::{
assert_noop, assert_ok,
pallet_prelude::*,
pezpallet_prelude::*,
traits::{ExecuteOverweightError, QueueFootprintQuery, ServiceQueues},
weights::Weight,
};
@@ -35,8 +35,8 @@ use pezkuwi_primitives::{
well_known_keys, ClaimQueueOffset, CoreSelector, Id as ParaId, UMPSignal, UpwardMessage,
UMP_SEPARATOR,
};
use sp_crypto_hashing::{blake2_256, twox_64};
use sp_runtime::traits::Bounded;
use pezsp_crypto_hashing::{blake2_256, twox_64};
use pezsp_runtime::traits::Bounded;
pub(super) struct GenesisConfigBuilder {
max_upward_message_size: u32,
@@ -128,7 +128,7 @@ mod check_upward_messages {
#[test]
fn basic_works() {
new_test_ext(GenesisConfigBuilder::default().build()).execute_with(|| {
let _g = frame_support::StorageNoopGuard::default();
let _g = pezframe_support::StorageNoopGuard::default();
check(P_0, vec![msg("p0m0")], None);
check(P_1, vec![msg("p1m0")], None);
check(P_0, vec![msg("p0m1")], None);
@@ -139,7 +139,7 @@ mod check_upward_messages {
#[test]
fn num_per_candidate_exceeded_error() {
new_test_ext(GenesisConfigBuilder::default().build()).execute_with(|| {
let _g = frame_support::StorageNoopGuard::default();
let _g = pezframe_support::StorageNoopGuard::default();
let permitted =
configuration::ActiveConfig::<Test>::get().max_upward_message_num_per_candidate;
@@ -159,7 +159,7 @@ mod check_upward_messages {
#[test]
fn size_per_message_exceeded_error() {
new_test_ext(GenesisConfigBuilder::default().build()).execute_with(|| {
let _g = frame_support::StorageNoopGuard::default();
let _g = pezframe_support::StorageNoopGuard::default();
let max_size = configuration::ActiveConfig::<Test>::get().max_upward_message_size;
let max_per_candidate =
configuration::ActiveConfig::<Test>::get().max_upward_message_num_per_candidate;
@@ -209,7 +209,7 @@ mod check_upward_messages {
fn queue_size_exceeded_error() {
new_test_ext(GenesisConfigBuilder::large_queue_count().build()).execute_with(|| {
let limit = configuration::ActiveConfig::<Test>::get().max_upward_queue_size as u64;
assert_eq!(pallet_message_queue::ItemHeader::<MessageQueueSize>::max_encoded_len(), 5);
assert_eq!(pezpallet_message_queue::ItemHeader::<MessageQueueSize>::max_encoded_len(), 5);
assert!(
configuration::ActiveConfig::<Test>::get().max_upward_queue_size <
crate::inclusion::MaxUmpMessageLenOf::<Test>::get(),
@@ -421,7 +421,7 @@ fn relay_dispatch_queue_size_is_updated() {
fn relay_dispatch_queue_size_key_is_correct() {
#![allow(deprecated)]
// Storage alias to the old way of accessing the queue size.
#[frame_support::storage_alias]
#[pezframe_support::storage_alias]
type RelayDispatchQueueSize = StorageMap<Ump, Twox64Concat, ParaId, (u32, u32), ValueQuery>;
for i in 0..1024 {
@@ -465,7 +465,7 @@ fn verify_relay_dispatch_queue_size_is_externally_accessible() {
fn assert_queue_size(para: ParaId, count: u32, size: u32) {
#[allow(deprecated)]
let raw_queue_size = sp_io::storage::get(&well_known_keys::relay_dispatch_queue_size(para))
let raw_queue_size = pezsp_io::storage::get(&well_known_keys::relay_dispatch_queue_size(para))
.expect(
"enqueuing a message should create the dispatch queue\
and it should be accessible via the well known keys",
@@ -533,21 +533,21 @@ fn overweight_queue_works() {
MessageQueue::service_queues(Weight::from_parts(500, 500));
assert_last_events(
[
pallet_message_queue::Event::<Test>::Processed {
pezpallet_message_queue::Event::<Test>::Processed {
id: hash_1.into(),
origin: Ump(UmpQueueId::Para(para_a)),
weight_used: Weight::from_parts(301, 301),
success: true,
}
.into(),
pallet_message_queue::Event::<Test>::OverweightEnqueued {
pezpallet_message_queue::Event::<Test>::OverweightEnqueued {
id: hash_2.into(),
origin: Ump(UmpQueueId::Para(para_a)),
page_index: 0,
message_index: 1,
}
.into(),
pallet_message_queue::Event::<Test>::OverweightEnqueued {
pezpallet_message_queue::Event::<Test>::OverweightEnqueued {
id: hash_3.into(),
origin: Ump(UmpQueueId::Para(para_a)),
page_index: 0,
@@ -575,7 +575,7 @@ fn overweight_queue_works() {
(Ump(UmpQueueId::Para(para_a)), 0, 2)
));
assert_last_event(
pallet_message_queue::Event::<Test>::Processed {
pezpallet_message_queue::Event::<Test>::Processed {
id: hash_3.into(),
origin: Ump(UmpQueueId::Para(para_a)),
weight_used: Weight::from_parts(501, 501),
+1 -1
View File
@@ -18,7 +18,7 @@
//! on all modules.
use alloc::{collections::btree_set::BTreeSet, vec::Vec};
use frame_system::pallet_prelude::BlockNumberFor;
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use pezkuwi_primitives::{HeadData, Id as ParaId, PersistedValidationData, ValidatorIndex};
use crate::{configuration, hrmp, paras};