mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 20:21:03 +00:00
[FRAME] Make MQ pallet re-entrancy safe (#2356)
Closes https://github.com/paritytech/polkadot-sdk/issues/2319 Changes: - Ensure that only `enqueue_message(s)` is callable from within the message processor. This prevents messed up storage that can currently happen when the pallet is called into recursively. - Use `H256` instead of `[u8; 32]` for clearer API. ## Details The re-entracy check is done with the `environmental` crate by adding a `with_service_mutex(f)` function that runs the closure exclusively. This works since the MQ pallet is not instantiable. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
committed by
GitHub
parent
95c3ee10bc
commit
7e7fe99047
@@ -523,21 +523,21 @@ fn overweight_queue_works() {
|
||||
assert_last_events(
|
||||
[
|
||||
pallet_message_queue::Event::<Test>::Processed {
|
||||
id: hash_1,
|
||||
id: hash_1.into(),
|
||||
origin: Ump(UmpQueueId::Para(para_a)),
|
||||
weight_used: Weight::from_parts(301, 301),
|
||||
success: true,
|
||||
}
|
||||
.into(),
|
||||
pallet_message_queue::Event::<Test>::OverweightEnqueued {
|
||||
id: hash_2,
|
||||
id: hash_2.into(),
|
||||
origin: Ump(UmpQueueId::Para(para_a)),
|
||||
page_index: 0,
|
||||
message_index: 1,
|
||||
}
|
||||
.into(),
|
||||
pallet_message_queue::Event::<Test>::OverweightEnqueued {
|
||||
id: hash_3,
|
||||
id: hash_3.into(),
|
||||
origin: Ump(UmpQueueId::Para(para_a)),
|
||||
page_index: 0,
|
||||
message_index: 2,
|
||||
@@ -565,7 +565,7 @@ fn overweight_queue_works() {
|
||||
));
|
||||
assert_last_event(
|
||||
pallet_message_queue::Event::<Test>::Processed {
|
||||
id: hash_3,
|
||||
id: hash_3.into(),
|
||||
origin: Ump(UmpQueueId::Para(para_a)),
|
||||
weight_used: Weight::from_parts(501, 501),
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user