malus: use spawn_blocking (#2804)

Looks like using `spawn` instead of `spawn_blocking` in malus is leading
to a deadlock somehow. I'm not sure why exactly, but switching to
`spawn_blocking` fixes
https://github.com/paritytech/disabling-e2e-tests/issues/1, at least for
`suggest-garbage-candidate` (didn't check other variants).

Maybe my assumption here was wrong:
https://github.com/paritytech/polkadot-sdk/pull/2184#discussion_r1403587674.

---------

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
This commit is contained in:
ordian
2024-01-02 11:13:16 +01:00
committed by GitHub
parent 1dd1a16066
commit 909c1e4945
4 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -188,7 +188,7 @@ where
let _candidate_descriptor = candidate_descriptor.clone();
let mut subsystem_sender = subsystem_sender.clone();
let (sender, receiver) = std::sync::mpsc::channel();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-get-validation-data",
Some("malus"),
Box::pin(async move {
@@ -95,7 +95,7 @@ where
let dispute_offset = self.dispute_offset;
let mut sender = subsystem_sender.clone();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-dispute-finalized-block",
Some("malus"),
Box::pin(async move {
@@ -113,7 +113,7 @@ where
let (sender, receiver) = std::sync::mpsc::channel();
let mut new_sender = subsystem_sender.clone();
let _candidate = candidate.clone();
self.spawner.spawn(
self.spawner.spawn_blocking(
"malus-get-validation-data",
Some("malus"),
Box::pin(async move {
+9
View File
@@ -0,0 +1,9 @@
title: Fix malus implementation.
doc:
- audience: Node Dev
description: |
The malus implementation is used to test security of Polkadot.
It was broken. This fixes it.
crates: [ ]