chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -37,8 +37,8 @@ use crate::{
|
||||
use alloc::{vec, vec::Vec};
|
||||
use pezframe_support::{defensive, pezpallet_prelude::*};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezpallet_broker::CoreAssignment;
|
||||
use pezkuwi_primitives::CoreIndex;
|
||||
use pezpallet_broker::CoreAssignment;
|
||||
use pezsp_runtime::traits::{One, Saturating};
|
||||
|
||||
pub use pezpallet::*;
|
||||
@@ -282,7 +282,8 @@ impl<T: Config> AssignmentProvider<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
|
||||
match a_type {
|
||||
CoreAssignment::Idle => None,
|
||||
CoreAssignment::Pool => on_demand::Pezpallet::<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())),
|
||||
}
|
||||
})
|
||||
@@ -473,7 +474,8 @@ impl<T: Config> AssignCoretime for Pezpallet<T> {
|
||||
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)];
|
||||
let assignment =
|
||||
vec![(pezpallet_broker::CoreAssignment::Task(id.into()), PartsOf57600::FULL)];
|
||||
Pezpallet::<T>::assign_core(CoreIndex(core), begin, assignment, None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ use crate::{
|
||||
scheduler::common::Assignment,
|
||||
};
|
||||
use pezframe_support::{assert_noop, assert_ok, pezpallet_prelude::*};
|
||||
use pezpallet_broker::TaskId;
|
||||
use pezkuwi_primitives::{BlockNumber, Id as ParaId, SessionIndex, ValidationCode};
|
||||
use pezpallet_broker::TaskId;
|
||||
|
||||
fn schedule_blank_para(id: ParaId, parakind: ParaKind) {
|
||||
let validation_code: ValidationCode = vec![1, 2, 3].into();
|
||||
|
||||
@@ -54,8 +54,8 @@ fn mock_validation_code() -> ValidationCode {
|
||||
|
||||
/// Grab an account, seeded by a name and index.
|
||||
///
|
||||
/// This is directly from pezframe-benchmarking. Copy/pasted so we can use it when not compiling with
|
||||
/// "features = runtime-benchmarks".
|
||||
/// This is directly from pezframe-benchmarking. Copy/pasted so we can use it when not compiling
|
||||
/// with "features = runtime-benchmarks".
|
||||
fn account<AccountId: Decode>(name: &'static str, index: u32, seed: u32) -> AccountId {
|
||||
let entropy = (name, index, seed).using_encoded(pezsp_io::hashing::blake2_256);
|
||||
AccountId::decode(&mut TrailingZeroInput::new(&entropy[..]))
|
||||
@@ -505,7 +505,11 @@ impl<T: paras_inherent::Config> BenchBuilder<T> {
|
||||
let header = Self::header(block_number);
|
||||
|
||||
pezframe_system::Pezpallet::<T>::reset_events();
|
||||
pezframe_system::Pezpallet::<T>::initialize(&header.number(), &header.hash(), header.digest());
|
||||
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);
|
||||
|
||||
@@ -41,8 +41,8 @@ mod benchmarking;
|
||||
|
||||
pub mod migration;
|
||||
|
||||
pub use pezpallet::*;
|
||||
use pezkuwi_primitives::SchedulerParams;
|
||||
pub use pezpallet::*;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::configuration";
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ mod v_coretime {
|
||||
weights::Weight,
|
||||
};
|
||||
use pezframe_system::pezpallet_prelude::BlockNumberFor;
|
||||
use pezpallet_broker::{CoreAssignment, CoreMask, ScheduleItem};
|
||||
use pezkuwi_primitives::{CoreIndex, Id as ParaId};
|
||||
use pezkuwi_teyrchain_primitives::primitives::IsSystem;
|
||||
use pezpallet_broker::{CoreAssignment, CoreMask, ScheduleItem};
|
||||
use pezsp_arithmetic::traits::SaturatedConversion;
|
||||
use pezsp_core::Get;
|
||||
use pezsp_runtime::BoundedVec;
|
||||
@@ -74,7 +74,8 @@ mod v_coretime {
|
||||
// storage data. But both pallets are introduced at the same time, so this is fine.
|
||||
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::Pezpallet<T>>();
|
||||
let storage_version_key =
|
||||
StorageVersion::storage_key::<assigner_coretime::Pezpallet<T>>();
|
||||
|
||||
loop {
|
||||
match pezsp_io::storage::next_key(&next_key) {
|
||||
|
||||
@@ -25,9 +25,9 @@ use pezframe_support::{
|
||||
traits::{defensive_prelude::*, Currency},
|
||||
};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezkuwi_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId};
|
||||
pub use pezpallet::*;
|
||||
use pezpallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
|
||||
use pezkuwi_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId};
|
||||
use pezsp_arithmetic::traits::SaturatedConversion;
|
||||
use pezsp_runtime::traits::TryConvert;
|
||||
use xcm::prelude::*;
|
||||
@@ -115,11 +115,14 @@ pub mod pezpallet {
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + assigner_coretime::Config + on_demand::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>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
/// The ParaId of the coretime chain.
|
||||
#[pezpallet::constant]
|
||||
type BrokerId: Get<u32>;
|
||||
@@ -216,8 +219,8 @@ pub mod pezpallet {
|
||||
/// -`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 pezpallet's `CoreIndex` definition is `u16` but on the relay chain it's `struct
|
||||
// CoreIndex(u32)`
|
||||
// The broker pezpallet's `CoreIndex` definition is `u16` but on the relay chain it's
|
||||
// `struct CoreIndex(u32)`
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::assign_core(assignment.len() as u32))]
|
||||
pub fn assign_core(
|
||||
@@ -352,16 +355,16 @@ fn do_notify_revenue<T: Config>(when: BlockNumber, raw_revenue: Balance) -> Resu
|
||||
let dummy_xcm_context = XcmContext { origin: None, message_id: [0; 32], topic: None };
|
||||
|
||||
if raw_revenue > 0 {
|
||||
let on_demand_pot =
|
||||
T::AccountToLocation::try_convert(&<on_demand::Pezpallet<T>>::account_id()).map_err(
|
||||
|err| {
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to convert on-demand pot account to XCM location: {err:?}",
|
||||
);
|
||||
XcmError::InvalidLocation
|
||||
},
|
||||
)?;
|
||||
let on_demand_pot = T::AccountToLocation::try_convert(
|
||||
&<on_demand::Pezpallet<T>>::account_id(),
|
||||
)
|
||||
.map_err(|err| {
|
||||
log::error!(
|
||||
target: LOG_TARGET,
|
||||
"Failed to convert on-demand pot account to XCM location: {err:?}",
|
||||
);
|
||||
XcmError::InvalidLocation
|
||||
})?;
|
||||
|
||||
let withdrawn = T::AssetTransactor::withdraw_asset(&asset, &on_demand_pot, None)?;
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ use pezkuwi_primitives::{
|
||||
ValidDisputeStatementKind, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use pezkuwi_runtime_metrics::get_current_time;
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{AppVerify, One, Saturating, Zero},
|
||||
DispatchError, RuntimeDebug, SaturatedConversion,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(unused_imports)]
|
||||
@@ -372,9 +372,12 @@ pub mod pezpallet {
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + session_info::Config {
|
||||
pub trait Config:
|
||||
pezframe_system::Config + configuration::Config + session_info::Config
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RewardValidators: RewardValidators;
|
||||
type SlashingHandler: SlashingHandler<BlockNumberFor<Self>>;
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ use pezkuwi_primitives::{
|
||||
slashing::{DisputeProof, DisputesTimeSlot, PendingSlashes},
|
||||
CandidateHash, DisputeOffenceKind, SessionIndex, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::Convert,
|
||||
transaction_validity::{
|
||||
@@ -78,6 +77,7 @@ use pezsp_runtime::{
|
||||
};
|
||||
use pezsp_session::{GetSessionNumber, GetValidatorCount};
|
||||
use pezsp_staking::offence::{Kind, Offence, OffenceError, ReportOffence};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
const LOG_TARGET: &str = "runtime::teyrchains::slashing";
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ use codec::Decode;
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_support::traits::{OnFinalize, OnInitialize};
|
||||
use pezframe_system::{pezpallet_prelude::BlockNumberFor, RawOrigin};
|
||||
use pezpallet_staking::testing_utils::create_validators;
|
||||
use pezkuwi_primitives::{Hash, TEYRCHAIN_KEY_TYPE_ID};
|
||||
use pezpallet_staking::testing_utils::create_validators;
|
||||
use pezsp_runtime::traits::{One, OpaqueKeys, StaticLookup};
|
||||
use pezsp_session::MembershipProof;
|
||||
|
||||
@@ -77,8 +77,12 @@ where
|
||||
|
||||
whitelist_account!(controller);
|
||||
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::Pezpallet::<T>::set_keys(
|
||||
RawOrigin::Signed(controller).into(),
|
||||
keys,
|
||||
proof,
|
||||
)
|
||||
.expect("session::set_keys should work");
|
||||
}
|
||||
|
||||
pezpallet_session::Pezpallet::<T>::on_initialize(BlockNumberFor::<T>::one());
|
||||
|
||||
@@ -83,8 +83,8 @@ impl From<QueueDownwardMessageError> for SendError {
|
||||
}
|
||||
}
|
||||
|
||||
/// An error returned by [`Pezpallet::check_processed_downward_messages`] that indicates an acceptance
|
||||
/// check didn't pass.
|
||||
/// 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,
|
||||
AdvancementRule,
|
||||
@@ -219,8 +219,10 @@ impl<T: Config> Pezpallet<T> {
|
||||
let serialized_len = msg.len();
|
||||
Self::can_queue_downward_message(config, ¶, &msg)?;
|
||||
|
||||
let inbound =
|
||||
InboundDownwardMessage { msg, sent_at: pezframe_system::Pezpallet::<T>::block_number() };
|
||||
let inbound = 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| {
|
||||
|
||||
@@ -20,8 +20,8 @@ use crate::{
|
||||
mock::{new_test_ext, Dmp, MockGenesisConfig, Paras, System, Test},
|
||||
};
|
||||
use codec::Encode;
|
||||
use pezframe_support::assert_ok;
|
||||
use hex_literal::hex;
|
||||
use pezframe_support::assert_ok;
|
||||
use pezkuwi_primitives::BlockNumber;
|
||||
use pezsp_arithmetic::traits::Saturating;
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ use pezkuwi_primitives::{
|
||||
SessionIndex,
|
||||
};
|
||||
use pezkuwi_teyrchain_primitives::primitives::{HorizontalMessages, IsSystem};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{AccountIdConversion, BlakeTwo256, Hash as HashT, UniqueSaturatedInto, Zero},
|
||||
ArithmeticError,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub use pezpallet::*;
|
||||
|
||||
@@ -173,8 +173,8 @@ pub(crate) enum HrmpWatermarkAcceptanceErr<BlockNumber> {
|
||||
LandsOnBlockWithNoMessages { new_watermark: BlockNumber },
|
||||
}
|
||||
|
||||
/// An error returned by [`Pezpallet::check_outbound_hrmp`] that indicates an acceptance criteria check
|
||||
/// didn't pass.
|
||||
/// 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 },
|
||||
NotSorted { idx: u32 },
|
||||
@@ -260,7 +260,8 @@ pub mod pezpallet {
|
||||
{
|
||||
/// The outer event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
type RuntimeOrigin: From<crate::Origin>
|
||||
+ From<<Self as pezframe_system::Config>::RuntimeOrigin>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use crate::{
|
||||
configuration::Pezpallet as Configuration,
|
||||
hrmp::{Pezpallet as Hrmp, *},
|
||||
paras::{Pezpallet as Paras, ParaKind, TeyrchainsCache},
|
||||
paras::{ParaKind, Pezpallet as Paras, TeyrchainsCache},
|
||||
shared::Pezpallet as Shared,
|
||||
};
|
||||
use pezframe_benchmarking::{v2::*, whitelisted_caller};
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
use bitvec::{bitvec, prelude::Lsb0};
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezpallet_message_queue as mq;
|
||||
use pezkuwi_primitives::{
|
||||
CandidateCommitments, CommittedCandidateReceiptV2 as CommittedCandidateReceipt, HrmpChannelId,
|
||||
OutboundHrmpMessage, SessionIndex,
|
||||
};
|
||||
use pezpallet_message_queue as mq;
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
|
||||
@@ -70,8 +70,8 @@ mod v1 {
|
||||
PendingAvailabilityCommitments as V0PendingAvailabilityCommitments,
|
||||
};
|
||||
use crate::inclusion::{
|
||||
CandidatePendingAvailability as V1CandidatePendingAvailability, Config, Pezpallet,
|
||||
PendingAvailability as V1PendingAvailability,
|
||||
CandidatePendingAvailability as V1CandidatePendingAvailability, Config,
|
||||
PendingAvailability as V1PendingAvailability, Pezpallet,
|
||||
};
|
||||
use alloc::{collections::vec_deque::VecDeque, vec::Vec};
|
||||
use pezframe_support::{traits::UncheckedOnRuntimeUpgrade, weights::Weight};
|
||||
|
||||
@@ -42,7 +42,6 @@ use pezframe_support::{
|
||||
BoundedSlice,
|
||||
};
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezpallet_message_queue::OnQueueChanged;
|
||||
use pezkuwi_primitives::{
|
||||
effective_minimum_backing_votes, skip_ump_signals, supermajority_threshold, well_known_keys,
|
||||
BackedCandidate, CandidateCommitments, CandidateDescriptorV2 as CandidateDescriptor,
|
||||
@@ -51,8 +50,9 @@ use pezkuwi_primitives::{
|
||||
Id as ParaId, SignedAvailabilityBitfields, SigningContext, UpwardMessage, ValidatorId,
|
||||
ValidatorIndex, ValidityAttestation,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezpallet_message_queue::OnQueueChanged;
|
||||
use pezsp_runtime::{traits::One, DispatchError, SaturatedConversion, Saturating};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub use pezpallet::*;
|
||||
|
||||
@@ -289,7 +289,8 @@ pub mod pezpallet {
|
||||
+ scheduler::Config
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type DisputesHandler: disputes::DisputesHandler<BlockNumberFor<Self>>;
|
||||
type RewardValidators: RewardValidators;
|
||||
|
||||
|
||||
@@ -312,8 +312,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// Allow to trigger `on_new_session` in tests, this is needed as long as `pezpallet_session` is not
|
||||
// implemented in mock.
|
||||
// Allow to trigger `on_new_session` in tests, this is needed as long as `pezpallet_session` is
|
||||
// not implemented in mock.
|
||||
#[cfg(any(test, feature = "runtime-benchmarks"))]
|
||||
pub(crate) fn test_trigger_on_new_session<'a, I: 'a>(
|
||||
changed: bool,
|
||||
|
||||
@@ -761,7 +761,9 @@ pub(crate) fn deregister_teyrchain(id: ParaId) {
|
||||
|
||||
/// Calls `schedule_para_cleanup` in a new storage transactions, since it assumes rollback on error.
|
||||
pub(crate) fn try_deregister_teyrchain(id: ParaId) -> crate::DispatchResult {
|
||||
pezframe_support::storage::transactional::with_storage_layer(|| Paras::schedule_para_cleanup(id))
|
||||
pezframe_support::storage::transactional::with_storage_layer(|| {
|
||||
Paras::schedule_para_cleanup(id)
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn set_disabled_validators(disabled: Vec<u32>) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use super::{Pezpallet, *};
|
||||
use crate::{
|
||||
configuration::{HostConfiguration, Pezpallet as ConfigurationPallet},
|
||||
paras::{Pezpallet as ParasPallet, ParaGenesisArgs, ParaKind, TeyrchainsCache},
|
||||
paras::{ParaGenesisArgs, ParaKind, Pezpallet as ParasPallet, TeyrchainsCache},
|
||||
shared::Pezpallet as ParasShared,
|
||||
};
|
||||
|
||||
|
||||
@@ -118,7 +118,8 @@ pub mod pezpallet {
|
||||
pub trait Config: pezframe_system::Config + configuration::Config + paras::Config {
|
||||
/// The runtime's definition of an event.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// The runtime's definition of a Currency.
|
||||
type Currency: Currency<Self::AccountId>;
|
||||
@@ -490,8 +491,8 @@ where
|
||||
existence_requirement,
|
||||
)?;
|
||||
|
||||
// Consume the negative imbalance and deposit it into the pezpallet account. Make
|
||||
// sure the account preserves even without the existential deposit.
|
||||
// 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) {
|
||||
System::<T>::inc_providers(&pot);
|
||||
@@ -759,7 +760,8 @@ where
|
||||
amount
|
||||
}
|
||||
|
||||
/// Account of the pezpallet 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 +788,11 @@ where
|
||||
pub fn populate_queue(para_id: ParaId, num: u32) {
|
||||
QueueStatus::<T>::mutate(|queue_status| {
|
||||
for _ in 0..num {
|
||||
Pezpallet::<T>::add_on_demand_order(queue_status, para_id, QueuePushDirection::Back);
|
||||
Pezpallet::<T>::add_on_demand_order(
|
||||
queue_status,
|
||||
para_id,
|
||||
QueuePushDirection::Back,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ use crate::{
|
||||
};
|
||||
use core::cmp::{Ord, Ordering};
|
||||
use pezframe_support::{assert_noop, assert_ok};
|
||||
use pezpallet_balances::Error as BalancesError;
|
||||
use pezkuwi_primitives::{BlockNumber, SessionIndex, ValidationCode, ON_DEMAND_MAX_QUEUE_MAX_SIZE};
|
||||
use pezpallet_balances::Error as BalancesError;
|
||||
use pezsp_runtime::traits::BadOrigin;
|
||||
|
||||
fn schedule_blank_para(id: ParaId, parakind: ParaKind) {
|
||||
|
||||
@@ -198,8 +198,11 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
let _ = Pezpallet::<T>::include_pvf_check_statement(
|
||||
RawOrigin::None.into(),
|
||||
stmt,
|
||||
signature,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,8 +213,11 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
let _ = Pezpallet::<T>::include_pvf_check_statement(
|
||||
RawOrigin::None.into(),
|
||||
stmt,
|
||||
signature,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +228,11 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
let _ = Pezpallet::<T>::include_pvf_check_statement(
|
||||
RawOrigin::None.into(),
|
||||
stmt,
|
||||
signature,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,8 +243,11 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
let _ = Pezpallet::<T>::include_pvf_check_statement(
|
||||
RawOrigin::None.into(),
|
||||
stmt,
|
||||
signature,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,8 +258,11 @@ mod benchmarks {
|
||||
|
||||
#[block]
|
||||
{
|
||||
let _ =
|
||||
Pezpallet::<T>::include_pvf_check_statement(RawOrigin::None.into(), stmt, signature);
|
||||
let _ = Pezpallet::<T>::include_pvf_check_statement(
|
||||
RawOrigin::None.into(),
|
||||
stmt,
|
||||
signature,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +272,8 @@ mod benchmarks {
|
||||
let old_code_hash = ValidationCode(vec![0]).hash();
|
||||
CurrentCodeHash::<T>::insert(¶_id, old_code_hash);
|
||||
pezframe_system::Pezpallet::<T>::set_block_number(10u32.into());
|
||||
let inclusion = pezframe_system::Pezpallet::<T>::block_number().saturating_add(10u32.into());
|
||||
let inclusion =
|
||||
pezframe_system::Pezpallet::<T>::block_number().saturating_add(10u32.into());
|
||||
let config = HostConfiguration::<BlockNumberFor<T>>::default();
|
||||
Pezpallet::<T>::schedule_code_upgrade(
|
||||
para_id,
|
||||
@@ -297,7 +313,8 @@ mod benchmarks {
|
||||
Event::CodeAuthorized {
|
||||
para_id,
|
||||
code_hash: new_code_hash,
|
||||
expire_at: pezframe_system::Pezpallet::<T>::block_number().saturating_add(valid_period),
|
||||
expire_at: pezframe_system::Pezpallet::<T>::block_number()
|
||||
.saturating_add(valid_period),
|
||||
}
|
||||
.into(),
|
||||
);
|
||||
@@ -307,8 +324,8 @@ mod benchmarks {
|
||||
fn apply_authorized_force_set_current_code(c: Linear<MIN_CODE_SIZE, MAX_CODE_SIZE>) {
|
||||
let code = ValidationCode(vec![0; c as usize]);
|
||||
let para_id = ParaId::from(1000);
|
||||
let expire_at =
|
||||
pezframe_system::Pezpallet::<T>::block_number().saturating_add(BlockNumberFor::<T>::from(c));
|
||||
let expire_at = pezframe_system::Pezpallet::<T>::block_number()
|
||||
.saturating_add(BlockNumberFor::<T>::from(c));
|
||||
AuthorizedCodeHash::<T>::insert(
|
||||
¶_id,
|
||||
AuthorizedCodeHashAndExpiry::from((code.hash(), expire_at)),
|
||||
|
||||
@@ -127,12 +127,12 @@ use pezkuwi_primitives::{
|
||||
ConsensusLog, HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, UpgradeGoAhead,
|
||||
UpgradeRestriction, ValidationCode, ValidationCodeHash, ValidatorSignature, MIN_CODE_SIZE,
|
||||
};
|
||||
use scale_info::{Type, TypeInfo};
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_runtime::{
|
||||
traits::{AppVerify, One, Saturating},
|
||||
DispatchResult, SaturatedConversion,
|
||||
};
|
||||
use scale_info::{Type, TypeInfo};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -664,7 +664,8 @@ pub mod pezpallet {
|
||||
+ pezframe_system::offchain::CreateBare<Call<Self>>
|
||||
{
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
#[pezpallet::constant]
|
||||
type UnsignedPriority: Get<TransactionPriority>;
|
||||
@@ -706,8 +707,9 @@ pub mod pezpallet {
|
||||
|
||||
/// The origin that can authorize [`Pezpallet::authorize_force_set_current_code_hash`].
|
||||
///
|
||||
/// 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.
|
||||
/// 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>;
|
||||
}
|
||||
|
||||
@@ -2420,7 +2422,11 @@ impl<T: Config> Pezpallet<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::Pezpallet::<T>::block_number());
|
||||
Self::set_current_code(
|
||||
para,
|
||||
new_code_hash,
|
||||
pezframe_system::Pezpallet::<T>::block_number(),
|
||||
);
|
||||
Self::deposit_event(Event::CurrentCodeUpdated(para));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ use pezframe_support::{
|
||||
};
|
||||
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezpallet_babe::{self, ParentBlockRandomness};
|
||||
use pezkuwi_primitives::{
|
||||
effective_minimum_backing_votes, node_features::FeatureIndex, BackedCandidate,
|
||||
CandidateDescriptorVersion, CandidateHash, CandidateReceiptV2 as CandidateReceipt,
|
||||
@@ -57,9 +56,10 @@ use pezkuwi_primitives::{
|
||||
UncheckedSignedAvailabilityBitfield, UncheckedSignedAvailabilityBitfields, ValidatorId,
|
||||
ValidatorIndex, ValidityAttestation, TEYRCHAINS_INHERENT_IDENTIFIER,
|
||||
};
|
||||
use pezpallet_babe::{self, ParentBlockRandomness};
|
||||
use pezsp_runtime::traits::{Header as HeaderT, One};
|
||||
use rand::{seq::SliceRandom, SeedableRng};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::traits::{Header as HeaderT, One};
|
||||
|
||||
mod misc;
|
||||
mod weights;
|
||||
@@ -1372,11 +1372,13 @@ 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::Pezpallet::<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::Pezpallet::<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;
|
||||
|
||||
@@ -63,10 +63,10 @@ mod enter {
|
||||
MutateDescriptorV2, UMPSignal, UncheckedSigned,
|
||||
};
|
||||
use pezkuwi_primitives_test_helpers::CandidateDescriptor;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
use pezsp_core::ByteArray;
|
||||
use pezsp_runtime::Perbill;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rstest::rstest;
|
||||
|
||||
struct TestConfig {
|
||||
dispute_statements: BTreeMap<u32, u32>,
|
||||
@@ -2040,7 +2040,8 @@ mod enter {
|
||||
// * 5 v2 candidate descriptors.
|
||||
assert_eq!(inherent_data.backed_candidates.len(), 5);
|
||||
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2099,7 +2100,8 @@ mod enter {
|
||||
// * 5 v2 candidate descriptors.
|
||||
assert_eq!(inherent_data.backed_candidates.len(), 5);
|
||||
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2264,7 +2266,8 @@ mod enter {
|
||||
expected_inherent_data
|
||||
);
|
||||
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data).unwrap_err();
|
||||
Pezpallet::<Test>::enter(pezframe_system::RawOrigin::None.into(), inherent_data)
|
||||
.unwrap_err();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2374,8 +2377,8 @@ mod sanitizers {
|
||||
AvailabilityBitfield, GroupIndex, Hash, Id as ParaId, SignedAvailabilityBitfield,
|
||||
ValidatorIndex,
|
||||
};
|
||||
use rstest::rstest;
|
||||
use pezsp_core::crypto::UncheckedFrom;
|
||||
use rstest::rstest;
|
||||
|
||||
use crate::mock::Test;
|
||||
use pezkuwi_primitives::TEYRCHAIN_KEY_TYPE_ID;
|
||||
@@ -2644,8 +2647,8 @@ 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` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering
|
||||
// backing votes) won't behave correctly
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
default_header().hash(),
|
||||
Default::default(),
|
||||
@@ -2967,8 +2970,8 @@ mod sanitizers {
|
||||
),
|
||||
]));
|
||||
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering
|
||||
// backing votes) won't behave correctly
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
relay_parent,
|
||||
Default::default(),
|
||||
@@ -2984,7 +2987,10 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=8u32 {
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
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),
|
||||
@@ -3508,7 +3514,10 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=4u32 {
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
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),
|
||||
@@ -3878,8 +3887,8 @@ mod sanitizers {
|
||||
}
|
||||
.hash();
|
||||
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering backing
|
||||
// votes) won't behave correctly
|
||||
// Add the relay parent to `shared` pezpallet. Otherwise some code (e.g. filtering
|
||||
// backing votes) won't behave correctly
|
||||
shared::Pezpallet::<Test>::add_allowed_relay_parent(
|
||||
prev_relay_parent,
|
||||
Default::default(),
|
||||
@@ -3990,7 +3999,10 @@ mod sanitizers {
|
||||
|
||||
// Set the on-chain included head data and current code hash.
|
||||
for id in 1..=2u32 {
|
||||
paras::Pezpallet::<Test>::set_current_head(ParaId::from(id), HeadData(vec![id as u8]));
|
||||
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),
|
||||
|
||||
@@ -127,8 +127,9 @@ fn current_relay_parent<T: pezframe_system::Config>(
|
||||
use codec::Decode as _;
|
||||
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");
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -148,7 +149,8 @@ where
|
||||
},
|
||||
OccupiedCoreAssumption::TimedOut => build(),
|
||||
OccupiedCoreAssumption::Free =>
|
||||
if !<inclusion::Pezpallet<Config>>::candidates_pending_availability(para_id).is_empty() {
|
||||
if !<inclusion::Pezpallet<Config>>::candidates_pending_availability(para_id).is_empty()
|
||||
{
|
||||
None
|
||||
} else {
|
||||
build()
|
||||
@@ -238,8 +240,10 @@ 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::Pezpallet::<T>::current_authorities().to_vec();
|
||||
authority_ids.extend(pezpallet_authority_discovery::Pezpallet::<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 +265,9 @@ pub fn validation_code<T: initializer::Config>(
|
||||
para_id: ParaId,
|
||||
assumption: OccupiedCoreAssumption,
|
||||
) -> Option<ValidationCode> {
|
||||
with_assumption::<T, _, _>(para_id, assumption, || paras::Pezpallet::<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.
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
//! Common traits and types used by the scheduler and assignment providers.
|
||||
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
codec::{Decode, Encode},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use pezkuwi_primitives::{CoreIndex, Id as ParaId};
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ mod v0 {
|
||||
use pezkuwi_primitives::{CollatorId, Id};
|
||||
|
||||
#[storage_alias]
|
||||
pub(super) type Scheduled<T: Config> = StorageValue<Pezpallet<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))]
|
||||
|
||||
@@ -30,7 +30,10 @@ pub mod v0 {
|
||||
#[storage_alias]
|
||||
pub(crate) type AllowedRelayParents<T: Config> = StorageValue<
|
||||
Pezpallet<T>,
|
||||
super::v0::AllowedRelayParentsTracker<<T as pezframe_system::Config>::Hash, BlockNumberFor<T>>,
|
||||
super::v0::AllowedRelayParentsTracker<
|
||||
<T as pezframe_system::Config>::Hash,
|
||||
BlockNumberFor<T>,
|
||||
>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
|
||||
@@ -209,7 +209,10 @@ mod check_upward_messages {
|
||||
fn queue_size_exceeded_error() {
|
||||
new_test_ext(GenesisConfigBuilder::large_queue_count().build()).execute_with(|| {
|
||||
let limit = configuration::ActiveConfig::<Test>::get().max_upward_queue_size as u64;
|
||||
assert_eq!(pezpallet_message_queue::ItemHeader::<MessageQueueSize>::max_encoded_len(), 5);
|
||||
assert_eq!(
|
||||
pezpallet_message_queue::ItemHeader::<MessageQueueSize>::max_encoded_len(),
|
||||
5
|
||||
);
|
||||
assert!(
|
||||
configuration::ActiveConfig::<Test>::get().max_upward_queue_size <
|
||||
crate::inclusion::MaxUmpMessageLenOf::<Test>::get(),
|
||||
|
||||
Reference in New Issue
Block a user