fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -41,7 +41,7 @@ use pezpallet_broker::CoreAssignment;
|
||||
use pezkuwi_primitives::CoreIndex;
|
||||
use pezsp_runtime::traits::{One, Saturating};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Fraction expressed as a nominator with an assumed denominator of 57,600.
|
||||
#[derive(
|
||||
@@ -204,22 +204,22 @@ impl<N> From<Schedule<N>> for WorkState<N> {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + on_demand::Config {}
|
||||
|
||||
/// Scheduled assignment sets.
|
||||
///
|
||||
/// Assignments as of the given block number. They will go into state once the block number is
|
||||
/// reached (and replace whatever was in there before).
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type CoreSchedules<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox256,
|
||||
@@ -232,7 +232,7 @@ pub mod pallet {
|
||||
///
|
||||
/// They will be picked from `PendingAssignments` once we reach the scheduled block number in
|
||||
/// `PendingAssignments`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type CoreDescriptors<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox256,
|
||||
@@ -242,10 +242,10 @@ pub mod pallet {
|
||||
GetDefault,
|
||||
>;
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
AssignmentsEmpty,
|
||||
/// assign_core is only allowed to append new assignments at the end of already existing
|
||||
@@ -254,9 +254,9 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
|
||||
impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn pop_assignment_for_core(core_idx: CoreIndex) -> Option<Assignment> {
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
|
||||
CoreDescriptors::<T>::mutate(core_idx, |core_state| {
|
||||
Self::ensure_workload(now, core_idx, core_state);
|
||||
@@ -282,7 +282,7 @@ impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
|
||||
|
||||
match a_type {
|
||||
CoreAssignment::Idle => None,
|
||||
CoreAssignment::Pool => on_demand::Pallet::<T>::pop_assignment_for_core(core_idx),
|
||||
CoreAssignment::Pool => on_demand::Pezpallet::<T>::pop_assignment_for_core(core_idx),
|
||||
CoreAssignment::Task(para_id) => Some(Assignment::Bulk((*para_id).into())),
|
||||
}
|
||||
})
|
||||
@@ -291,7 +291,7 @@ impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
|
||||
fn report_processed(assignment: Assignment) {
|
||||
match assignment {
|
||||
Assignment::Pool { para_id, core_index } =>
|
||||
on_demand::Pallet::<T>::report_processed(para_id, core_index),
|
||||
on_demand::Pezpallet::<T>::report_processed(para_id, core_index),
|
||||
Assignment::Bulk(_) => {},
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
|
||||
fn push_back_assignment(assignment: Assignment) {
|
||||
match assignment {
|
||||
Assignment::Pool { para_id, core_index } =>
|
||||
on_demand::Pallet::<T>::push_back_assignment(para_id, core_index),
|
||||
on_demand::Pezpallet::<T>::push_back_assignment(para_id, core_index),
|
||||
Assignment::Bulk(_) => {
|
||||
// Session changes are rough. We just drop assignments that did not make it on a
|
||||
// session boundary. This seems sensible as bulk is region based. Meaning, even if
|
||||
@@ -325,13 +325,13 @@ impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pallet<T> {
|
||||
fn assignment_duplicated(assignment: &Assignment) {
|
||||
match assignment {
|
||||
Assignment::Pool { para_id, core_index } =>
|
||||
on_demand::Pallet::<T>::assignment_duplicated(*para_id, *core_index),
|
||||
on_demand::Pezpallet::<T>::assignment_duplicated(*para_id, *core_index),
|
||||
Assignment::Bulk(_) => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Ensure given workload for core is up to date.
|
||||
fn ensure_workload(
|
||||
now: BlockNumberFor<T>,
|
||||
@@ -459,9 +459,9 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> AssignCoretime for Pallet<T> {
|
||||
impl<T: Config> AssignCoretime for Pezpallet<T> {
|
||||
fn assign_coretime(id: ParaId) -> DispatchResult {
|
||||
let current_block = pezframe_system::Pallet::<T>::block_number();
|
||||
let current_block = pezframe_system::Pezpallet::<T>::block_number();
|
||||
|
||||
// Add a new core and assign the para to it.
|
||||
let mut config = configuration::ActiveConfig::<T>::get();
|
||||
@@ -470,10 +470,10 @@ impl<T: Config> AssignCoretime for Pallet<T> {
|
||||
|
||||
// `assign_coretime` is only called at genesis or by root, so setting the active
|
||||
// config here is fine.
|
||||
configuration::Pallet::<T>::force_set_active_config(config);
|
||||
configuration::Pezpallet::<T>::force_set_active_config(config);
|
||||
|
||||
let begin = current_block + One::one();
|
||||
let assignment = vec![(pezpallet_broker::CoreAssignment::Task(id.into()), PartsOf57600::FULL)];
|
||||
Pallet::<T>::assign_core(CoreIndex(core), begin, assignment, None)
|
||||
Pezpallet::<T>::assign_core(CoreIndex(core), begin, assignment, None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use super::*;
|
||||
|
||||
use crate::{
|
||||
assigner_coretime::{mock_helpers::GenesisConfigBuilder, pallet::Error, Schedule},
|
||||
assigner_coretime::{mock_helpers::GenesisConfigBuilder, pezpallet::Error, Schedule},
|
||||
initializer::SessionChangeNotification,
|
||||
mock::{
|
||||
new_test_ext, CoretimeAssigner, OnDemand, Paras, ParasShared, RuntimeOrigin, Scheduler,
|
||||
@@ -76,7 +76,7 @@ fn run_to_block(
|
||||
// Update the spot traffic and revenue on every block.
|
||||
OnDemand::on_initialize(b + 1);
|
||||
|
||||
// In the real runtime this is expected to be called by the `InclusionInherent` pallet.
|
||||
// In the real runtime this is expected to be called by the `InclusionInherent` pezpallet.
|
||||
Scheduler::advance_claim_queue(&Default::default());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,13 +422,13 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
/// way.
|
||||
fn run_to_block(to: u32) {
|
||||
let to = to.into();
|
||||
while pezframe_system::Pallet::<T>::block_number() < to {
|
||||
let b = pezframe_system::Pallet::<T>::block_number();
|
||||
initializer::Pallet::<T>::on_finalize(b);
|
||||
while pezframe_system::Pezpallet::<T>::block_number() < to {
|
||||
let b = pezframe_system::Pezpallet::<T>::block_number();
|
||||
initializer::Pezpallet::<T>::on_finalize(b);
|
||||
|
||||
let b = b + One::one();
|
||||
pezframe_system::Pallet::<T>::set_block_number(b);
|
||||
initializer::Pallet::<T>::on_initialize(b);
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(b);
|
||||
initializer::Pezpallet::<T>::on_initialize(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
let para_id = ParaId::from(i as u32);
|
||||
let validation_code = mock_validation_code();
|
||||
|
||||
paras::Pallet::<T>::schedule_para_initialize(
|
||||
paras::Pezpallet::<T>::schedule_para_initialize(
|
||||
para_id,
|
||||
paras::ParaGenesisArgs {
|
||||
genesis_head: Self::mock_head_data(),
|
||||
@@ -451,7 +451,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<T>::add_trusted_validation_code(
|
||||
paras::Pezpallet::<T>::add_trusted_validation_code(
|
||||
pezframe_system::Origin::<T>::Root.into(),
|
||||
validation_code,
|
||||
)
|
||||
@@ -484,7 +484,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
) -> Self {
|
||||
let mut block = 1;
|
||||
for session in 0..target_session {
|
||||
initializer::Pallet::<T>::test_trigger_on_new_session(
|
||||
initializer::Pezpallet::<T>::test_trigger_on_new_session(
|
||||
false,
|
||||
session,
|
||||
validators.iter().map(|(a, v)| (a, v.clone())),
|
||||
@@ -494,19 +494,19 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
Self::run_to_block(block);
|
||||
}
|
||||
|
||||
initializer::Pallet::<T>::test_trigger_on_new_session(
|
||||
initializer::Pezpallet::<T>::test_trigger_on_new_session(
|
||||
false,
|
||||
block - 1,
|
||||
validators.iter().map(|(a, v)| (a, v.clone())),
|
||||
None,
|
||||
);
|
||||
initializer::Pallet::<T>::on_finalize(block.into());
|
||||
initializer::Pezpallet::<T>::on_finalize(block.into());
|
||||
let block_number = BlockNumberFor::<T>::from(block + 1);
|
||||
let header = Self::header(block_number);
|
||||
|
||||
pezframe_system::Pallet::<T>::reset_events();
|
||||
pezframe_system::Pallet::<T>::initialize(&header.number(), &header.hash(), header.digest());
|
||||
initializer::Pallet::<T>::on_initialize(*header.number());
|
||||
pezframe_system::Pezpallet::<T>::reset_events();
|
||||
pezframe_system::Pezpallet::<T>::initialize(&header.number(), &header.hash(), header.digest());
|
||||
initializer::Pezpallet::<T>::on_initialize(*header.number());
|
||||
|
||||
assert_eq!(shared::CurrentSessionIndex::<T>::get(), target_session);
|
||||
|
||||
@@ -545,7 +545,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
for _chain_idx in 0..elastic_paras.get(&seed).cloned().unwrap_or(1) {
|
||||
let core_idx = CoreIndex::from(current_core_idx);
|
||||
let group_idx =
|
||||
scheduler::Pallet::<T>::group_assigned_to_core(core_idx, self.block_number)
|
||||
scheduler::Pezpallet::<T>::group_assigned_to_core(core_idx, self.block_number)
|
||||
.unwrap();
|
||||
|
||||
Self::add_availability(
|
||||
@@ -612,7 +612,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
let core_idx = CoreIndex::from(current_core_idx);
|
||||
// Advance core index.
|
||||
current_core_idx += 1;
|
||||
let group_idx = scheduler::Pallet::<T>::group_assigned_to_core(
|
||||
let group_idx = scheduler::Pezpallet::<T>::group_assigned_to_core(
|
||||
core_idx,
|
||||
self.block_number,
|
||||
)
|
||||
@@ -629,7 +629,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
|
||||
if chain_idx == 0 {
|
||||
// Only first parahead of the chain needs to be set in storage.
|
||||
paras::Pallet::<T>::heads_insert(¶_id, head_data.clone());
|
||||
paras::Pezpallet::<T>::heads_insert(¶_id, head_data.clone());
|
||||
} else {
|
||||
// Make each candidate head data unique to avoid cycles.
|
||||
head_data.0[0] = chain_idx;
|
||||
@@ -655,7 +655,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
past_code_meta.note_replacement(0u32.into(), 0u32.into());
|
||||
|
||||
let group_validators =
|
||||
scheduler::Pallet::<T>::group_validators(group_idx).unwrap();
|
||||
scheduler::Pezpallet::<T>::group_validators(group_idx).unwrap();
|
||||
|
||||
let descriptor = CandidateDescriptorV2::new(
|
||||
para_id,
|
||||
@@ -767,7 +767,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
current_core_idx +=1;
|
||||
|
||||
let group_idx =
|
||||
scheduler::Pallet::<T>::group_assigned_to_core(core_idx, self.block_number)
|
||||
scheduler::Pezpallet::<T>::group_assigned_to_core(core_idx, self.block_number)
|
||||
.unwrap();
|
||||
|
||||
let candidate_hash = CandidateHash(H256::from(byte32_slice_from(seed)));
|
||||
@@ -843,7 +843,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
// NOTE: there is an n+2 session delay for these actions to take effect.
|
||||
// We are currently in Session 0, so these changes will take effect in Session 2.
|
||||
Self::setup_para_ids(used_cores - extra_cores);
|
||||
configuration::Pallet::<T>::set_coretime_cores_unchecked(used_cores as u32).unwrap();
|
||||
configuration::Pezpallet::<T>::set_coretime_cores_unchecked(used_cores as u32).unwrap();
|
||||
|
||||
let validator_ids = generate_validator_pairs::<T>(self.max_validators());
|
||||
let target_session = SessionIndex::from(self.target_session);
|
||||
@@ -852,7 +852,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
let bitfields = builder.create_availability_bitfields(
|
||||
&builder.backed_and_concluding_paras,
|
||||
&builder.elastic_paras,
|
||||
scheduler::Pallet::<T>::num_availability_cores(),
|
||||
scheduler::Pezpallet::<T>::num_availability_cores(),
|
||||
);
|
||||
|
||||
let mut backed_in_inherent = BTreeMap::new();
|
||||
@@ -885,7 +885,7 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
let mut core_idx = 0u32;
|
||||
let elastic_paras = &builder.elastic_paras;
|
||||
|
||||
let mut occupied_cores = inclusion::Pallet::<T>::get_occupied_cores()
|
||||
let mut occupied_cores = inclusion::Pezpallet::<T>::get_occupied_cores()
|
||||
.map(|(core, candidate)| (core, candidate.candidate_descriptor().para_id()))
|
||||
.collect::<Vec<_>>();
|
||||
occupied_cores.sort_by(|(core_a, _), (core_b, _)| core_a.0.cmp(&core_b.0));
|
||||
|
||||
@@ -41,7 +41,7 @@ mod benchmarking;
|
||||
|
||||
pub mod migration;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
use pezkuwi_primitives::SchedulerParams;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::configuration";
|
||||
@@ -507,8 +507,8 @@ impl WeightInfo for TestWeightInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
/// The in-code storage version.
|
||||
@@ -529,26 +529,26 @@ pub mod pallet {
|
||||
/// v11-12: <https://github.com/pezkuwichain/kurdistan-sdk/issues/112>
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(12);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + shared::Config {
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The new value for a configuration parameter is invalid.
|
||||
InvalidNewValue,
|
||||
}
|
||||
|
||||
/// The active configuration for the current session.
|
||||
#[pallet::storage]
|
||||
#[pallet::whitelist_storage]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::whitelist_storage]
|
||||
pub type ActiveConfig<T: Config> =
|
||||
StorageValue<_, HostConfiguration<BlockNumberFor<T>>, ValueQuery>;
|
||||
|
||||
@@ -559,22 +559,22 @@ pub mod pallet {
|
||||
///
|
||||
/// The list is sorted ascending by session index. Also, this list can only contain at most
|
||||
/// 2 items: for the next session and for the `scheduled_session`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type PendingConfigs<T: Config> =
|
||||
StorageValue<_, Vec<(SessionIndex, HostConfiguration<BlockNumberFor<T>>)>, ValueQuery>;
|
||||
|
||||
/// If this is set, then the configuration setters will bypass the consistency checks. This
|
||||
/// is meant to be used only as the last resort.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type BypassConsistencyCheck<T: Config> = StorageValue<_, bool, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub config: HostConfiguration<BlockNumberFor<T>>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
self.config.panic_if_not_consistent();
|
||||
@@ -582,11 +582,11 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set the validation upgrade cooldown.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -601,8 +601,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the validation upgrade delay.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -617,8 +617,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the acceptance period for an included candidate.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -633,8 +633,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the max validation code size for incoming upgrades.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -646,8 +646,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the max POV block size for incoming upgrades.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -659,8 +659,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the max head data size for paras.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -675,8 +675,8 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE: that this configuration is managed by the coretime chain. Only manually change
|
||||
/// this, if you really know what you are doing!
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -688,8 +688,8 @@ pub mod pallet {
|
||||
// Call index 7 used to be `set_max_availability_timeouts`, which was removed.
|
||||
|
||||
/// Set the teyrchain validator-group rotation frequency
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(8)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -704,8 +704,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the availability period for paras.
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(9)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -720,8 +720,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the scheduling lookahead, in expected number of blocks at peak throughput.
|
||||
#[pallet::call_index(11)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(11)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -733,8 +733,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the maximum number of validators to assign to any core.
|
||||
#[pallet::call_index(12)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(12)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_option_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -749,8 +749,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the maximum number of validators to use in teyrchain consensus.
|
||||
#[pallet::call_index(13)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(13)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_option_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -762,8 +762,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the dispute period, in number of sessions to keep for disputes.
|
||||
#[pallet::call_index(14)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(14)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -775,8 +775,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the dispute post conclusion acceptance period.
|
||||
#[pallet::call_index(15)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(15)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -792,8 +792,8 @@ pub mod pallet {
|
||||
|
||||
/// Set the no show slots, in number of number of consensus slots.
|
||||
/// Must be at least 1.
|
||||
#[pallet::call_index(18)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(18)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -805,8 +805,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the total number of delay tranches.
|
||||
#[pallet::call_index(19)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(19)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -818,8 +818,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the zeroth delay tranche width.
|
||||
#[pallet::call_index(20)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(20)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -831,8 +831,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the number of validators needed to approve a block.
|
||||
#[pallet::call_index(21)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(21)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -844,8 +844,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the number of samples to do of the `RelayVRFModulo` approval assignment criterion.
|
||||
#[pallet::call_index(22)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(22)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -857,8 +857,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum items that can present in a upward dispatch queue at once.
|
||||
#[pallet::call_index(23)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(23)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -871,8 +871,8 @@ pub mod pallet {
|
||||
|
||||
/// Sets the maximum total size of items that can present in a upward dispatch queue at
|
||||
/// once.
|
||||
#[pallet::call_index(24)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(24)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -885,8 +885,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the critical downward message size.
|
||||
#[pallet::call_index(25)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(25)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -898,8 +898,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum size of an upward message that can be sent by a candidate.
|
||||
#[pallet::call_index(27)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(27)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -911,8 +911,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of messages that a candidate can contain.
|
||||
#[pallet::call_index(28)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(28)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -927,8 +927,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the number of sessions after which an HRMP open channel request expires.
|
||||
#[pallet::call_index(29)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(29)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_hrmp_open_request_ttl(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -939,8 +939,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the amount of funds that the sender should provide for opening an HRMP channel.
|
||||
#[pallet::call_index(30)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(30)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_balance(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -953,8 +953,8 @@ pub mod pallet {
|
||||
|
||||
/// Sets the amount of funds that the recipient should provide for accepting opening an HRMP
|
||||
/// channel.
|
||||
#[pallet::call_index(31)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(31)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_balance(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -966,8 +966,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of messages allowed in an HRMP channel at once.
|
||||
#[pallet::call_index(32)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(32)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -979,8 +979,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum total size of messages in bytes allowed in an HRMP channel at once.
|
||||
#[pallet::call_index(33)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(33)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -992,8 +992,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of inbound HRMP channels a teyrchain is allowed to accept.
|
||||
#[pallet::call_index(34)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(34)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1008,8 +1008,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum size of a message that could ever be put into an HRMP channel.
|
||||
#[pallet::call_index(36)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(36)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1021,8 +1021,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of outbound HRMP channels a teyrchain is allowed to open.
|
||||
#[pallet::call_index(37)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(37)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1037,8 +1037,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Sets the maximum number of outbound HRMP messages can be sent by a candidate.
|
||||
#[pallet::call_index(39)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(39)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1053,8 +1053,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the number of session changes after which a PVF pre-checking voting is rejected.
|
||||
#[pallet::call_index(42)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(42)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1069,8 +1069,8 @@ pub mod pallet {
|
||||
/// upgrade taking place.
|
||||
///
|
||||
/// See the field documentation for information and constraints for the new value.
|
||||
#[pallet::call_index(43)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(43)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_block_number(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1086,8 +1086,8 @@ pub mod pallet {
|
||||
|
||||
/// Setting this to true will disable consistency checks for the configuration setters.
|
||||
/// Use with caution.
|
||||
#[pallet::call_index(44)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(44)]
|
||||
#[pezpallet::weight((
|
||||
T::DbWeight::get().writes(1),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1098,8 +1098,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the asynchronous backing parameters.
|
||||
#[pallet::call_index(45)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(45)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_option_u32(), // The same size in bytes.
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1114,8 +1114,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set PVF executor parameters.
|
||||
#[pallet::call_index(46)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(46)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_executor_params(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1127,8 +1127,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the on demand (parathreads) base fee.
|
||||
#[pallet::call_index(47)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(47)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_balance(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1140,8 +1140,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the on demand (parathreads) fee variability.
|
||||
#[pallet::call_index(48)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(48)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_perbill(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1153,8 +1153,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the on demand (parathreads) queue max size.
|
||||
#[pallet::call_index(49)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(49)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_option_u32(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1166,8 +1166,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the on demand (parathreads) fee variability.
|
||||
#[pallet::call_index(50)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(50)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_perbill(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1184,8 +1184,8 @@ pub mod pallet {
|
||||
// Call index 51 used to be `set_on_demand_ttl`, which was removed.
|
||||
|
||||
/// Set the minimum backing votes threshold.
|
||||
#[pallet::call_index(52)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(52)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_u32(),
|
||||
DispatchClass::Operational
|
||||
))]
|
||||
@@ -1197,8 +1197,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set/Unset a node feature.
|
||||
#[pallet::call_index(53)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(53)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_node_feature(),
|
||||
DispatchClass::Operational
|
||||
))]
|
||||
@@ -1215,8 +1215,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set approval-voting-params.
|
||||
#[pallet::call_index(54)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(54)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_executor_params(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1231,8 +1231,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set scheduler-params.
|
||||
#[pallet::call_index(55)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(55)]
|
||||
#[pezpallet::weight((
|
||||
T::WeightInfo::set_config_with_scheduler_params(),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
@@ -1247,7 +1247,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set coretime cores.
|
||||
///
|
||||
/// To be used if authorization is checked otherwise.
|
||||
@@ -1258,14 +1258,14 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn integrity_test() {
|
||||
assert_eq!(
|
||||
&ActiveConfig::<T>::hashed_key(),
|
||||
pezkuwi_primitives::well_known_keys::ACTIVE_CONFIG,
|
||||
"`well_known_keys::ACTIVE_CONFIG` doesn't match key of `ActiveConfig`! Make sure that the name of the\
|
||||
configuration pallet is `Configuration` in the runtime!",
|
||||
configuration pezpallet is `Configuration` in the runtime!",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1280,13 +1280,13 @@ pub struct SessionChangeOutcome<BlockNumber> {
|
||||
pub new_config: Option<HostConfiguration<BlockNumber>>,
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the configuration pallet.
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Called by the initializer to initialize the configuration pezpallet.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the configuration pallet.
|
||||
/// Called by the initializer to finalize the configuration pezpallet.
|
||||
pub(crate) fn initializer_finalize() {}
|
||||
|
||||
/// Called by the initializer to note that a new session has started.
|
||||
@@ -1331,7 +1331,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Return the session index that should be used for any future scheduled changes.
|
||||
fn scheduled_session() -> SessionIndex {
|
||||
shared::Pallet::<T>::scheduled_session()
|
||||
shared::Pezpallet::<T>::scheduled_session()
|
||||
}
|
||||
|
||||
/// Forcibly set the active config. This should be used with extreme care, and typically
|
||||
@@ -1454,7 +1454,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// The implementation of `Get<(u32, u32)>` which reads `ActiveConfig` and returns `P` percent of
|
||||
/// `hrmp_channel_max_message_size` / `hrmp_channel_max_capacity`.
|
||||
pub struct ActiveConfigHrmpChannelSizeAndCapacityRatio<T, P>(core::marker::PhantomData<(T, P)>);
|
||||
impl<T: crate::hrmp::pallet::Config, P: Get<Percent>> Get<(u32, u32)>
|
||||
impl<T: crate::hrmp::pezpallet::Config, P: Get<Percent>> Get<(u32, u32)>
|
||||
for ActiveConfigHrmpChannelSizeAndCapacityRatio<T, P>
|
||||
{
|
||||
fn get() -> (u32, u32) {
|
||||
|
||||
@@ -100,7 +100,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{Config, Pallet};
|
||||
use crate::configuration::{Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
@@ -139,11 +139,11 @@ mod v9 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V9HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -154,11 +154,11 @@ mod v10 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V10HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -180,7 +180,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateToV10<T> {
|
||||
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),
|
||||
Pezpallet::<T>::on_chain_storage_version() >= StorageVersion::new(10),
|
||||
"Storage version should be >= 10 after the migration"
|
||||
);
|
||||
|
||||
@@ -192,7 +192,7 @@ pub type MigrateToV10<T> = pezframe_support::migrations::VersionedMigration<
|
||||
9,
|
||||
10,
|
||||
VersionUncheckedMigrateToV10<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -366,7 +366,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there're no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v10_no_pending() {
|
||||
let v9 = V9HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{self, Config, Pallet};
|
||||
use crate::configuration::{self, Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
migrations::VersionedMigration,
|
||||
@@ -144,11 +144,11 @@ mod v10 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V10HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V10HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -159,11 +159,11 @@ mod v11 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V11HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -173,7 +173,7 @@ pub type MigrateToV11<T> = VersionedMigration<
|
||||
10,
|
||||
11,
|
||||
UncheckedMigrateToV11<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -198,7 +198,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV11<T> {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 11,
|
||||
"Storage version should be >= 11 after the migration"
|
||||
);
|
||||
|
||||
@@ -422,7 +422,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there're no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v11_no_pending() {
|
||||
let v10 = V10HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{self, migration::v11::V11HostConfiguration, Config, Pallet};
|
||||
use crate::configuration::{self, migration::v11::V11HostConfiguration, Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
migrations::VersionedMigration,
|
||||
@@ -35,11 +35,11 @@ mod v11 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V11HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V11HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -50,11 +50,11 @@ mod v12 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V12HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V12HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V12HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -64,7 +64,7 @@ pub type MigrateToV12<T> = VersionedMigration<
|
||||
11,
|
||||
12,
|
||||
UncheckedMigrateToV12<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -90,7 +90,7 @@ impl<T: Config> UncheckedOnRuntimeUpgrade for UncheckedMigrateToV12<T> {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 12,
|
||||
"Storage version should be >= 12 after the migration"
|
||||
);
|
||||
|
||||
@@ -340,7 +340,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there are no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v12_no_pending() {
|
||||
let v11 = V11HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Contains the V6 storage definition of the host configuration.
|
||||
|
||||
use crate::configuration::{Config, Pallet};
|
||||
use crate::configuration::{Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::BlockNumberFor;
|
||||
@@ -124,11 +124,11 @@ mod v6 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V6HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{self, Config, Pallet};
|
||||
use crate::configuration::{self, Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
@@ -129,11 +129,11 @@ mod v6 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V6HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V6HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -144,11 +144,11 @@ mod v7 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V7HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -164,11 +164,11 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV7<T> {
|
||||
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
log::info!(target: configuration::LOG_TARGET, "MigrateToV7 started");
|
||||
if StorageVersion::get::<Pallet<T>>() == 6 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() == 6 {
|
||||
let weight_consumed = migrate_to_v7::<T>();
|
||||
|
||||
log::info!(target: configuration::LOG_TARGET, "MigrateToV7 executed successfully");
|
||||
StorageVersion::new(7).put::<Pallet<T>>();
|
||||
StorageVersion::new(7).put::<Pezpallet<T>>();
|
||||
|
||||
weight_consumed
|
||||
} else {
|
||||
@@ -181,7 +181,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV7<T> {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 7,
|
||||
"Storage version should be >= 7 after the migration"
|
||||
);
|
||||
|
||||
@@ -388,7 +388,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there're no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v7_no_pending() {
|
||||
let v6 = V6HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{self, Config, Pallet};
|
||||
use crate::configuration::{self, Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
@@ -136,11 +136,11 @@ mod v7 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V7HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V7HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -151,11 +151,11 @@ mod v8 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V8HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -171,11 +171,11 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV8<T> {
|
||||
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
log::info!(target: configuration::LOG_TARGET, "HostConfiguration MigrateToV8 started");
|
||||
if StorageVersion::get::<Pallet<T>>() == 7 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() == 7 {
|
||||
let weight_consumed = migrate_to_v8::<T>();
|
||||
|
||||
log::info!(target: configuration::LOG_TARGET, "HostConfiguration MigrateToV8 executed successfully");
|
||||
StorageVersion::new(8).put::<Pallet<T>>();
|
||||
StorageVersion::new(8).put::<Pezpallet<T>>();
|
||||
|
||||
weight_consumed
|
||||
} else {
|
||||
@@ -188,7 +188,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV8<T> {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 8,
|
||||
"Storage version should be >= 8 after the migration"
|
||||
);
|
||||
|
||||
@@ -401,7 +401,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there're no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v8_no_pending() {
|
||||
let v7 = V7HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! A module that is responsible for migration of storage.
|
||||
|
||||
use crate::configuration::{self, Config, Pallet};
|
||||
use crate::configuration::{self, Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*,
|
||||
@@ -139,11 +139,11 @@ mod v8 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V8HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V8HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -154,11 +154,11 @@ mod v9 {
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type ActiveConfig<T: Config> =
|
||||
StorageValue<Pallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
StorageValue<Pezpallet<T>, V9HostConfiguration<BlockNumberFor<T>>, OptionQuery>;
|
||||
|
||||
#[pezframe_support::storage_alias]
|
||||
pub(crate) type PendingConfigs<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Vec<(SessionIndex, V9HostConfiguration<BlockNumberFor<T>>)>,
|
||||
OptionQuery,
|
||||
>;
|
||||
@@ -174,11 +174,11 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV9<T> {
|
||||
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
log::info!(target: configuration::LOG_TARGET, "HostConfiguration MigrateToV9 started");
|
||||
if StorageVersion::get::<Pallet<T>>() == 8 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() == 8 {
|
||||
let weight_consumed = migrate_to_v9::<T>();
|
||||
|
||||
log::info!(target: configuration::LOG_TARGET, "HostConfiguration MigrateToV9 executed successfully");
|
||||
StorageVersion::new(9).put::<Pallet<T>>();
|
||||
StorageVersion::new(9).put::<Pezpallet<T>>();
|
||||
|
||||
weight_consumed
|
||||
} else {
|
||||
@@ -191,7 +191,7 @@ impl<T: Config> OnRuntimeUpgrade for MigrateToV9<T> {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 9,
|
||||
"Storage version should be >= 9 after the migration"
|
||||
);
|
||||
|
||||
@@ -406,7 +406,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Test that migration doesn't panic in case there're no pending configurations upgrades in
|
||||
// pallet's storage.
|
||||
// pezpallet's storage.
|
||||
#[test]
|
||||
fn test_migrate_to_v9_no_pending() {
|
||||
let v8 = V8HostConfiguration::<pezkuwi_primitives::BlockNumber>::default();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Coretime pallet benchmarking.
|
||||
//! Coretime pezpallet benchmarking.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
@@ -32,7 +32,7 @@ mod benchmarks {
|
||||
fn request_revenue_at() {
|
||||
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
|
||||
let mhr = <T as on_demand::Config>::MaxHistoricalRevenue::get();
|
||||
pezframe_system::Pallet::<T>::set_block_number((mhr + 2).into());
|
||||
pezframe_system::Pezpallet::<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 pezframe_support::traits::Currency<
|
||||
@@ -46,7 +46,7 @@ mod benchmarks {
|
||||
crate::paras::Heads::<T>::insert(ParaId::from(T::BrokerId::get()), vec![1, 2, 3]);
|
||||
|
||||
<T as on_demand::Config>::Currency::make_free_balance_be(
|
||||
&<on_demand::Pallet<T>>::account_id(),
|
||||
&<on_demand::Pezpallet<T>>::account_id(),
|
||||
minimum_balance * (mhr * (mhr + 1)).into(),
|
||||
);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Migrations for the Coretime pallet.
|
||||
//! Migrations for the Coretime pezpallet.
|
||||
|
||||
pub use v_coretime::{GetLegacyLease, MigrateToCoretime};
|
||||
|
||||
@@ -70,11 +70,11 @@ mod v_coretime {
|
||||
> MigrateToCoretime<T, XcmSender, LegacyLease, TIMESLICE_PERIOD>
|
||||
{
|
||||
fn already_migrated() -> bool {
|
||||
// We are using the assigner coretime because the coretime pallet doesn't has any
|
||||
// We are using the assigner coretime because the coretime pezpallet doesn't has any
|
||||
// storage data. But both pallets are introduced at the same time, so this is fine.
|
||||
let name_hash = assigner_coretime::Pallet::<T>::name_hash();
|
||||
let name_hash = assigner_coretime::Pezpallet::<T>::name_hash();
|
||||
let mut next_key = name_hash.to_vec();
|
||||
let storage_version_key = StorageVersion::storage_key::<assigner_coretime::Pallet<T>>();
|
||||
let storage_version_key = StorageVersion::storage_key::<assigner_coretime::Pezpallet<T>>();
|
||||
|
||||
loop {
|
||||
match pezsp_io::storage::next_key(&next_key) {
|
||||
@@ -82,7 +82,7 @@ mod v_coretime {
|
||||
Some(key) if &key == &storage_version_key => {
|
||||
next_key = key;
|
||||
},
|
||||
// If there is any other key with the prefix of the pallet,
|
||||
// If there is any other key with the prefix of the pezpallet,
|
||||
// we already have executed the migration.
|
||||
Some(key) if key.starts_with(&name_hash) => {
|
||||
log::info!("`MigrateToCoretime` already executed!");
|
||||
@@ -122,7 +122,7 @@ mod v_coretime {
|
||||
let total_core_count = config.scheduler_params.num_cores + legacy_paras.len() as u32;
|
||||
|
||||
let dmp_queue_size =
|
||||
crate::dmp::Pallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
|
||||
crate::dmp::Pezpallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
|
||||
|
||||
let total_core_count = total_core_count as u32;
|
||||
|
||||
@@ -141,7 +141,7 @@ mod v_coretime {
|
||||
<(u32, u32)>::decode(&mut &state[..]).unwrap();
|
||||
|
||||
let dmp_queue_size =
|
||||
crate::dmp::Pallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
|
||||
crate::dmp::Pezpallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
let new_core_count = config.scheduler_params.num_cores;
|
||||
ensure!(new_core_count == prev_core_count, "Total number of cores need to not change.");
|
||||
@@ -165,9 +165,9 @@ mod v_coretime {
|
||||
>() -> Weight {
|
||||
let legacy_paras = LegacyLease::get_all_teyrchains_with_leases();
|
||||
let legacy_count = legacy_paras.len() as u32;
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
for (core, para_id) in legacy_paras.into_iter().enumerate() {
|
||||
let r = assigner_coretime::Pallet::<T>::assign_core(
|
||||
let r = assigner_coretime::Pezpallet::<T>::assign_core(
|
||||
CoreIndex(core as u32),
|
||||
now,
|
||||
vec![(CoreAssignment::Task(para_id.into()), PartsOf57600::FULL)],
|
||||
@@ -185,7 +185,7 @@ mod v_coretime {
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
for on_demand in 0..config.scheduler_params.num_cores {
|
||||
let core = CoreIndex(legacy_count.saturating_add(on_demand as _));
|
||||
let r = assigner_coretime::Pallet::<T>::assign_core(
|
||||
let r = assigner_coretime::Pezpallet::<T>::assign_core(
|
||||
core,
|
||||
now,
|
||||
vec![(CoreAssignment::Pool, PartsOf57600::FULL)],
|
||||
|
||||
@@ -25,7 +25,7 @@ use pezframe_support::{
|
||||
traits::{defensive_prelude::*, Currency},
|
||||
};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
use pezpallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
|
||||
use pezkuwi_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId};
|
||||
use pezsp_arithmetic::traits::SaturatedConversion;
|
||||
@@ -75,7 +75,7 @@ pub type BalanceOf<T> = <<T as on_demand::Config>::Currency as Currency<
|
||||
<T as pezframe_system::Config>::AccountId,
|
||||
>>::Balance;
|
||||
|
||||
/// Broker pallet index on the coretime chain. Used to
|
||||
/// Broker pezpallet index on the coretime chain. Used to
|
||||
///
|
||||
/// construct remote calls. The codec index must correspond to the index of `Broker` in the
|
||||
/// `construct_runtime` of the coretime chain.
|
||||
@@ -85,7 +85,7 @@ enum BrokerRuntimePallets {
|
||||
Broker(CoretimeCalls),
|
||||
}
|
||||
|
||||
/// Call encoding for the calls needed from the Broker pallet.
|
||||
/// Call encoding for the calls needed from the Broker pezpallet.
|
||||
#[derive(Encode, Decode)]
|
||||
enum CoretimeCalls {
|
||||
#[codec(index = 1)]
|
||||
@@ -100,8 +100,8 @@ enum CoretimeCalls {
|
||||
SwapLeases(ParaId, ParaId),
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
|
||||
use crate::configuration;
|
||||
use pezsp_runtime::traits::TryConvert;
|
||||
@@ -110,23 +110,23 @@ pub mod pallet {
|
||||
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
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 pezframe_system::Config>::RuntimeEvent>;
|
||||
/// The ParaId of the coretime chain.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type BrokerId: Get<u32>;
|
||||
/// The coretime chain pot location.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type BrokerPotLocation: Get<InteriorLocation>;
|
||||
/// Something that provides the weight of this pallet.
|
||||
/// Something that provides the weight of this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
/// The XCM sender.
|
||||
type SendXcm: SendXcm;
|
||||
@@ -141,8 +141,8 @@ pub mod pallet {
|
||||
type MaxXcmTransactWeight: Get<Weight>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// The broker chain has asked for revenue information for a specific block.
|
||||
RevenueInfoRequested { when: BlockNumberFor<T> },
|
||||
@@ -150,7 +150,7 @@ pub mod pallet {
|
||||
CoreAssigned { core: CoreIndex },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The paraid making the call is not the coretime brokerage system teyrchain.
|
||||
NotBroker,
|
||||
@@ -161,40 +161,40 @@ pub mod pallet {
|
||||
AssetTransferFailed,
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Request the configuration to be updated with the specified number of cores. Warning:
|
||||
/// Since this only schedules a configuration update, it takes two sessions to come into
|
||||
/// effect.
|
||||
///
|
||||
/// - `origin`: Root or the Coretime Chain
|
||||
/// - `count`: total number of cores
|
||||
#[pallet::weight(<T as Config>::WeightInfo::request_core_count())]
|
||||
#[pallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::request_core_count())]
|
||||
#[pezpallet::call_index(1)]
|
||||
pub fn request_core_count(origin: OriginFor<T>, count: u16) -> DispatchResult {
|
||||
// Ignore requests not coming from the coretime chain or root.
|
||||
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
|
||||
|
||||
configuration::Pallet::<T>::set_coretime_cores_unchecked(u32::from(count))
|
||||
configuration::Pezpallet::<T>::set_coretime_cores_unchecked(u32::from(count))
|
||||
}
|
||||
|
||||
/// Request to claim the instantaneous coretime sales revenue starting from the block it was
|
||||
/// last claimed until and up to the block specified. The claimed amount value is sent back
|
||||
/// to the Coretime chain in a `notify_revenue` message. At the same time, the amount is
|
||||
/// teleported to the Coretime chain.
|
||||
#[pallet::weight(<T as Config>::WeightInfo::request_revenue_at())]
|
||||
#[pallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::request_revenue_at())]
|
||||
#[pezpallet::call_index(2)]
|
||||
pub fn request_revenue_at(origin: OriginFor<T>, when: BlockNumber) -> DispatchResult {
|
||||
// Ignore requests not coming from the Coretime Chain or Root.
|
||||
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
|
||||
Self::notify_revenue(when)
|
||||
}
|
||||
|
||||
#[pallet::weight(<T as Config>::WeightInfo::credit_account())]
|
||||
#[pallet::call_index(3)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::credit_account())]
|
||||
#[pezpallet::call_index(3)]
|
||||
pub fn credit_account(
|
||||
origin: OriginFor<T>,
|
||||
who: T::AccountId,
|
||||
@@ -203,7 +203,7 @@ pub mod pallet {
|
||||
// Ignore requests not coming from the coretime chain or root.
|
||||
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
|
||||
|
||||
on_demand::Pallet::<T>::credit_account(who, amount.saturated_into());
|
||||
on_demand::Pezpallet::<T>::credit_account(who, amount.saturated_into());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -216,10 +216,10 @@ pub mod pallet {
|
||||
/// -`begin`: The starting blockheight of the instruction.
|
||||
/// -`assignment`: How the blockspace should be utilised.
|
||||
/// -`end_hint`: An optional hint as to when this particular set of instructions will end.
|
||||
// The broker pallet's `CoreIndex` definition is `u16` but on the relay chain it's `struct
|
||||
// The broker pezpallet's `CoreIndex` definition is `u16` but on the relay chain it's `struct
|
||||
// CoreIndex(u32)`
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::assign_core(assignment.len() as u32))]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::assign_core(assignment.len() as u32))]
|
||||
pub fn assign_core(
|
||||
origin: OriginFor<T>,
|
||||
core: BrokerCoreIndex,
|
||||
@@ -232,14 +232,14 @@ pub mod pallet {
|
||||
|
||||
let core = u32::from(core).into();
|
||||
|
||||
<assigner_coretime::Pallet<T>>::assign_core(core, begin, assignment, end_hint)?;
|
||||
<assigner_coretime::Pezpallet<T>>::assign_core(core, begin, assignment, end_hint)?;
|
||||
Self::deposit_event(Event::<T>::CoreAssigned { core });
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Ensure the origin is one of Root or the `para` itself.
|
||||
fn ensure_root_or_para(
|
||||
origin: <T as pezframe_system::Config>::RuntimeOrigin,
|
||||
@@ -287,13 +287,13 @@ 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 = <pezframe_system::Pallet<T>>::block_number();
|
||||
let now = <pezframe_system::Pezpallet<T>>::block_number();
|
||||
let until_bnf: BlockNumberFor<T> = until.into();
|
||||
|
||||
// When cannot be in the future.
|
||||
ensure!(until_bnf <= now, Error::<T>::RequestedFutureRevenue);
|
||||
|
||||
let amount = <on_demand::Pallet<T>>::claim_revenue_until(until_bnf);
|
||||
let amount = <on_demand::Pezpallet<T>>::claim_revenue_until(until_bnf);
|
||||
log::debug!(target: LOG_TARGET, "Revenue info requested: {:?}", amount);
|
||||
|
||||
let raw_revenue: Balance = amount.try_into().map_err(|_| {
|
||||
@@ -328,7 +328,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> OnNewSession<BlockNumberFor<T>> for Pallet<T> {
|
||||
impl<T: Config> OnNewSession<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_new_session(notification: &SessionChangeNotification<BlockNumberFor<T>>) {
|
||||
Self::initializer_on_new_session(notification);
|
||||
}
|
||||
@@ -353,7 +353,7 @@ fn do_notify_revenue<T: Config>(when: BlockNumber, raw_revenue: Balance) -> Resu
|
||||
|
||||
if raw_revenue > 0 {
|
||||
let on_demand_pot =
|
||||
T::AccountToLocation::try_convert(&<on_demand::Pallet<T>>::account_id()).map_err(
|
||||
T::AccountToLocation::try_convert(&<on_demand::Pezpallet<T>>::account_id()).map_err(
|
||||
|err| {
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
|
||||
@@ -102,10 +102,10 @@ pub trait SlashingHandler<BlockNumber> {
|
||||
backers: impl IntoIterator<Item = ValidatorIndex>,
|
||||
);
|
||||
|
||||
/// Called by the initializer to initialize the slashing pallet.
|
||||
/// Called by the initializer to initialize the slashing pezpallet.
|
||||
fn initializer_initialize(now: BlockNumber) -> Weight;
|
||||
|
||||
/// Called by the initializer to finalize the slashing pallet.
|
||||
/// Called by the initializer to finalize the slashing pezpallet.
|
||||
fn initializer_finalize();
|
||||
|
||||
/// Called by the initializer to note that a new session has started.
|
||||
@@ -238,10 +238,10 @@ pub trait DisputesHandler<BlockNumber: Ord> {
|
||||
/// Whether the given candidate concluded invalid in a dispute with supermajority.
|
||||
fn concluded_invalid(session: SessionIndex, candidate_hash: CandidateHash) -> bool;
|
||||
|
||||
/// Called by the initializer to initialize the disputes pallet.
|
||||
/// Called by the initializer to initialize the disputes pezpallet.
|
||||
fn initializer_initialize(now: BlockNumber) -> Weight;
|
||||
|
||||
/// Called by the initializer to finalize the disputes pallet.
|
||||
/// Called by the initializer to finalize the disputes pezpallet.
|
||||
fn initializer_finalize();
|
||||
|
||||
/// Called by the initializer to note that a new session has started.
|
||||
@@ -300,26 +300,26 @@ impl<BlockNumber: Ord> DisputesHandler<BlockNumber> for () {
|
||||
fn initializer_on_new_session(_notification: &SessionChangeNotification<BlockNumber>) {}
|
||||
}
|
||||
|
||||
impl<T: Config> DisputesHandler<BlockNumberFor<T>> for pallet::Pallet<T>
|
||||
impl<T: Config> DisputesHandler<BlockNumberFor<T>> for pezpallet::Pezpallet<T>
|
||||
where
|
||||
BlockNumberFor<T>: Ord,
|
||||
{
|
||||
fn is_frozen() -> bool {
|
||||
pallet::Pallet::<T>::is_frozen()
|
||||
pezpallet::Pezpallet::<T>::is_frozen()
|
||||
}
|
||||
|
||||
fn filter_dispute_data(
|
||||
set: DisputeStatementSet,
|
||||
post_conclusion_acceptance_period: BlockNumberFor<T>,
|
||||
) -> Option<CheckedDisputeStatementSet> {
|
||||
pallet::Pallet::<T>::filter_dispute_data(&set, post_conclusion_acceptance_period)
|
||||
pezpallet::Pezpallet::<T>::filter_dispute_data(&set, post_conclusion_acceptance_period)
|
||||
.filter_statement_set(set)
|
||||
}
|
||||
|
||||
fn process_checked_multi_dispute_data(
|
||||
statement_sets: &CheckedMultiDisputeStatementSet,
|
||||
) -> Result<Vec<(SessionIndex, CandidateHash)>, DispatchError> {
|
||||
pallet::Pallet::<T>::process_checked_multi_dispute_data(statement_sets)
|
||||
pezpallet::Pezpallet::<T>::process_checked_multi_dispute_data(statement_sets)
|
||||
}
|
||||
|
||||
fn note_included(
|
||||
@@ -327,30 +327,30 @@ where
|
||||
candidate_hash: CandidateHash,
|
||||
included_in: BlockNumberFor<T>,
|
||||
) {
|
||||
pallet::Pallet::<T>::note_included(session, candidate_hash, included_in)
|
||||
pezpallet::Pezpallet::<T>::note_included(session, candidate_hash, included_in)
|
||||
}
|
||||
|
||||
fn included_state(
|
||||
session: SessionIndex,
|
||||
candidate_hash: CandidateHash,
|
||||
) -> Option<BlockNumberFor<T>> {
|
||||
pallet::Pallet::<T>::included_state(session, candidate_hash)
|
||||
pezpallet::Pezpallet::<T>::included_state(session, candidate_hash)
|
||||
}
|
||||
|
||||
fn concluded_invalid(session: SessionIndex, candidate_hash: CandidateHash) -> bool {
|
||||
pallet::Pallet::<T>::concluded_invalid(session, candidate_hash)
|
||||
pezpallet::Pezpallet::<T>::concluded_invalid(session, candidate_hash)
|
||||
}
|
||||
|
||||
fn initializer_initialize(now: BlockNumberFor<T>) -> Weight {
|
||||
pallet::Pallet::<T>::initializer_initialize(now)
|
||||
pezpallet::Pezpallet::<T>::initializer_initialize(now)
|
||||
}
|
||||
|
||||
fn initializer_finalize() {
|
||||
pallet::Pallet::<T>::initializer_finalize()
|
||||
pezpallet::Pezpallet::<T>::initializer_finalize()
|
||||
}
|
||||
|
||||
fn initializer_on_new_session(notification: &SessionChangeNotification<BlockNumberFor<T>>) {
|
||||
pallet::Pallet::<T>::initializer_on_new_session(notification)
|
||||
pezpallet::Pezpallet::<T>::initializer_on_new_session(notification)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,38 +365,38 @@ impl WeightInfo for TestWeightInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pub use pallet::*;
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
pub use pezpallet::*;
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + session_info::Config {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RewardValidators: RewardValidators;
|
||||
type SlashingHandler: SlashingHandler<BlockNumberFor<Self>>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
/// The in-code storage version.
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// The last pruned session, if any. All data stored by this module
|
||||
/// references sessions.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type LastPrunedSession<T> = StorageValue<_, SessionIndex>;
|
||||
|
||||
/// All ongoing or concluded disputes for the last several sessions.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type Disputes<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -408,7 +408,7 @@ pub mod pallet {
|
||||
|
||||
/// Backing votes stored for each dispute.
|
||||
/// This storage is used for slashing.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type BackersOnDisputes<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -420,7 +420,7 @@ pub mod pallet {
|
||||
|
||||
/// All included blocks on the chain, as well as the block number in this chain that
|
||||
/// should be reverted back to if the candidate is disputed and determined to be invalid.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type Included<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -434,11 +434,11 @@ pub mod pallet {
|
||||
/// the chain will not accept any new teyrchain blocks for backing or inclusion,
|
||||
/// and its value indicates the last valid block number in the chain.
|
||||
/// It can only be set back to `None` by governance intervention.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Frozen<T: Config> = StorageValue<_, Option<BlockNumberFor<T>>, ValueQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// A dispute has been initiated. \[candidate hash, dispute location\]
|
||||
DisputeInitiated(CandidateHash, DisputeLocation),
|
||||
@@ -452,7 +452,7 @@ pub mod pallet {
|
||||
Revert(BlockNumberFor<T>),
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Duplicate dispute statement sets provided.
|
||||
DuplicateDisputeStatementSets,
|
||||
@@ -474,10 +474,10 @@ pub mod pallet {
|
||||
UnconfirmedDispute,
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
|
||||
pub fn force_unfreeze(origin: OriginFor<T>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Frozen::<T>::set(None);
|
||||
@@ -854,16 +854,16 @@ impl StatementSetFilter {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Called by the initializer to initialize the disputes module.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the disputes pallet.
|
||||
/// Called by the initializer to finalize the disputes pezpallet.
|
||||
pub(crate) fn initializer_finalize() {}
|
||||
|
||||
/// Called by the initializer to note a new session in the disputes pallet.
|
||||
/// Called by the initializer to note a new session in the disputes pezpallet.
|
||||
pub(crate) fn initializer_on_new_session(
|
||||
notification: &SessionChangeNotification<BlockNumberFor<T>>,
|
||||
) {
|
||||
@@ -889,7 +889,7 @@ impl<T: Config> Pallet<T> {
|
||||
#[allow(deprecated)]
|
||||
BackersOnDisputes::<T>::remove_prefix(to_prune, None);
|
||||
|
||||
// This is larger, and will be extracted to the `shared` pallet for more proper
|
||||
// This is larger, and will be extracted to the `shared` pezpallet for more proper
|
||||
// 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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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));
|
||||
pezframe_system::Pallet::<T>::deposit_log(
|
||||
pezframe_system::Pezpallet::<T>::deposit_log(
|
||||
ConsensusLog::Revert(revert.saturated_into()).into(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
);
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Storage migration(s) related to disputes pallet
|
||||
//! Storage migration(s) related to disputes pezpallet
|
||||
|
||||
use pezframe_support::traits::StorageVersion;
|
||||
|
||||
pub mod v1 {
|
||||
use super::*;
|
||||
use crate::disputes::{Config, Pallet};
|
||||
use crate::disputes::{Config, Pezpallet};
|
||||
use alloc::vec::Vec;
|
||||
use pezframe_support::{
|
||||
pezpallet_prelude::*, storage_alias, traits::OnRuntimeUpgrade, weights::Weight,
|
||||
@@ -28,17 +28,17 @@ pub mod v1 {
|
||||
use pezkuwi_primitives::SessionIndex;
|
||||
|
||||
#[storage_alias]
|
||||
type SpamSlots<T: Config> = StorageMap<Pallet<T>, Twox64Concat, SessionIndex, Vec<u32>>;
|
||||
type SpamSlots<T: Config> = StorageMap<Pezpallet<T>, Twox64Concat, SessionIndex, Vec<u32>>;
|
||||
|
||||
pub struct MigrateToV1<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let mut weight: Weight = Weight::zero();
|
||||
|
||||
if StorageVersion::get::<Pallet<T>>() < 1 {
|
||||
if StorageVersion::get::<Pezpallet<T>>() < 1 {
|
||||
log::info!(target: crate::disputes::LOG_TARGET, "Migrating disputes storage to v1");
|
||||
weight += migrate_to_v1::<T>();
|
||||
StorageVersion::new(1).put::<Pallet<T>>();
|
||||
StorageVersion::new(1).put::<Pezpallet<T>>();
|
||||
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
|
||||
} else {
|
||||
log::info!(
|
||||
@@ -58,7 +58,7 @@ pub mod v1 {
|
||||
SpamSlots::<T>::iter().count()
|
||||
);
|
||||
ensure!(
|
||||
StorageVersion::get::<Pallet<T>>() == 0,
|
||||
StorageVersion::get::<Pezpallet<T>>() == 0,
|
||||
"Storage version should be less than `1` before the migration",
|
||||
);
|
||||
Ok(Vec::new())
|
||||
@@ -68,7 +68,7 @@ pub mod v1 {
|
||||
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,
|
||||
StorageVersion::get::<Pezpallet<T>>() >= 1,
|
||||
"Storage version should be `1` after the migration"
|
||||
);
|
||||
ensure!(
|
||||
@@ -79,7 +79,7 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Migrates the pallet storage to the most recent version, checking and setting the
|
||||
/// Migrates the pezpallet storage to the most recent version, checking and setting the
|
||||
/// `StorageVersion`.
|
||||
pub fn migrate_to_v1<T: Config>() -> Weight {
|
||||
let mut weight: Weight = Weight::zero();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Dispute slashing pallet.
|
||||
//! Dispute slashing pezpallet.
|
||||
//!
|
||||
//! Once a dispute is concluded, we want to slash validators who were on the
|
||||
//! wrong side of the dispute.
|
||||
@@ -30,7 +30,7 @@
|
||||
//!
|
||||
//! Past session slashing edgecase:
|
||||
//!
|
||||
//! The `offences` pallet from Bizinikiwi provides us with a way to do both.
|
||||
//! The `offences` pezpallet 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.
|
||||
//!
|
||||
@@ -178,7 +178,7 @@ impl<C> Default for SlashValidatorsForDisputes<C> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> SlashValidatorsForDisputes<Pallet<T>>
|
||||
impl<T> SlashValidatorsForDisputes<Pezpallet<T>>
|
||||
where
|
||||
T: Config<KeyOwnerIdentification = IdentificationTuple<T>>,
|
||||
{
|
||||
@@ -191,7 +191,7 @@ where
|
||||
// We use `ValidatorSet::session_index` and not
|
||||
// `shared::CurrentSessionIndex::<T>::get()` because at the first block of a new era,
|
||||
// the `IdentificationOf` of a validator in the previous session might be
|
||||
// missing, while `shared` pallet would return the same session index as being
|
||||
// missing, while `shared` pezpallet would return the same session index as being
|
||||
// updated at the end of the block.
|
||||
let current_session = T::ValidatorSet::session_index();
|
||||
if session_index == current_session {
|
||||
@@ -262,7 +262,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> disputes::SlashingHandler<BlockNumberFor<T>> for SlashValidatorsForDisputes<Pallet<T>>
|
||||
impl<T> disputes::SlashingHandler<BlockNumberFor<T>> for SlashValidatorsForDisputes<Pezpallet<T>>
|
||||
where
|
||||
T: Config<KeyOwnerIdentification = IdentificationTuple<T>>,
|
||||
{
|
||||
@@ -311,15 +311,15 @@ where
|
||||
}
|
||||
|
||||
fn initializer_initialize(now: BlockNumberFor<T>) -> Weight {
|
||||
Pallet::<T>::initializer_initialize(now)
|
||||
Pezpallet::<T>::initializer_initialize(now)
|
||||
}
|
||||
|
||||
fn initializer_finalize() {
|
||||
Pallet::<T>::initializer_finalize()
|
||||
Pezpallet::<T>::initializer_finalize()
|
||||
}
|
||||
|
||||
fn initializer_on_new_session(session_index: SessionIndex) {
|
||||
Pallet::<T>::initializer_on_new_session(session_index)
|
||||
Pezpallet::<T>::initializer_on_new_session(session_index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ where
|
||||
/// an offchain context).
|
||||
pub trait HandleReports<T: Config> {
|
||||
/// The longevity, in blocks, that the offence report is valid for. When
|
||||
/// using the staking pallet this should be equal to the bonding duration
|
||||
/// using the staking pezpallet this should be equal to the bonding duration
|
||||
/// (in blocks, not eras).
|
||||
type ReportLongevity: Get<u64>;
|
||||
|
||||
@@ -387,14 +387,14 @@ impl WeightInfo for TestWeightInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pub use pallet::*;
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
pub use pezpallet::*;
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::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
|
||||
@@ -416,23 +416,23 @@ pub mod pallet {
|
||||
/// offence (after the slashing report has been validated) and for
|
||||
/// submitting a transaction to report a slash (from an offchain
|
||||
/// context). NOTE: when enabling slashing report handling (i.e. this
|
||||
/// type isn't set to `()`) you must use this pallet's
|
||||
/// type isn't set to `()`) you must use this pezpallet's
|
||||
/// `ValidateUnsigned` in the runtime definition.
|
||||
type HandleReports: HandleReports<Self>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
/// Benchmarking configuration.
|
||||
type BenchmarkingConfig: BenchmarkingConfiguration;
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
/// Validators pending dispute slashes.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type UnappliedSlashes<T> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -443,11 +443,11 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// `ValidatorSetCount` per session.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type ValidatorSetCounts<T> =
|
||||
StorageMap<_, Twox64Concat, SessionIndex, ValidatorSetCount>;
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The key ownership proof is invalid.
|
||||
InvalidKeyOwnershipProof,
|
||||
@@ -464,10 +464,10 @@ pub mod pallet {
|
||||
DuplicateSlashingReport,
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::report_dispute_lost_unsigned(
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::report_dispute_lost_unsigned(
|
||||
key_owner_proof.validator_count()
|
||||
))]
|
||||
pub fn report_dispute_lost_unsigned(
|
||||
@@ -530,8 +530,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::validate_unsigned]
|
||||
impl<T: Config> ValidateUnsigned for Pallet<T> {
|
||||
#[pezpallet::validate_unsigned]
|
||||
impl<T: Config> ValidateUnsigned for Pezpallet<T> {
|
||||
type Call = Call<T>;
|
||||
fn validate_unsigned(source: TransactionSource, call: &Self::Call) -> TransactionValidity {
|
||||
Self::validate_unsigned(source, call)
|
||||
@@ -543,17 +543,17 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Called by the initializer to initialize the disputes slashing module.
|
||||
fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the disputes slashing pallet.
|
||||
/// Called by the initializer to finalize the disputes slashing pezpallet.
|
||||
fn initializer_finalize() {}
|
||||
|
||||
/// Called by the initializer to note a new session in the disputes slashing
|
||||
/// pallet.
|
||||
/// pezpallet.
|
||||
fn initializer_on_new_session(session_index: SessionIndex) {
|
||||
// This should be small, as disputes are limited by spam slots, so no limit is
|
||||
// fine.
|
||||
@@ -585,7 +585,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// It restricts calls to `report_dispute_lost_unsigned` to local calls (i.e.
|
||||
/// extrinsics generated on this node) or that already in a block. This
|
||||
/// guarantees that only block authors can include unsigned slashing reports.
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
pub fn validate_unsigned(source: TransactionSource, call: &Call<T>) -> TransactionValidity {
|
||||
if let Call::report_dispute_lost_unsigned { dispute_proof, key_owner_proof } = call {
|
||||
// discard slashing report not coming from the local node
|
||||
|
||||
@@ -56,7 +56,7 @@ where
|
||||
use rand::{RngCore, SeedableRng};
|
||||
|
||||
let validator = T::Lookup::lookup(who).unwrap();
|
||||
let controller = pezpallet_staking::Pallet::<T>::bonded(&validator).unwrap();
|
||||
let controller = pezpallet_staking::Pezpallet::<T>::bonded(&validator).unwrap();
|
||||
|
||||
let keys = {
|
||||
const SESSION_KEY_LEN: usize = 32;
|
||||
@@ -76,35 +76,35 @@ where
|
||||
let proof: Vec<u8> = vec![];
|
||||
|
||||
whitelist_account!(controller);
|
||||
pezpallet_session::Pallet::<T>::ensure_can_pay_key_deposit(&controller).unwrap();
|
||||
pezpallet_session::Pallet::<T>::set_keys(RawOrigin::Signed(controller).into(), keys, proof)
|
||||
pezpallet_session::Pezpallet::<T>::ensure_can_pay_key_deposit(&controller).unwrap();
|
||||
pezpallet_session::Pezpallet::<T>::set_keys(RawOrigin::Signed(controller).into(), keys, proof)
|
||||
.expect("session::set_keys should work");
|
||||
}
|
||||
|
||||
pezpallet_session::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
initializer::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
pezpallet_session::Pezpallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
initializer::Pezpallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
|
||||
// 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 pezpallet_session::Pallet::<T>::validators().len() < n as usize {
|
||||
pezpallet_session::Pallet::<T>::rotate_session();
|
||||
while pezpallet_session::Pezpallet::<T>::validators().len() < n as usize {
|
||||
pezpallet_session::Pezpallet::<T>::rotate_session();
|
||||
}
|
||||
initializer::Pallet::<T>::on_finalize(BlockNumberFor::<T>::one());
|
||||
initializer::Pezpallet::<T>::on_finalize(BlockNumberFor::<T>::one());
|
||||
|
||||
let session_index = crate::shared::CurrentSessionIndex::<T>::get();
|
||||
let session_info = crate::session_info::Sessions::<T>::get(session_index);
|
||||
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 = pezpallet_session::historical::Pallet::<T>::prove(key).unwrap();
|
||||
let key_owner_proof = pezpallet_session::historical::Pezpallet::<T>::prove(key).unwrap();
|
||||
|
||||
// rotate a session to make sure `key_owner_proof` is historical
|
||||
initializer::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
pezpallet_session::Pallet::<T>::rotate_session();
|
||||
initializer::Pallet::<T>::on_finalize(BlockNumberFor::<T>::one());
|
||||
initializer::Pezpallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
pezpallet_session::Pezpallet::<T>::rotate_session();
|
||||
initializer::Pezpallet::<T>::on_finalize(BlockNumberFor::<T>::one());
|
||||
|
||||
let idx = crate::shared::CurrentSessionIndex::<T>::get();
|
||||
assert!(
|
||||
|
||||
@@ -44,7 +44,7 @@ fn filter_dispute_set(stmts: MultiDisputeStatementSet) -> CheckedMultiDisputeSta
|
||||
.into_iter()
|
||||
.filter_map(|set| {
|
||||
let filter =
|
||||
Pallet::<Test>::filter_dispute_data(&set, post_conclusion_acceptance_period);
|
||||
Pezpallet::<Test>::filter_dispute_data(&set, post_conclusion_acceptance_period);
|
||||
filter.filter_statement_set(set)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
@@ -86,7 +86,7 @@ type NewSession<'a> = (
|
||||
Option<Vec<(&'a AccountId, ValidatorId)>>,
|
||||
);
|
||||
|
||||
// Run to specific block, while calling disputes pallet hooks manually, because disputes is not
|
||||
// Run to specific block, while calling disputes pezpallet hooks manually, because disputes is not
|
||||
// integrated in initializer yet.
|
||||
pub(crate) fn run_to_block<'a>(
|
||||
to: BlockNumber,
|
||||
@@ -385,13 +385,13 @@ fn test_initializer_on_new_session() {
|
||||
let v0 = <ValidatorId as CryptoType>::Pair::generate().0;
|
||||
|
||||
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);
|
||||
Pallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
Pallet::<Test>::note_included(4, candidate_hash, 4);
|
||||
Pallet::<Test>::note_included(5, candidate_hash, 5);
|
||||
Pallet::<Test>::note_included(6, candidate_hash, 5);
|
||||
Pezpallet::<Test>::note_included(0, candidate_hash, 0);
|
||||
Pezpallet::<Test>::note_included(1, candidate_hash, 1);
|
||||
Pezpallet::<Test>::note_included(2, candidate_hash, 2);
|
||||
Pezpallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
Pezpallet::<Test>::note_included(4, candidate_hash, 4);
|
||||
Pezpallet::<Test>::note_included(5, candidate_hash, 5);
|
||||
Pezpallet::<Test>::note_included(6, candidate_hash, 5);
|
||||
|
||||
run_to_block(7, |b| {
|
||||
// a new session at each block
|
||||
@@ -435,7 +435,7 @@ fn test_provide_data_duplicate_error() {
|
||||
},
|
||||
];
|
||||
|
||||
assert!(Pallet::<Test>::deduplicate_and_sort_dispute_data(&mut stmts).is_err());
|
||||
assert!(Pezpallet::<Test>::deduplicate_and_sort_dispute_data(&mut stmts).is_err());
|
||||
assert_eq!(stmts.len(), 2);
|
||||
})
|
||||
}
|
||||
@@ -488,7 +488,7 @@ fn test_provide_multi_dispute_is_providing() {
|
||||
}];
|
||||
|
||||
assert_ok!(
|
||||
Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -545,7 +545,7 @@ fn test_disputes_with_missing_backing_votes_are_rejected() {
|
||||
],
|
||||
}];
|
||||
|
||||
assert!(Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
assert!(Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -607,7 +607,7 @@ fn test_freeze_on_note_included() {
|
||||
),
|
||||
],
|
||||
}];
|
||||
assert!(Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
assert!(Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -615,7 +615,7 @@ fn test_freeze_on_note_included() {
|
||||
)
|
||||
.is_ok());
|
||||
|
||||
Pallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
Pezpallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
assert_eq!(Frozen::<Test>::get(), Some(2));
|
||||
});
|
||||
}
|
||||
@@ -673,8 +673,8 @@ fn test_freeze_provided_against_supermajority_for_included() {
|
||||
],
|
||||
}];
|
||||
|
||||
Pallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
assert!(Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
Pezpallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
assert!(Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -755,8 +755,8 @@ fn test_freeze_provided_against_byzantine_threshold_for_included() {
|
||||
}];
|
||||
|
||||
// Include the candidate and import the votes
|
||||
Pallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
assert!(Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
Pezpallet::<Test>::note_included(3, candidate_hash, 3);
|
||||
assert!(Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -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(pezsp_core::H256::repeat_byte(2)), 3);
|
||||
Pezpallet::<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 {
|
||||
@@ -801,7 +801,7 @@ fn test_freeze_provided_against_byzantine_threshold_for_included() {
|
||||
),
|
||||
],
|
||||
}];
|
||||
assert!(Pallet::<Test>::process_checked_multi_dispute_data(
|
||||
assert!(Pezpallet::<Test>::process_checked_multi_dispute_data(
|
||||
&stmts
|
||||
.into_iter()
|
||||
.map(CheckedDisputeStatementSet::unchecked_from_unchecked)
|
||||
@@ -898,7 +898,7 @@ mod unconfirmed_disputes {
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
|
||||
// Not confirmed => should be filtered out
|
||||
assert_ok!(Pallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![],);
|
||||
assert_ok!(Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![],);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ mod unconfirmed_disputes {
|
||||
let stmts = vec![CheckedDisputeStatementSet::unchecked_from_unchecked(stmts)];
|
||||
|
||||
assert_matches!(
|
||||
Pallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
Err(DispatchError::Module(ModuleError{index: _, error: _, message})) => assert_eq!(message, Some("UnconfirmedDispute"))
|
||||
);
|
||||
|
||||
@@ -1010,7 +1010,7 @@ fn test_provide_multi_dispute_success_and_other() {
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
|
||||
assert_ok!(
|
||||
Pallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
vec![(3, candidate_hash)],
|
||||
);
|
||||
|
||||
@@ -1063,7 +1063,7 @@ fn test_provide_multi_dispute_success_and_other() {
|
||||
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
assert_ok!(
|
||||
Pallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
vec![(5, candidate_hash)],
|
||||
);
|
||||
|
||||
@@ -1081,7 +1081,7 @@ fn test_provide_multi_dispute_success_and_other() {
|
||||
)],
|
||||
}];
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
assert_ok!(Pallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![]);
|
||||
assert_ok!(Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![]);
|
||||
|
||||
let stmts = vec![
|
||||
// 0, 4, and 5 vote against 5
|
||||
@@ -1140,10 +1140,10 @@ fn test_provide_multi_dispute_success_and_other() {
|
||||
},
|
||||
];
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
assert_ok!(Pallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![]);
|
||||
assert_ok!(Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![]);
|
||||
|
||||
assert_eq!(
|
||||
Pallet::<Test>::disputes(),
|
||||
Pezpallet::<Test>::disputes(),
|
||||
vec![
|
||||
(
|
||||
5,
|
||||
@@ -1168,9 +1168,9 @@ fn test_provide_multi_dispute_success_and_other() {
|
||||
]
|
||||
);
|
||||
|
||||
assert!(!Pallet::<Test>::concluded_invalid(3, candidate_hash));
|
||||
assert!(!Pallet::<Test>::concluded_invalid(4, candidate_hash));
|
||||
assert!(Pallet::<Test>::concluded_invalid(5, candidate_hash));
|
||||
assert!(!Pezpallet::<Test>::concluded_invalid(3, candidate_hash));
|
||||
assert!(!Pezpallet::<Test>::concluded_invalid(4, candidate_hash));
|
||||
assert!(Pezpallet::<Test>::concluded_invalid(5, candidate_hash));
|
||||
|
||||
// Ensure the `reward_validator` function was correctly called
|
||||
assert_eq!(
|
||||
@@ -1329,7 +1329,7 @@ fn test_punish_post_conclusion() {
|
||||
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
assert_ok!(
|
||||
Pallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts),
|
||||
vec![(session, candidate_hash)],
|
||||
);
|
||||
|
||||
@@ -1368,7 +1368,7 @@ fn test_punish_post_conclusion() {
|
||||
}];
|
||||
|
||||
let stmts = filter_dispute_set(stmts);
|
||||
assert_ok!(Pallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![],);
|
||||
assert_ok!(Pezpallet::<Test>::process_checked_multi_dispute_data(&stmts), vec![],);
|
||||
|
||||
// Ensure punishment for is called
|
||||
assert_eq!(
|
||||
@@ -1403,14 +1403,14 @@ fn test_revert_and_freeze() {
|
||||
Frozen::<Test>::put(Some(0));
|
||||
assert_noop!(
|
||||
{
|
||||
Pallet::<Test>::revert_and_freeze(0);
|
||||
Pezpallet::<Test>::revert_and_freeze(0);
|
||||
Result::<(), ()>::Err(()) // Just a small trick in order to use `assert_noop`.
|
||||
},
|
||||
(),
|
||||
);
|
||||
|
||||
Frozen::<Test>::kill();
|
||||
Pallet::<Test>::revert_and_freeze(0);
|
||||
Pezpallet::<Test>::revert_and_freeze(0);
|
||||
|
||||
assert_eq!(Frozen::<Test>::get(), Some(0));
|
||||
assert_eq!(System::digest().logs[0], ConsensusLog::Revert(1).into());
|
||||
@@ -1424,13 +1424,13 @@ fn test_revert_and_freeze_merges() {
|
||||
Frozen::<Test>::put(Some(10));
|
||||
assert_noop!(
|
||||
{
|
||||
Pallet::<Test>::revert_and_freeze(10);
|
||||
Pezpallet::<Test>::revert_and_freeze(10);
|
||||
Result::<(), ()>::Err(()) // Just a small trick in order to use `assert_noop`.
|
||||
},
|
||||
(),
|
||||
);
|
||||
|
||||
Pallet::<Test>::revert_and_freeze(8);
|
||||
Pezpallet::<Test>::revert_and_freeze(8);
|
||||
assert_eq!(Frozen::<Test>::get(), Some(8));
|
||||
})
|
||||
}
|
||||
@@ -1959,7 +1959,7 @@ fn deduplication_and_sorting_works() {
|
||||
|
||||
let disputes_orig = disputes.clone();
|
||||
|
||||
<Pallet<Test> as DisputesHandler<BlockNumberFor<Test>>>::deduplicate_and_sort_dispute_data(
|
||||
<Pezpallet<Test> as DisputesHandler<BlockNumberFor<Test>>>::deduplicate_and_sort_dispute_data(
|
||||
&mut disputes,
|
||||
)
|
||||
.unwrap_err();
|
||||
@@ -1991,7 +1991,7 @@ fn apply_filter_all<T: Config, I: IntoIterator<Item = DisputeStatementSet>>(
|
||||
let mut acc = Vec::<CheckedDisputeStatementSet>::new();
|
||||
for dispute_statement in sets {
|
||||
if let Some(checked) =
|
||||
<Pallet<T> as DisputesHandler<BlockNumberFor<T>>>::filter_dispute_data(
|
||||
<Pezpallet<T> as DisputesHandler<BlockNumberFor<T>>>::filter_dispute_data(
|
||||
dispute_statement,
|
||||
post_conclusion_acceptance_period,
|
||||
) {
|
||||
@@ -2059,7 +2059,7 @@ fn filter_removes_duplicates_within_set() {
|
||||
|
||||
let post_conclusion_acceptance_period = 10;
|
||||
let statements =
|
||||
<Pallet<Test> as DisputesHandler<BlockNumberFor<Test>>>::filter_dispute_data(
|
||||
<Pezpallet<Test> as DisputesHandler<BlockNumberFor<Test>>>::filter_dispute_data(
|
||||
statements,
|
||||
post_conclusion_acceptance_period,
|
||||
);
|
||||
@@ -2330,7 +2330,7 @@ fn filter_removes_duplicate_statements_sets() {
|
||||
];
|
||||
|
||||
// `Err(())` indicates presence of duplicates
|
||||
assert!(<Pallet::<Test> as DisputesHandler<
|
||||
assert!(<Pezpallet::<Test> as DisputesHandler<
|
||||
BlockNumberFor<Test>,
|
||||
>>::deduplicate_and_sort_dispute_data(&mut sets)
|
||||
.is_err());
|
||||
|
||||
@@ -58,7 +58,7 @@ use pezsp_runtime::{
|
||||
};
|
||||
use xcm::latest::SendError;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -83,7 +83,7 @@ impl From<QueueDownwardMessageError> for SendError {
|
||||
}
|
||||
}
|
||||
|
||||
/// An error returned by [`Pallet::check_processed_downward_messages`] that indicates an acceptance
|
||||
/// An error returned by [`Pezpallet::check_processed_downward_messages`] that indicates an acceptance
|
||||
/// check didn't pass.
|
||||
pub(crate) enum ProcessedDownwardMessagesAcceptanceErr {
|
||||
/// If there are pending messages then `processed_downward_messages` should be at least 1,
|
||||
@@ -108,19 +108,19 @@ impl fmt::Debug for ProcessedDownwardMessagesAcceptanceErr {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {}
|
||||
|
||||
/// The downward messages addressed for a certain para.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type DownwardMessageQueues<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -136,17 +136,17 @@ pub mod pallet {
|
||||
/// - `prev_head`: is the previous head hash or zero if none.
|
||||
/// - `B`: is the relay-chain block number in which a message was appended.
|
||||
/// - `H(M)`: is the hash of the message being appended.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type DownwardMessageQueueHeads<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, Hash, ValueQuery>;
|
||||
|
||||
/// The factor to multiply the base delivery fee by.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type DeliveryFeeFactor<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, FixedU128, ValueQuery, GetMinFeeFactor<Pallet<T>>>;
|
||||
StorageMap<_, Twox64Concat, ParaId, FixedU128, ValueQuery, GetMinFeeFactor<Pezpallet<T>>>;
|
||||
}
|
||||
/// Routines and getters related to downward message passing.
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Block initialization logic, called by initializer.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
@@ -220,7 +220,7 @@ impl<T: Config> Pallet<T> {
|
||||
Self::can_queue_downward_message(config, ¶, &msg)?;
|
||||
|
||||
let inbound =
|
||||
InboundDownwardMessage { msg, sent_at: pezframe_system::Pallet::<T>::block_number() };
|
||||
InboundDownwardMessage { msg, sent_at: pezframe_system::Pezpallet::<T>::block_number() };
|
||||
|
||||
// obtain the new link in the MQC and update the head.
|
||||
DownwardMessageQueueHeads::<T>::mutate(para, |head| {
|
||||
@@ -338,7 +338,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> FeeTracker for Pallet<T> {
|
||||
impl<T: Config> FeeTracker for Pezpallet<T> {
|
||||
type Id = ParaId;
|
||||
|
||||
fn get_fee_factor(id: Self::Id) -> FixedU128 {
|
||||
@@ -351,7 +351,7 @@ impl<T: Config> FeeTracker for Pallet<T> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl<T: Config> crate::EnsureForTeyrchain for Pallet<T> {
|
||||
impl<T: Config> crate::EnsureForTeyrchain for Pezpallet<T> {
|
||||
fn ensure(para: ParaId) {
|
||||
Self::make_teyrchain_reachable(para);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ fn verify_fee_increase_and_decrease() {
|
||||
new_test_ext(genesis).execute_with(|| {
|
||||
register_paras(&[a]);
|
||||
|
||||
let initial = Pallet::<Test>::MIN_FEE_FACTOR;
|
||||
let initial = Pezpallet::<Test>::MIN_FEE_FACTOR;
|
||||
assert_eq!(DeliveryFeeFactor::<Test>::get(a), initial);
|
||||
|
||||
// Under fee limit
|
||||
@@ -290,7 +290,7 @@ fn verify_fee_increase_and_decrease() {
|
||||
|
||||
// Limit reached so fee is increased
|
||||
queue_downward_message(a, vec![1]).unwrap();
|
||||
let result = Pallet::<Test>::MIN_FEE_FACTOR.saturating_mul(Dmp::EXPONENTIAL_FEE_BASE);
|
||||
let result = Pezpallet::<Test>::MIN_FEE_FACTOR.saturating_mul(Dmp::EXPONENTIAL_FEE_BASE);
|
||||
assert_eq!(DeliveryFeeFactor::<Test>::get(a), result);
|
||||
|
||||
Dmp::prune_dmq(a, 1);
|
||||
|
||||
@@ -38,12 +38,12 @@ use pezsp_runtime::{
|
||||
ArithmeticError,
|
||||
};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Maximum bound that can be set for inbound channels.
|
||||
///
|
||||
/// If inaccurate, the weighing of this pallet might become inaccurate. It is expected form the
|
||||
/// `configurations` pallet to check these values before setting
|
||||
/// If inaccurate, the weighing of this pezpallet might become inaccurate. It is expected form the
|
||||
/// `configurations` pezpallet to check these values before setting
|
||||
pub const HRMP_MAX_INBOUND_CHANNELS_BOUND: u32 = 128;
|
||||
/// Same as [`HRMP_MAX_INBOUND_CHANNELS_BOUND`], but for outbound channels.
|
||||
pub const HRMP_MAX_OUTBOUND_CHANNELS_BOUND: u32 = 128;
|
||||
@@ -165,7 +165,7 @@ pub struct HrmpChannel {
|
||||
pub recipient_deposit: Balance,
|
||||
}
|
||||
|
||||
/// An error returned by [`Pallet::check_hrmp_watermark`] that indicates an acceptance criteria
|
||||
/// An error returned by [`Pezpallet::check_hrmp_watermark`] that indicates an acceptance criteria
|
||||
/// check didn't pass.
|
||||
pub(crate) enum HrmpWatermarkAcceptanceErr<BlockNumber> {
|
||||
AdvancementRule { new_watermark: BlockNumber, last_watermark: BlockNumber },
|
||||
@@ -173,7 +173,7 @@ pub(crate) enum HrmpWatermarkAcceptanceErr<BlockNumber> {
|
||||
LandsOnBlockWithNoMessages { new_watermark: BlockNumber },
|
||||
}
|
||||
|
||||
/// An error returned by [`Pallet::check_outbound_hrmp`] that indicates an acceptance criteria check
|
||||
/// An error returned by [`Pezpallet::check_outbound_hrmp`] that indicates an acceptance criteria check
|
||||
/// didn't pass.
|
||||
pub(crate) enum OutboundHrmpAcceptanceErr {
|
||||
MoreMessagesThanPermitted { sent: u32, permitted: u32 },
|
||||
@@ -246,15 +246,15 @@ impl fmt::Debug for OutboundHrmpAcceptanceErr {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config + configuration::Config + paras::Config + dmp::Config
|
||||
{
|
||||
@@ -272,7 +272,7 @@ pub mod pallet {
|
||||
/// An interface for reserving deposits for opening channels.
|
||||
///
|
||||
/// NOTE that this Currency instance will be charged with the amounts defined in the
|
||||
/// `Configuration` pallet. Specifically, that means that the `Balance` of the `Currency`
|
||||
/// `Configuration` pezpallet. Specifically, that means that the `Balance` of the `Currency`
|
||||
/// implementation should be the same as `Balance` as used in the `Configuration`.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
|
||||
@@ -280,7 +280,7 @@ pub mod pallet {
|
||||
/// teyrchain.
|
||||
type DefaultChannelSizeAndCapacityWithSystem: Get<(u32, u32)>;
|
||||
|
||||
/// Means of converting an `Xcm` into a `VersionedXcm`. This pallet sends HRMP XCM
|
||||
/// Means of converting an `Xcm` into a `VersionedXcm`. This pezpallet sends HRMP XCM
|
||||
/// notifications to the channel-related teyrchains, while the `WrapVersion` implementation
|
||||
/// attempts to wrap them into the most suitable XCM version for the destination teyrchain.
|
||||
///
|
||||
@@ -288,12 +288,12 @@ pub mod pallet {
|
||||
/// the default `()` implementation uses the latest XCM version for all teyrchains.
|
||||
type VersionWrapper: xcm::WrapVersion;
|
||||
|
||||
/// Something that provides the weight of this pallet.
|
||||
/// Something that provides the weight of this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// Open HRMP channel requested.
|
||||
OpenChannelRequested {
|
||||
@@ -326,7 +326,7 @@ pub mod pallet {
|
||||
OpenChannelDepositsUpdated { sender: ParaId, recipient: ParaId },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The sender tried to open a channel to themselves.
|
||||
OpenHrmpChannelToSelf,
|
||||
@@ -376,28 +376,28 @@ pub mod pallet {
|
||||
///
|
||||
/// Invariant:
|
||||
/// - There are no channels that exists in list but not in the set and vice versa.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpOpenChannelRequests<T: Config> =
|
||||
StorageMap<_, Twox64Concat, HrmpChannelId, HrmpOpenChannelRequest>;
|
||||
|
||||
// NOTE: could become bounded, but we don't have a global maximum for this.
|
||||
// `HRMP_MAX_INBOUND_CHANNELS_BOUND` are per teyrchain, while this storage tracks the
|
||||
// global state.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpOpenChannelRequestsList<T: Config> =
|
||||
StorageValue<_, Vec<HrmpChannelId>, ValueQuery>;
|
||||
|
||||
/// This mapping tracks how many open channel requests are initiated by a given sender para.
|
||||
/// Invariant: `HrmpOpenChannelRequests` should contain the same number of items that has
|
||||
/// `(X, _)` as the number of `HrmpOpenChannelRequestCount` for `X`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpOpenChannelRequestCount<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, u32, ValueQuery>;
|
||||
|
||||
/// This mapping tracks how many open channel requests were accepted by a given recipient para.
|
||||
/// Invariant: `HrmpOpenChannelRequests` should contain the same number of items `(_, X)` with
|
||||
/// `confirmed` set to true, as the number of `HrmpAcceptedChannelRequestCount` for `X`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpAcceptedChannelRequestCount<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, u32, ValueQuery>;
|
||||
|
||||
@@ -408,10 +408,10 @@ pub mod pallet {
|
||||
///
|
||||
/// Invariant:
|
||||
/// - There are no channels that exists in list but not in the set and vice versa.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpCloseChannelRequests<T: Config> = StorageMap<_, Twox64Concat, HrmpChannelId, ()>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpCloseChannelRequestsList<T: Config> =
|
||||
StorageValue<_, Vec<HrmpChannelId>, ValueQuery>;
|
||||
|
||||
@@ -419,13 +419,13 @@ pub mod pallet {
|
||||
/// Invariant:
|
||||
/// - each para `P` used here as a key should satisfy `Paras::is_valid_para(P)` within a
|
||||
/// session.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpWatermarks<T: Config> = StorageMap<_, Twox64Concat, ParaId, BlockNumberFor<T>>;
|
||||
|
||||
/// HRMP channel data associated with each para.
|
||||
/// Invariant:
|
||||
/// - each participant in the channel should satisfy `Paras::is_valid_para(P)` within a session.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpChannels<T: Config> = StorageMap<_, Twox64Concat, HrmpChannelId, HrmpChannel>;
|
||||
|
||||
/// Ingress/egress indexes allow to find all the senders and receivers given the opposite side.
|
||||
@@ -441,19 +441,19 @@ pub mod pallet {
|
||||
/// `HrmpChannels` as `(P, E)`.
|
||||
/// - there should be no other dangling channels in `HrmpChannels`.
|
||||
/// - the vectors are sorted.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpIngressChannelsIndex<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, Vec<ParaId>, ValueQuery>;
|
||||
|
||||
// NOTE that this field is used by teyrchains via merkle storage proofs, therefore changing
|
||||
// the format will require migration of teyrchains.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpEgressChannelsIndex<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, Vec<ParaId>, ValueQuery>;
|
||||
|
||||
/// Storage for the messages for each channel.
|
||||
/// Invariant: cannot be non-empty if the corresponding channel in `HrmpChannels` is `None`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpChannelContents<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -468,7 +468,7 @@ pub mod pallet {
|
||||
/// - The inner `Vec<ParaId>` cannot store two same `ParaId`.
|
||||
/// - The outer vector is sorted ascending by block number and cannot store two items with the
|
||||
/// same block number.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type HrmpChannelDigests<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, Vec<(BlockNumberFor<T>, Vec<ParaId>)>, ValueQuery>;
|
||||
|
||||
@@ -483,9 +483,9 @@ pub mod pallet {
|
||||
/// As such, each channel initializer should satisfy the same constraints, namely:
|
||||
///
|
||||
/// 1. `max_capacity` and `max_message_size` should be within the limits set by the
|
||||
/// configuration pallet.
|
||||
/// configuration pezpallet.
|
||||
/// 2. `sender` and `recipient` must be valid paras.
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
@@ -493,15 +493,15 @@ pub mod pallet {
|
||||
preopen_hrmp_channels: Vec<(ParaId, ParaId, u32, u32)>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
initialize_storage::<T>(&self.preopen_hrmp_channels);
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Initiate opening a channel from a teyrchain to a given recipient with given channel
|
||||
/// parameters.
|
||||
///
|
||||
@@ -512,8 +512,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The channel can be opened only after the recipient confirms it and only on a session
|
||||
/// change.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::hrmp_init_open_channel())]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::hrmp_init_open_channel())]
|
||||
pub fn hrmp_init_open_channel(
|
||||
origin: OriginFor<T>,
|
||||
recipient: ParaId,
|
||||
@@ -539,8 +539,8 @@ pub mod pallet {
|
||||
/// Accept a pending open channel request from the given sender.
|
||||
///
|
||||
/// The channel will be opened only on the next session boundary.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::hrmp_accept_open_channel())]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::hrmp_accept_open_channel())]
|
||||
pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult {
|
||||
let origin = ensure_teyrchain(<T as Config>::RuntimeOrigin::from(origin))?;
|
||||
Self::accept_open_channel(origin, sender)?;
|
||||
@@ -552,8 +552,8 @@ pub mod pallet {
|
||||
/// recipient in the channel being closed.
|
||||
///
|
||||
/// The closure can only happen on a session change.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::hrmp_close_channel())]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::hrmp_close_channel())]
|
||||
pub fn hrmp_close_channel(
|
||||
origin: OriginFor<T>,
|
||||
channel_id: HrmpChannelId,
|
||||
@@ -571,8 +571,8 @@ pub mod pallet {
|
||||
/// Number of inbound and outbound channels for `para` must be provided as witness data.
|
||||
///
|
||||
/// Origin must be the `ChannelManager`.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_clean_hrmp(*num_inbound, *num_outbound))]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_clean_hrmp(*num_inbound, *num_outbound))]
|
||||
pub fn force_clean_hrmp(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -604,8 +604,8 @@ pub mod pallet {
|
||||
/// Total number of opening channels must be provided as witness data.
|
||||
///
|
||||
/// Origin must be the `ChannelManager`.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_open(*channels))]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_process_hrmp_open(*channels))]
|
||||
pub fn force_process_hrmp_open(origin: OriginFor<T>, channels: u32) -> DispatchResult {
|
||||
T::ChannelManager::ensure_origin(origin)?;
|
||||
|
||||
@@ -628,8 +628,8 @@ pub mod pallet {
|
||||
/// Total number of closing channels must be provided as witness data.
|
||||
///
|
||||
/// Origin must be the `ChannelManager`.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_process_hrmp_close(*channels))]
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_process_hrmp_close(*channels))]
|
||||
pub fn force_process_hrmp_close(origin: OriginFor<T>, channels: u32) -> DispatchResult {
|
||||
T::ChannelManager::ensure_origin(origin)?;
|
||||
|
||||
@@ -651,8 +651,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Total number of open requests (i.e. `HrmpOpenChannelRequestsList`) must be provided as
|
||||
/// witness data.
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::hrmp_cancel_open_request(*open_requests))]
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::hrmp_cancel_open_request(*open_requests))]
|
||||
pub fn hrmp_cancel_open_request(
|
||||
origin: OriginFor<T>,
|
||||
channel_id: HrmpChannelId,
|
||||
@@ -677,8 +677,8 @@ pub mod pallet {
|
||||
/// governed by the system, e.g. a system teyrchain.
|
||||
///
|
||||
/// Origin must be the `ChannelManager`.
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_open_hrmp_channel(1))]
|
||||
#[pezpallet::call_index(7)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_open_hrmp_channel(1))]
|
||||
pub fn force_open_hrmp_channel(
|
||||
origin: OriginFor<T>,
|
||||
sender: ParaId,
|
||||
@@ -727,8 +727,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Any signed origin can call this function, but _both_ inputs MUST be system chains. If
|
||||
/// the channel does not exist yet, there is no fee.
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::establish_system_channel())]
|
||||
#[pezpallet::call_index(8)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::establish_system_channel())]
|
||||
pub fn establish_system_channel(
|
||||
origin: OriginFor<T>,
|
||||
sender: ParaId,
|
||||
@@ -768,8 +768,8 @@ pub mod pallet {
|
||||
/// - `recipient`: A chain, `ParaId`.
|
||||
///
|
||||
/// Any signed origin can call this function.
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::poke_channel_deposits())]
|
||||
#[pezpallet::call_index(9)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::poke_channel_deposits())]
|
||||
pub fn poke_channel_deposits(
|
||||
origin: OriginFor<T>,
|
||||
sender: ParaId,
|
||||
@@ -862,8 +862,8 @@ pub mod pallet {
|
||||
/// - `target_system_chain`: A system chain, `ParaId`.
|
||||
///
|
||||
/// The origin needs to be the teyrchain origin.
|
||||
#[pallet::call_index(10)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::establish_channel_with_system())]
|
||||
#[pezpallet::call_index(10)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::establish_channel_with_system())]
|
||||
pub fn establish_channel_with_system(
|
||||
origin: OriginFor<T>,
|
||||
target_system_chain: ParaId,
|
||||
@@ -910,7 +910,7 @@ fn initialize_storage<T: Config>(preopen_hrmp_channels: &[(ParaId, ParaId, u32,
|
||||
panic!("failed to initialize the genesis storage: {:?}", err);
|
||||
}
|
||||
}
|
||||
Pallet::<T>::process_hrmp_open_channel_requests(&host_config);
|
||||
Pezpallet::<T>::process_hrmp_open_channel_requests(&host_config);
|
||||
}
|
||||
|
||||
fn preopen_hrmp_channel<T: Config>(
|
||||
@@ -919,13 +919,13 @@ fn preopen_hrmp_channel<T: Config>(
|
||||
max_capacity: u32,
|
||||
max_message_size: u32,
|
||||
) -> DispatchResult {
|
||||
Pallet::<T>::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||
Pallet::<T>::accept_open_channel(recipient, sender)?;
|
||||
Pezpallet::<T>::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||
Pezpallet::<T>::accept_open_channel(recipient, sender)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Routines and getters related to HRMP.
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Block initialization logic, called by initializer.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
@@ -1080,8 +1080,8 @@ impl<T: Config> Pallet<T> {
|
||||
let recipient_deposit = if system_channel { 0 } else { config.hrmp_recipient_deposit };
|
||||
|
||||
if request.confirmed {
|
||||
if paras::Pallet::<T>::is_valid_para(channel_id.sender) &&
|
||||
paras::Pallet::<T>::is_valid_para(channel_id.recipient)
|
||||
if paras::Pezpallet::<T>::is_valid_para(channel_id.sender) &&
|
||||
paras::Pezpallet::<T>::is_valid_para(channel_id.recipient)
|
||||
{
|
||||
HrmpChannels::<T>::insert(
|
||||
&channel_id,
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
|
||||
for out_msg in out_hrmp_msgs {
|
||||
let channel_id = HrmpChannelId { sender, recipient: out_msg.recipient };
|
||||
@@ -1437,7 +1437,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// will be required for `origin` (the sender) upon opening the request and the `recipient` upon
|
||||
/// accepting it.
|
||||
///
|
||||
/// Basically the same as [`hrmp_init_open_channel`](Pallet::hrmp_init_open_channel) but
|
||||
/// Basically the same as [`hrmp_init_open_channel`](Pezpallet::hrmp_init_open_channel) but
|
||||
/// intended for calling directly from other pallets rather than dispatched.
|
||||
pub fn init_open_channel(
|
||||
origin: ParaId,
|
||||
@@ -1447,7 +1447,7 @@ impl<T: Config> Pallet<T> {
|
||||
) -> DispatchResult {
|
||||
ensure!(origin != recipient, Error::<T>::OpenHrmpChannelToSelf);
|
||||
ensure!(
|
||||
paras::Pallet::<T>::is_valid_para(recipient),
|
||||
paras::Pezpallet::<T>::is_valid_para(recipient),
|
||||
Error::<T>::OpenHrmpChannelInvalidRecipient,
|
||||
);
|
||||
|
||||
@@ -1526,7 +1526,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Accept a pending open channel request from the given sender.
|
||||
///
|
||||
/// Basically the same as [`hrmp_accept_open_channel`](Pallet::hrmp_accept_open_channel) but
|
||||
/// Basically the same as [`hrmp_accept_open_channel`](Pezpallet::hrmp_accept_open_channel) but
|
||||
/// intended for calling directly from other pallets rather than dispatched.
|
||||
pub fn accept_open_channel(origin: ParaId, sender: ParaId) -> DispatchResult {
|
||||
let channel_id = HrmpChannelId { sender, recipient: origin };
|
||||
@@ -1682,7 +1682,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Decreases the open channel request count for the given sender. If the value reaches zero
|
||||
/// it is removed completely.
|
||||
fn decrease_open_channel_request_count(sender: ParaId) {
|
||||
@@ -1714,7 +1714,7 @@ impl<T: Config> Pallet<T> {
|
||||
let assert_contains_only_onboarded = |paras: Vec<ParaId>, cause: &str| {
|
||||
for para in paras {
|
||||
assert!(
|
||||
crate::paras::Pallet::<T>::is_valid_para(para),
|
||||
crate::paras::Pezpallet::<T>::is_valid_para(para),
|
||||
"{}: {:?} para is offboarded",
|
||||
cause,
|
||||
para
|
||||
@@ -1859,7 +1859,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Wraps HRMP XCM notifications to the most suitable XCM version for the destination para.
|
||||
/// If the XCM version is unknown, the latest XCM version is used as a best effort.
|
||||
fn wrap_notification(
|
||||
@@ -1899,7 +1899,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// try to enqueue
|
||||
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
|
||||
dmp::Pallet::<T>::queue_downward_message(&config, dest, notification_bytes)
|
||||
dmp::Pezpallet::<T>::queue_downward_message(&config, dest, notification_bytes)
|
||||
{
|
||||
// this should never happen unless the max downward message size is configured to a
|
||||
// jokingly small number.
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use crate::{
|
||||
configuration::Pallet as Configuration,
|
||||
hrmp::{Pallet as Hrmp, *},
|
||||
paras::{Pallet as Paras, ParaKind, TeyrchainsCache},
|
||||
shared::Pallet as Shared,
|
||||
configuration::Pezpallet as Configuration,
|
||||
hrmp::{Pezpallet as Hrmp, *},
|
||||
paras::{Pezpallet as Paras, ParaKind, TeyrchainsCache},
|
||||
shared::Pezpallet as Shared,
|
||||
};
|
||||
use pezframe_benchmarking::{v2::*, whitelisted_caller};
|
||||
use pezframe_support::{assert_ok, traits::Currency};
|
||||
@@ -43,7 +43,7 @@ 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 = pezframe_system::Pallet::<T>::events();
|
||||
let events = pezframe_system::Pezpallet::<T>::events();
|
||||
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
// compare to the last event record
|
||||
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
|
||||
@@ -51,7 +51,7 @@ fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
}
|
||||
|
||||
fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
let events = pezframe_system::Pallet::<T>::events();
|
||||
let events = pezframe_system::Pezpallet::<T>::events();
|
||||
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
|
||||
assert!(events.iter().any(|record| record.event == system_event));
|
||||
|
||||
@@ -30,7 +30,7 @@ use crate::{
|
||||
initializer, HeadData, ValidationCode,
|
||||
};
|
||||
|
||||
fn create_candidate_commitments<T: crate::hrmp::pallet::Config>(
|
||||
fn create_candidate_commitments<T: crate::hrmp::pezpallet::Config>(
|
||||
para_id: ParaId,
|
||||
head_data: HeadData,
|
||||
max_msg_len: usize,
|
||||
@@ -103,7 +103,7 @@ mod benchmarks {
|
||||
let validators = generate_validator_pairs::<T>(n_validators);
|
||||
|
||||
let session = SessionIndex::from(0_u32);
|
||||
initializer::Pallet::<T>::test_trigger_on_new_session(
|
||||
initializer::Pezpallet::<T>::test_trigger_on_new_session(
|
||||
false,
|
||||
session,
|
||||
validators.iter().map(|(a, v)| (a, v.clone())),
|
||||
@@ -133,11 +133,11 @@ mod benchmarks {
|
||||
|
||||
let receipt = CommittedCandidateReceipt::<T::Hash> { descriptor, commitments };
|
||||
|
||||
Pallet::<T>::receive_upward_messages(para, &vec![vec![0; max_len]; 1]);
|
||||
Pezpallet::<T>::receive_upward_messages(para, &vec![vec![0; max_len]; 1]);
|
||||
|
||||
#[block]
|
||||
{
|
||||
Pallet::<T>::enact_candidate(
|
||||
Pezpallet::<T>::enact_candidate(
|
||||
relay_parent_number,
|
||||
receipt,
|
||||
backers,
|
||||
@@ -149,7 +149,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite! {
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
pub use v1::MigrateToV1;
|
||||
|
||||
pub mod v0 {
|
||||
use crate::inclusion::{Config, Pallet};
|
||||
use crate::inclusion::{Config, Pezpallet};
|
||||
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
|
||||
use codec::{Decode, Encode};
|
||||
use pezframe_support::{storage_alias, Twox64Concat};
|
||||
@@ -45,7 +45,7 @@ pub mod v0 {
|
||||
|
||||
#[storage_alias]
|
||||
pub type PendingAvailability<T: Config> = StorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Twox64Concat,
|
||||
ParaId,
|
||||
CandidatePendingAvailability<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
|
||||
@@ -53,11 +53,11 @@ pub mod v0 {
|
||||
|
||||
#[storage_alias]
|
||||
pub type PendingAvailabilityCommitments<T: Config> =
|
||||
StorageMap<Pallet<T>, Twox64Concat, ParaId, CandidateCommitments>;
|
||||
StorageMap<Pezpallet<T>, Twox64Concat, ParaId, CandidateCommitments>;
|
||||
|
||||
#[storage_alias]
|
||||
pub type AvailabilityBitfields<T: Config> = StorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Twox64Concat,
|
||||
ValidatorIndex,
|
||||
AvailabilityBitfieldRecord<BlockNumberFor<T>>,
|
||||
@@ -70,7 +70,7 @@ mod v1 {
|
||||
PendingAvailabilityCommitments as V0PendingAvailabilityCommitments,
|
||||
};
|
||||
use crate::inclusion::{
|
||||
CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pallet,
|
||||
CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pezpallet,
|
||||
PendingAvailability as V1PendingAvailability,
|
||||
};
|
||||
use alloc::{collections::vec_deque::VecDeque, vec::Vec};
|
||||
@@ -158,7 +158,7 @@ mod v1 {
|
||||
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),
|
||||
Pezpallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
|
||||
"Storage version should be >= 1 after the migration"
|
||||
);
|
||||
|
||||
@@ -201,7 +201,7 @@ mod v1 {
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The inclusion pallet is responsible for inclusion and availability of scheduled teyrchains.
|
||||
//! The inclusion pezpallet is responsible for inclusion and availability of scheduled teyrchains.
|
||||
//!
|
||||
//! It is responsible for carrying candidates from being backable to being backed, and then from
|
||||
//! backed to included.
|
||||
@@ -54,7 +54,7 @@ use pezkuwi_primitives::{
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests;
|
||||
@@ -89,7 +89,7 @@ impl WeightInfo for () {
|
||||
/// Maximum value that `config.max_upward_message_size` can be set to.
|
||||
///
|
||||
/// This is used for benchmarking sanely bounding relevant storage items. It is expected from the
|
||||
/// `configuration` pallet to check these values before setting.
|
||||
/// `configuration` pezpallet to check these values before setting.
|
||||
pub const MAX_UPWARD_MESSAGE_SIZE_BOUND: u32 = 128 * 1024;
|
||||
|
||||
/// A backed candidate pending availability.
|
||||
@@ -214,7 +214,7 @@ impl QueueFootprinter for () {
|
||||
}
|
||||
}
|
||||
|
||||
/// Aggregate message origin for the `MessageQueue` pallet.
|
||||
/// Aggregate message origin for the `MessageQueue` pezpallet.
|
||||
///
|
||||
/// Can be extended to serve further use-cases besides just UMP. Is stored in storage, so any change
|
||||
/// to existing values will require a migration.
|
||||
@@ -235,7 +235,7 @@ pub enum AggregateMessageOrigin {
|
||||
Ump(UmpQueueId),
|
||||
}
|
||||
|
||||
/// Identifies a UMP queue inside the `MessageQueue` pallet.
|
||||
/// Identifies a UMP queue inside the `MessageQueue` pezpallet.
|
||||
///
|
||||
/// It is written in verbose form since future variants like `Here` and `Bridged` are already
|
||||
/// foreseeable.
|
||||
@@ -268,17 +268,17 @@ impl From<u32> for AggregateMessageOrigin {
|
||||
pub type MaxUmpMessageLenOf<T> =
|
||||
<<T as Config>::MessageQueue as EnqueueMessage<AggregateMessageOrigin>>::MaxMessageLen;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config
|
||||
+ shared::Config
|
||||
@@ -301,12 +301,12 @@ pub mod pallet {
|
||||
type MessageQueue: EnqueueMessage<AggregateMessageOrigin>
|
||||
+ QueueFootprintQuery<AggregateMessageOrigin, MaxMessageLen = MaxUmpMessageLenOf<Self>>;
|
||||
|
||||
/// Weight info for the calls of this pallet.
|
||||
/// Weight info for the calls of this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// A candidate was backed. `[candidate, head_data]`
|
||||
CandidateBacked(CandidateReceipt<T::Hash>, HeadData, CoreIndex, GroupIndex),
|
||||
@@ -318,7 +318,7 @@ pub mod pallet {
|
||||
UpwardMessagesReceived { from: ParaId, count: u32 },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Validator index out of bounds.
|
||||
ValidatorIndexOutOfBounds,
|
||||
@@ -364,8 +364,8 @@ pub mod pallet {
|
||||
/// Use a different prefix post-migration to v1, since the v0 `PendingAvailability` storage
|
||||
/// would otherwise have the exact same prefix which could cause undefined behaviour when doing
|
||||
/// the migration.
|
||||
#[pallet::storage]
|
||||
#[pallet::storage_prefix = "V1"]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::storage_prefix = "V1"]
|
||||
pub(crate) type PendingAvailability<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -373,8 +373,8 @@ pub mod pallet {
|
||||
VecDeque<CandidatePendingAvailability<T::Hash, BlockNumberFor<T>>>,
|
||||
>;
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {}
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {}
|
||||
}
|
||||
|
||||
const LOG_TARGET: &str = "runtime::inclusion";
|
||||
@@ -421,7 +421,7 @@ impl From<hrmp::OutboundHrmpAcceptanceErr> for AcceptanceCheckErr {
|
||||
}
|
||||
}
|
||||
|
||||
/// An error returned by [`Pallet::check_upward_messages`] that indicates a violation of one of
|
||||
/// An error returned by [`Pezpallet::check_upward_messages`] that indicates a violation of one of
|
||||
/// acceptance criteria rules.
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[allow(dead_code)]
|
||||
@@ -468,7 +468,7 @@ impl fmt::Debug for UmpAcceptanceCheckErr {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Block initialization logic, called by initializer.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
@@ -647,7 +647,7 @@ impl<T: Config> Pallet<T> {
|
||||
return Ok(Default::default());
|
||||
}
|
||||
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
let validators = shared::ActiveValidatorKeys::<T>::get();
|
||||
|
||||
// Collect candidate receipts with backers.
|
||||
@@ -679,7 +679,7 @@ impl<T: Config> Pallet<T> {
|
||||
// group assigned to core at block `N + 1`. Thus,
|
||||
// `relay_parent_number + 1` will always land in the current
|
||||
// session.
|
||||
let group_idx = scheduler::Pallet::<T>::group_assigned_to_core(
|
||||
let group_idx = scheduler::Pezpallet::<T>::group_assigned_to_core(
|
||||
*core,
|
||||
relay_parent_number + One::one(),
|
||||
)
|
||||
@@ -880,9 +880,9 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
if let Some(new_code) = commitments.new_validation_code {
|
||||
// Block number of candidate's inclusion.
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
|
||||
paras::Pallet::<T>::schedule_code_upgrade(
|
||||
paras::Pezpallet::<T>::schedule_code_upgrade(
|
||||
receipt.descriptor.para_id(),
|
||||
new_code,
|
||||
now,
|
||||
@@ -892,7 +892,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
// enact the messaging facet of the candidate.
|
||||
dmp::Pallet::<T>::prune_dmq(
|
||||
dmp::Pezpallet::<T>::prune_dmq(
|
||||
receipt.descriptor.para_id(),
|
||||
commitments.processed_downward_messages,
|
||||
);
|
||||
@@ -900,11 +900,11 @@ impl<T: Config> Pallet<T> {
|
||||
receipt.descriptor.para_id(),
|
||||
commitments.upward_messages.as_slice(),
|
||||
);
|
||||
hrmp::Pallet::<T>::prune_hrmp(
|
||||
hrmp::Pezpallet::<T>::prune_hrmp(
|
||||
receipt.descriptor.para_id(),
|
||||
BlockNumberFor::<T>::from(commitments.hrmp_watermark),
|
||||
);
|
||||
hrmp::Pallet::<T>::queue_outbound_hrmp(
|
||||
hrmp::Pezpallet::<T>::queue_outbound_hrmp(
|
||||
receipt.descriptor.para_id(),
|
||||
commitments.horizontal_messages,
|
||||
);
|
||||
@@ -916,7 +916,7 @@ impl<T: Config> Pallet<T> {
|
||||
backing_group,
|
||||
));
|
||||
|
||||
paras::Pallet::<T>::note_new_head(
|
||||
paras::Pezpallet::<T>::note_new_head(
|
||||
receipt.descriptor.para_id(),
|
||||
commitments.head_data,
|
||||
relay_parent_number,
|
||||
@@ -938,7 +938,7 @@ impl<T: Config> Pallet<T> {
|
||||
let upward_messages = skip_ump_signals(upward_messages.iter()).collect::<Vec<_>>();
|
||||
|
||||
// Cannot send UMP messages while off-boarding.
|
||||
if paras::Pallet::<T>::is_offboarding(para) {
|
||||
if paras::Pezpallet::<T>::is_offboarding(para) {
|
||||
ensure!(upward_messages.is_empty(), UmpAcceptanceCheckErr::IsOffboarding);
|
||||
}
|
||||
|
||||
@@ -1022,7 +1022,7 @@ impl<T: Config> Pallet<T> {
|
||||
///
|
||||
/// Returns a vector of cleaned-up core IDs.
|
||||
pub(crate) fn free_timedout() -> Vec<CoreIndex> {
|
||||
let timeout_pred = scheduler::Pallet::<T>::availability_timeout_predicate();
|
||||
let timeout_pred = scheduler::Pezpallet::<T>::availability_timeout_predicate();
|
||||
|
||||
let timed_out: Vec<_> = Self::free_failed_cores(
|
||||
|candidate| timeout_pred(candidate.backed_in_number).timed_out,
|
||||
@@ -1193,7 +1193,7 @@ impl AcceptanceCheckErr {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> OnQueueChanged<AggregateMessageOrigin> for Pallet<T> {
|
||||
impl<T: Config> OnQueueChanged<AggregateMessageOrigin> for Pezpallet<T> {
|
||||
// Write back the remaining queue capacity into `relay_dispatch_queue_remaining_capacity`.
|
||||
fn on_queue_changed(origin: AggregateMessageOrigin, fp: QueueFootprint) {
|
||||
let para = match origin {
|
||||
@@ -1339,7 +1339,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
.map_err(|_| AcceptanceCheckErr::NewCodeTooLarge)?;
|
||||
|
||||
ensure!(
|
||||
paras::Pallet::<T>::can_upgrade_validation_code(para_id),
|
||||
paras::Pezpallet::<T>::can_upgrade_validation_code(para_id),
|
||||
AcceptanceCheckErr::PrematureCodeUpgrade,
|
||||
);
|
||||
ensure!(
|
||||
@@ -1349,7 +1349,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
}
|
||||
|
||||
// check if the candidate passes the messaging acceptance criteria
|
||||
dmp::Pallet::<T>::check_processed_downward_messages(
|
||||
dmp::Pezpallet::<T>::check_processed_downward_messages(
|
||||
para_id,
|
||||
relay_parent_number,
|
||||
processed_downward_messages,
|
||||
@@ -1364,7 +1364,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
);
|
||||
e
|
||||
})?;
|
||||
Pallet::<T>::check_upward_messages(&self.config, para_id, upward_messages).map_err(
|
||||
Pezpallet::<T>::check_upward_messages(&self.config, para_id, upward_messages).map_err(
|
||||
|e| {
|
||||
log::debug!(
|
||||
target: LOG_TARGET,
|
||||
@@ -1375,7 +1375,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
e
|
||||
},
|
||||
)?;
|
||||
hrmp::Pallet::<T>::check_hrmp_watermark(para_id, relay_parent_number, hrmp_watermark)
|
||||
hrmp::Pezpallet::<T>::check_hrmp_watermark(para_id, relay_parent_number, hrmp_watermark)
|
||||
.map_err(|e| {
|
||||
log::debug!(
|
||||
target: LOG_TARGET,
|
||||
@@ -1386,7 +1386,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
);
|
||||
e
|
||||
})?;
|
||||
hrmp::Pallet::<T>::check_outbound_hrmp(&self.config, para_id, horizontal_messages)
|
||||
hrmp::Pezpallet::<T>::check_outbound_hrmp(&self.config, para_id, horizontal_messages)
|
||||
.map_err(|e| {
|
||||
log::debug!(
|
||||
target: LOG_TARGET,
|
||||
@@ -1401,7 +1401,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> QueueFootprinter for Pallet<T> {
|
||||
impl<T: Config> QueueFootprinter for Pezpallet<T> {
|
||||
type Origin = UmpQueueId;
|
||||
|
||||
fn message_count(origin: Self::Origin) -> u64 {
|
||||
|
||||
@@ -349,7 +349,7 @@ impl TestCandidateBuilder {
|
||||
}
|
||||
|
||||
pub(crate) fn make_vdata_hash(para_id: ParaId) -> Option<Hash> {
|
||||
let relay_parent_number = pezframe_system::Pallet::<Test>::block_number() - 1;
|
||||
let relay_parent_number = pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<Test>::parent_hash();
|
||||
let parent_hash = pezframe_system::Pezpallet::<Test>::parent_hash();
|
||||
let session_index = shared::CurrentSessionIndex::<Test>::get();
|
||||
let validators = shared::ActiveValidatorKeys::<Test>::get();
|
||||
|
||||
@@ -702,8 +702,8 @@ fn bitfield_checks() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras.clone())).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
let signing_context =
|
||||
SigningContext { parent_hash: System::parent_hash(), session_index: 5 };
|
||||
@@ -890,8 +890,8 @@ fn supermajority_bitfields_trigger_availability() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
let signing_context =
|
||||
SigningContext { parent_hash: System::parent_hash(), session_index: 5 };
|
||||
@@ -1220,8 +1220,8 @@ fn candidate_checks() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
run_to_block(5, |_| None);
|
||||
|
||||
@@ -1785,8 +1785,8 @@ fn backing_works() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
run_to_block(5, |_| None);
|
||||
|
||||
@@ -2068,8 +2068,8 @@ fn backing_works_with_elastic_scaling_mvp() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
run_to_block(5, |_| None);
|
||||
|
||||
@@ -2329,8 +2329,8 @@ fn can_include_candidate_with_ok_code_upgrade() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
run_to_block(5, |_| None);
|
||||
|
||||
@@ -2447,8 +2447,8 @@ fn check_allowed_relay_parents() {
|
||||
config.configuration.config.scheduler_params.group_rotation_frequency = 1;
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
run_to_block(5, |_| None);
|
||||
|
||||
@@ -2637,8 +2637,8 @@ fn session_change_wipes() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
let validators_new =
|
||||
vec![Sr25519Keyring::Alice, Sr25519Keyring::Bob, Sr25519Keyring::Charlie];
|
||||
@@ -2743,8 +2743,8 @@ fn para_upgrade_delay_scheduled_from_inclusion() {
|
||||
let validator_public = validator_pubkeys(&validators);
|
||||
|
||||
new_test_ext(genesis_config(paras)).execute_with(|| {
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pallet::<Test>::set_session_index(5);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_public.clone());
|
||||
shared::Pezpallet::<Test>::set_session_index(5);
|
||||
|
||||
let new_validation_code: ValidationCode = vec![9, 8, 7, 6, 5, 4, 3, 2, 1].into();
|
||||
let new_validation_code_hash = new_validation_code.hash();
|
||||
@@ -2841,7 +2841,7 @@ fn para_upgrade_delay_scheduled_from_inclusion() {
|
||||
|
||||
assert!(PendingAvailability::<Test>::get(&chain_a).unwrap().is_empty());
|
||||
|
||||
let active_vote_state = paras::Pallet::<Test>::active_vote_state(&new_validation_code_hash)
|
||||
let active_vote_state = paras::Pezpallet::<Test>::active_vote_state(&new_validation_code_hash)
|
||||
.expect("prechecking must be initiated");
|
||||
|
||||
let cause = &active_vote_state.causes()[0];
|
||||
|
||||
@@ -41,7 +41,7 @@ mod tests;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benchmarking;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Information about a session change that has just occurred.
|
||||
#[derive(Clone)]
|
||||
@@ -103,17 +103,17 @@ impl WeightInfo for () {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config
|
||||
+ configuration::Config
|
||||
@@ -134,7 +134,7 @@ pub mod pallet {
|
||||
/// 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.
|
||||
type CoretimeOnNewSession: OnNewSession<BlockNumberFor<Self>>;
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ pub mod pallet {
|
||||
/// As a `bool`, `set(false)` and `remove()` both lead to the next `get()` being false, but one
|
||||
/// of them writes to the trie and one does not. This confusion makes `Option<()>` more suitable
|
||||
/// for the semantics of this variable.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type HasInitialized<T: Config> = StorageValue<_, ()>;
|
||||
|
||||
/// Buffered session changes.
|
||||
@@ -156,12 +156,12 @@ pub mod pallet {
|
||||
///
|
||||
/// However this is a `Vec` regardless to handle various edge cases that may occur at runtime
|
||||
/// upgrade boundaries or if governance intervenes.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type BufferedSessionChanges<T: Config> =
|
||||
StorageValue<_, Vec<BufferedSessionChange>, ValueQuery>;
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_initialize(now: BlockNumberFor<T>) -> Weight {
|
||||
// The other modules are initialized in this order:
|
||||
// - Configuration
|
||||
@@ -173,16 +173,16 @@ pub mod pallet {
|
||||
// - DMP
|
||||
// - UMP
|
||||
// - HRMP
|
||||
let total_weight = configuration::Pallet::<T>::initializer_initialize(now) +
|
||||
shared::Pallet::<T>::initializer_initialize(now) +
|
||||
paras::Pallet::<T>::initializer_initialize(now) +
|
||||
scheduler::Pallet::<T>::initializer_initialize(now) +
|
||||
inclusion::Pallet::<T>::initializer_initialize(now) +
|
||||
session_info::Pallet::<T>::initializer_initialize(now) +
|
||||
let total_weight = configuration::Pezpallet::<T>::initializer_initialize(now) +
|
||||
shared::Pezpallet::<T>::initializer_initialize(now) +
|
||||
paras::Pezpallet::<T>::initializer_initialize(now) +
|
||||
scheduler::Pezpallet::<T>::initializer_initialize(now) +
|
||||
inclusion::Pezpallet::<T>::initializer_initialize(now) +
|
||||
session_info::Pezpallet::<T>::initializer_initialize(now) +
|
||||
T::DisputesHandler::initializer_initialize(now) +
|
||||
T::SlashingHandler::initializer_initialize(now) +
|
||||
dmp::Pallet::<T>::initializer_initialize(now) +
|
||||
hrmp::Pallet::<T>::initializer_initialize(now);
|
||||
dmp::Pezpallet::<T>::initializer_initialize(now) +
|
||||
hrmp::Pezpallet::<T>::initializer_initialize(now);
|
||||
|
||||
HasInitialized::<T>::set(Some(()));
|
||||
|
||||
@@ -191,16 +191,16 @@ pub mod pallet {
|
||||
|
||||
fn on_finalize(now: BlockNumberFor<T>) {
|
||||
// reverse initialization order.
|
||||
hrmp::Pallet::<T>::initializer_finalize();
|
||||
dmp::Pallet::<T>::initializer_finalize();
|
||||
hrmp::Pezpallet::<T>::initializer_finalize();
|
||||
dmp::Pezpallet::<T>::initializer_finalize();
|
||||
T::SlashingHandler::initializer_finalize();
|
||||
T::DisputesHandler::initializer_finalize();
|
||||
session_info::Pallet::<T>::initializer_finalize();
|
||||
inclusion::Pallet::<T>::initializer_finalize();
|
||||
scheduler::Pallet::<T>::initializer_finalize();
|
||||
paras::Pallet::<T>::initializer_finalize(now);
|
||||
shared::Pallet::<T>::initializer_finalize();
|
||||
configuration::Pallet::<T>::initializer_finalize();
|
||||
session_info::Pezpallet::<T>::initializer_finalize();
|
||||
inclusion::Pezpallet::<T>::initializer_finalize();
|
||||
scheduler::Pezpallet::<T>::initializer_finalize();
|
||||
paras::Pezpallet::<T>::initializer_finalize(now);
|
||||
shared::Pezpallet::<T>::initializer_finalize();
|
||||
configuration::Pezpallet::<T>::initializer_finalize();
|
||||
|
||||
// Apply buffered session changes as the last thing. This way the runtime APIs and the
|
||||
// next block will observe the next session.
|
||||
@@ -217,28 +217,28 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Issue a signal to the consensus engine to forcibly act as though all teyrchain
|
||||
/// blocks in all relay chain blocks up to and including the given number in the current
|
||||
/// chain are valid and should be finalized.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight((
|
||||
<T as Config>::WeightInfo::force_approve(
|
||||
pezframe_system::Pallet::<T>::digest().logs.len() as u32,
|
||||
pezframe_system::Pezpallet::<T>::digest().logs.len() as u32,
|
||||
),
|
||||
DispatchClass::Operational,
|
||||
))]
|
||||
pub fn force_approve(origin: OriginFor<T>, up_to: BlockNumber) -> DispatchResult {
|
||||
T::ForceOrigin::ensure_origin(origin)?;
|
||||
|
||||
pezframe_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(up_to).into());
|
||||
pezframe_system::Pezpallet::<T>::deposit_log(ConsensusLog::ForceApprove(up_to).into());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
fn apply_new_session(
|
||||
session_index: SessionIndex,
|
||||
all_validators: Vec<ValidatorId>,
|
||||
@@ -255,10 +255,10 @@ impl<T: Config> Pallet<T> {
|
||||
};
|
||||
|
||||
let configuration::SessionChangeOutcome { prev_config, new_config } =
|
||||
configuration::Pallet::<T>::initializer_on_new_session(&session_index);
|
||||
configuration::Pezpallet::<T>::initializer_on_new_session(&session_index);
|
||||
let new_config = new_config.unwrap_or_else(|| prev_config.clone());
|
||||
|
||||
let validators = shared::Pallet::<T>::initializer_on_new_session(
|
||||
let validators = shared::Pezpallet::<T>::initializer_on_new_session(
|
||||
session_index,
|
||||
random_seed,
|
||||
&new_config,
|
||||
@@ -274,14 +274,14 @@ impl<T: Config> Pallet<T> {
|
||||
session_index,
|
||||
};
|
||||
|
||||
let outgoing_paras = paras::Pallet::<T>::initializer_on_new_session(¬ification);
|
||||
scheduler::Pallet::<T>::initializer_on_new_session(¬ification);
|
||||
inclusion::Pallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
session_info::Pallet::<T>::initializer_on_new_session(¬ification);
|
||||
let outgoing_paras = paras::Pezpallet::<T>::initializer_on_new_session(¬ification);
|
||||
scheduler::Pezpallet::<T>::initializer_on_new_session(¬ification);
|
||||
inclusion::Pezpallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
session_info::Pezpallet::<T>::initializer_on_new_session(¬ification);
|
||||
T::DisputesHandler::initializer_on_new_session(¬ification);
|
||||
T::SlashingHandler::initializer_on_new_session(session_index);
|
||||
dmp::Pallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
hrmp::Pallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
dmp::Pezpallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
hrmp::Pezpallet::<T>::initializer_on_new_session(¬ification, &outgoing_paras);
|
||||
T::CoretimeOnNewSession::on_new_session(¬ification);
|
||||
}
|
||||
|
||||
@@ -332,26 +332,26 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
|
||||
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pezpallet<T> {
|
||||
type Public = ValidatorId;
|
||||
}
|
||||
|
||||
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
|
||||
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pezpallet<T> {
|
||||
type Key = ValidatorId;
|
||||
|
||||
fn on_genesis_session<'a, I: 'a>(validators: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, Self::Key)>,
|
||||
{
|
||||
Pallet::<T>::on_new_session(false, 0, validators, None);
|
||||
Pezpallet::<T>::on_new_session(false, 0, validators, None);
|
||||
}
|
||||
|
||||
fn on_new_session<'a, I: 'a>(changed: bool, validators: I, queued: I)
|
||||
where
|
||||
I: Iterator<Item = (&'a T::AccountId, Self::Key)>,
|
||||
{
|
||||
let session_index = pezpallet_session::Pallet::<T>::current_index();
|
||||
Pallet::<T>::on_new_session(changed, session_index, validators, Some(queued));
|
||||
let session_index = pezpallet_session::Pezpallet::<T>::current_index();
|
||||
Pezpallet::<T>::on_new_session(changed, session_index, validators, Some(queued));
|
||||
}
|
||||
|
||||
fn on_disabled(_i: u32) {}
|
||||
|
||||
@@ -30,14 +30,14 @@ mod benchmarks {
|
||||
#[benchmark]
|
||||
fn force_approve(d: Linear<0, DIGEST_MAX_LEN>) -> Result<(), BenchmarkError> {
|
||||
for _ in 0..d {
|
||||
pezframe_system::Pallet::<T>::deposit_log(ConsensusLog::ForceApprove(d).into());
|
||||
pezframe_system::Pezpallet::<T>::deposit_log(ConsensusLog::ForceApprove(d).into());
|
||||
}
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Root, d + 1);
|
||||
|
||||
assert_eq!(
|
||||
pezframe_system::Pallet::<T>::digest().logs.last().unwrap(),
|
||||
pezframe_system::Pezpallet::<T>::digest().logs.last().unwrap(),
|
||||
&DigestItem::from(ConsensusLog::ForceApprove(d + 1)),
|
||||
);
|
||||
|
||||
@@ -45,7 +45,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
);
|
||||
|
||||
@@ -132,22 +132,22 @@ pub fn schedule_para_initialize<T: paras::Config>(
|
||||
id: ParaId,
|
||||
genesis: paras::ParaGenesisArgs,
|
||||
) -> Result<(), ()> {
|
||||
paras::Pallet::<T>::schedule_para_initialize(id, genesis).map_err(|_| ())
|
||||
paras::Pezpallet::<T>::schedule_para_initialize(id, genesis).map_err(|_| ())
|
||||
}
|
||||
|
||||
/// Schedule a para to be cleaned up at the start of the next session.
|
||||
pub fn schedule_para_cleanup<T: paras::Config>(id: pezkuwi_primitives::Id) -> Result<(), ()> {
|
||||
paras::Pallet::<T>::schedule_para_cleanup(id).map_err(|_| ())
|
||||
paras::Pezpallet::<T>::schedule_para_cleanup(id).map_err(|_| ())
|
||||
}
|
||||
|
||||
/// Schedule a parathread (on-demand teyrchain) to be upgraded to a lease holding teyrchain.
|
||||
pub fn schedule_parathread_upgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
|
||||
paras::Pallet::<T>::schedule_parathread_upgrade(id).map_err(|_| ())
|
||||
paras::Pezpallet::<T>::schedule_parathread_upgrade(id).map_err(|_| ())
|
||||
}
|
||||
|
||||
/// Schedule a lease holding teyrchain to be downgraded to an on-demand teyrchain.
|
||||
pub fn schedule_teyrchain_downgrade<T: paras::Config>(id: ParaId) -> Result<(), ()> {
|
||||
paras::Pallet::<T>::schedule_teyrchain_downgrade(id).map_err(|_| ())
|
||||
paras::Pezpallet::<T>::schedule_teyrchain_downgrade(id).map_err(|_| ())
|
||||
}
|
||||
|
||||
/// Schedules a validation code upgrade to a teyrchain with the given id.
|
||||
@@ -156,12 +156,12 @@ pub fn schedule_code_upgrade<T: paras::Config>(
|
||||
new_code: ValidationCode,
|
||||
set_go_ahead: UpgradeStrategy,
|
||||
) -> DispatchResult {
|
||||
paras::Pallet::<T>::schedule_code_upgrade_external(id, new_code, set_go_ahead)
|
||||
paras::Pezpallet::<T>::schedule_code_upgrade_external(id, new_code, set_go_ahead)
|
||||
}
|
||||
|
||||
/// Sets the current teyrchain head with the given id.
|
||||
pub fn set_current_head<T: paras::Config>(id: ParaId, new_head: HeadData) {
|
||||
paras::Pallet::<T>::set_current_head(id, new_head)
|
||||
paras::Pezpallet::<T>::set_current_head(id, new_head)
|
||||
}
|
||||
|
||||
/// Ensure more initialization for `ParaId` when benchmarking. (e.g. open HRMP channels, ...)
|
||||
|
||||
@@ -287,7 +287,7 @@ impl crate::hrmp::Config for Test {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type ChannelManager = pezframe_system::EnsureRoot<u64>;
|
||||
type Currency = pezpallet_balances::Pallet<Test>;
|
||||
type Currency = pezpallet_balances::Pezpallet<Test>;
|
||||
type DefaultChannelSizeAndCapacityWithSystem = DefaultChannelSizeAndCapacityWithSystem;
|
||||
type VersionWrapper = TestUsesOnlyStoredVersionWrapper;
|
||||
type WeightInfo = crate::hrmp::TestWeightInfo;
|
||||
@@ -508,25 +508,25 @@ pub mod mock_assigner {
|
||||
use crate::scheduler::common::Assignment;
|
||||
|
||||
use super::*;
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {}
|
||||
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type MockAssignmentQueue<T: Config> =
|
||||
StorageValue<_, VecDeque<Assignment>, ValueQuery>;
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Adds a claim to the `MockAssignmentQueue` this claim can later be popped by the
|
||||
/// scheduler when filling the claim queue for tests.
|
||||
pub fn add_test_assignment(assignment: Assignment) {
|
||||
@@ -534,7 +534,7 @@ pub mod mock_assigner {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> AssignmentProvider<BlockNumber> for Pallet<T> {
|
||||
impl<T: Config> AssignmentProvider<BlockNumber> for Pezpallet<T> {
|
||||
// With regards to popping_assignments, the scheduler just needs to be tested under
|
||||
// the following two conditions:
|
||||
// 1. An assignment is provided
|
||||
@@ -564,7 +564,7 @@ pub mod mock_assigner {
|
||||
}
|
||||
}
|
||||
|
||||
impl mock_assigner::pallet::Config for Test {}
|
||||
impl mock_assigner::pezpallet::Config for Test {}
|
||||
|
||||
pub struct FoolIdentificationOf;
|
||||
impl pezsp_runtime::traits::Convert<AccountId, Option<()>> for FoolIdentificationOf {
|
||||
@@ -710,7 +710,7 @@ pub struct MockGenesisConfig {
|
||||
}
|
||||
|
||||
pub fn assert_last_event(generic_event: RuntimeEvent) {
|
||||
let events = pezframe_system::Pallet::<Test>::events();
|
||||
let events = pezframe_system::Pezpallet::<Test>::events();
|
||||
let system_event: <Test as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
// compare to the last event record
|
||||
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
|
||||
@@ -721,7 +721,7 @@ pub fn assert_last_events<E>(generic_events: E)
|
||||
where
|
||||
E: DoubleEndedIterator<Item = RuntimeEvent> + ExactSizeIterator,
|
||||
{
|
||||
for (i, (got, want)) in pezframe_system::Pallet::<Test>::events()
|
||||
for (i, (got, want)) in pezframe_system::Pezpallet::<Test>::events()
|
||||
.into_iter()
|
||||
.rev()
|
||||
.map(|e| e.event)
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! On demand assigner pallet benchmarking.
|
||||
//! On demand assigner pezpallet benchmarking.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use super::{Pallet, *};
|
||||
use super::{Pezpallet, *};
|
||||
use crate::{
|
||||
configuration::{HostConfiguration, Pallet as ConfigurationPallet},
|
||||
paras::{Pallet as ParasPallet, ParaGenesisArgs, ParaKind, TeyrchainsCache},
|
||||
shared::Pallet as ParasShared,
|
||||
configuration::{HostConfiguration, Pezpallet as ConfigurationPallet},
|
||||
paras::{Pezpallet as ParasPallet, ParaGenesisArgs, ParaKind, TeyrchainsCache},
|
||||
shared::Pezpallet as ParasShared,
|
||||
};
|
||||
|
||||
use alloc::vec;
|
||||
@@ -71,7 +71,7 @@ mod benchmarks {
|
||||
let para_id = ParaId::from(111u32);
|
||||
init_parathread::<T>(para_id);
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
Pallet::<T>::populate_queue(para_id, s);
|
||||
Pezpallet::<T>::populate_queue(para_id, s);
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.into()), BalanceOf::<T>::max_value(), para_id)
|
||||
@@ -85,7 +85,7 @@ mod benchmarks {
|
||||
init_parathread::<T>(para_id);
|
||||
T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
|
||||
Pallet::<T>::populate_queue(para_id, s);
|
||||
Pezpallet::<T>::populate_queue(para_id, s);
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.into()), BalanceOf::<T>::max_value(), para_id)
|
||||
@@ -99,14 +99,14 @@ mod benchmarks {
|
||||
init_parathread::<T>(para_id);
|
||||
Credits::<T>::insert(&caller, BalanceOf::<T>::max_value());
|
||||
|
||||
Pallet::<T>::populate_queue(para_id, s);
|
||||
Pezpallet::<T>::populate_queue(para_id, s);
|
||||
|
||||
#[extrinsic_call]
|
||||
_(RawOrigin::Signed(caller.into()), BalanceOf::<T>::max_value(), para_id)
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(
|
||||
crate::on_demand::mock_helpers::GenesisConfigBuilder::default().build()
|
||||
),
|
||||
|
||||
@@ -34,14 +34,14 @@ mod v0 {
|
||||
/// assigner.
|
||||
/// NOTE: Ignoring the `OnEmpty` field for the migration.
|
||||
#[storage_alias]
|
||||
pub(super) type SpotTraffic<T: Config> = StorageValue<Pallet<T>, FixedU128, ValueQuery>;
|
||||
pub(super) type SpotTraffic<T: Config> = StorageValue<Pezpallet<T>, FixedU128, ValueQuery>;
|
||||
|
||||
/// The order storage entry. Uses a VecDeque to be able to push to the front of the
|
||||
/// queue from the scheduler on session boundaries.
|
||||
/// NOTE: Ignoring the `OnEmpty` field for the migration.
|
||||
#[storage_alias]
|
||||
pub(super) type OnDemandQueue<T: Config> =
|
||||
StorageValue<Pallet<T>, VecDeque<EnqueuedOrder>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, VecDeque<EnqueuedOrder>, ValueQuery>;
|
||||
}
|
||||
|
||||
mod v1 {
|
||||
@@ -58,13 +58,13 @@ mod v1 {
|
||||
// Migrate the current traffic value
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
QueueStatus::<T>::mutate(|mut queue_status| {
|
||||
Pallet::<T>::update_spot_traffic(&config, &mut queue_status);
|
||||
Pezpallet::<T>::update_spot_traffic(&config, &mut queue_status);
|
||||
|
||||
let v0_queue = v0::OnDemandQueue::<T>::take();
|
||||
// Process the v0 queue into v1.
|
||||
v0_queue.into_iter().for_each(|enqueued_order| {
|
||||
// Readding the old orders will use the new systems.
|
||||
Pallet::<T>::add_on_demand_order(
|
||||
Pezpallet::<T>::add_on_demand_order(
|
||||
queue_status,
|
||||
enqueued_order.para_id,
|
||||
QueuePushDirection::Back,
|
||||
@@ -135,7 +135,7 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
v1::UncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ use pezframe_support::{
|
||||
},
|
||||
PalletId,
|
||||
};
|
||||
use pezframe_system::{pezpallet_prelude::*, Pallet as System};
|
||||
use pezframe_system::{pezpallet_prelude::*, Pezpallet as System};
|
||||
use pezkuwi_primitives::{CoreIndex, Id as ParaId};
|
||||
use pezsp_runtime::{
|
||||
traits::{AccountIdConversion, One, SaturatedConversion},
|
||||
@@ -68,7 +68,7 @@ use types::{
|
||||
|
||||
const LOG_TARGET: &str = "runtime::teyrchains::on-demand";
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn place_order_allow_death(s: u32) -> Weight;
|
||||
@@ -102,19 +102,19 @@ enum PaymentType {
|
||||
Balance,
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
|
||||
use super::*;
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {
|
||||
/// The runtime's definition of an event.
|
||||
#[allow(deprecated)]
|
||||
@@ -123,30 +123,30 @@ pub mod pallet {
|
||||
/// The runtime's definition of a Currency.
|
||||
type Currency: Currency<Self::AccountId>;
|
||||
|
||||
/// Something that provides the weight of this pallet.
|
||||
/// Something that provides the weight of this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
/// The default value for the spot traffic multiplier.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type TrafficDefaultValue: Get<FixedU128>;
|
||||
|
||||
/// The maximum number of blocks some historical revenue
|
||||
/// information stored for.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxHistoricalRevenue: Get<u32>;
|
||||
|
||||
/// Identifier for the internal revenue balance.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type PalletId: Get<PalletId>;
|
||||
}
|
||||
|
||||
/// Creates an empty queue status for an empty queue with initial traffic value.
|
||||
#[pallet::type_value]
|
||||
#[pezpallet::type_value]
|
||||
pub(super) fn QueueStatusOnEmpty<T: Config>() -> QueueStatusType {
|
||||
QueueStatusType { traffic: T::TrafficDefaultValue::get(), ..Default::default() }
|
||||
}
|
||||
|
||||
#[pallet::type_value]
|
||||
#[pezpallet::type_value]
|
||||
pub(super) fn EntriesOnEmpty<T: Config>() -> BinaryHeap<EnqueuedOrder> {
|
||||
BinaryHeap::new()
|
||||
}
|
||||
@@ -154,22 +154,22 @@ pub mod pallet {
|
||||
/// Maps a `ParaId` to `CoreIndex` and keeps track of how many assignments the scheduler has in
|
||||
/// it's lookahead. Keeping track of this affinity prevents parallel execution of the same
|
||||
/// `ParaId` on two or more `CoreIndex`es.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type ParaIdAffinity<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, CoreAffinityCount, OptionQuery>;
|
||||
|
||||
/// Overall status of queue (both free + affinity entries)
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type QueueStatus<T: Config> =
|
||||
StorageValue<_, QueueStatusType, ValueQuery, QueueStatusOnEmpty<T>>;
|
||||
|
||||
/// Priority queue for all orders which don't yet (or not any more) have any core affinity.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type FreeEntries<T: Config> =
|
||||
StorageValue<_, BinaryHeap<EnqueuedOrder>, ValueQuery, EntriesOnEmpty<T>>;
|
||||
|
||||
/// Queue entries that are currently bound to a particular core due to core affinity.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type AffinityEntries<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -180,17 +180,17 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// Keeps track of accumulated revenue from on demand order sales.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Revenue<T: Config> =
|
||||
StorageValue<_, BoundedVec<BalanceOf<T>, T::MaxHistoricalRevenue>, ValueQuery>;
|
||||
|
||||
/// Keeps track of credits owned by each account.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Credits<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, T::AccountId, BalanceOf<T>, ValueQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// An order was placed at some spot price amount by orderer ordered_by
|
||||
OnDemandOrderPlaced { para_id: ParaId, spot_price: BalanceOf<T>, ordered_by: T::AccountId },
|
||||
@@ -200,7 +200,7 @@ pub mod pallet {
|
||||
AccountCredited { who: T::AccountId, amount: BalanceOf<T> },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The order queue is full, `place_order` will not continue.
|
||||
QueueFull,
|
||||
@@ -211,8 +211,8 @@ pub mod pallet {
|
||||
InsufficientCredits,
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
// Update revenue information storage.
|
||||
Revenue::<T>::mutate(|revenue| {
|
||||
@@ -240,8 +240,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Create a single on demand core order.
|
||||
/// Will use the spot price for the current block and will reap the account if needed.
|
||||
///
|
||||
@@ -257,8 +257,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Events:
|
||||
/// - `OnDemandOrderPlaced`
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::place_order_allow_death(QueueStatus::<T>::get().size()))]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::place_order_allow_death(QueueStatus::<T>::get().size()))]
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(note = "This will be removed in favor of using `place_order_with_credits`")]
|
||||
pub fn place_order_allow_death(
|
||||
@@ -267,7 +267,7 @@ pub mod pallet {
|
||||
para_id: ParaId,
|
||||
) -> DispatchResult {
|
||||
let sender = ensure_signed(origin)?;
|
||||
Pallet::<T>::do_place_order(
|
||||
Pezpallet::<T>::do_place_order(
|
||||
sender,
|
||||
max_amount,
|
||||
para_id,
|
||||
@@ -291,8 +291,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Events:
|
||||
/// - `OnDemandOrderPlaced`
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::place_order_keep_alive(QueueStatus::<T>::get().size()))]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::place_order_keep_alive(QueueStatus::<T>::get().size()))]
|
||||
#[allow(deprecated)]
|
||||
#[deprecated(note = "This will be removed in favor of using `place_order_with_credits`")]
|
||||
pub fn place_order_keep_alive(
|
||||
@@ -301,7 +301,7 @@ pub mod pallet {
|
||||
para_id: ParaId,
|
||||
) -> DispatchResult {
|
||||
let sender = ensure_signed(origin)?;
|
||||
Pallet::<T>::do_place_order(
|
||||
Pezpallet::<T>::do_place_order(
|
||||
sender,
|
||||
max_amount,
|
||||
para_id,
|
||||
@@ -327,15 +327,15 @@ pub mod pallet {
|
||||
///
|
||||
/// Events:
|
||||
/// - `OnDemandOrderPlaced`
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::place_order_with_credits(QueueStatus::<T>::get().size()))]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::place_order_with_credits(QueueStatus::<T>::get().size()))]
|
||||
pub fn place_order_with_credits(
|
||||
origin: OriginFor<T>,
|
||||
max_amount: BalanceOf<T>,
|
||||
para_id: ParaId,
|
||||
) -> DispatchResult {
|
||||
let sender = ensure_signed(origin)?;
|
||||
Pallet::<T>::do_place_order(
|
||||
Pezpallet::<T>::do_place_order(
|
||||
sender,
|
||||
max_amount,
|
||||
para_id,
|
||||
@@ -347,7 +347,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
// Internal functions and interface to scheduler/wrapping assignment provider.
|
||||
impl<T: Config> Pallet<T>
|
||||
impl<T: Config> Pezpallet<T>
|
||||
where
|
||||
BalanceOf<T>: FixedPointOperand,
|
||||
{
|
||||
@@ -387,13 +387,13 @@ where
|
||||
|
||||
let assignment = entry.map(|e| Assignment::Pool { para_id: e.para_id, core_index }).ok()?;
|
||||
|
||||
Pallet::<T>::increase_affinity(assignment.para_id(), core_index);
|
||||
Pezpallet::<T>::increase_affinity(assignment.para_id(), core_index);
|
||||
Some(assignment)
|
||||
}
|
||||
|
||||
/// Report that an assignment was duplicated by the scheduler.
|
||||
pub fn assignment_duplicated(para_id: ParaId, core_index: CoreIndex) {
|
||||
Pallet::<T>::increase_affinity(para_id, core_index);
|
||||
Pezpallet::<T>::increase_affinity(para_id, core_index);
|
||||
}
|
||||
|
||||
/// Report that the `para_id` & `core_index` combination was processed.
|
||||
@@ -403,7 +403,7 @@ where
|
||||
/// In other words for each `pop_assignment_for_core` a call to this function or
|
||||
/// `push_back_assignment` must follow, but only one.
|
||||
pub fn report_processed(para_id: ParaId, core_index: CoreIndex) {
|
||||
Pallet::<T>::decrease_affinity_update_queue(para_id, core_index);
|
||||
Pezpallet::<T>::decrease_affinity_update_queue(para_id, core_index);
|
||||
}
|
||||
|
||||
/// Push an assignment back to the front of the queue.
|
||||
@@ -417,9 +417,9 @@ where
|
||||
/// - `para_id`: The para that did not make it.
|
||||
/// - `core_index`: The core the para was scheduled on.
|
||||
pub fn push_back_assignment(para_id: ParaId, core_index: CoreIndex) {
|
||||
Pallet::<T>::decrease_affinity_update_queue(para_id, core_index);
|
||||
Pezpallet::<T>::decrease_affinity_update_queue(para_id, core_index);
|
||||
QueueStatus::<T>::mutate(|queue_status| {
|
||||
Pallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Front);
|
||||
Pezpallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Front);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -432,12 +432,12 @@ where
|
||||
Credits::<T>::mutate(who.clone(), |credits| {
|
||||
*credits = credits.saturating_add(amount);
|
||||
});
|
||||
Pallet::<T>::deposit_event(Event::<T>::AccountCredited { who, amount });
|
||||
Pezpallet::<T>::deposit_event(Event::<T>::AccountCredited { who, amount });
|
||||
}
|
||||
|
||||
/// Helper function for `place_order_*` calls. Used to differentiate between placing orders
|
||||
/// with a keep alive check or to allow the account to be reaped. The amount charged is
|
||||
/// stored to the pallet account to be later paid out as revenue.
|
||||
/// stored to the pezpallet account to be later paid out as revenue.
|
||||
///
|
||||
/// Parameters:
|
||||
/// - `sender`: The sender of the call, funds will be withdrawn from this account.
|
||||
@@ -490,7 +490,7 @@ where
|
||||
existence_requirement,
|
||||
)?;
|
||||
|
||||
// Consume the negative imbalance and deposit it into the pallet account. Make
|
||||
// Consume the negative imbalance and deposit it into the pezpallet account. Make
|
||||
// sure the account preserves even without the existential deposit.
|
||||
let pot = Self::account_id();
|
||||
if !System::<T>::account_exists(&pot) {
|
||||
@@ -525,8 +525,8 @@ where
|
||||
}
|
||||
});
|
||||
|
||||
Pallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Back);
|
||||
Pallet::<T>::deposit_event(Event::<T>::OnDemandOrderPlaced {
|
||||
Pezpallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Back);
|
||||
Pezpallet::<T>::deposit_event(Event::<T>::OnDemandOrderPlaced {
|
||||
para_id,
|
||||
spot_price,
|
||||
ordered_by: sender,
|
||||
@@ -560,7 +560,7 @@ where
|
||||
);
|
||||
|
||||
// emit the event for updated new price
|
||||
Pallet::<T>::deposit_event(Event::<T>::SpotPriceSet { spot_price });
|
||||
Pezpallet::<T>::deposit_event(Event::<T>::SpotPriceSet { spot_price });
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
@@ -675,7 +675,7 @@ where
|
||||
///
|
||||
/// if affinity dropped to 0, moving entries back to `FreeEntries`.
|
||||
fn decrease_affinity_update_queue(para_id: ParaId, core_index: CoreIndex) {
|
||||
let affinity = Pallet::<T>::decrease_affinity(para_id, core_index);
|
||||
let affinity = Pezpallet::<T>::decrease_affinity(para_id, core_index);
|
||||
#[cfg(not(test))]
|
||||
debug_assert_ne!(
|
||||
affinity, None,
|
||||
@@ -743,7 +743,7 @@ where
|
||||
|
||||
/// Collect the revenue from the `when` blockheight
|
||||
pub fn claim_revenue_until(when: BlockNumberFor<T>) -> BalanceOf<T> {
|
||||
let now = <pezframe_system::Pallet<T>>::block_number();
|
||||
let now = <pezframe_system::Pezpallet<T>>::block_number();
|
||||
let mut amount: BalanceOf<T> = BalanceOf::<T>::zero();
|
||||
Revenue::<T>::mutate(|revenue| {
|
||||
while !revenue.is_empty() {
|
||||
@@ -759,7 +759,7 @@ where
|
||||
amount
|
||||
}
|
||||
|
||||
/// Account of the pallet pot, where the funds from instantaneous coretime sale are accumulated.
|
||||
/// Account of the pezpallet pot, where the funds from instantaneous coretime sale are accumulated.
|
||||
pub fn account_id() -> T::AccountId {
|
||||
T::PalletId::get().into_account_truncating()
|
||||
}
|
||||
@@ -786,7 +786,7 @@ where
|
||||
pub fn populate_queue(para_id: ParaId, num: u32) {
|
||||
QueueStatus::<T>::mutate(|queue_status| {
|
||||
for _ in 0..num {
|
||||
Pallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Back);
|
||||
Pezpallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Back);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ fn run_to_block(
|
||||
// Update the spot traffic and revenue on every block.
|
||||
OnDemand::on_initialize(b + 1);
|
||||
|
||||
// In the real runtime this is expected to be called by the `InclusionInherent` pallet.
|
||||
// In the real runtime this is expected to be called by the `InclusionInherent` pezpallet.
|
||||
Scheduler::advance_claim_queue(&Default::default());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! On demand module types.
|
||||
|
||||
use super::{alloc, pallet::Config};
|
||||
use super::{alloc, pezpallet::Config};
|
||||
use alloc::collections::BinaryHeap;
|
||||
use core::cmp::{Ord, Ordering, PartialOrd};
|
||||
use pezframe_support::{
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Declaration of the teyrchain specific origin and a pallet that hosts it.
|
||||
//! Declaration of the teyrchain specific origin and a pezpallet that hosts it.
|
||||
|
||||
use core::result;
|
||||
use pezkuwi_primitives::Id as ParaId;
|
||||
use pezsp_runtime::traits::BadOrigin;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
/// Ensure that the origin `o` represents a teyrchain.
|
||||
/// Returns `Ok` with the teyrchain ID that effected the extrinsic or an `Err` otherwise.
|
||||
@@ -34,24 +34,24 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// There is no way to register an origin type in `construct_runtime` without a pallet the origin
|
||||
/// There is no way to register an origin type in `construct_runtime` without a pezpallet the origin
|
||||
/// belongs to.
|
||||
///
|
||||
/// 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.
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {}
|
||||
|
||||
/// Origin for the teyrchains.
|
||||
#[pallet::origin]
|
||||
#[pezpallet::origin]
|
||||
#[derive(
|
||||
PartialEq,
|
||||
Eq,
|
||||
|
||||
@@ -37,7 +37,7 @@ 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 = pezframe_system::Pallet::<T>::events();
|
||||
let events = pezframe_system::Pezpallet::<T>::events();
|
||||
let system_event: <T as pezframe_system::Config>::RuntimeEvent = generic_event.into();
|
||||
// compare to the last event record
|
||||
let pezframe_system::EventRecord { event, .. } = &events[events.len() - 1];
|
||||
@@ -141,13 +141,13 @@ mod benchmarks {
|
||||
let new_head = HeadData(vec![0; s as usize]);
|
||||
let old_code_hash = ValidationCode(vec![0]).hash();
|
||||
CurrentCodeHash::<T>::insert(¶_id, old_code_hash);
|
||||
pezframe_system::Pallet::<T>::set_block_number(10u32.into());
|
||||
pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<T>::block_number().saturating_sub(One::one());
|
||||
let expired = pezframe_system::Pezpallet::<T>::block_number().saturating_sub(One::one());
|
||||
let config = HostConfiguration::<BlockNumberFor<T>>::default();
|
||||
generate_disordered_pruning::<T>();
|
||||
Pallet::<T>::schedule_code_upgrade(
|
||||
Pezpallet::<T>::schedule_code_upgrade(
|
||||
para_id,
|
||||
ValidationCode(vec![0u8; MIN_CODE_SIZE as usize]),
|
||||
expired,
|
||||
@@ -199,7 +199,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ mod benchmarks {
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,10 +256,10 @@ mod benchmarks {
|
||||
let para_id = ParaId::from(1000);
|
||||
let old_code_hash = ValidationCode(vec![0]).hash();
|
||||
CurrentCodeHash::<T>::insert(¶_id, old_code_hash);
|
||||
pezframe_system::Pallet::<T>::set_block_number(10u32.into());
|
||||
let inclusion = pezframe_system::Pallet::<T>::block_number().saturating_add(10u32.into());
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(10u32.into());
|
||||
let inclusion = pezframe_system::Pezpallet::<T>::block_number().saturating_add(10u32.into());
|
||||
let config = HostConfiguration::<BlockNumberFor<T>>::default();
|
||||
Pallet::<T>::schedule_code_upgrade(
|
||||
Pezpallet::<T>::schedule_code_upgrade(
|
||||
para_id,
|
||||
ValidationCode(vec![0u8; MIN_CODE_SIZE as usize]),
|
||||
inclusion,
|
||||
@@ -297,7 +297,7 @@ mod benchmarks {
|
||||
Event::CodeAuthorized {
|
||||
para_id,
|
||||
code_hash: new_code_hash,
|
||||
expire_at: pezframe_system::Pallet::<T>::block_number().saturating_add(valid_period),
|
||||
expire_at: pezframe_system::Pezpallet::<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 =
|
||||
pezframe_system::Pallet::<T>::block_number().saturating_add(BlockNumberFor::<T>::from(c));
|
||||
pezframe_system::Pezpallet::<T>::block_number().saturating_add(BlockNumberFor::<T>::from(c));
|
||||
AuthorizedCodeHash::<T>::insert(
|
||||
¶_id,
|
||||
AuthorizedCodeHashAndExpiry::from((code.hash(), expire_at)),
|
||||
@@ -322,7 +322,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
);
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Implements benchmarking setup for the `merkle-mountain-range` pallet.
|
||||
//! Implements benchmarking setup for the `merkle-mountain-range` pezpallet.
|
||||
|
||||
use crate::paras::*;
|
||||
use pezpallet_mmr::BenchmarkHelper;
|
||||
use pezsp_std::vec;
|
||||
|
||||
/// Struct to setup benchmarks for the `merkle-mountain-range` pallet.
|
||||
/// Struct to setup benchmarks for the `merkle-mountain-range` pezpallet.
|
||||
pub struct MmrSetup<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T> BenchmarkHelper for MmrSetup<T>
|
||||
@@ -34,7 +34,7 @@ where
|
||||
for para in 0..MAX_PARA_HEADS {
|
||||
let id = (para as u32).into();
|
||||
let h = head.clone().into();
|
||||
Pallet::<T>::heads_insert(&id, h);
|
||||
Pezpallet::<T>::heads_insert(&id, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! This module focuses on the benchmarking of the `include_pvf_check_statement` dispatchable.
|
||||
|
||||
use crate::{configuration, paras::*, shared::Pallet as ParasShared};
|
||||
use crate::{configuration, paras::*, shared::Pezpallet as ParasShared};
|
||||
use alloc::{vec, vec::Vec};
|
||||
use pezframe_support::assert_ok;
|
||||
use pezframe_system::RawOrigin;
|
||||
@@ -80,7 +80,7 @@ where
|
||||
let stmt_n_sig = stmts.pop().unwrap();
|
||||
|
||||
for (stmt, sig) in stmts {
|
||||
let r = Pallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, sig);
|
||||
let r = Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, sig);
|
||||
assert!(r.is_ok());
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ where
|
||||
initialize::<T>();
|
||||
for i in 0..PARAS_NUM {
|
||||
let id = ParaId::from(i as u32);
|
||||
assert_ok!(Pallet::<T>::schedule_para_initialize(
|
||||
assert_ok!(Pezpallet::<T>::schedule_para_initialize(
|
||||
id,
|
||||
ParaGenesisArgs {
|
||||
para_kind: ParaKind::Teyrchain,
|
||||
@@ -135,7 +135,7 @@ where
|
||||
|
||||
// 1. Make sure PVF pre-checking is enabled in the config.
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
configuration::Pallet::<T>::force_set_active_config(config.clone());
|
||||
configuration::Pezpallet::<T>::force_set_active_config(config.clone());
|
||||
|
||||
// 2. initialize a new session with deterministic validator set.
|
||||
ParasShared::<T>::set_active_validators_ascending(validators.clone());
|
||||
@@ -160,7 +160,7 @@ where
|
||||
let validation_code = validation_code();
|
||||
|
||||
let mut teyrchains = TeyrchainsCache::new();
|
||||
Pallet::<T>::initialize_para_now(
|
||||
Pezpallet::<T>::initialize_para_now(
|
||||
&mut teyrchains,
|
||||
id,
|
||||
&ParaGenesisArgs {
|
||||
@@ -173,7 +173,7 @@ where
|
||||
// asap.
|
||||
drop(teyrchains);
|
||||
|
||||
Pallet::<T>::schedule_code_upgrade(
|
||||
Pezpallet::<T>::schedule_code_upgrade(
|
||||
id,
|
||||
validation_code,
|
||||
/* relay_parent_number */ 1u32.into(),
|
||||
@@ -181,7 +181,7 @@ where
|
||||
UpgradeStrategy::SetGoAheadSignal,
|
||||
);
|
||||
} else {
|
||||
let r = Pallet::<T>::schedule_para_initialize(
|
||||
let r = Pezpallet::<T>::schedule_para_initialize(
|
||||
id,
|
||||
ParaGenesisArgs {
|
||||
para_kind: ParaKind::Teyrchain,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The paras pallet acts as the main registry of paras.
|
||||
//! The paras pezpallet acts as the main registry of paras.
|
||||
//!
|
||||
//! # Tracking State of Paras
|
||||
//!
|
||||
@@ -22,7 +22,7 @@
|
||||
//! are active and what their current state is. The current state of a para consists of the current
|
||||
//! head data and the current validation code (AKA Teyrchain Validation Function (PVF)).
|
||||
//!
|
||||
//! A para is not considered live until it is registered and activated in this pallet.
|
||||
//! A para is not considered live until it is registered and activated in this pezpallet.
|
||||
//!
|
||||
//! The set of teyrchains cannot change except at session boundaries. This is primarily to ensure
|
||||
//! that the number and meaning of bits required for the availability bitfields does not change
|
||||
@@ -78,7 +78,7 @@
|
||||
//! part of this process, validators from the active set will take the validation code and check if
|
||||
//! it is malicious. Once they did that and have their judgement, either accept or reject, they
|
||||
//! issue a statement in a form of an unsigned extrinsic. This extrinsic is processed by this
|
||||
//! pallet. Once supermajority is gained for accept, then the process that initiated the check is
|
||||
//! pezpallet. Once supermajority is gained for accept, then the process that initiated the check is
|
||||
//! resumed (as mentioned before this can be either upgrading of validation code or onboarding). If
|
||||
//! getting a supermajority becomes impossible (>1/3 of validators have already voted against), then
|
||||
//! we reject.
|
||||
@@ -144,7 +144,7 @@ pub mod benchmarking;
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::paras";
|
||||
|
||||
@@ -638,8 +638,8 @@ impl WeightInfo for TestWeightInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::traits::{
|
||||
fungible::{Inspect, Mutate},
|
||||
@@ -652,11 +652,11 @@ pub mod pallet {
|
||||
|
||||
type BalanceOf<T> = <<T as Config>::Fungible as Inspect<AccountIdFor<T>>>::Balance;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config
|
||||
+ configuration::Config
|
||||
@@ -666,7 +666,7 @@ pub mod pallet {
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type UnsignedPriority: Get<TransactionPriority>;
|
||||
|
||||
type NextSessionRotation: EstimateNextSessionRotation<BlockNumberFor<Self>>;
|
||||
@@ -674,13 +674,13 @@ pub mod pallet {
|
||||
/// Retrieve how many UMP messages are enqueued for this para-chain.
|
||||
///
|
||||
/// This is used to judge whether or not a para-chain can offboard. Per default this should
|
||||
/// be set to the `ParaInclusion` pallet.
|
||||
/// be set to the `ParaInclusion` pezpallet.
|
||||
type QueueFootprinter: QueueFootprinter<Origin = UmpQueueId>;
|
||||
|
||||
/// Runtime hook for when a teyrchain head is updated.
|
||||
type OnNewHead: OnNewHead;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
/// Runtime hook for assigning coretime for a given teyrchain.
|
||||
@@ -699,20 +699,20 @@ pub mod pallet {
|
||||
/// ([`configuration::HostConfiguration::validation_upgrade_cooldown`]). This cooldown
|
||||
/// exists to prevent spamming the relay chain with runtime upgrades. But as life is going
|
||||
/// on, mistakes can happen and a consequent may be required. The cooldown period can be
|
||||
/// removed by using [`Pallet::remove_upgrade_cooldown`]. This dispatchable will use this
|
||||
/// removed by using [`Pezpallet::remove_upgrade_cooldown`]. This dispatchable will use this
|
||||
/// multiplier to determine the cost for removing the upgrade cooldown. Time left for the
|
||||
/// cooldown multiplied with this multiplier determines the cost.
|
||||
type CooldownRemovalMultiplier: Get<BalanceOf<Self>>;
|
||||
|
||||
/// The origin that can authorize [`Pallet::authorize_force_set_current_code_hash`].
|
||||
/// The origin that can authorize [`Pezpallet::authorize_force_set_current_code_hash`].
|
||||
///
|
||||
/// In the end this allows [`Pallet::apply_authorized_force_set_current_code`] to force set
|
||||
/// In the end this allows [`Pezpallet::apply_authorized_force_set_current_code`] to force set
|
||||
/// the current code without paying any fee. So, the origin should be chosen with care.
|
||||
type AuthorizeCurrentCodeOrigin: EnsureOriginWithArg<Self::RuntimeOrigin, ParaId>;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// Current code has been updated for a Para. `para_id`
|
||||
CurrentCodeUpdated(ParaId),
|
||||
@@ -749,7 +749,7 @@ pub mod pallet {
|
||||
},
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Para is not registered in our system.
|
||||
NotRegistered,
|
||||
@@ -789,7 +789,7 @@ pub mod pallet {
|
||||
///
|
||||
/// Invariant:
|
||||
/// - There are no PVF pre-checking votes that exists in list but not in the set and vice versa.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type PvfActiveVoteMap<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -799,7 +799,7 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// The list of all currently active PVF votes. Auxiliary to `PvfActiveVoteMap`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type PvfActiveVoteList<T: Config> =
|
||||
StorageValue<_, Vec<ValidationCodeHash>, ValueQuery>;
|
||||
|
||||
@@ -807,39 +807,39 @@ pub mod pallet {
|
||||
/// included.
|
||||
///
|
||||
/// Consider using the [`TeyrchainsCache`] type of modifying.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Teyrchains<T: Config> = StorageValue<_, Vec<ParaId>, ValueQuery>;
|
||||
|
||||
/// The current lifecycle of a all known Para IDs.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type ParaLifecycles<T: Config> = StorageMap<_, Twox64Concat, ParaId, ParaLifecycle>;
|
||||
|
||||
/// The head-data of every registered para.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Heads<T: Config> = StorageMap<_, Twox64Concat, ParaId, HeadData>;
|
||||
|
||||
/// The context (relay-chain block number) of the most recent teyrchain head.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type MostRecentContext<T: Config> = StorageMap<_, Twox64Concat, ParaId, BlockNumberFor<T>>;
|
||||
|
||||
/// The validation code hash of every live para.
|
||||
///
|
||||
/// Corresponding code can be retrieved with [`CodeByHash`].
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type CurrentCodeHash<T: Config> = StorageMap<_, Twox64Concat, ParaId, ValidationCodeHash>;
|
||||
|
||||
/// Actual past code hash, indicated by the para id as well as the block number at which it
|
||||
/// became outdated.
|
||||
///
|
||||
/// Corresponding code can be retrieved with [`CodeByHash`].
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type PastCodeHash<T: Config> =
|
||||
StorageMap<_, Twox64Concat, (ParaId, BlockNumberFor<T>), ValidationCodeHash>;
|
||||
|
||||
/// Past code of teyrchains. The teyrchains themselves may not be registered anymore,
|
||||
/// but we also keep their code on-chain for the same amount of time as outdated code
|
||||
/// to keep it available for approval checkers.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type PastCodeMeta<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, ParaPastCodeMeta<BlockNumberFor<T>>, ValueQuery>;
|
||||
|
||||
@@ -849,7 +849,7 @@ pub mod pallet {
|
||||
/// This is to ensure the entire acceptance period is covered, not an offset acceptance period
|
||||
/// starting from the time at which the teyrchain perceives a code upgrade as having occurred.
|
||||
/// Multiple entries for a single para are permitted. Ordered ascending by block number.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type PastCodePruning<T: Config> =
|
||||
StorageValue<_, Vec<(ParaId, BlockNumberFor<T>)>, ValueQuery>;
|
||||
|
||||
@@ -857,7 +857,7 @@ pub mod pallet {
|
||||
///
|
||||
/// The change will be applied after the first parablock for this ID included which executes
|
||||
/// in the context of a relay chain block with a number >= `expected_at`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type FutureCodeUpgrades<T: Config> = StorageMap<_, Twox64Concat, ParaId, BlockNumberFor<T>>;
|
||||
|
||||
/// The list of upcoming future code upgrades.
|
||||
@@ -868,18 +868,18 @@ pub mod pallet {
|
||||
/// progress or not.
|
||||
///
|
||||
/// Ordered ascending by block number.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type FutureCodeUpgradesAt<T: Config> =
|
||||
StorageValue<_, Vec<(ParaId, BlockNumberFor<T>)>, ValueQuery>;
|
||||
|
||||
/// The actual future code hash of a para.
|
||||
///
|
||||
/// Corresponding code can be retrieved with [`CodeByHash`].
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type FutureCodeHash<T: Config> = StorageMap<_, Twox64Concat, ParaId, ValidationCodeHash>;
|
||||
|
||||
/// The code hash authorizations for a para which will expire `expire_at` `BlockNumberFor<T>`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type AuthorizedCodeHash<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, AuthorizedCodeHashAndExpiry<BlockNumberFor<T>>>;
|
||||
|
||||
@@ -893,7 +893,7 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE that this field is used by teyrchains via merkle storage proofs, therefore changing
|
||||
/// the format will require migration of teyrchains.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type UpgradeGoAheadSignal<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, UpgradeGoAhead>;
|
||||
|
||||
@@ -906,14 +906,14 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE that this field is used by teyrchains via merkle storage proofs, therefore changing
|
||||
/// the format will require migration of teyrchains.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type UpgradeRestrictionSignal<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, UpgradeRestriction>;
|
||||
|
||||
/// The list of teyrchains that are awaiting for their upgrade restriction to cooldown.
|
||||
///
|
||||
/// Ordered ascending by block number.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type UpgradeCooldowns<T: Config> =
|
||||
StorageValue<_, Vec<(ParaId, BlockNumberFor<T>)>, ValueQuery>;
|
||||
|
||||
@@ -923,12 +923,12 @@ pub mod pallet {
|
||||
/// is expected at.
|
||||
///
|
||||
/// Ordered ascending by block number.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type UpcomingUpgrades<T: Config> =
|
||||
StorageValue<_, Vec<(ParaId, BlockNumberFor<T>)>, ValueQuery>;
|
||||
|
||||
/// The actions to perform during the start of a specific session index.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ActionsQueue<T: Config> =
|
||||
StorageMap<_, Twox64Concat, SessionIndex, Vec<ParaId>, ValueQuery>;
|
||||
|
||||
@@ -936,12 +936,12 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE that after PVF pre-checking is enabled the para genesis arg will have it's code set
|
||||
/// to empty. Instead, the code will be saved into the storage right away via `CodeByHash`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type UpcomingParasGenesis<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, ParaGenesisArgs>;
|
||||
|
||||
/// The number of reference on the validation code in [`CodeByHash`] storage.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type CodeByHashRefs<T: Config> =
|
||||
StorageMap<_, Identity, ValidationCodeHash, u32, ValueQuery>;
|
||||
|
||||
@@ -949,10 +949,10 @@ pub mod pallet {
|
||||
///
|
||||
/// This storage is consistent with [`FutureCodeHash`], [`CurrentCodeHash`] and
|
||||
/// [`PastCodeHash`].
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type CodeByHash<T: Config> = StorageMap<_, Identity, ValidationCodeHash, ValidationCode>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[pezpallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
@@ -960,7 +960,7 @@ pub mod pallet {
|
||||
pub paras: Vec<(ParaId, ParaGenesisArgs)>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
#[pezpallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
let mut teyrchains = TeyrchainsCache::new();
|
||||
@@ -968,7 +968,7 @@ pub mod pallet {
|
||||
if genesis_args.validation_code.0.is_empty() {
|
||||
panic!("empty validation code is not allowed in genesis");
|
||||
}
|
||||
Pallet::<T>::initialize_para_now(&mut teyrchains, *id, genesis_args);
|
||||
Pezpallet::<T>::initialize_para_now(&mut teyrchains, *id, genesis_args);
|
||||
if genesis_args.para_kind == ParaKind::Teyrchain {
|
||||
T::AssignCoretime::assign_coretime(*id)
|
||||
.expect("Assigning coretime works at genesis; qed");
|
||||
@@ -978,11 +978,11 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Set the storage for the teyrchain validation code immediately.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_code(new_code.0.len() as u32))]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_set_current_code(new_code.0.len() as u32))]
|
||||
pub fn force_set_current_code(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -994,8 +994,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the storage for the current teyrchain head data immediately.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_set_current_head(new_head.0.len() as u32))]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_set_current_head(new_head.0.len() as u32))]
|
||||
pub fn force_set_current_head(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -1007,8 +1007,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Schedule an upgrade as if it was scheduled in the given relay parent block.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_schedule_code_upgrade(new_code.0.len() as u32))]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_schedule_code_upgrade(new_code.0.len() as u32))]
|
||||
pub fn force_schedule_code_upgrade(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -1029,15 +1029,15 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Note a new block head for para within the context of the current block.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_note_new_head(new_head.0.len() as u32))]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_note_new_head(new_head.0.len() as u32))]
|
||||
pub fn force_note_new_head(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
new_head: HeadData,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
Self::note_new_head(para, new_head, now);
|
||||
Self::deposit_event(Event::NewHeadNoted(para));
|
||||
Ok(())
|
||||
@@ -1046,8 +1046,8 @@ pub mod pallet {
|
||||
/// Put a teyrchain directly into the next session's action queue.
|
||||
/// We can't queue it any sooner than this without going into the
|
||||
/// initializer...
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_queue_action())]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_queue_action())]
|
||||
pub fn force_queue_action(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let next_session = shared::CurrentSessionIndex::<T>::get().saturating_add(One::one());
|
||||
@@ -1074,8 +1074,8 @@ pub mod pallet {
|
||||
///
|
||||
/// This function is mainly meant to be used for upgrading teyrchains that do not follow
|
||||
/// the go-ahead signal while the PVF pre-checking feature is enabled.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::add_trusted_validation_code(validation_code.0.len() as u32))]
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::add_trusted_validation_code(validation_code.0.len() as u32))]
|
||||
pub fn add_trusted_validation_code(
|
||||
origin: OriginFor<T>,
|
||||
validation_code: ValidationCode,
|
||||
@@ -1094,7 +1094,7 @@ pub mod pallet {
|
||||
|
||||
let cfg = configuration::ActiveConfig::<T>::get();
|
||||
Self::enact_pvf_accepted(
|
||||
pezframe_system::Pallet::<T>::block_number(),
|
||||
pezframe_system::Pezpallet::<T>::block_number(),
|
||||
&code_hash,
|
||||
&vote.causes,
|
||||
vote.age,
|
||||
@@ -1123,8 +1123,8 @@ pub mod pallet {
|
||||
/// This is better than removing the storage directly, because it will not remove the code
|
||||
/// that was suddenly got used by some teyrchain while this dispatchable was pending
|
||||
/// dispatching.
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::poke_unused_validation_code())]
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::poke_unused_validation_code())]
|
||||
pub fn poke_unused_validation_code(
|
||||
origin: OriginFor<T>,
|
||||
validation_code_hash: ValidationCodeHash,
|
||||
@@ -1138,8 +1138,8 @@ pub mod pallet {
|
||||
|
||||
/// Includes a statement for a PVF pre-checking vote. Potentially, finalizes the vote and
|
||||
/// enacts the results if that was the last vote before achieving the supermajority.
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(
|
||||
#[pezpallet::call_index(7)]
|
||||
#[pezpallet::weight(
|
||||
<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_accept()
|
||||
.max(<T as Config>::WeightInfo::include_pvf_check_statement_finalize_upgrade_reject())
|
||||
.max(<T as Config>::WeightInfo::include_pvf_check_statement_finalize_onboarding_accept()
|
||||
@@ -1204,7 +1204,7 @@ pub mod pallet {
|
||||
PvfCheckOutcome::Accepted => {
|
||||
let cfg = configuration::ActiveConfig::<T>::get();
|
||||
Self::enact_pvf_accepted(
|
||||
pezframe_system::Pallet::<T>::block_number(),
|
||||
pezframe_system::Pezpallet::<T>::block_number(),
|
||||
&stmt.subject,
|
||||
&active_vote.causes,
|
||||
active_vote.age,
|
||||
@@ -1229,8 +1229,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Set the storage for the current teyrchain head data immediately.
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::force_set_most_recent_context())]
|
||||
#[pezpallet::call_index(8)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::force_set_most_recent_context())]
|
||||
pub fn force_set_most_recent_context(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -1245,8 +1245,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The cost for removing the cooldown earlier depends on the time left for the cooldown
|
||||
/// multiplied by [`Config::CooldownRemovalMultiplier`]. The paid tokens are burned.
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::remove_upgrade_cooldown())]
|
||||
#[pezpallet::call_index(9)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::remove_upgrade_cooldown())]
|
||||
pub fn remove_upgrade_cooldown(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -1283,15 +1283,15 @@ pub mod pallet {
|
||||
/// If not applied, it will be removed at the `System::block_number() + valid_period` block.
|
||||
///
|
||||
/// This can be useful, when triggering `Paras::force_set_current_code(para, code)`
|
||||
/// from a different chain than the one where the `Paras` pallet is deployed.
|
||||
/// from a different chain than the one where the `Paras` pezpallet is deployed.
|
||||
///
|
||||
/// The main purpose is to avoid transferring the entire `code` Wasm blob between chains.
|
||||
/// Instead, we authorize `code_hash` with `root`, which can later be applied by
|
||||
/// `Paras::apply_authorized_force_set_current_code(para, code)` by anyone.
|
||||
///
|
||||
/// Authorizations are stored in an **overwriting manner**.
|
||||
#[pallet::call_index(10)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::authorize_force_set_current_code_hash())]
|
||||
#[pezpallet::call_index(10)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::authorize_force_set_current_code_hash())]
|
||||
pub fn authorize_force_set_current_code_hash(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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.
|
||||
@@ -1321,8 +1321,8 @@ pub mod pallet {
|
||||
|
||||
/// Applies the already authorized current code for the teyrchain,
|
||||
/// triggering the same functionality as `force_set_current_code`.
|
||||
#[pallet::call_index(11)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::apply_authorized_force_set_current_code(new_code.0.len() as u32))]
|
||||
#[pezpallet::call_index(11)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::apply_authorized_force_set_current_code(new_code.0.len() as u32))]
|
||||
pub fn apply_authorized_force_set_current_code(
|
||||
_origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
@@ -1342,19 +1342,19 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
pub(crate) fn calculate_remove_upgrade_cooldown_cost(
|
||||
cooldown_until: BlockNumberFor<T>,
|
||||
) -> BalanceOf<T> {
|
||||
let time_left =
|
||||
cooldown_until.saturating_sub(pezframe_system::Pallet::<T>::block_number());
|
||||
cooldown_until.saturating_sub(pezframe_system::Pezpallet::<T>::block_number());
|
||||
|
||||
BalanceOf::<T>::from(time_left).saturating_mul(T::CooldownRemovalMultiplier::get())
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::view_functions]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::view_functions]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Returns the cost for removing an upgrade cooldown for the given `para`.
|
||||
pub fn remove_upgrade_cooldown_cost(para: ParaId) -> BalanceOf<T> {
|
||||
UpgradeCooldowns::<T>::get()
|
||||
@@ -1365,8 +1365,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::validate_unsigned]
|
||||
impl<T: Config> ValidateUnsigned for Pallet<T> {
|
||||
#[pezpallet::validate_unsigned]
|
||||
impl<T: Config> ValidateUnsigned for Pezpallet<T> {
|
||||
type Call = Call<T>;
|
||||
|
||||
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
let longevity = authorized_code.expire_at.saturating_sub(now);
|
||||
|
||||
ValidTransaction::with_tag_prefix("ApplyAuthorizedForceSetCurrentCode")
|
||||
@@ -1465,7 +1465,7 @@ const INVALID_TX_UNAUTHORIZED_CODE: u8 = 4;
|
||||
/// communicate via offchain XCMP. Snowbridge will still work as it only cares about `BridgeHub`.
|
||||
pub const MAX_PARA_HEADS: usize = 1024;
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// This is a call to schedule code upgrades for teyrchains which is safe to be called
|
||||
/// outside of this module. That means this function does all checks necessary to ensure
|
||||
/// that some external code is allowed to trigger a code upgrade. We do not do auth checks,
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let current_block = pezframe_system::Pezpallet::<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);
|
||||
@@ -1496,7 +1496,7 @@ impl<T: Config> Pallet<T> {
|
||||
Self::deposit_event(Event::CurrentHeadUpdated(para));
|
||||
}
|
||||
|
||||
/// Called by the initializer to initialize the paras pallet.
|
||||
/// Called by the initializer to initialize the paras pezpallet.
|
||||
pub(crate) fn initializer_initialize(now: BlockNumberFor<T>) -> Weight {
|
||||
Self::prune_old_code(now) +
|
||||
Self::process_scheduled_upgrade_changes(now) +
|
||||
@@ -1504,7 +1504,7 @@ impl<T: Config> Pallet<T> {
|
||||
Self::prune_expired_authorizations(now)
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the paras pallet.
|
||||
/// Called by the initializer to finalize the paras pezpallet.
|
||||
pub(crate) fn initializer_finalize(now: BlockNumberFor<T>) {
|
||||
Self::process_scheduled_upgrade_cooldowns(now);
|
||||
}
|
||||
@@ -1526,7 +1526,7 @@ impl<T: Config> Pallet<T> {
|
||||
let code = CodeByHash::<T>::get(&code_hash);
|
||||
if code.is_none() {
|
||||
log::error!(
|
||||
"Pallet paras storage is inconsistent, code not found for hash {}",
|
||||
"Pezpallet paras storage is inconsistent, code not found for hash {}",
|
||||
code_hash,
|
||||
);
|
||||
debug_assert!(false, "inconsistent paras storages");
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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);
|
||||
pezframe_system::Pallet::<T>::deposit_log(log.into());
|
||||
pezframe_system::Pezpallet::<T>::deposit_log(log.into());
|
||||
|
||||
weight
|
||||
}
|
||||
@@ -2033,7 +2033,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// does not guarantee that the teyrchain will eventually be onboarded. This can happen in case
|
||||
/// the PVF does not pass PVF pre-checking.
|
||||
///
|
||||
/// The Para ID should be not activated in this pallet. The validation code supplied in
|
||||
/// The Para ID should be not activated in this pezpallet. The validation code supplied in
|
||||
/// `genesis_data` should not be empty. If those conditions are not met, then the para cannot
|
||||
/// be onboarded.
|
||||
pub(crate) fn schedule_para_initialize(
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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);
|
||||
<pezframe_system::Pallet<T>>::deposit_log(log.into());
|
||||
<pezframe_system::Pezpallet<T>>::deposit_log(log.into());
|
||||
|
||||
// `now` is only used for registering pruning as part of `fn note_past_code`
|
||||
let now = <pezframe_system::Pallet<T>>::block_number();
|
||||
let now = <pezframe_system::Pezpallet<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, pezframe_system::Pallet::<T>::block_number());
|
||||
Self::set_current_code(para, new_code_hash, pezframe_system::Pezpallet::<T>::block_number());
|
||||
Self::deposit_event(Event::CurrentCodeUpdated(para));
|
||||
}
|
||||
|
||||
@@ -2502,7 +2502,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Return the session index that should be used for any future scheduled changes.
|
||||
fn scheduled_session() -> SessionIndex {
|
||||
shared::Pallet::<T>::scheduled_session()
|
||||
shared::Pezpallet::<T>::scheduled_session()
|
||||
}
|
||||
|
||||
/// Store the validation code if not already stored, and increase the number of reference.
|
||||
@@ -2542,7 +2542,7 @@ impl<T: Config> Pallet<T> {
|
||||
weight
|
||||
}
|
||||
|
||||
/// Test function for triggering a new session in this pallet.
|
||||
/// Test function for triggering a new session in this pezpallet.
|
||||
#[cfg(any(feature = "std", feature = "runtime-benchmarks", test))]
|
||||
pub fn test_on_new_session() {
|
||||
Self::initializer_on_new_session(&SessionChangeNotification {
|
||||
@@ -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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
ensure!(authorized.expire_at > now, Error::<T>::InvalidBlockNumber);
|
||||
ensure!(authorized.code_hash == code.hash(), Error::<T>::Unauthorized);
|
||||
Ok(authorized)
|
||||
|
||||
@@ -180,7 +180,7 @@ impl EventValidator {
|
||||
}
|
||||
|
||||
fn check(&self) {
|
||||
assert_eq!(&pezframe_system::Pallet::<Test>::events(), &self.events);
|
||||
assert_eq!(&pezframe_system::Pezpallet::<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!(pezframe_system::Pallet::<Test>::block_number(), 7);
|
||||
assert_eq!(pezframe_system::Pezpallet::<Test>::block_number(), 7);
|
||||
Paras::note_new_head(para_id, Default::default(), expected_at);
|
||||
AuthorizedCodeHash::<Test>::insert(
|
||||
¶_id,
|
||||
@@ -2118,7 +2118,7 @@ fn remove_upgrade_cooldown_works() {
|
||||
.dispatch_bypass_filter(RuntimeOrigin::signed(1)));
|
||||
|
||||
let expected_issuance = issuance -
|
||||
Pallet::<Test>::calculate_remove_upgrade_cooldown_cost(next_possible_upgrade_at);
|
||||
Pezpallet::<Test>::calculate_remove_upgrade_cooldown_cost(next_possible_upgrade_at);
|
||||
// Check that we burned the funds
|
||||
assert_eq!(expected_issuance, Balances::total_issuance());
|
||||
|
||||
@@ -2308,7 +2308,7 @@ fn apply_authorized_force_set_current_code_works() {
|
||||
);
|
||||
|
||||
// cannot apply obsolete authorization
|
||||
pezframe_system::Pallet::<Test>::set_block_number(valid_period + 5 + 10);
|
||||
pezframe_system::Pezpallet::<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())
|
||||
),
|
||||
);
|
||||
pezframe_system::Pallet::<Test>::set_block_number(5);
|
||||
pezframe_system::Pezpallet::<Test>::set_block_number(5);
|
||||
|
||||
// ok - can apply authorized code
|
||||
let (validate_unsigned, dispatch_result) =
|
||||
|
||||
@@ -133,7 +133,7 @@ mod benchmarks {
|
||||
},
|
||||
>,
|
||||
) -> Result<(), BenchmarkError> {
|
||||
configuration::Pallet::<T>::set_node_feature(
|
||||
configuration::Pezpallet::<T>::set_node_feature(
|
||||
RawOrigin::Root.into(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -153,7 +153,7 @@ mod benchmarks {
|
||||
assert_eq!(benchmark.backed_candidates.len(), 1);
|
||||
// with `v` validity votes.
|
||||
let votes = min(
|
||||
scheduler::Pallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(),
|
||||
scheduler::Pezpallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(),
|
||||
v as usize,
|
||||
);
|
||||
assert_eq!(benchmark.backed_candidates.get(0).unwrap().validity_votes().len(), votes);
|
||||
@@ -191,7 +191,7 @@ mod benchmarks {
|
||||
|
||||
#[benchmark]
|
||||
fn enter_backed_candidate_code_upgrade() -> Result<(), BenchmarkError> {
|
||||
configuration::Pallet::<T>::set_node_feature(
|
||||
configuration::Pezpallet::<T>::set_node_feature(
|
||||
RawOrigin::Root.into(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -212,7 +212,7 @@ mod benchmarks {
|
||||
let mut benchmark = scenario.data.clone();
|
||||
|
||||
let votes = min(
|
||||
scheduler::Pallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(),
|
||||
scheduler::Pezpallet::<T>::group_validators(GroupIndex::from(0)).unwrap().len(),
|
||||
BenchBuilder::<T>::fallback_min_backing_votes() as usize,
|
||||
);
|
||||
|
||||
@@ -252,7 +252,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite! {
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
crate::mock::new_test_ext(Default::default()),
|
||||
crate::mock::Test
|
||||
}
|
||||
|
||||
@@ -101,26 +101,26 @@ impl DisputedBitfield {
|
||||
}
|
||||
}
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pallet::disable_pezframe_system_supertrait_check]
|
||||
#[pezpallet::config]
|
||||
#[pezpallet::disable_pezframe_system_supertrait_check]
|
||||
pub trait Config:
|
||||
inclusion::Config + scheduler::Config + initializer::Config + pezpallet_babe::Config
|
||||
{
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Inclusion inherent called more than once per block.
|
||||
TooManyInclusionInherents,
|
||||
@@ -140,11 +140,11 @@ pub mod pallet {
|
||||
/// due to the guarantees of FRAME's storage APIs.
|
||||
///
|
||||
/// If this is `None` at the end of the block, we panic and render the block invalid.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type Included<T> = StorageValue<_, ()>;
|
||||
|
||||
/// Scraped on chain data for extracting resolved disputes as well as backing votes.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type OnChainVotes<T: Config> = StorageValue<_, ScrapedOnChainVotes<T::Hash>>;
|
||||
|
||||
/// Update the disputes statements set part of the on-chain votes.
|
||||
@@ -188,8 +188,8 @@ pub mod pallet {
|
||||
})
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
|
||||
T::DbWeight::get().reads_writes(1, 1) // in `on_finalize`.
|
||||
}
|
||||
@@ -201,8 +201,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::inherent]
|
||||
impl<T: Config> ProvideInherent for Pallet<T> {
|
||||
#[pezpallet::inherent]
|
||||
impl<T: Config> ProvideInherent for Pezpallet<T> {
|
||||
type Call = Call<T>;
|
||||
type Error = MakeFatalError<()>;
|
||||
const INHERENT_IDENTIFIER: InherentIdentifier = TEYRCHAINS_INHERENT_IDENTIFIER;
|
||||
@@ -218,11 +218,11 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Enter the paras inherent. This will process bitfields and backed candidates.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight((
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight((
|
||||
paras_inherent_total_weight::<T>(
|
||||
data.backed_candidates.as_slice(),
|
||||
&data.bitfields,
|
||||
@@ -248,7 +248,7 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Create the `TeyrchainsInherentData` that gets passed to [`Self::enter`] in
|
||||
/// [`Self::create_inherent`]. This code is pulled out of [`Self::create_inherent`] so it can be
|
||||
/// unit tested.
|
||||
@@ -299,14 +299,14 @@ impl<T: Config> Pallet<T> {
|
||||
disputes.len()
|
||||
);
|
||||
|
||||
let parent_hash = pezframe_system::Pallet::<T>::parent_hash();
|
||||
let parent_hash = pezframe_system::Pezpallet::<T>::parent_hash();
|
||||
|
||||
ensure!(
|
||||
parent_header.hash().as_ref() == parent_hash.as_ref(),
|
||||
Error::<T>::InvalidParentHeader,
|
||||
);
|
||||
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
|
||||
// Before anything else, update the allowed relay-parents.
|
||||
@@ -342,7 +342,7 @@ impl<T: Config> Pallet<T> {
|
||||
log::debug!(target: LOG_TARGET, "Time weight before filter: {}, candidates + bitfields: {}, disputes: {}", weight_before_filtering.ref_time(), candidates_weight.ref_time() + bitfields_weight.ref_time(), disputes_weight.ref_time());
|
||||
|
||||
let current_session = shared::CurrentSessionIndex::<T>::get();
|
||||
let expected_bits = scheduler::Pallet::<T>::num_availability_cores();
|
||||
let expected_bits = scheduler::Pezpallet::<T>::num_availability_cores();
|
||||
let validator_public = shared::ActiveValidatorKeys::<T>::get();
|
||||
|
||||
// We are assuming (incorrectly) to have all the weight (for the mandatory class or even
|
||||
@@ -480,7 +480,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// Get the cores freed as a result of concluded invalid candidates.
|
||||
let (freed_disputed, concluded_invalid_hashes): (Vec<CoreIndex>, BTreeSet<CandidateHash>) =
|
||||
inclusion::Pallet::<T>::free_disputed(¤t_concluded_invalid_disputes)
|
||||
inclusion::Pezpallet::<T>::free_disputed(¤t_concluded_invalid_disputes)
|
||||
.into_iter()
|
||||
.unzip();
|
||||
|
||||
@@ -503,7 +503,7 @@ impl<T: Config> Pallet<T> {
|
||||
// Process new availability bitfields, yielding any availability cores whose
|
||||
// work has now concluded.
|
||||
let (enact_weight, freed_concluded) =
|
||||
inclusion::Pallet::<T>::update_pending_availability_and_get_freed_cores(
|
||||
inclusion::Pezpallet::<T>::update_pending_availability_and_get_freed_cores(
|
||||
&validator_public[..],
|
||||
bitfields.clone(),
|
||||
);
|
||||
@@ -537,8 +537,8 @@ impl<T: Config> Pallet<T> {
|
||||
METRICS.on_candidates_included(freed_concluded.len() as u64);
|
||||
|
||||
// Get the timed out candidates
|
||||
let freed_timeout = if scheduler::Pallet::<T>::availability_timeout_check_required() {
|
||||
inclusion::Pallet::<T>::free_timedout()
|
||||
let freed_timeout = if scheduler::Pezpallet::<T>::availability_timeout_check_required() {
|
||||
inclusion::Pezpallet::<T>::free_timedout()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
@@ -590,13 +590,13 @@ impl<T: Config> Pallet<T> {
|
||||
DispatchErrorWithPostInfo,
|
||||
> {
|
||||
let allowed_relay_parents = shared::AllowedRelayParents::<T>::get();
|
||||
let upcoming_new_session = initializer::Pallet::<T>::upcoming_session_change();
|
||||
let upcoming_new_session = initializer::Pezpallet::<T>::upcoming_session_change();
|
||||
|
||||
METRICS.on_candidates_processed_total(backed_candidates.len() as u64);
|
||||
|
||||
if !upcoming_new_session {
|
||||
let occupied_cores =
|
||||
inclusion::Pallet::<T>::get_occupied_cores().map(|(core, _)| core).collect();
|
||||
inclusion::Pezpallet::<T>::get_occupied_cores().map(|(core, _)| core).collect();
|
||||
|
||||
let mut eligible: BTreeMap<ParaId, BTreeSet<CoreIndex>> = BTreeMap::new();
|
||||
let mut total_eligible_cores = 0;
|
||||
@@ -629,16 +629,16 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// Process backed candidates according to scheduled cores.
|
||||
let candidate_receipt_with_backing_validator_indices =
|
||||
inclusion::Pallet::<T>::process_candidates(
|
||||
inclusion::Pezpallet::<T>::process_candidates(
|
||||
&allowed_relay_parents,
|
||||
&backed_candidates_with_core,
|
||||
scheduler::Pallet::<T>::group_validators,
|
||||
scheduler::Pezpallet::<T>::group_validators,
|
||||
)?;
|
||||
|
||||
// We need to advance the claim queue on all cores, except for the ones that did not
|
||||
// get freed in this block. The ones that did not get freed also cannot be newly
|
||||
// occupied.
|
||||
scheduler::Pallet::<T>::advance_claim_queue(&occupied_cores);
|
||||
scheduler::Pezpallet::<T>::advance_claim_queue(&occupied_cores);
|
||||
|
||||
Ok((candidate_receipt_with_backing_validator_indices, backed_candidates_with_core))
|
||||
} else {
|
||||
@@ -1262,7 +1262,7 @@ fn filter_backed_statements_from_disabled_validators<
|
||||
allowed_relay_parents: &AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>,
|
||||
) {
|
||||
let disabled_validators =
|
||||
BTreeSet::<_>::from_iter(shared::Pallet::<T>::disabled_validators().into_iter());
|
||||
BTreeSet::<_>::from_iter(shared::Pezpallet::<T>::disabled_validators().into_iter());
|
||||
|
||||
if disabled_validators.is_empty() {
|
||||
// No disabled validators - nothing to do
|
||||
@@ -1297,7 +1297,7 @@ fn filter_backed_statements_from_disabled_validators<
|
||||
};
|
||||
|
||||
// Get the group index for the core
|
||||
let group_idx = match scheduler::Pallet::<T>::group_assigned_to_core(
|
||||
let group_idx = match scheduler::Pezpallet::<T>::group_assigned_to_core(
|
||||
*core_idx,
|
||||
relay_parent_block_number + One::one(),
|
||||
) {
|
||||
@@ -1309,7 +1309,7 @@ fn filter_backed_statements_from_disabled_validators<
|
||||
};
|
||||
|
||||
// And finally get the validator group for this group index
|
||||
let validator_group = match scheduler::Pallet::<T>::group_validators(group_idx) {
|
||||
let validator_group = match scheduler::Pezpallet::<T>::group_validators(group_idx) {
|
||||
Some(validator_group) => validator_group,
|
||||
None => {
|
||||
log::debug!(target: LOG_TARGET, "Can't get the validators from group {:?}. Dropping the candidate.", group_idx);
|
||||
@@ -1372,11 +1372,11 @@ fn filter_unchained_candidates<T: inclusion::Config + paras::Config + inclusion:
|
||||
) {
|
||||
let mut para_latest_context: BTreeMap<ParaId, (HeadData, BlockNumberFor<T>)> = BTreeMap::new();
|
||||
for para_id in candidates.keys() {
|
||||
let Some(latest_head_data) = inclusion::Pallet::<T>::para_latest_head_data(¶_id) else {
|
||||
let Some(latest_head_data) = inclusion::Pezpallet::<T>::para_latest_head_data(¶_id) else {
|
||||
defensive!("Latest included head data for paraid {:?} is None", para_id);
|
||||
continue;
|
||||
};
|
||||
let Some(latest_relay_parent) = inclusion::Pallet::<T>::para_most_recent_context(¶_id)
|
||||
let Some(latest_relay_parent) = inclusion::Pezpallet::<T>::para_most_recent_context(¶_id)
|
||||
else {
|
||||
defensive!("Latest relay parent for paraid {:?} is None", para_id);
|
||||
continue;
|
||||
@@ -1578,7 +1578,7 @@ fn get_injected_core_index<T: configuration::Config + scheduler::Config + inclus
|
||||
};
|
||||
|
||||
// Get the backing group of the candidate backed at `core_idx`.
|
||||
let group_idx = match scheduler::Pallet::<T>::group_assigned_to_core(
|
||||
let group_idx = match scheduler::Pezpallet::<T>::group_assigned_to_core(
|
||||
core_idx,
|
||||
relay_parent_block_number + One::one(),
|
||||
) {
|
||||
@@ -1593,7 +1593,7 @@ fn get_injected_core_index<T: configuration::Config + scheduler::Config + inclus
|
||||
},
|
||||
};
|
||||
|
||||
let group_validators = match scheduler::Pallet::<T>::group_validators(group_idx) {
|
||||
let group_validators = match scheduler::Pezpallet::<T>::group_validators(group_idx) {
|
||||
Some(validators) => validators,
|
||||
None => return None,
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ mod enter {
|
||||
(0..(builder.max_cores() as usize - extra_cores)).for_each(|para_id| {
|
||||
(0..elastic_paras.get(&(para_id as u32)).cloned().unwrap_or(1)).for_each(
|
||||
|_para_local_core_idx| {
|
||||
mock_assigner::Pallet::<Test>::add_test_assignment(Assignment::Bulk(
|
||||
mock_assigner::Pezpallet::<Test>::add_test_assignment(Assignment::Bulk(
|
||||
para_id.into(),
|
||||
));
|
||||
},
|
||||
@@ -158,7 +158,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -201,11 +201,11 @@ mod enter {
|
||||
inherent_data
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
// Nothing is filtered out (including the backed candidates.)
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
expected_para_inherent_data
|
||||
);
|
||||
|
||||
@@ -254,7 +254,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -295,19 +295,19 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(pallet::OnChainVotes::<Test>::get().is_none());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
assert!(pezpallet::OnChainVotes::<Test>::get().is_none());
|
||||
|
||||
// Nothing is filtered out (including the backed candidates.)
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
expected_para_inherent_data
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
// The length of this vec is equal to the number of candidates, so we know our 5
|
||||
// backed candidates did not get filtered out
|
||||
pallet::OnChainVotes::<Test>::get()
|
||||
pezpallet::OnChainVotes::<Test>::get()
|
||||
.unwrap()
|
||||
.backing_validators_per_candidate
|
||||
.len(),
|
||||
@@ -316,7 +316,7 @@ mod enter {
|
||||
|
||||
assert_eq!(
|
||||
// The session of the on chain votes should equal the current session, which is 2
|
||||
pallet::OnChainVotes::<Test>::get().unwrap().session,
|
||||
pezpallet::OnChainVotes::<Test>::get().unwrap().session,
|
||||
2
|
||||
);
|
||||
|
||||
@@ -356,7 +356,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -394,7 +394,7 @@ mod enter {
|
||||
assert_eq!(expected_para_inherent_data.backed_candidates.len(), 6);
|
||||
// * 0 disputes.
|
||||
assert_eq!(expected_para_inherent_data.disputes.len(), 0);
|
||||
assert!(pallet::OnChainVotes::<Test>::get().is_none());
|
||||
assert!(pezpallet::OnChainVotes::<Test>::get().is_none());
|
||||
|
||||
expected_para_inherent_data.backed_candidates = expected_para_inherent_data
|
||||
.backed_candidates
|
||||
@@ -410,17 +410,17 @@ mod enter {
|
||||
let mut inherent_data = InherentData::new();
|
||||
inherent_data.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &scenario.data).unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
// The right candidates have been filtered out (the ones for cores 0,4,5)
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
expected_para_inherent_data
|
||||
);
|
||||
|
||||
// 3 candidates have been backed (for cores 1,2 and 3)
|
||||
assert_eq!(
|
||||
pallet::OnChainVotes::<Test>::get()
|
||||
pezpallet::OnChainVotes::<Test>::get()
|
||||
.unwrap()
|
||||
.backing_validators_per_candidate
|
||||
.len(),
|
||||
@@ -429,7 +429,7 @@ mod enter {
|
||||
|
||||
assert_eq!(
|
||||
// The session of the on chain votes should equal the current session, which is 2
|
||||
pallet::OnChainVotes::<Test>::get().unwrap().session,
|
||||
pezpallet::OnChainVotes::<Test>::get().unwrap().session,
|
||||
2
|
||||
);
|
||||
|
||||
@@ -486,12 +486,12 @@ mod enter {
|
||||
|
||||
// Nothing has been filtered out.
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
data
|
||||
);
|
||||
|
||||
// No more candidates have been backed
|
||||
assert!(pallet::OnChainVotes::<Test>::get()
|
||||
assert!(pezpallet::OnChainVotes::<Test>::get()
|
||||
.unwrap()
|
||||
.backing_validators_per_candidate
|
||||
.is_empty());
|
||||
@@ -583,7 +583,7 @@ mod enter {
|
||||
inherent_data
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
// Simulate a session change scheduled to happen at the end of the block.
|
||||
initializer::BufferedSessionChanges::<Test>::put(vec![BufferedSessionChange {
|
||||
@@ -594,7 +594,7 @@ mod enter {
|
||||
|
||||
// Only backed candidates are filtered out.
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap(),
|
||||
expected_para_inherent_data
|
||||
);
|
||||
|
||||
@@ -687,7 +687,7 @@ mod enter {
|
||||
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 {
|
||||
assert_matches!(pezpallet::OnChainVotes::<Test>::get(), Some(ScrapedOnChainVotes {
|
||||
session,
|
||||
..
|
||||
} ) => {
|
||||
@@ -706,7 +706,7 @@ mod enter {
|
||||
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 {
|
||||
assert_matches!(pezpallet::OnChainVotes::<Test>::get(), Some(ScrapedOnChainVotes {
|
||||
session,
|
||||
..
|
||||
} ) => {
|
||||
@@ -752,10 +752,10 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
let multi_dispute_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Dispute for session that lies too far in the future should be filtered out
|
||||
assert!(multi_dispute_inherent_data != expected_para_inherent_data);
|
||||
|
||||
@@ -769,7 +769,7 @@ mod enter {
|
||||
|
||||
clear_dispute_storage::<Test>();
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
multi_dispute_inherent_data,
|
||||
));
|
||||
@@ -827,10 +827,10 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Expect that inherent data is filtered to include only 2 disputes
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
|
||||
@@ -841,7 +841,7 @@ mod enter {
|
||||
|
||||
clear_dispute_storage::<Test>();
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
limit_inherent_data,
|
||||
));
|
||||
@@ -902,11 +902,11 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
// Nothing is filtered out (including the backed candidates.)
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
|
||||
// Three disputes is over weight (see previous test), so we expect to only see 2
|
||||
@@ -926,7 +926,7 @@ mod enter {
|
||||
|
||||
clear_dispute_storage::<Test>();
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
limit_inherent_data,
|
||||
));
|
||||
@@ -992,10 +992,10 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
assert!(!scheduler::Pallet::<Test>::claim_queue_is_empty());
|
||||
assert!(!scheduler::Pezpallet::<Test>::claim_queue_is_empty());
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
assert_ne!(limit_inherent_data, expected_para_inherent_data);
|
||||
assert!(inherent_data_weight(&limit_inherent_data)
|
||||
.all_lte(inherent_data_weight(&expected_para_inherent_data)));
|
||||
@@ -1016,7 +1016,7 @@ mod enter {
|
||||
|
||||
clear_dispute_storage::<Test>();
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
limit_inherent_data
|
||||
));
|
||||
@@ -1082,7 +1082,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
assert_eq!(limit_inherent_data.bitfields.len(), 20);
|
||||
assert_eq!(limit_inherent_data.disputes.len(), 2);
|
||||
assert_eq!(limit_inherent_data.backed_candidates.len(), 0);
|
||||
@@ -1098,7 +1098,7 @@ mod enter {
|
||||
use crate::inclusion::WeightInfo as _;
|
||||
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1148,7 +1148,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
assert!(limit_inherent_data == expected_para_inherent_data);
|
||||
|
||||
// Cores were scheduled. We should put the assignments back, before calling enter().
|
||||
@@ -1166,7 +1166,7 @@ mod enter {
|
||||
.collect();
|
||||
scheduler::ClaimQueue::<Test>::set(cores);
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
limit_inherent_data,
|
||||
));
|
||||
@@ -1212,7 +1212,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1262,7 +1262,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Expect that inherent data is filtered to include only 1 backed candidate and 2
|
||||
// disputes
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
@@ -1312,7 +1312,7 @@ mod enter {
|
||||
|
||||
clear_dispute_storage::<Test>();
|
||||
|
||||
assert_ok!(Pallet::<Test>::enter(
|
||||
assert_ok!(Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
limit_inherent_data,
|
||||
));
|
||||
@@ -1368,7 +1368,7 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Expect that inherent data is filtered to include only 1 backed candidate and 2
|
||||
// disputes
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
@@ -1402,7 +1402,7 @@ mod enter {
|
||||
)));
|
||||
new_test_ext(default_config()).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1446,7 +1446,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Expect that inherent data is filtered to include only 1 backed candidate and 2
|
||||
// disputes
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
@@ -1480,7 +1480,7 @@ mod enter {
|
||||
)));
|
||||
new_test_ext(MockGenesisConfig::default()).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1522,7 +1522,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
let limit_inherent_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data.clone()).unwrap();
|
||||
// Expect that inherent data is filtered to include only 1 backed candidate and 2
|
||||
// disputes
|
||||
assert!(limit_inherent_data != expected_para_inherent_data);
|
||||
@@ -1592,7 +1592,7 @@ mod enter {
|
||||
let mut backed_and_concluding = BTreeMap::new();
|
||||
|
||||
// Enable the v2 receipts.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
v2_descriptor,
|
||||
@@ -1725,7 +1725,7 @@ mod enter {
|
||||
inherent_data
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &expected_para_inherent_data)
|
||||
.unwrap();
|
||||
let dispatch_error = Pallet::<Test>::enter(
|
||||
let dispatch_error = Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
expected_para_inherent_data,
|
||||
)
|
||||
@@ -1781,11 +1781,11 @@ mod enter {
|
||||
|
||||
// We expect all backed candidates to be filtered out.
|
||||
let filtered_para_inherend_data =
|
||||
Pallet::<Test>::create_inherent_inner(&inherent_data).unwrap();
|
||||
Pezpallet::<Test>::create_inherent_inner(&inherent_data).unwrap();
|
||||
|
||||
assert_eq!(filtered_para_inherend_data.backed_candidates.len(), 0);
|
||||
|
||||
let dispatch_error = Pallet::<Test>::enter(
|
||||
let dispatch_error = Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
unfiltered_para_inherent_data,
|
||||
)
|
||||
@@ -1804,7 +1804,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Set the v2 receipts feature.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1853,7 +1853,7 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &unfiltered_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
let dispatch_error = Pallet::<Test>::enter(
|
||||
let dispatch_error = Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
unfiltered_para_inherent_data,
|
||||
)
|
||||
@@ -1874,7 +1874,7 @@ mod enter {
|
||||
// Invalid core selector. Cannot decode it.
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Set the V2 receipts feature.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1918,7 +1918,7 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &unfiltered_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
let dispatch_error = Pallet::<Test>::enter(
|
||||
let dispatch_error = Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
unfiltered_para_inherent_data,
|
||||
)
|
||||
@@ -1934,7 +1934,7 @@ mod enter {
|
||||
let config = default_config();
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Set the V2 receipts feature.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -1978,7 +1978,7 @@ mod enter {
|
||||
.put_data(TEYRCHAINS_INHERENT_IDENTIFIER, &unfiltered_para_inherent_data)
|
||||
.unwrap();
|
||||
|
||||
let dispatch_error = Pallet::<Test>::enter(
|
||||
let dispatch_error = Pezpallet::<Test>::enter(
|
||||
pezframe_system::RawOrigin::None.into(),
|
||||
unfiltered_para_inherent_data,
|
||||
)
|
||||
@@ -2004,7 +2004,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Enable the v2 receipts.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -2040,7 +2040,7 @@ mod enter {
|
||||
// * 5 v2 candidate descriptors.
|
||||
assert_eq!(inherent_data.backed_candidates.len(), 5);
|
||||
|
||||
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2052,7 +2052,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Enable the v2 receipts.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -2099,7 +2099,7 @@ mod enter {
|
||||
// * 5 v2 candidate descriptors.
|
||||
assert_eq!(inherent_data.backed_candidates.len(), 5);
|
||||
|
||||
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2110,7 +2110,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Enable the v2 receipts.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -2172,7 +2172,7 @@ mod enter {
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
expected_inherent_data
|
||||
);
|
||||
});
|
||||
@@ -2186,7 +2186,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// Enable the v2 receipts.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -2260,11 +2260,11 @@ mod enter {
|
||||
|
||||
// 1 candidate with invalid session is filtered out
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
expected_inherent_data
|
||||
);
|
||||
|
||||
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap_err();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap_err();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2278,7 +2278,7 @@ mod enter {
|
||||
|
||||
new_test_ext(config).execute_with(|| {
|
||||
// V2 receipts are always enabled.
|
||||
configuration::Pallet::<Test>::set_node_feature(
|
||||
configuration::Pezpallet::<Test>::set_node_feature(
|
||||
RuntimeOrigin::root(),
|
||||
FeatureIndex::CandidateReceiptV2 as u8,
|
||||
true,
|
||||
@@ -2338,12 +2338,12 @@ mod enter {
|
||||
expected_inherent_data.backed_candidates.remove(0);
|
||||
|
||||
assert_eq!(
|
||||
Pallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
Pezpallet::<Test>::create_inherent_inner(&create_inherent_data).unwrap(),
|
||||
expected_inherent_data
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Pallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
|
||||
.unwrap_err()
|
||||
.error,
|
||||
Error::<Test>::InherentDataFilteredDuringExecution.into()
|
||||
@@ -2644,9 +2644,9 @@ mod sanitizers {
|
||||
fn get_test_data_one_core_per_para(backing_kind: BackingKind) -> TestData {
|
||||
const RELAY_PARENT_NUM: u32 = 3;
|
||||
|
||||
// Add the relay parent to `shared` pallet. Otherwise some code (e.g. filtering backing
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
default_header().hash(),
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
@@ -2682,10 +2682,10 @@ mod sanitizers {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// Set active validators in `shared` pallet
|
||||
// Set active validators in `shared` pezpallet
|
||||
let validator_ids =
|
||||
validators.iter().map(|v| v.public().into()).collect::<Vec<ValidatorId>>();
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
|
||||
// Two scheduled teyrchains - ParaId(1) on CoreIndex(0) and ParaId(2) on CoreIndex(1)
|
||||
let scheduled: BTreeMap<ParaId, BTreeSet<CoreIndex>> = (0_usize..2)
|
||||
@@ -2699,13 +2699,13 @@ mod sanitizers {
|
||||
.collect::<BTreeMap<_, _>>();
|
||||
|
||||
// Set the validator groups in `scheduler`
|
||||
scheduler::Pallet::<Test>::set_validator_groups(vec![
|
||||
scheduler::Pezpallet::<Test>::set_validator_groups(vec![
|
||||
vec![ValidatorIndex(0), ValidatorIndex(1), ValidatorIndex(2), ValidatorIndex(3)],
|
||||
vec![ValidatorIndex(4), ValidatorIndex(5), ValidatorIndex(6), ValidatorIndex(7)],
|
||||
]);
|
||||
|
||||
// Update scheduler's claimqueue with the teyrchains
|
||||
scheduler::Pallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
scheduler::Pezpallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
(
|
||||
CoreIndex::from(0),
|
||||
VecDeque::from([Assignment::Pool {
|
||||
@@ -2723,30 +2723,30 @@ mod sanitizers {
|
||||
]));
|
||||
|
||||
// Set the on-chain included head data for paras.
|
||||
paras::Pallet::<Test>::set_current_head(ParaId::from(1), HeadData(vec![1]));
|
||||
paras::Pallet::<Test>::set_current_head(ParaId::from(2), HeadData(vec![2]));
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(1), HeadData(vec![1]));
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(2), HeadData(vec![2]));
|
||||
|
||||
// Set the current_code_hash
|
||||
paras::Pallet::<Test>::force_set_current_code(
|
||||
paras::Pezpallet::<Test>::force_set_current_code(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(1),
|
||||
ValidationCode(vec![1]),
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<Test>::force_set_current_code(
|
||||
paras::Pezpallet::<Test>::force_set_current_code(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(2),
|
||||
ValidationCode(vec![2]),
|
||||
)
|
||||
.unwrap();
|
||||
// Set the most recent relay parent.
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(1),
|
||||
BlockNumberFor::<Test>::from(0u32),
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(2),
|
||||
BlockNumberFor::<Test>::from(0u32),
|
||||
@@ -2800,7 +2800,7 @@ mod sanitizers {
|
||||
|
||||
// State sanity checks
|
||||
assert_eq!(
|
||||
Pallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
Pezpallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
vec![(CoreIndex(0), ParaId::from(1)), (CoreIndex(1), ParaId::from(2))]
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -2876,13 +2876,13 @@ mod sanitizers {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// Set active validators in `shared` pallet
|
||||
// Set active validators in `shared` pezpallet
|
||||
let validator_ids =
|
||||
validators.iter().map(|v| v.public().into()).collect::<Vec<ValidatorId>>();
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
|
||||
// Set the validator groups in `scheduler`
|
||||
scheduler::Pallet::<Test>::set_validator_groups(vec![
|
||||
scheduler::Pezpallet::<Test>::set_validator_groups(vec![
|
||||
vec![ValidatorIndex(0)],
|
||||
vec![ValidatorIndex(1)],
|
||||
vec![ValidatorIndex(2)],
|
||||
@@ -2894,7 +2894,7 @@ mod sanitizers {
|
||||
]);
|
||||
|
||||
// Update scheduler's claimqueue with the teyrchains
|
||||
scheduler::Pallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
scheduler::Pezpallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
(
|
||||
CoreIndex::from(0),
|
||||
VecDeque::from([Assignment::Pool {
|
||||
@@ -2967,9 +2967,9 @@ mod sanitizers {
|
||||
),
|
||||
]));
|
||||
|
||||
// Add the relay parent to `shared` pallet. Otherwise some code (e.g. filtering backing
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
relay_parent,
|
||||
Default::default(),
|
||||
scheduler::ClaimQueue::<Test>::get()
|
||||
@@ -2984,14 +2984,14 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=8u32 {
|
||||
paras::Pallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pallet::<Test>::force_set_current_code(
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pezpallet::<Test>::force_set_current_code(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
ValidationCode(vec![id as u8]),
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
BlockNumberFor::<Test>::from(0u32),
|
||||
@@ -3331,7 +3331,7 @@ mod sanitizers {
|
||||
|
||||
// State sanity checks
|
||||
assert_eq!(
|
||||
Pallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
Pezpallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
vec![
|
||||
(CoreIndex(0), ParaId::from(1)),
|
||||
(CoreIndex(1), ParaId::from(1)),
|
||||
@@ -3346,7 +3346,7 @@ mod sanitizers {
|
||||
]
|
||||
);
|
||||
let mut scheduled: BTreeMap<ParaId, BTreeSet<CoreIndex>> = BTreeMap::new();
|
||||
for (core_idx, para_id) in Pallet::<Test>::eligible_paras(&Default::default()) {
|
||||
for (core_idx, para_id) in Pezpallet::<Test>::eligible_paras(&Default::default()) {
|
||||
scheduled.entry(para_id).or_default().insert(core_idx);
|
||||
}
|
||||
|
||||
@@ -3408,13 +3408,13 @@ mod sanitizers {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// Set active validators in `shared` pallet
|
||||
// Set active validators in `shared` pezpallet
|
||||
let validator_ids =
|
||||
validators.iter().map(|v| v.public().into()).collect::<Vec<ValidatorId>>();
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
|
||||
// Set the validator groups in `scheduler`
|
||||
scheduler::Pallet::<Test>::set_validator_groups(vec![
|
||||
scheduler::Pezpallet::<Test>::set_validator_groups(vec![
|
||||
vec![ValidatorIndex(0)],
|
||||
vec![ValidatorIndex(1)],
|
||||
vec![ValidatorIndex(2)],
|
||||
@@ -3427,7 +3427,7 @@ mod sanitizers {
|
||||
]);
|
||||
|
||||
// Update scheduler's claimqueue with the teyrchains
|
||||
scheduler::Pallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
scheduler::Pezpallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
(
|
||||
CoreIndex::from(0),
|
||||
VecDeque::from([Assignment::Pool {
|
||||
@@ -3493,7 +3493,7 @@ mod sanitizers {
|
||||
),
|
||||
]));
|
||||
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
relay_parent,
|
||||
Default::default(),
|
||||
scheduler::ClaimQueue::<Test>::get()
|
||||
@@ -3508,14 +3508,14 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=4u32 {
|
||||
paras::Pallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pallet::<Test>::force_set_current_code(
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pezpallet::<Test>::force_set_current_code(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
ValidationCode(vec![id as u8]),
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
BlockNumberFor::<Test>::from(0u32),
|
||||
@@ -3811,7 +3811,7 @@ mod sanitizers {
|
||||
|
||||
// State sanity checks
|
||||
assert_eq!(
|
||||
Pallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
Pezpallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
vec![
|
||||
(CoreIndex(0), ParaId::from(1)),
|
||||
(CoreIndex(1), ParaId::from(1)),
|
||||
@@ -3825,7 +3825,7 @@ mod sanitizers {
|
||||
]
|
||||
);
|
||||
let mut scheduled: BTreeMap<ParaId, BTreeSet<CoreIndex>> = BTreeMap::new();
|
||||
for (core_idx, para_id) in Pallet::<Test>::eligible_paras(&Default::default()) {
|
||||
for (core_idx, para_id) in Pezpallet::<Test>::eligible_paras(&Default::default()) {
|
||||
scheduled.entry(para_id).or_default().insert(core_idx);
|
||||
}
|
||||
|
||||
@@ -3878,9 +3878,9 @@ mod sanitizers {
|
||||
}
|
||||
.hash();
|
||||
|
||||
// Add the relay parent to `shared` pallet. Otherwise some code (e.g. filtering backing
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
prev_relay_parent,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
@@ -3888,7 +3888,7 @@ mod sanitizers {
|
||||
2,
|
||||
);
|
||||
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
relay_parent,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
@@ -3896,7 +3896,7 @@ mod sanitizers {
|
||||
2,
|
||||
);
|
||||
|
||||
shared::Pallet::<Test>::add_allowed_relay_parent(
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
next_relay_parent,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
@@ -3927,13 +3927,13 @@ mod sanitizers {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// Set active validators in `shared` pallet
|
||||
// Set active validators in `shared` pezpallet
|
||||
let validator_ids =
|
||||
validators.iter().map(|v| v.public().into()).collect::<Vec<ValidatorId>>();
|
||||
shared::Pallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
shared::Pezpallet::<Test>::set_active_validators_ascending(validator_ids);
|
||||
|
||||
// Set the validator groups in `scheduler`
|
||||
scheduler::Pallet::<Test>::set_validator_groups(vec![
|
||||
scheduler::Pezpallet::<Test>::set_validator_groups(vec![
|
||||
vec![ValidatorIndex(0)],
|
||||
vec![ValidatorIndex(1)],
|
||||
vec![ValidatorIndex(2)],
|
||||
@@ -3943,7 +3943,7 @@ mod sanitizers {
|
||||
]);
|
||||
|
||||
// Update scheduler's claimqueue with the teyrchains
|
||||
scheduler::Pallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
scheduler::Pezpallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
(
|
||||
CoreIndex::from(0),
|
||||
VecDeque::from([Assignment::Pool {
|
||||
@@ -3990,14 +3990,14 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=2u32 {
|
||||
paras::Pallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pallet::<Test>::force_set_current_code(
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
paras::Pezpallet::<Test>::force_set_current_code(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
ValidationCode(vec![id as u8]),
|
||||
)
|
||||
.unwrap();
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(id),
|
||||
BlockNumberFor::<Test>::from(0u32),
|
||||
@@ -4224,7 +4224,7 @@ mod sanitizers {
|
||||
|
||||
// State sanity checks
|
||||
assert_eq!(
|
||||
Pallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
Pezpallet::<Test>::eligible_paras(&Default::default()).collect::<Vec<_>>(),
|
||||
vec![
|
||||
(CoreIndex(0), ParaId::from(1)),
|
||||
(CoreIndex(1), ParaId::from(1)),
|
||||
@@ -4235,7 +4235,7 @@ mod sanitizers {
|
||||
]
|
||||
);
|
||||
let mut scheduled: BTreeMap<ParaId, BTreeSet<CoreIndex>> = BTreeMap::new();
|
||||
for (core_idx, para_id) in Pallet::<Test>::eligible_paras(&Default::default()) {
|
||||
for (core_idx, para_id) in Pezpallet::<Test>::eligible_paras(&Default::default()) {
|
||||
scheduled.entry(para_id).or_default().insert(core_idx);
|
||||
}
|
||||
|
||||
@@ -4370,14 +4370,14 @@ mod sanitizers {
|
||||
expected_backed_candidates_with_core,
|
||||
} = get_test_data_for_relay_parent_ordering();
|
||||
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(1),
|
||||
BlockNumberFor::<Test>::from(4u32),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
paras::Pallet::<Test>::force_set_most_recent_context(
|
||||
paras::Pezpallet::<Test>::force_set_most_recent_context(
|
||||
RuntimeOrigin::root(),
|
||||
ParaId::from(2),
|
||||
BlockNumberFor::<Test>::from(2u32),
|
||||
@@ -4642,7 +4642,7 @@ mod sanitizers {
|
||||
// Alice's one.
|
||||
let mut hc = configuration::ActiveConfig::<Test>::get();
|
||||
hc.minimum_backing_votes = 1;
|
||||
configuration::Pallet::<Test>::force_set_active_config(hc);
|
||||
configuration::Pezpallet::<Test>::force_set_active_config(hc);
|
||||
|
||||
// Verify the initial state is as expected
|
||||
assert_eq!(
|
||||
@@ -4900,10 +4900,10 @@ mod sanitizers {
|
||||
);
|
||||
|
||||
let candidate_receipt_with_backing_validator_indices =
|
||||
inclusion::Pallet::<Test>::process_candidates(
|
||||
inclusion::Pezpallet::<Test>::process_candidates(
|
||||
&shared::AllowedRelayParents::<Test>::get(),
|
||||
&expected_backed_candidates_with_core,
|
||||
scheduler::Pallet::<Test>::group_validators,
|
||||
scheduler::Pezpallet::<Test>::group_validators,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -52,20 +52,20 @@ 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 = pezframe_system::Pallet::<T>::block_number() + One::one();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number() + One::one();
|
||||
|
||||
let groups = scheduler::ValidatorGroups::<T>::get();
|
||||
let rotation_info = scheduler::Pallet::<T>::group_rotation_info(now);
|
||||
let rotation_info = scheduler::Pezpallet::<T>::group_rotation_info(now);
|
||||
|
||||
(groups, rotation_info)
|
||||
}
|
||||
|
||||
/// Implementation for the `availability_cores` function of the runtime API.
|
||||
pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, BlockNumberFor<T>>> {
|
||||
let time_out_for = scheduler::Pallet::<T>::availability_timeout_predicate();
|
||||
let time_out_for = scheduler::Pezpallet::<T>::availability_timeout_predicate();
|
||||
|
||||
let group_responsible_for =
|
||||
|backed_in_number, core_index| match scheduler::Pallet::<T>::group_assigned_to_core(
|
||||
|backed_in_number, core_index| match scheduler::Pezpallet::<T>::group_assigned_to_core(
|
||||
core_index,
|
||||
backed_in_number,
|
||||
) {
|
||||
@@ -81,10 +81,10 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, Bl
|
||||
},
|
||||
};
|
||||
|
||||
let claim_queue = scheduler::Pallet::<T>::get_claim_queue();
|
||||
let claim_queue = scheduler::Pezpallet::<T>::get_claim_queue();
|
||||
let occupied_cores: BTreeMap<CoreIndex, inclusion::CandidatePendingAvailability<_, _>> =
|
||||
inclusion::Pallet::<T>::get_occupied_cores().collect();
|
||||
let n_cores = scheduler::Pallet::<T>::num_availability_cores();
|
||||
inclusion::Pezpallet::<T>::get_occupied_cores().collect();
|
||||
let n_cores = scheduler::Pezpallet::<T>::num_availability_cores();
|
||||
|
||||
(0..n_cores)
|
||||
.map(|core_idx| {
|
||||
@@ -95,10 +95,10 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, Bl
|
||||
let backing_group_allocation_time =
|
||||
pending_availability.relay_parent_number() + One::one();
|
||||
CoreState::Occupied(OccupiedCore {
|
||||
next_up_on_available: scheduler::Pallet::<T>::next_up_on_available(core_idx),
|
||||
next_up_on_available: scheduler::Pezpallet::<T>::next_up_on_available(core_idx),
|
||||
occupied_since: pending_availability.backed_in_number(),
|
||||
time_out_at: time_out_for(pending_availability.backed_in_number()).live_until,
|
||||
next_up_on_time_out: scheduler::Pallet::<T>::next_up_on_available(core_idx),
|
||||
next_up_on_time_out: scheduler::Pezpallet::<T>::next_up_on_available(core_idx),
|
||||
availability: pending_availability.availability_votes().clone(),
|
||||
group_responsible: group_responsible_for(
|
||||
backing_group_allocation_time,
|
||||
@@ -125,8 +125,8 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, Bl
|
||||
fn current_relay_parent<T: pezframe_system::Config>(
|
||||
) -> (BlockNumberFor<T>, <T as pezframe_system::Config>::Hash) {
|
||||
use codec::Decode as _;
|
||||
let state_version = pezframe_system::Pallet::<T>::runtime_version().state_version();
|
||||
let relay_parent_number = pezframe_system::Pallet::<T>::block_number();
|
||||
let state_version = pezframe_system::Pezpallet::<T>::runtime_version().state_version();
|
||||
let relay_parent_number = pezframe_system::Pezpallet::<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)
|
||||
@@ -143,12 +143,12 @@ where
|
||||
{
|
||||
match assumption {
|
||||
OccupiedCoreAssumption::Included => {
|
||||
<inclusion::Pallet<Config>>::force_enact(para_id);
|
||||
<inclusion::Pezpallet<Config>>::force_enact(para_id);
|
||||
build()
|
||||
},
|
||||
OccupiedCoreAssumption::TimedOut => build(),
|
||||
OccupiedCoreAssumption::Free =>
|
||||
if !<inclusion::Pallet<Config>>::candidates_pending_availability(para_id).is_empty() {
|
||||
if !<inclusion::Pezpallet<Config>>::candidates_pending_availability(para_id).is_empty() {
|
||||
None
|
||||
} else {
|
||||
build()
|
||||
@@ -191,10 +191,10 @@ pub fn assumed_validation_data<T: initializer::Config>(
|
||||
let persisted_validation_data = make_validation_data().or_else(|| {
|
||||
// Try again with force enacting the pending candidates. This check only makes sense if
|
||||
// there are any pending candidates.
|
||||
(!inclusion::Pallet::<T>::candidates_pending_availability(para_id).is_empty())
|
||||
(!inclusion::Pezpallet::<T>::candidates_pending_availability(para_id).is_empty())
|
||||
.then_some(())
|
||||
.and_then(|_| {
|
||||
inclusion::Pallet::<T>::force_enact(para_id);
|
||||
inclusion::Pezpallet::<T>::force_enact(para_id);
|
||||
make_validation_data()
|
||||
})
|
||||
});
|
||||
@@ -207,8 +207,8 @@ pub fn check_validation_outputs<T: initializer::Config>(
|
||||
para_id: ParaId,
|
||||
outputs: pezkuwi_primitives::CandidateCommitments,
|
||||
) -> bool {
|
||||
let relay_parent_number = pezframe_system::Pallet::<T>::block_number();
|
||||
inclusion::Pallet::<T>::check_validation_outputs_for_runtime_api(
|
||||
let relay_parent_number = pezframe_system::Pezpallet::<T>::block_number();
|
||||
inclusion::Pezpallet::<T>::check_validation_outputs_for_runtime_api(
|
||||
para_id,
|
||||
relay_parent_number,
|
||||
outputs,
|
||||
@@ -238,8 +238,8 @@ pub fn relevant_authority_ids<T: initializer::Config + pezpallet_authority_disco
|
||||
// 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 = pezpallet_authority_discovery::Pallet::<T>::current_authorities().to_vec();
|
||||
authority_ids.extend(pezpallet_authority_discovery::Pallet::<T>::next_authorities().to_vec());
|
||||
let mut authority_ids = pezpallet_authority_discovery::Pezpallet::<T>::current_authorities().to_vec();
|
||||
authority_ids.extend(pezpallet_authority_discovery::Pezpallet::<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.
|
||||
@@ -261,7 +261,7 @@ pub fn validation_code<T: initializer::Config>(
|
||||
para_id: ParaId,
|
||||
assumption: OccupiedCoreAssumption,
|
||||
) -> Option<ValidationCode> {
|
||||
with_assumption::<T, _, _>(para_id, assumption, || paras::Pallet::<T>::current_code(¶_id))
|
||||
with_assumption::<T, _, _>(para_id, assumption, || paras::Pezpallet::<T>::current_code(¶_id))
|
||||
}
|
||||
|
||||
/// Implementation for the `candidate_pending_availability` function of the runtime API.
|
||||
@@ -272,7 +272,7 @@ pub fn validation_code<T: initializer::Config>(
|
||||
pub fn candidate_pending_availability<T: initializer::Config>(
|
||||
para_id: ParaId,
|
||||
) -> Option<CommittedCandidateReceipt<T::Hash>> {
|
||||
inclusion::Pallet::<T>::first_candidate_pending_availability(para_id)
|
||||
inclusion::Pezpallet::<T>::first_candidate_pending_availability(para_id)
|
||||
}
|
||||
|
||||
/// Implementation for the `candidate_events` function of the runtime API.
|
||||
@@ -285,7 +285,7 @@ where
|
||||
{
|
||||
use inclusion::Event as RawEvent;
|
||||
|
||||
pezframe_system::Pallet::<T>::read_events_no_consensus()
|
||||
pezframe_system::Pezpallet::<T>::read_events_no_consensus()
|
||||
.into_iter()
|
||||
.filter_map(|record| extract_event(record.event))
|
||||
.filter_map(|event| {
|
||||
@@ -313,14 +313,14 @@ pub fn session_info<T: session_info::Config>(index: SessionIndex) -> Option<Sess
|
||||
pub fn dmq_contents<T: dmp::Config>(
|
||||
recipient: ParaId,
|
||||
) -> Vec<InboundDownwardMessage<BlockNumberFor<T>>> {
|
||||
dmp::Pallet::<T>::dmq_contents(recipient)
|
||||
dmp::Pezpallet::<T>::dmq_contents(recipient)
|
||||
}
|
||||
|
||||
/// Implementation for the `inbound_hrmp_channels_contents` function of the runtime API.
|
||||
pub fn inbound_hrmp_channels_contents<T: hrmp::Config>(
|
||||
recipient: ParaId,
|
||||
) -> BTreeMap<ParaId, Vec<InboundHrmpMessage<BlockNumberFor<T>>>> {
|
||||
hrmp::Pallet::<T>::inbound_hrmp_channels_contents(recipient)
|
||||
hrmp::Pezpallet::<T>::inbound_hrmp_channels_contents(recipient)
|
||||
}
|
||||
|
||||
/// Implementation for the `validation_code_by_hash` function of the runtime API.
|
||||
@@ -340,12 +340,12 @@ pub fn submit_pvf_check_statement<T: paras::Config>(
|
||||
stmt: PvfCheckStatement,
|
||||
signature: ValidatorSignature,
|
||||
) {
|
||||
paras::Pallet::<T>::submit_pvf_check_statement(stmt, signature)
|
||||
paras::Pezpallet::<T>::submit_pvf_check_statement(stmt, signature)
|
||||
}
|
||||
|
||||
/// Returns the list of all PVF code hashes that require pre-checking.
|
||||
pub fn pvfs_require_precheck<T: paras::Config>() -> Vec<ValidationCodeHash> {
|
||||
paras::Pallet::<T>::pvfs_require_precheck()
|
||||
paras::Pezpallet::<T>::pvfs_require_precheck()
|
||||
}
|
||||
|
||||
/// Returns the validation code hash for the given teyrchain making the given
|
||||
@@ -363,7 +363,7 @@ where
|
||||
/// Implementation for `get_session_disputes` function from the runtime API
|
||||
pub fn get_session_disputes<T: disputes::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumberFor<T>>)> {
|
||||
disputes::Pallet::<T>::disputes()
|
||||
disputes::Pezpallet::<T>::disputes()
|
||||
}
|
||||
|
||||
/// Get session executor parameter set
|
||||
@@ -376,7 +376,7 @@ pub fn session_executor_params<T: session_info::Config>(
|
||||
/// Implementation of `unapplied_slashes` runtime API
|
||||
pub fn unapplied_slashes<T: disputes::slashing::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, slashing::LegacyPendingSlashes)> {
|
||||
disputes::slashing::Pallet::<T>::unapplied_slashes()
|
||||
disputes::slashing::Pezpallet::<T>::unapplied_slashes()
|
||||
.into_iter()
|
||||
.filter_map(|(session, candidate_hash, pending_slash)| {
|
||||
let legacy_pending_slash = slashing::LegacyPendingSlashes {
|
||||
@@ -391,7 +391,7 @@ pub fn unapplied_slashes<T: disputes::slashing::Config>(
|
||||
/// Implementation of `unapplied_slashes_v2` runtime API
|
||||
pub fn unapplied_slashes_v2<T: disputes::slashing::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)> {
|
||||
disputes::slashing::Pallet::<T>::unapplied_slashes()
|
||||
disputes::slashing::Pezpallet::<T>::unapplied_slashes()
|
||||
}
|
||||
|
||||
/// Implementation of `submit_report_dispute_lost` runtime API
|
||||
@@ -401,7 +401,7 @@ pub fn submit_unsigned_slashing_report<T: disputes::slashing::Config>(
|
||||
) -> Option<()> {
|
||||
let key_ownership_proof = key_ownership_proof.decode()?;
|
||||
|
||||
disputes::slashing::Pallet::<T>::submit_unsigned_slashing_report(
|
||||
disputes::slashing::Pezpallet::<T>::submit_unsigned_slashing_report(
|
||||
dispute_proof,
|
||||
key_ownership_proof,
|
||||
)
|
||||
@@ -422,11 +422,11 @@ pub fn backing_constraints<T: initializer::Config>(
|
||||
// clears the buffer.
|
||||
//
|
||||
// Thus, minimum relay parent is ensured to have asynchronous backing enabled.
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
|
||||
// Use the right storage depending on version to ensure #64 doesn't cause issues with this
|
||||
// migration.
|
||||
let min_relay_parent_number = if shared::Pallet::<T>::on_chain_storage_version() ==
|
||||
let min_relay_parent_number = if shared::Pezpallet::<T>::on_chain_storage_version() ==
|
||||
StorageVersion::new(0)
|
||||
{
|
||||
shared::migration::v0::AllowedRelayParents::<T>::get().hypothetical_earliest_block_number(
|
||||
@@ -451,18 +451,18 @@ pub fn backing_constraints<T: initializer::Config>(
|
||||
});
|
||||
|
||||
let (ump_msg_count, ump_total_bytes) =
|
||||
inclusion::Pallet::<T>::relay_dispatch_queue_size(para_id);
|
||||
inclusion::Pezpallet::<T>::relay_dispatch_queue_size(para_id);
|
||||
let ump_remaining = config.max_upward_queue_count - ump_msg_count;
|
||||
let ump_remaining_bytes = config.max_upward_queue_size - ump_total_bytes;
|
||||
|
||||
let dmp_remaining_messages = dmp::Pallet::<T>::dmq_contents(para_id)
|
||||
let dmp_remaining_messages = dmp::Pezpallet::<T>::dmq_contents(para_id)
|
||||
.into_iter()
|
||||
.map(|msg| msg.sent_at)
|
||||
.collect();
|
||||
|
||||
let valid_watermarks = hrmp::Pallet::<T>::valid_watermarks(para_id);
|
||||
let valid_watermarks = hrmp::Pezpallet::<T>::valid_watermarks(para_id);
|
||||
let hrmp_inbound = InboundHrmpLimitations { valid_watermarks };
|
||||
let hrmp_channels_out = hrmp::Pallet::<T>::outbound_remaining_capacity(para_id)
|
||||
let hrmp_channels_out = hrmp::Pezpallet::<T>::outbound_remaining_capacity(para_id)
|
||||
.into_iter()
|
||||
.map(|(para, (messages_remaining, bytes_remaining))| {
|
||||
(para, OutboundHrmpChannelLimitations { messages_remaining, bytes_remaining })
|
||||
@@ -532,7 +532,7 @@ pub fn disabled_validators<T>() -> Vec<ValidatorIndex>
|
||||
where
|
||||
T: shared::Config,
|
||||
{
|
||||
<shared::Pallet<T>>::disabled_validators()
|
||||
<shared::Pezpallet<T>>::disabled_validators()
|
||||
}
|
||||
|
||||
/// Returns the current state of the node features.
|
||||
@@ -550,7 +550,7 @@ pub fn claim_queue<T: scheduler::Config>() -> BTreeMap<CoreIndex, VecDeque<ParaI
|
||||
let config = configuration::ActiveConfig::<T>::get();
|
||||
// Extra sanity, config should already never be smaller than 1:
|
||||
let n_lookahead = config.scheduler_params.lookahead.max(1);
|
||||
scheduler::Pallet::<T>::get_claim_queue()
|
||||
scheduler::Pezpallet::<T>::get_claim_queue()
|
||||
.into_iter()
|
||||
.map(|(core_index, entries)| {
|
||||
(
|
||||
@@ -566,7 +566,7 @@ pub fn claim_queue<T: scheduler::Config>() -> BTreeMap<CoreIndex, VecDeque<ParaI
|
||||
pub fn candidates_pending_availability<T: initializer::Config>(
|
||||
para_id: ParaId,
|
||||
) -> Vec<CommittedCandidateReceipt<T::Hash>> {
|
||||
<inclusion::Pallet<T>>::candidates_pending_availability(para_id)
|
||||
<inclusion::Pezpallet<T>>::candidates_pending_availability(para_id)
|
||||
}
|
||||
|
||||
/// Implementation for `validation_code_bomb_limit` function from the runtime API
|
||||
|
||||
@@ -29,5 +29,5 @@ pub fn para_ids<T: initializer::Config>() -> Vec<ParaId> {
|
||||
/// Implementation of `unapplied_slashes_v2` runtime API
|
||||
pub fn unapplied_slashes_v2<T: disputes::slashing::Config>(
|
||||
) -> Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)> {
|
||||
disputes::slashing::Pallet::<T>::unapplied_slashes()
|
||||
disputes::slashing::Pezpallet::<T>::unapplied_slashes()
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ pub mod common;
|
||||
|
||||
use common::{Assignment, AssignmentProvider};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -63,18 +63,18 @@ const LOG_TARGET: &str = "runtime::teyrchains::scheduler";
|
||||
|
||||
pub mod migration;
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(3);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {
|
||||
type AssignmentProvider: AssignmentProvider<BlockNumberFor<Self>>;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ pub mod pallet {
|
||||
/// Bound: The number of cores is the sum of the numbers of teyrchains and parathread
|
||||
/// multiplexers. Reasonably, 100-1000. The dominant factor is the number of validators: safe
|
||||
/// upper bound at 10k.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ValidatorGroups<T> = StorageValue<_, Vec<Vec<ValidatorIndex>>, ValueQuery>;
|
||||
|
||||
/// The block number where the session start occurred. Used to track how many group rotations
|
||||
@@ -96,12 +96,12 @@ pub mod pallet {
|
||||
/// the block and enacted at the end of the block (at the finalization stage, to be exact).
|
||||
/// Thus for all intents and purposes the effect of the session change is observed at the
|
||||
/// block following the session change, block number of which we save in this storage value.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type SessionStartBlock<T: Config> = StorageValue<_, BlockNumberFor<T>, ValueQuery>;
|
||||
|
||||
/// One entry for each availability core. The `VecDeque` represents the assignments to be
|
||||
/// scheduled on that core.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ClaimQueue<T> = StorageValue<_, BTreeMap<CoreIndex, VecDeque<Assignment>>, ValueQuery>;
|
||||
|
||||
/// Availability timeout status of a core.
|
||||
@@ -119,13 +119,13 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the scheduler pallet.
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Called by the initializer to initialize the scheduler pezpallet.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the scheduler pallet.
|
||||
/// Called by the initializer to finalize the scheduler pezpallet.
|
||||
pub(crate) fn initializer_finalize() {}
|
||||
|
||||
/// Called by the initializer to note that a new session has started.
|
||||
@@ -190,7 +190,7 @@ impl<T: Config> Pallet<T> {
|
||||
Self::maybe_resize_claim_queue();
|
||||
Self::populate_claim_queue_after_session_change();
|
||||
|
||||
let now = pezframe_system::Pallet::<T>::block_number() + One::one();
|
||||
let now = pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<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 = pezframe_system::Pallet::<T>::block_number() + One::one();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number() + One::one();
|
||||
let rotation_info = Self::group_rotation_info(now);
|
||||
|
||||
let current_window =
|
||||
|
||||
@@ -38,7 +38,7 @@ mod v0 {
|
||||
use pezkuwi_primitives::{CollatorId, Id};
|
||||
|
||||
#[storage_alias]
|
||||
pub(super) type Scheduled<T: Config> = StorageValue<Pallet<T>, Vec<CoreAssignment>, ValueQuery>;
|
||||
pub(super) type Scheduled<T: Config> = StorageValue<Pezpallet<T>, Vec<CoreAssignment>, ValueQuery>;
|
||||
|
||||
#[derive(Clone, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(PartialEq))]
|
||||
@@ -66,14 +66,14 @@ mod v0 {
|
||||
/// The actual type isn't important, as we only delete the key in the state.
|
||||
#[storage_alias]
|
||||
pub(crate) type AvailabilityCores<T: Config> =
|
||||
StorageValue<Pallet<T>, Vec<Option<CoreOccupied>>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, Vec<Option<CoreOccupied>>, ValueQuery>;
|
||||
|
||||
/// The actual type isn't important, as we only delete the key in the state.
|
||||
#[storage_alias]
|
||||
pub(super) type ParathreadQueue<T: Config> = StorageValue<Pallet<T>, (), ValueQuery>;
|
||||
pub(super) type ParathreadQueue<T: Config> = StorageValue<Pezpallet<T>, (), ValueQuery>;
|
||||
|
||||
#[storage_alias]
|
||||
pub(super) type ParathreadClaimIndex<T: Config> = StorageValue<Pallet<T>, (), ValueQuery>;
|
||||
pub(super) type ParathreadClaimIndex<T: Config> = StorageValue<Pezpallet<T>, (), ValueQuery>;
|
||||
|
||||
/// The assignment type.
|
||||
#[derive(Clone, Encode, Decode, TypeInfo, RuntimeDebug)]
|
||||
@@ -116,14 +116,14 @@ mod v1 {
|
||||
|
||||
#[storage_alias]
|
||||
pub(super) type ClaimQueue<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
BTreeMap<CoreIndex, VecDeque<Option<ParasEntry<BlockNumberFor<T>>>>>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
#[storage_alias]
|
||||
pub(super) type AvailabilityCores<T: Config> =
|
||||
StorageValue<Pallet<T>, Vec<CoreOccupied<BlockNumberFor<T>>>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, Vec<CoreOccupied<BlockNumberFor<T>>>, ValueQuery>;
|
||||
|
||||
#[derive(Encode, Decode, TypeInfo, RuntimeDebug, PartialEq)]
|
||||
pub(super) enum CoreOccupied<N> {
|
||||
@@ -173,7 +173,7 @@ mod v1 {
|
||||
v0::ParathreadQueue::<T>::kill();
|
||||
v0::ParathreadClaimIndex::<T>::kill();
|
||||
|
||||
let now = pezframe_system::Pallet::<T>::block_number();
|
||||
let now = pezframe_system::Pezpallet::<T>::block_number();
|
||||
let scheduled = v0::Scheduled::<T>::take();
|
||||
let sched_len = scheduled.len() as u64;
|
||||
for core_assignment in scheduled {
|
||||
@@ -249,7 +249,7 @@ mod v1 {
|
||||
.count();
|
||||
|
||||
ensure!(
|
||||
Pallet::<T>::claim_queue_len() as u32 + availability_cores_waiting as u32 ==
|
||||
Pezpallet::<T>::claim_queue_len() as u32 + availability_cores_waiting as u32 ==
|
||||
expected_len,
|
||||
"ClaimQueue and AvailabilityCores should have the correct length",
|
||||
);
|
||||
@@ -264,7 +264,7 @@ pub type MigrateV0ToV1<T> = VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
v1::UncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -288,14 +288,14 @@ pub(crate) mod v2 {
|
||||
// V2 (no Option wrapper) and new [`Assignment`].
|
||||
#[storage_alias]
|
||||
pub(crate) type ClaimQueue<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
BTreeMap<CoreIndex, VecDeque<ParasEntry<BlockNumberFor<T>>>>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
#[storage_alias]
|
||||
pub(crate) type AvailabilityCores<T: Config> =
|
||||
StorageValue<Pallet<T>, Vec<CoreOccupied<BlockNumberFor<T>>>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, Vec<CoreOccupied<BlockNumberFor<T>>>, ValueQuery>;
|
||||
|
||||
fn is_bulk<T: Config>(core_index: CoreIndex) -> bool {
|
||||
core_index.0 < paras::Teyrchains::<T>::decode_len().unwrap_or(0) as u32
|
||||
@@ -403,7 +403,7 @@ pub type MigrateV1ToV2<T> = VersionedMigration<
|
||||
1,
|
||||
2,
|
||||
v2::UncheckedMigrateToV2<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -416,7 +416,7 @@ mod v3 {
|
||||
|
||||
#[storage_alias]
|
||||
pub(crate) type ClaimQueue<T: Config> =
|
||||
StorageValue<Pallet<T>, BTreeMap<CoreIndex, VecDeque<Assignment>>, ValueQuery>;
|
||||
StorageValue<Pezpallet<T>, BTreeMap<CoreIndex, VecDeque<Assignment>>, ValueQuery>;
|
||||
/// Migration to V3
|
||||
pub struct UncheckedMigrateToV3<T>(core::marker::PhantomData<T>);
|
||||
|
||||
@@ -489,6 +489,6 @@ pub type MigrateV2ToV3<T> = VersionedMigration<
|
||||
2,
|
||||
3,
|
||||
v3::UncheckedMigrateToV3<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -690,7 +690,7 @@ fn session_change_decreasing_number_of_cores() {
|
||||
_ => None,
|
||||
});
|
||||
|
||||
scheduler::Pallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
scheduler::Pezpallet::<Test>::set_claim_queue(BTreeMap::from([
|
||||
(CoreIndex::from(0), VecDeque::from([assignment_a.clone()])),
|
||||
// Leave a hole for core 1.
|
||||
(CoreIndex::from(2), VecDeque::from([assignment_b.clone(), assignment_b.clone()])),
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! The session info pallet provides information about validator sets
|
||||
//! The session info pezpallet provides information about validator sets
|
||||
//! from prior sessions needed for approvals and disputes.
|
||||
//!
|
||||
//! See the documentation on [session info][session-info-page] in the implementers' guide.
|
||||
@@ -34,7 +34,7 @@ use pezkuwi_primitives::{
|
||||
AssignmentId, AuthorityDiscoveryId, ExecutorParams, SessionIndex, SessionInfo,
|
||||
};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
pub mod migration;
|
||||
|
||||
@@ -55,16 +55,16 @@ pub type IdentificationTuple<T> = (
|
||||
>>::Identification,
|
||||
);
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(migration::STORAGE_VERSION)]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(migration::STORAGE_VERSION)]
|
||||
#[pezpallet::without_storage_info]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config
|
||||
+ configuration::Config
|
||||
@@ -82,33 +82,33 @@ pub mod pallet {
|
||||
/// Assignment keys for the current session.
|
||||
/// Note that this API is private due to it being prone to 'off-by-one' at session boundaries.
|
||||
/// When in doubt, use `Sessions` API instead.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(super) type AssignmentKeysUnsafe<T: Config> =
|
||||
StorageValue<_, Vec<AssignmentId>, ValueQuery>;
|
||||
|
||||
/// The earliest session for which previous session info is stored.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type EarliestStoredSession<T: Config> = StorageValue<_, SessionIndex, ValueQuery>;
|
||||
|
||||
/// Session information in a rolling window.
|
||||
/// Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
|
||||
/// Does not have any entries before the session index in the first session change notification.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type Sessions<T: Config> = StorageMap<_, Identity, SessionIndex, SessionInfo>;
|
||||
|
||||
/// The validator account keys of the validators actively participating in teyrchain consensus.
|
||||
// We do not store this in `SessionInfo` to avoid leaking the `AccountId` type to the client,
|
||||
// which would complicate the migration process if we are to change it in the future.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type AccountKeys<T: Config> = StorageMap<_, Identity, SessionIndex, Vec<AccountId<T>>>;
|
||||
|
||||
/// Executor parameter set for a given session index
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type SessionExecutorParams<T: Config> =
|
||||
StorageMap<_, Identity, SessionIndex, ExecutorParams>;
|
||||
}
|
||||
|
||||
/// An abstraction for the authority discovery pallet
|
||||
/// An abstraction for the authority discovery pezpallet
|
||||
/// to help with mock testing.
|
||||
pub trait AuthorityDiscoveryConfig {
|
||||
/// Retrieve authority identifiers of the current authority set in canonical ordering.
|
||||
@@ -117,11 +117,11 @@ pub trait AuthorityDiscoveryConfig {
|
||||
|
||||
impl<T: pezpallet_authority_discovery::Config> AuthorityDiscoveryConfig for T {
|
||||
fn authorities() -> Vec<AuthorityDiscoveryId> {
|
||||
pezpallet_authority_discovery::Pallet::<T>::current_authorities().to_vec()
|
||||
pezpallet_authority_discovery::Pezpallet::<T>::current_authorities().to_vec()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Handle an incoming session change.
|
||||
pub(crate) fn initializer_on_new_session(
|
||||
notification: &crate::initializer::SessionChangeNotification<BlockNumberFor<T>>,
|
||||
@@ -193,20 +193,20 @@ impl<T: Config> Pallet<T> {
|
||||
SessionExecutorParams::<T>::insert(&new_session_index, config.executor_params);
|
||||
}
|
||||
|
||||
/// Called by the initializer to initialize the session info pallet.
|
||||
/// Called by the initializer to initialize the session info pezpallet.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the session info pallet.
|
||||
/// Called by the initializer to finalize the session info pezpallet.
|
||||
pub(crate) fn initializer_finalize() {}
|
||||
}
|
||||
|
||||
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pallet<T> {
|
||||
impl<T: Config> pezsp_runtime::BoundToRuntimeAppPublic for Pezpallet<T> {
|
||||
type Public = AssignmentId;
|
||||
}
|
||||
|
||||
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pallet<T> {
|
||||
impl<T: pezpallet_session::Config + Config> OneSessionHandler<T::AccountId> for Pezpallet<T> {
|
||||
type Key = AssignmentId;
|
||||
|
||||
fn on_genesis_session<'a, I: 'a>(_validators: I)
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! A pallet for any shared state that other pallets may want access to.
|
||||
//! A pezpallet for any shared state that other pallets may want access to.
|
||||
//!
|
||||
//! To avoid cyclic dependencies, it is important that this pallet is not
|
||||
//! To avoid cyclic dependencies, it is important that this pezpallet is not
|
||||
//! dependent on any of the other pallets.
|
||||
|
||||
use alloc::{
|
||||
@@ -35,7 +35,7 @@ use rand_chacha::ChaCha20Rng;
|
||||
|
||||
use crate::configuration::HostConfiguration;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
// `SESSION_DELAY` is used to delay any changes to Paras registration or configurations.
|
||||
// Wait until the session index is 2 larger then the current index to apply any changes,
|
||||
@@ -144,52 +144,52 @@ impl<Hash: PartialEq + Copy, BlockNumber: AtLeast32BitUnsigned + Copy>
|
||||
}
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::without_storage_info]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config {
|
||||
type DisabledValidators: pezframe_support::traits::DisabledValidators;
|
||||
}
|
||||
|
||||
/// The current session index.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type CurrentSessionIndex<T: Config> = StorageValue<_, SessionIndex, ValueQuery>;
|
||||
|
||||
/// All the validators actively participating in teyrchain consensus.
|
||||
/// Indices are into the broader validator set.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ActiveValidatorIndices<T: Config> = StorageValue<_, Vec<ValidatorIndex>, ValueQuery>;
|
||||
|
||||
/// The teyrchain attestation keys of the validators actively participating in teyrchain
|
||||
/// consensus. This should be the same length as `ActiveValidatorIndices`.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ActiveValidatorKeys<T: Config> = StorageValue<_, Vec<ValidatorId>, ValueQuery>;
|
||||
|
||||
/// All allowed relay-parents.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub(crate) type AllowedRelayParents<T: Config> =
|
||||
StorageValue<_, AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>, ValueQuery>;
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {}
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Called by the initializer to initialize the configuration pallet.
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Called by the initializer to initialize the configuration pezpallet.
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
/// Called by the initializer to finalize the configuration pallet.
|
||||
/// Called by the initializer to finalize the configuration pezpallet.
|
||||
pub(crate) fn initializer_finalize() {}
|
||||
|
||||
/// Called by the initializer to note that a new session has started.
|
||||
@@ -240,7 +240,7 @@ impl<T: Config> Pallet<T> {
|
||||
CurrentSessionIndex::<T>::get().saturating_add(SESSION_DELAY)
|
||||
}
|
||||
|
||||
/// Fetches disabled validators list from session pallet.
|
||||
/// Fetches disabled validators list from session pezpallet.
|
||||
/// CAVEAT: this might produce incorrect results on session boundaries
|
||||
pub fn disabled_validators() -> Vec<ValidatorIndex> {
|
||||
let shuffled_indices = ActiveValidatorIndices::<T>::get();
|
||||
|
||||
@@ -29,7 +29,7 @@ pub mod v0 {
|
||||
/// All allowed relay-parents storage at version 0.
|
||||
#[storage_alias]
|
||||
pub(crate) type AllowedRelayParents<T: Config> = StorageValue<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
super::v0::AllowedRelayParentsTracker<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
|
||||
ValueQuery,
|
||||
>;
|
||||
@@ -124,7 +124,7 @@ mod v1 {
|
||||
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),
|
||||
Pezpallet::<T>::on_chain_storage_version() >= StorageVersion::new(1),
|
||||
"Storage version should be >= 1 after the migration"
|
||||
);
|
||||
|
||||
@@ -151,7 +151,7 @@ pub type MigrateToV1<T> = pezframe_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
v1::VersionUncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ fn queue_enact_too_long_ignored() {
|
||||
});
|
||||
}
|
||||
|
||||
/// Check that the Inclusion pallet correctly updates the well known keys in the MQ handler.
|
||||
/// Check that the Inclusion pezpallet correctly updates the well known keys in the MQ handler.
|
||||
///
|
||||
/// Also checks that it works in the presence of overweight messages.
|
||||
#[test]
|
||||
@@ -365,7 +365,7 @@ fn relay_dispatch_queue_size_is_updated() {
|
||||
|
||||
for p in 0..100 {
|
||||
let para = p.into();
|
||||
// Do some tricks with the weight such that the MQ pallet will process in order:
|
||||
// Do some tricks with the weight such that the MQ pezpallet will process in order:
|
||||
// Q0:0, Q1:0 … Q0:1, Q1:1 …
|
||||
let m1 = (300u32 * (100 - p), "m1").encode();
|
||||
let m2 = (300u32 * (100 - p), "m11").encode();
|
||||
|
||||
Reference in New Issue
Block a user