Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
240e20b
[stable2407] Backport #5713 (#5739)
paritytech-cmd-bot-polkadot-sdk[bot] Oct 7, 2024
3809977
[stable2407] Backport #3049 (#5734)
paritytech-cmd-bot-polkadot-sdk[bot] Oct 7, 2024
43daea1
Move prdocs to release folder
EgorPopelyaev Oct 8, 2024
977ff2a
Bump polkadot node version
EgorPopelyaev Oct 8, 2024
69c3190
Update plan
Morganamilo Oct 9, 2024
f72fe54
[stable2407] Backport Fix parity-publish (#5670) (#6019)
EgorPopelyaev Oct 10, 2024
88c3250
[stable2407] Backport docker fix to 2407 (#6017)
EgorPopelyaev Oct 11, 2024
47155f8
[stable2407] Backport #5913 (#6004)
paritytech-cmd-bot-polkadot-sdk[bot] Oct 15, 2024
fc62793
[stable2407] Backport #4803 (#6097)
paritytech-cmd-bot-polkadot-sdk[bot] Oct 17, 2024
fff69c3
[stable2407] Backport #5599 (#6068)
paritytech-cmd-bot-polkadot-sdk[bot] Oct 25, 2024
6d6aa61
[stable2407] Backport #6205 (#6238)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 5, 2024
bab3fb5
[stable2407] Backport #6148 (#6232)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 7, 2024
6f9c849
Bump node version
EgorPopelyaev Nov 7, 2024
fa0f15e
Move prdocs
EgorPopelyaev Nov 7, 2024
48bce85
Update plan
Morganamilo Nov 7, 2024
b386125
Apply plan
Morganamilo Nov 7, 2024
0e22c93
[stable2407] Backport #6417 (#6437)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 12, 2024
b5eb098
[Release|CI/CD] Fix audiences changelog template (#6444)
EgorPopelyaev Nov 12, 2024
b98e0b3
[stable2407] Backport #6526 (#6530)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 21, 2024
7041e2b
[stable2407] Backport #6645 (#6655)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 27, 2024
f5245c8
[stable2407] Backport #6579 (#6634)
paritytech-cmd-bot-polkadot-sdk[bot] Nov 27, 2024
9ac3300
[stable2407] Backport #6603 (#6668)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 3, 2024
c29cf6e
Backport #5887 to `stable2407` (#6674)
s0me0ne-unkn0wn Dec 3, 2024
5405cdc
[stable2407] Backport #6031 (#6106)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 4, 2024
6604c1c
[stable2407] Backport #6080 (#6180)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 4, 2024
22601b2
[stable2407] Backport #6540 (#6591)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 4, 2024
fb7075d
[stable2407] Backport #6506 (#6657)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 4, 2024
37323c9
[stable2407] Backport #6459 (#6663)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 4, 2024
2be0d01
Bump polkadot node version
EgorPopelyaev Dec 4, 2024
fe4e09d
Move prdoxs to release folder
EgorPopelyaev Dec 4, 2024
9c8ad9b
Apply plan
Morganamilo Dec 9, 2024
ed1932e
Update Cargo.lock
EgorPopelyaev Dec 9, 2024
637f011
[stable2407] Backport #6690 (#6798)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 10, 2024
f2ada78
[stable2407] Backport #6729 (#6828)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 11, 2024
57794df
[stable2407] Backport #6662 (#6801)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 11, 2024
3fd8c60
[stable2407] Backport #5311 (#6804)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 11, 2024
f2081f6
[stable2407] Backport #6696 (#6839)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 11, 2024
fb9b95d
[stable2407] Backport #6864 (#6877)
paritytech-cmd-bot-polkadot-sdk[bot] Dec 18, 2024
826bb49
[stable2407] Backport #7050 (#7058)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 8, 2025
92e4d83
[stable2407] Backport #7013 (#7015)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 10, 2025
7e984b5
Switch to parity-large runners to be able to run on the github (#7113)
EgorPopelyaev Jan 10, 2025
dcbca59
Move prdocs to release folder
EgorPopelyaev Jan 10, 2025
08af329
Bump node_version
EgorPopelyaev Jan 10, 2025
77aa3e5
[stable2407] Backport #7116 (#7135)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 13, 2025
83db0a1
Move prdoc to release folder
EgorPopelyaev Jan 13, 2025
c983de5
[stable2407] Backport #6807 (#7155)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 15, 2025
6c1c8b9
[stable2407] Backport #6973 (#7159)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 15, 2025
c980380
[stable2407] Backport #6971 (#7172)
paritytech-cmd-bot-polkadot-sdk[bot] Jan 15, 2025
6ae6bbc
Move prdocs to release folder
EgorPopelyaev Jan 15, 2025
39e71bd
Apply plan
EgorPopelyaev Jan 16, 2025
fd4b790
[stable2407] Backport #7365 (#7380)
paritytech-cmd-bot-polkadot-sdk[bot] Feb 5, 2025
dc31da0
[stable2407] Backport #7437 (#7465)
paritytech-cmd-bot-polkadot-sdk[bot] Feb 5, 2025
544b535
[stable2407] Backport #7446 (#7460)
paritytech-cmd-bot-polkadot-sdk[bot] Feb 5, 2025
5a543ef
Update plan
EgorPopelyaev Feb 6, 2025
5c40d27
Apply changes
EgorPopelyaev Feb 6, 2025
78e15d1
Move prdocs to release folder
EgorPopelyaev Feb 6, 2025
7642d6b
Bump node version
EgorPopelyaev Feb 6, 2025
f0ddc6f
Backport 1.12.0: check-weight: Disable total pov size check for manda…
skunert May 27, 2024
5067508
Implement `CheckMetadataHash` extension (#4274) (#4619)
bkchr May 29, 2024
b7be8b2
init bifrost-polkadot-base
dnjscksdn98 Oct 19, 2023
852526f
fix: add legacy transferrable balance to currency trait (#1)
dnjscksdn98 Dec 20, 2023
4db553c
wasm-builder(cherry-pick): Also set mcpu for c deps (https://github.c…
dnjscksdn98 Jul 22, 2024
3dc203c
update Cargo.lock
dnjscksdn98 Sep 20, 2024
d78fc55
feat: add a getter function to retrieve keystore raw value
dnjscksdn98 Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[stable2407] Backport paritytech#4803 (paritytech#6097)
Backport paritytech#4803 into `stable2407` from gotnoshoeson.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

Co-authored-by: Miles Patterson <miles_patterson@icloud.com>
  • Loading branch information
commit fc627930d54785acaaa30fe003190244221ca36a
14 changes: 14 additions & 0 deletions prdoc/pr_4803.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Fix for issue #4762

doc:
- audience: Runtime Dev
description: |
When the status of the queue is on_initialize, throw a defensive message and return weight of 0,
however when status is on_idle, do not throw a defensive message, only return weight of 0

crates:
- name: pallet-message-queue
bump: patch
109 changes: 65 additions & 44 deletions substrate/frame/message-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ pub mod pallet {
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
if let Some(weight_limit) = T::ServiceWeight::get() {
Self::service_queues(weight_limit)
Self::service_queues_impl(weight_limit, ServiceQueuesContext::OnInitialize)
} else {
Weight::zero()
}
Expand All @@ -658,7 +658,10 @@ pub mod pallet {
fn on_idle(_n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight {
if let Some(weight_limit) = T::IdleMaxServiceWeight::get() {
// Make use of the remaining weight to process enqueued messages.
Self::service_queues(weight_limit.min(remaining_weight))
Self::service_queues_impl(
weight_limit.min(remaining_weight),
ServiceQueuesContext::OnIdle,
)
} else {
Weight::zero()
}
Expand Down Expand Up @@ -777,6 +780,18 @@ enum MessageExecutionStatus {
StackLimitReached,
}

/// The context to pass to [`Pallet::service_queues_impl`] through on_idle and on_initialize hooks
/// We don't want to throw the defensive message if called from on_idle hook
#[derive(PartialEq)]
enum ServiceQueuesContext {
/// Context of on_idle hook.
OnIdle,
/// Context of on_initialize hook.
OnInitialize,
/// Context `service_queues` trait function.
ServiceQueues,
}

impl<T: Config> Pallet<T> {
/// Knit `origin` into the ready ring right at the end.
///
Expand Down Expand Up @@ -1489,6 +1504,53 @@ impl<T: Config> Pallet<T> {
},
}
}

fn service_queues_impl(weight_limit: Weight, context: ServiceQueuesContext) -> Weight {
let mut weight = WeightMeter::with_limit(weight_limit);

// Get the maximum weight that processing a single message may take:
let max_weight = Self::max_message_weight(weight_limit).unwrap_or_else(|| {
if matches!(context, ServiceQueuesContext::OnInitialize) {
defensive!("Not enough weight to service a single message.");
}
Weight::zero()
});

match with_service_mutex(|| {
let mut next = match Self::bump_service_head(&mut weight) {
Some(h) => h,
None => return weight.consumed(),
};
// The last queue that did not make any progress.
// The loop aborts as soon as it arrives at this queue again without making any progress
// on other queues in between.
let mut last_no_progress = None;

loop {
let (progressed, n) = Self::service_queue(next.clone(), &mut weight, max_weight);
next = match n {
Some(n) =>
if !progressed {
if last_no_progress == Some(n.clone()) {
break
}
if last_no_progress.is_none() {
last_no_progress = Some(next.clone())
}
n
} else {
last_no_progress = None;
n
},
None => break,
}
}
weight.consumed()
}) {
Err(()) => weight.consumed(),
Ok(w) => w,
}
}
}

/// Run a closure that errors on re-entrance. Meant to be used by anything that services queues.
Expand Down Expand Up @@ -1558,48 +1620,7 @@ impl<T: Config> ServiceQueues for Pallet<T> {
type OverweightMessageAddress = (MessageOriginOf<T>, PageIndex, T::Size);

fn service_queues(weight_limit: Weight) -> Weight {
let mut weight = WeightMeter::with_limit(weight_limit);

// Get the maximum weight that processing a single message may take:
let max_weight = Self::max_message_weight(weight_limit).unwrap_or_else(|| {
defensive!("Not enough weight to service a single message.");
Weight::zero()
});

match with_service_mutex(|| {
let mut next = match Self::bump_service_head(&mut weight) {
Some(h) => h,
None => return weight.consumed(),
};
// The last queue that did not make any progress.
// The loop aborts as soon as it arrives at this queue again without making any progress
// on other queues in between.
let mut last_no_progress = None;

loop {
let (progressed, n) = Self::service_queue(next.clone(), &mut weight, max_weight);
next = match n {
Some(n) =>
if !progressed {
if last_no_progress == Some(n.clone()) {
break
}
if last_no_progress.is_none() {
last_no_progress = Some(next.clone())
}
n
} else {
last_no_progress = None;
n
},
None => break,
}
}
weight.consumed()
}) {
Err(()) => weight.consumed(),
Ok(w) => w,
}
Self::service_queues_impl(weight_limit, ServiceQueuesContext::ServiceQueues)
}

/// Execute a single overweight message.
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/message-queue/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ fn service_queues_low_weight_defensive() {
assert!(MessageQueue::do_integrity_test().is_err());

MessageQueue::enqueue_message(msg("weight=0"), Here);
MessageQueue::service_queues(104.into_weight());
MessageQueue::service_queues_impl(104.into_weight(), ServiceQueuesContext::OnInitialize);
});
}

Expand Down