mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 13:31:10 +00:00
[FRAME] Use 'ready' pages in XCMP suspend logic (#2393)
Changes: - `QueueFootprint` gets a new field; `ready_pages` that contains the non-overweight and not yet processed pages. - `XCMP` queue pallet is change to use the `ready_pages` instead of `pages` to calculate the channel suspension thresholds. This should give the XCMP queue pallet a more correct view of when to suspend channels. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
committed by
GitHub
parent
c367ac2488
commit
329c077236
@@ -208,8 +208,9 @@ use frame_support::{
|
||||
defensive,
|
||||
pallet_prelude::*,
|
||||
traits::{
|
||||
Defensive, DefensiveTruncateFrom, EnqueueMessage, ExecuteOverweightError, Footprint,
|
||||
ProcessMessage, ProcessMessageError, QueueFootprint, QueuePausedQuery, ServiceQueues,
|
||||
Defensive, DefensiveSaturating, DefensiveTruncateFrom, EnqueueMessage,
|
||||
ExecuteOverweightError, Footprint, ProcessMessage, ProcessMessageError, QueueFootprint,
|
||||
QueuePausedQuery, ServiceQueues,
|
||||
},
|
||||
BoundedSlice, CloneNoBound, DefaultNoBound,
|
||||
};
|
||||
@@ -442,6 +443,7 @@ impl<MessageOrigin> From<BookState<MessageOrigin>> for QueueFootprint {
|
||||
fn from(book: BookState<MessageOrigin>) -> Self {
|
||||
QueueFootprint {
|
||||
pages: book.count,
|
||||
ready_pages: book.end.defensive_saturating_sub(book.begin),
|
||||
storage: Footprint { count: book.message_count, size: book.size },
|
||||
}
|
||||
}
|
||||
@@ -1281,6 +1283,9 @@ impl<T: Config> Pallet<T> {
|
||||
ensure!(book.message_count < 1 << 30, "Likely overflow or corruption");
|
||||
ensure!(book.size < 1 << 30, "Likely overflow or corruption");
|
||||
ensure!(book.count < 1 << 30, "Likely overflow or corruption");
|
||||
|
||||
let fp: QueueFootprint = book.into();
|
||||
ensure!(fp.ready_pages <= fp.pages, "There cannot be more ready than total pages");
|
||||
}
|
||||
|
||||
//loop around this origin
|
||||
|
||||
Reference in New Issue
Block a user