mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 09:51:02 +00:00
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber (#7431)
* Companion for substrate * Minor update * Formatting * Fixes for cumulus * Fixes tests in polkadot-runtime-parachains * Minor update * Removes unused import * Fixes tests in polkadot-runtime-common * Minor fix * Update roadmap/implementers-guide/src/runtime/configuration.md Co-authored-by: ordian <write@reusable.software> * ".git/.scripts/commands/fmt/fmt.sh" * update lockfile for {"substrate"} --------- Co-authored-by: ordian <write@reusable.software> Co-authored-by: command-bot <>
This commit is contained in:
@@ -33,6 +33,7 @@ use frame_support::{
|
||||
traits::{Defensive, EnqueueMessage},
|
||||
BoundedSlice,
|
||||
};
|
||||
use frame_system::pallet_prelude::*;
|
||||
use pallet_message_queue::OnQueueChanged;
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use primitives::{
|
||||
@@ -270,7 +271,7 @@ pub mod pallet {
|
||||
+ configuration::Config
|
||||
{
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
type DisputesHandler: disputes::DisputesHandler<Self::BlockNumber>;
|
||||
type DisputesHandler: disputes::DisputesHandler<BlockNumberFor<Self>>;
|
||||
type RewardValidators: RewardValidators;
|
||||
|
||||
/// The system message queue.
|
||||
@@ -365,12 +366,16 @@ pub mod pallet {
|
||||
/// The latest bitfield for each validator, referred to by their index in the validator set.
|
||||
#[pallet::storage]
|
||||
pub(crate) type AvailabilityBitfields<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ValidatorIndex, AvailabilityBitfieldRecord<T::BlockNumber>>;
|
||||
StorageMap<_, Twox64Concat, ValidatorIndex, AvailabilityBitfieldRecord<BlockNumberFor<T>>>;
|
||||
|
||||
/// Candidates pending availability by `ParaId`.
|
||||
#[pallet::storage]
|
||||
pub(crate) type PendingAvailability<T: Config> =
|
||||
StorageMap<_, Twox64Concat, ParaId, CandidatePendingAvailability<T::Hash, T::BlockNumber>>;
|
||||
pub(crate) type PendingAvailability<T: Config> = StorageMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
ParaId,
|
||||
CandidatePendingAvailability<T::Hash, BlockNumberFor<T>>,
|
||||
>;
|
||||
|
||||
/// The commitments of candidates pending availability, by `ParaId`.
|
||||
#[pallet::storage]
|
||||
@@ -450,7 +455,7 @@ impl fmt::Debug for UmpAcceptanceCheckErr {
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Block initialization logic, called by initializer.
|
||||
pub(crate) fn initializer_initialize(_now: T::BlockNumber) -> Weight {
|
||||
pub(crate) fn initializer_initialize(_now: BlockNumberFor<T>) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
|
||||
@@ -459,7 +464,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Handle an incoming session change.
|
||||
pub(crate) fn initializer_on_new_session(
|
||||
_notification: &crate::initializer::SessionChangeNotification<T::BlockNumber>,
|
||||
_notification: &crate::initializer::SessionChangeNotification<BlockNumberFor<T>>,
|
||||
outgoing_paras: &[ParaId],
|
||||
) {
|
||||
// unlike most drain methods, drained elements are not cleared on `Drop` of the iterator
|
||||
@@ -832,7 +837,7 @@ impl<T: Config> Pallet<T> {
|
||||
&validation_outputs.new_validation_code,
|
||||
validation_outputs.processed_downward_messages,
|
||||
&validation_outputs.upward_messages,
|
||||
T::BlockNumber::from(validation_outputs.hrmp_watermark),
|
||||
BlockNumberFor::<T>::from(validation_outputs.hrmp_watermark),
|
||||
&validation_outputs.horizontal_messages,
|
||||
)
|
||||
.is_err()
|
||||
@@ -849,7 +854,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
fn enact_candidate(
|
||||
relay_parent_number: T::BlockNumber,
|
||||
relay_parent_number: BlockNumberFor<T>,
|
||||
receipt: CommittedCandidateReceipt<T::Hash>,
|
||||
backers: BitVec<u8, BitOrderLsb0>,
|
||||
availability_votes: BitVec<u8, BitOrderLsb0>,
|
||||
@@ -898,7 +903,7 @@ impl<T: Config> Pallet<T> {
|
||||
));
|
||||
weight.saturating_accrue(<hrmp::Pallet<T>>::prune_hrmp(
|
||||
receipt.descriptor.para_id,
|
||||
T::BlockNumber::from(commitments.hrmp_watermark),
|
||||
BlockNumberFor::<T>::from(commitments.hrmp_watermark),
|
||||
));
|
||||
weight.saturating_accrue(<hrmp::Pallet<T>>::queue_outbound_hrmp(
|
||||
receipt.descriptor.para_id,
|
||||
@@ -921,7 +926,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Check that all the upward messages sent by a candidate pass the acceptance criteria.
|
||||
pub(crate) fn check_upward_messages(
|
||||
config: &HostConfiguration<T::BlockNumber>,
|
||||
config: &HostConfiguration<BlockNumberFor<T>>,
|
||||
para: ParaId,
|
||||
upward_messages: &[UpwardMessage],
|
||||
) -> Result<(), UmpAcceptanceCheckErr> {
|
||||
@@ -1020,7 +1025,7 @@ impl<T: Config> Pallet<T> {
|
||||
///
|
||||
/// Returns a vector of cleaned-up core IDs.
|
||||
pub(crate) fn collect_pending(
|
||||
pred: impl Fn(CoreIndex, T::BlockNumber) -> bool,
|
||||
pred: impl Fn(CoreIndex, BlockNumberFor<T>) -> bool,
|
||||
) -> Vec<CoreIndex> {
|
||||
let mut cleaned_up_ids = Vec::new();
|
||||
let mut cleaned_up_cores = Vec::new();
|
||||
@@ -1115,7 +1120,7 @@ impl<T: Config> Pallet<T> {
|
||||
/// para provided, if any.
|
||||
pub(crate) fn pending_availability(
|
||||
para: ParaId,
|
||||
) -> Option<CandidatePendingAvailability<T::Hash, T::BlockNumber>> {
|
||||
) -> Option<CandidatePendingAvailability<T::Hash, BlockNumberFor<T>>> {
|
||||
<PendingAvailability<T>>::get(¶)
|
||||
}
|
||||
}
|
||||
@@ -1162,9 +1167,9 @@ impl<T: Config> OnQueueChanged<AggregateMessageOrigin> for Pallet<T> {
|
||||
|
||||
/// A collection of data required for checking a candidate.
|
||||
pub(crate) struct CandidateCheckContext<T: Config> {
|
||||
config: configuration::HostConfiguration<T::BlockNumber>,
|
||||
now: T::BlockNumber,
|
||||
relay_parent_number: T::BlockNumber,
|
||||
config: configuration::HostConfiguration<BlockNumberFor<T>>,
|
||||
now: BlockNumberFor<T>,
|
||||
relay_parent_number: BlockNumberFor<T>,
|
||||
}
|
||||
|
||||
/// An error indicating that creating Persisted Validation Data failed
|
||||
@@ -1172,7 +1177,7 @@ pub(crate) struct CandidateCheckContext<T: Config> {
|
||||
pub(crate) struct FailedToCreatePVD;
|
||||
|
||||
impl<T: Config> CandidateCheckContext<T> {
|
||||
pub(crate) fn new(now: T::BlockNumber, relay_parent_number: T::BlockNumber) -> Self {
|
||||
pub(crate) fn new(now: BlockNumberFor<T>, relay_parent_number: BlockNumberFor<T>) -> Self {
|
||||
Self { config: <configuration::Pallet<T>>::config(), now, relay_parent_number }
|
||||
}
|
||||
|
||||
@@ -1244,7 +1249,7 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
&backed_candidate.candidate.commitments.new_validation_code,
|
||||
backed_candidate.candidate.commitments.processed_downward_messages,
|
||||
&backed_candidate.candidate.commitments.upward_messages,
|
||||
T::BlockNumber::from(backed_candidate.candidate.commitments.hrmp_watermark),
|
||||
BlockNumberFor::<T>::from(backed_candidate.candidate.commitments.hrmp_watermark),
|
||||
&backed_candidate.candidate.commitments.horizontal_messages,
|
||||
) {
|
||||
log::debug!(
|
||||
@@ -1267,9 +1272,9 @@ impl<T: Config> CandidateCheckContext<T> {
|
||||
new_validation_code: &Option<primitives::ValidationCode>,
|
||||
processed_downward_messages: u32,
|
||||
upward_messages: &[primitives::UpwardMessage],
|
||||
hrmp_watermark: T::BlockNumber,
|
||||
hrmp_watermark: BlockNumberFor<T>,
|
||||
horizontal_messages: &[primitives::OutboundHrmpMessage<ParaId>],
|
||||
) -> Result<(), AcceptanceCheckErr<T::BlockNumber>> {
|
||||
) -> Result<(), AcceptanceCheckErr<BlockNumberFor<T>>> {
|
||||
ensure!(
|
||||
head_data.0.len() <= self.config.max_head_data_size as _,
|
||||
AcceptanceCheckErr::HeadDataTooLarge,
|
||||
|
||||
Reference in New Issue
Block a user