Change best effort queue behaviour in dispute-coordinator (#6275)

* Change best effort queue behaviour in `dispute-coordinator`

Use the same type of queue (`BTreeMap<CandidateComparator,
ParticipationRequest>`) for best effort and priority in
`dispute-coordinator`.

Rework `CandidateComparator` to handle unavailable parent
block numbers.

Best effort queue will order disputes the same way as priority does - by
parent's block height. Disputes on candidates for which the parent's
block number can't be obtained will be treated with the lowest priority.

* Fix tests: Handle `ChainApiMessage::BlockNumber` in `handle_sync_queries`

* Some tests are deadlocking on sending messages via overseer so change `SingleItemSink`to `mpsc::Sender` with a buffer of 1

* Fix a race in test after adding a buffered queue for overseer messages

* Fix the rest of the tests

* Guide update - best-effort queue

* Guide update: clarification about spam votes

* Fix tests in `availability-distribution`

* Update comments

* Add `make_buffered_subsystem_context` in `subsystem-test-helpers`

* Code review feedback

* Code review feedback

* Code review feedback

* Don't add best effort candidate if it is already in priority queue

* Remove an old comment

* Fix insert in best_effort
This commit is contained in:
Tsvetomir Dimitrov
2022-11-17 17:41:19 +02:00
committed by GitHub
parent ad41e56e6e
commit ccad411e46
7 changed files with 329 additions and 196 deletions
@@ -51,7 +51,7 @@ use polkadot_primitives::v2::{
CandidateHash, CoreState, GroupIndex, Hash, Id as ParaId, ScheduledCore, SessionInfo,
ValidatorIndex,
};
use test_helpers::{mock::make_ferdie_keystore, SingleItemSink};
use test_helpers::mock::make_ferdie_keystore;
use super::mock::{make_session_info, OccupiedCoreBuilder};
use crate::LOG_TARGET;
@@ -295,7 +295,7 @@ impl TestState {
}
async fn overseer_signal(
mut tx: SingleItemSink<FromOrchestra<AvailabilityDistributionMessage>>,
mut tx: mpsc::Sender<FromOrchestra<AvailabilityDistributionMessage>>,
msg: impl Into<OverseerSignal>,
) {
let msg = msg.into();