lib.rs 19.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Polkadot.  If not, see <http://www.gnu.org/licenses/>.

//! The provisioner is responsible for assembling a relay chain block
//! from a set of available parachain candidates of its choice.

20
#![deny(missing_docs, unused_crate_dependencies, unused_results)]
21
22
23
24
25

use futures::{
	channel::{mpsc, oneshot},
	prelude::*,
};
26
use sp_keystore::SyncCryptoStorePtr;
27
use polkadot_node_subsystem::{
28
	jaeger, PerLeafSpan,
29
30
31
	errors::ChainApiError,
	messages::{
		AllMessages, CandidateBackingMessage, CandidateSelectionMessage, CollatorProtocolMessage,
32
		RuntimeApiRequest,
33
	},
34
35
};
use polkadot_node_subsystem_util::{
36
37
38
39
40
	self as util, request_from_runtime, request_validator_groups, delegated_subsystem,
	JobTrait, FromJobCommand, Validator, metrics::{self, prometheus},
};
use polkadot_primitives::v1::{
	CandidateReceipt, CollatorId, CoreState, CoreIndex, Hash, Id as ParaId, PoV,
41
};
42
use polkadot_node_primitives::SignedFullStatement;
43
use std::{pin::Pin, sync::Arc};
44
use thiserror::Error;
45

46
const LOG_TARGET: &'static str = "parachain::candidate-selection";
47
48

struct CandidateSelectionJob {
49
	assignment: ParaId,
50
51
	sender: mpsc::Sender<FromJobCommand>,
	receiver: mpsc::Receiver<CandidateSelectionMessage>,
52
53
54
55
	metrics: Metrics,
	seconded_candidate: Option<CollatorId>,
}

56
#[derive(Debug, Error)]
57
enum Error {
58
59
60
61
62
63
64
65
	#[error(transparent)]
	Sending(#[from] mpsc::SendError),
	#[error(transparent)]
	Util(#[from] util::Error),
	#[error(transparent)]
	OneshotRecv(#[from] oneshot::Canceled),
	#[error(transparent)]
	ChainApi(#[from] ChainApiError),
66
67
}

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
macro_rules! try_runtime_api {
	($x: expr) => {
		match $x {
			Ok(x) => x,
			Err(e) => {
				tracing::warn!(
					target: LOG_TARGET,
					err = ?e,
					"Failed to fetch runtime API data for job",
				);

				// We can't do candidate selection work if we don't have the
				// requisite runtime API data. But these errors should not take
				// down the node.
				return Ok(());
			}
		}
	}
}

88
impl JobTrait for CandidateSelectionJob {
89
	type ToJob = CandidateSelectionMessage;
90
	type Error = Error;
91
	type RunArgs = SyncCryptoStorePtr;
92
93
94
95
	type Metrics = Metrics;

	const NAME: &'static str = "CandidateSelectionJob";

96
	#[tracing::instrument(skip(keystore, metrics, receiver, sender), fields(subsystem = LOG_TARGET))]
97
	fn run(
98
		relay_parent: Hash,
99
		span: Arc<jaeger::Span>,
100
		keystore: Self::RunArgs,
101
		metrics: Self::Metrics,
102
		receiver: mpsc::Receiver<CandidateSelectionMessage>,
103
		mut sender: mpsc::Sender<FromJobCommand>,
104
	) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>> {
105
		let span = PerLeafSpan::new(span, "candidate-selection");
106
		async move {
107
108
109
110
			let _span = span.child_builder("query-runtime")
				.with_relay_parent(&relay_parent)
				.with_stage(jaeger::Stage::CandidateSelection)
				.build();
111
112
113
114
115
116
117
118
119
120
121
122
			let (groups, cores) = futures::try_join!(
				try_runtime_api!(request_validator_groups(relay_parent, &mut sender).await),
				try_runtime_api!(request_from_runtime(
					relay_parent,
					&mut sender,
					|tx| RuntimeApiRequest::AvailabilityCores(tx),
				).await),
			)?;

			let (validator_groups, group_rotation_info) = try_runtime_api!(groups);
			let cores = try_runtime_api!(cores);

123
			drop(_span);
124
125
126
127
			let _span = span.child_builder("find-assignment")
				.with_relay_parent(&relay_parent)
				.with_stage(jaeger::Stage::CandidateSelection)
				.build();
128

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
			let n_cores = cores.len();

			let validator = match Validator::new(relay_parent, keystore.clone(), sender.clone()).await {
				Ok(validator) => validator,
				Err(util::Error::NotAValidator) => return Ok(()),
				Err(err) => return Err(Error::Util(err)),
			};

			let mut assignment = None;

			for (idx, core) in cores.into_iter().enumerate() {
				// Ignore prospective assignments on occupied cores for the time being.
				if let CoreState::Scheduled(scheduled) = core {
					let core_index = CoreIndex(idx as _);
					let group_index = group_rotation_info.group_for_core(core_index, n_cores);
					if let Some(g) = validator_groups.get(group_index.0 as usize) {
						if g.contains(&validator.index()) {
							assignment = Some(scheduled.para_id);
							break;
						}
					}
				}
			}

			let assignment = match assignment {
				Some(assignment) => assignment,
				None => return Ok(()),
			};

158
159
160
			drop(_span);

			CandidateSelectionJob::new(assignment, metrics, sender, receiver).run_loop(&span).await
161
		}.boxed()
162
163
164
165
166
	}
}

impl CandidateSelectionJob {
	pub fn new(
167
		assignment: ParaId,
168
		metrics: Metrics,
169
170
		sender: mpsc::Sender<FromJobCommand>,
		receiver: mpsc::Receiver<CandidateSelectionMessage>,
171
172
173
174
175
	) -> Self {
		Self {
			sender,
			receiver,
			metrics,
176
			assignment,
177
178
179
180
			seconded_candidate: None,
		}
	}

181
182
183
184
185
	async fn run_loop(&mut self, span: &jaeger::Span) -> Result<(), Error> {
		let span = span.child_builder("run-loop")
			.with_stage(jaeger::Stage::CandidateSelection)
			.build();

186
187
188
		loop {
			match self.receiver.next().await  {
				Some(CandidateSelectionMessage::Collation(
189
190
191
192
					relay_parent,
					para_id,
					collator_id,
				)) => {
asynchronous rob's avatar
asynchronous rob committed
193
					let _span = span.child("handle-collation");
194
					self.handle_collation(relay_parent, para_id, collator_id).await;
195
				}
196
				Some(CandidateSelectionMessage::Invalid(
197
					_relay_parent,
198
199
					candidate_receipt,
				)) => {
200
201
202
203
204
					let _span = span.child_builder("handle-invalid")
						.with_stage(jaeger::Stage::CandidateSelection)
						.with_candidate(&candidate_receipt.hash())
						.with_relay_parent(&_relay_parent)
						.build();
205
206
					self.handle_invalid(candidate_receipt).await;
				}
207
208
209
210
211
212
				Some(CandidateSelectionMessage::Seconded(_relay_parent, statement)) => {
					let _span = span.child_builder("handle-seconded")
						.with_stage(jaeger::Stage::CandidateSelection)
						.with_candidate(&statement.payload().candidate_hash())
						.with_relay_parent(&_relay_parent)
						.build();
213
214
					self.handle_seconded(statement).await;
				}
215
				None => break,
216
217
218
219
220
221
222
223
224
			}
		}

		// closing the sender here means that we don't deadlock in tests
		self.sender.close_channel();

		Ok(())
	}

225
	#[tracing::instrument(level = "trace", skip(self), fields(subsystem = LOG_TARGET))]
226
227
228
229
230
231
	async fn handle_collation(
		&mut self,
		relay_parent: Hash,
		para_id: ParaId,
		collator_id: CollatorId,
	) {
232
233
		let _timer = self.metrics.time_handle_collation();

234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
		if self.assignment != para_id {
			tracing::info!(
				target: LOG_TARGET,
				"Collator {:?} sent a collation outside of our assignment {:?}",
				collator_id,
				para_id,
			);
			if let Err(err) = forward_invalidity_note(&collator_id, &mut self.sender).await {
				tracing::warn!(
					target: LOG_TARGET,
					err = ?err,
					"failed to forward invalidity note",
				);
			}
			return;
		}

251
252
		if self.seconded_candidate.is_none() {
			let (candidate_receipt, pov) =
253
254
255
256
257
258
				match get_collation(
					relay_parent,
					para_id,
					collator_id.clone(),
					self.sender.clone(),
				).await {
259
260
					Ok(response) => response,
					Err(err) => {
261
262
263
264
						tracing::warn!(
							target: LOG_TARGET,
							err = ?err,
							"failed to get collation from collator protocol subsystem",
265
266
267
268
269
270
271
272
273
274
275
						);
						return;
					}
				};

			match second_candidate(
				relay_parent,
				candidate_receipt,
				pov,
				&mut self.sender,
				&self.metrics,
276
			).await {
277
				Err(err) => tracing::warn!(target: LOG_TARGET, err = ?err, "failed to second a candidate"),
278
279
280
281
282
				Ok(()) => self.seconded_candidate = Some(collator_id),
			}
		}
	}

283
	#[tracing::instrument(level = "trace", skip(self), fields(subsystem = LOG_TARGET))]
284
	async fn handle_invalid(&mut self, candidate_receipt: CandidateReceipt) {
285
286
		let _timer = self.metrics.time_handle_invalid();

287
288
289
		let received_from = match &self.seconded_candidate {
			Some(peer) => peer,
			None => {
290
291
				tracing::warn!(
					target: LOG_TARGET,
292
293
294
295
296
					"received invalidity notice for a candidate we don't remember seconding"
				);
				return;
			}
		};
297
298
299
300
		tracing::info!(
			target: LOG_TARGET,
			candidate_receipt = ?candidate_receipt,
			"received invalidity note for candidate",
301
302
		);

303
		let result =
304
			if let Err(err) = forward_invalidity_note(received_from, &mut self.sender).await {
305
306
307
308
				tracing::warn!(
					target: LOG_TARGET,
					err = ?err,
					"failed to forward invalidity note",
309
				);
310
				Err(())
311
			} else {
312
				Ok(())
313
			};
314
		self.metrics.on_invalid_selection(result);
315
	}
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355

	async fn handle_seconded(&mut self, statement: SignedFullStatement) {
		let received_from = match &self.seconded_candidate {
			Some(peer) => peer,
			None => {
				tracing::warn!(
					target: LOG_TARGET,
					"received seconded notice for a candidate we don't remember seconding"
				);
				return;
			}
		};
		tracing::debug!(
			target: LOG_TARGET,
			statement = ?statement,
			"received seconded note for candidate",
		);

		if let Err(e) = self.sender
			.send(AllMessages::from(CollatorProtocolMessage::NoteGoodCollation(received_from.clone())).into()).await
		{
			tracing::debug!(
				target: LOG_TARGET,
				error = ?e,
				"failed to note good collator"
			);
		}

		if let Err(e) = self.sender
			.send(AllMessages::from(
				CollatorProtocolMessage::NotifyCollationSeconded(received_from.clone(), statement)
			).into()).await
		{
			tracing::debug!(
				target: LOG_TARGET,
				error = ?e,
				"failed to notify collator about seconded collation"
			);
		}
	}
356
357
358
359
360
}

// get a collation from the Collator Protocol subsystem
//
// note that this gets an owned clone of the sender; that's becuase unlike `forward_invalidity_note`, it's expected to take a while longer
361
#[tracing::instrument(level = "trace", skip(sender), fields(subsystem = LOG_TARGET))]
362
363
364
async fn get_collation(
	relay_parent: Hash,
	para_id: ParaId,
365
	collator_id: CollatorId,
366
	mut sender: mpsc::Sender<FromJobCommand>,
367
368
369
) -> Result<(CandidateReceipt, PoV), Error> {
	let (tx, rx) = oneshot::channel();
	sender
370
		.send(AllMessages::from(CollatorProtocolMessage::FetchCollation(
371
			relay_parent,
372
			collator_id,
373
374
			para_id,
			tx,
375
		)).into())
376
377
378
379
380
381
382
383
		.await?;
	rx.await.map_err(Into::into)
}

async fn second_candidate(
	relay_parent: Hash,
	candidate_receipt: CandidateReceipt,
	pov: PoV,
384
	sender: &mut mpsc::Sender<FromJobCommand>,
385
386
387
	metrics: &Metrics,
) -> Result<(), Error> {
	match sender
388
		.send(AllMessages::from(CandidateBackingMessage::Second(
389
390
391
			relay_parent,
			candidate_receipt,
			pov,
392
		)).into())
393
394
395
		.await
	{
		Err(err) => {
396
			tracing::warn!(target: LOG_TARGET, err = ?err, "failed to send a seconding message");
397
			metrics.on_second(Err(()));
398
399
400
			Err(err.into())
		}
		Ok(_) => {
401
			metrics.on_second(Ok(()));
402
403
404
405
406
407
408
			Ok(())
		}
	}
}

async fn forward_invalidity_note(
	received_from: &CollatorId,
409
	sender: &mut mpsc::Sender<FromJobCommand>,
410
411
) -> Result<(), Error> {
	sender
412
		.send(AllMessages::from(CollatorProtocolMessage::ReportCollator(
413
			received_from.clone(),
414
		)).into())
415
416
417
418
419
420
421
422
		.await
		.map_err(Into::into)
}

#[derive(Clone)]
struct MetricsInner {
	seconds: prometheus::CounterVec<prometheus::U64>,
	invalid_selections: prometheus::CounterVec<prometheus::U64>,
423
424
	handle_collation: prometheus::Histogram,
	handle_invalid: prometheus::Histogram,
425
426
}

427
/// Candidate selection metrics.
428
429
430
431
#[derive(Default, Clone)]
pub struct Metrics(Option<MetricsInner>);

impl Metrics {
432
	fn on_second(&self, result: Result<(), ()>) {
433
		if let Some(metrics) = &self.0 {
434
			let label = if result.is_ok() { "succeeded" } else { "failed" };
435
436
437
438
			metrics.seconds.with_label_values(&[label]).inc();
		}
	}

439
	fn on_invalid_selection(&self, result: Result<(), ()>) {
440
		if let Some(metrics) = &self.0 {
441
			let label = if result.is_ok() { "succeeded" } else { "failed" };
442
443
444
			metrics.invalid_selections.with_label_values(&[label]).inc();
		}
	}
445
446
447
448
449
450
451
452
453
454

	/// Provide a timer for `handle_collation` which observes on drop.
	fn time_handle_collation(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
		self.0.as_ref().map(|metrics| metrics.handle_collation.start_timer())
	}

	/// Provide a timer for `handle_invalid` which observes on drop.
	fn time_handle_invalid(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
		self.0.as_ref().map(|metrics| metrics.handle_invalid.start_timer())
	}
455
456
457
458
459
460
461
462
}

impl metrics::Metrics for Metrics {
	fn try_register(registry: &prometheus::Registry) -> Result<Self, prometheus::PrometheusError> {
		let metrics = MetricsInner {
			seconds: prometheus::register(
				prometheus::CounterVec::new(
					prometheus::Opts::new(
463
464
						"candidate_selection_seconds_total",
						"Number of Candidate Selection subsystem seconding events.",
465
					),
466
					&["success"],
467
468
469
470
471
472
473
474
475
				)?,
				registry,
			)?,
			invalid_selections: prometheus::register(
				prometheus::CounterVec::new(
					prometheus::Opts::new(
						"candidate_selection_invalid_selections_total",
						"Number of Candidate Selection subsystem seconding selections which proved to be invalid.",
					),
476
					&["success"],
477
478
479
				)?,
				registry,
			)?,
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
			handle_collation: prometheus::register(
				prometheus::Histogram::with_opts(
					prometheus::HistogramOpts::new(
						"parachain_candidate_selection_handle_collation",
						"Time spent within `candidate_selection::handle_collation`",
					)
				)?,
				registry,
			)?,
			handle_invalid: prometheus::register(
				prometheus::Histogram::with_opts(
					prometheus::HistogramOpts::new(
						"parachain_candidate_selection:handle_invalid",
						"Time spent within `candidate_selection::handle_invalid`",
					)
				)?,
				registry,
			)?,
498
499
500
501
502
		};
		Ok(Metrics(Some(metrics)))
	}
}

503
delegated_subsystem!(CandidateSelectionJob(SyncCryptoStorePtr, Metrics) <- CandidateSelectionMessage as CandidateSelectionSubsystem);
504
505
506
507
508

#[cfg(test)]
mod tests {
	use super::*;
	use futures::lock::Mutex;
509
	use polkadot_primitives::v1::BlockData;
510
	use sp_core::crypto::Public;
511
	use std::sync::Arc;
512
513
514
515
516
517
518

	fn test_harness<Preconditions, TestBuilder, Test, Postconditions>(
		preconditions: Preconditions,
		test: TestBuilder,
		postconditions: Postconditions,
	) where
		Preconditions: FnOnce(&mut CandidateSelectionJob),
519
		TestBuilder: FnOnce(mpsc::Sender<CandidateSelectionMessage>, mpsc::Receiver<FromJobCommand>) -> Test,
520
521
522
523
524
525
		Test: Future<Output = ()>,
		Postconditions: FnOnce(CandidateSelectionJob, Result<(), Error>),
	{
		let (to_job_tx, to_job_rx) = mpsc::channel(0);
		let (from_job_tx, from_job_rx) = mpsc::channel(0);
		let mut job = CandidateSelectionJob {
526
			assignment: 123.into(),
527
528
529
530
531
532
533
			sender: from_job_tx,
			receiver: to_job_rx,
			metrics: Default::default(),
			seconded_candidate: None,
		};

		preconditions(&mut job);
534
		let span = jaeger::Span::Disabled;
535
536
		let (_, job_result) = futures::executor::block_on(future::join(
			test(to_job_tx, from_job_rx),
537
			job.run_loop(&span),
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
		));

		postconditions(job, job_result);
	}

	/// when nothing is seconded so far, the collation is fetched and seconded
	#[test]
	fn fetches_and_seconds_a_collation() {
		let relay_parent = Hash::random();
		let para_id: ParaId = 123.into();
		let collator_id = CollatorId::from_slice(&(0..32).collect::<Vec<u8>>());
		let collator_id_clone = collator_id.clone();

		let candidate_receipt = CandidateReceipt::default();
		let pov = PoV {
			block_data: BlockData((0..32).cycle().take(256).collect()),
		};

		let was_seconded = Arc::new(Mutex::new(false));
		let was_seconded_clone = was_seconded.clone();

		test_harness(
			|_job| {},
			|mut to_job, mut from_job| async move {
				to_job
563
564
565
566
					.send(CandidateSelectionMessage::Collation(
						relay_parent,
						para_id,
						collator_id_clone.clone(),
567
568
569
570
571
572
573
					))
					.await
					.unwrap();
				std::mem::drop(to_job);

				while let Some(msg) = from_job.next().await {
					match msg {
574
						FromJobCommand::SendMessage(AllMessages::CollatorProtocol(CollatorProtocolMessage::FetchCollation(
575
							got_relay_parent,
576
							collator_id,
577
578
							got_para_id,
							return_sender,
579
						))) => {
580
581
							assert_eq!(got_relay_parent, relay_parent);
							assert_eq!(got_para_id, para_id);
582
							assert_eq!(collator_id, collator_id_clone);
583
584
585
586
587

							return_sender
								.send((candidate_receipt.clone(), pov.clone()))
								.unwrap();
						}
588
						FromJobCommand::SendMessage(AllMessages::CandidateBacking(CandidateBackingMessage::Second(
589
590
591
							got_relay_parent,
							got_candidate_receipt,
							got_pov,
592
						))) => {
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
							assert_eq!(got_relay_parent, relay_parent);
							assert_eq!(got_candidate_receipt, candidate_receipt);
							assert_eq!(got_pov, pov);

							*was_seconded_clone.lock().await = true;
						}
						other => panic!("unexpected message from job: {:?}", other),
					}
				}
			},
			|job, job_result| {
				assert!(job_result.is_ok());
				assert_eq!(job.seconded_candidate.unwrap(), collator_id);
			},
		);

		assert!(Arc::try_unwrap(was_seconded).unwrap().into_inner());
	}

	/// when something has been seconded, further collation notifications are ignored
	#[test]
	fn ignores_collation_notifications_after_the_first() {
		let relay_parent = Hash::random();
		let para_id: ParaId = 123.into();
		let prev_collator_id = CollatorId::from_slice(&(0..32).rev().collect::<Vec<u8>>());
		let collator_id = CollatorId::from_slice(&(0..32).collect::<Vec<u8>>());
		let collator_id_clone = collator_id.clone();

		let was_seconded = Arc::new(Mutex::new(false));
		let was_seconded_clone = was_seconded.clone();

		test_harness(
			|job| job.seconded_candidate = Some(prev_collator_id.clone()),
			|mut to_job, mut from_job| async move {
				to_job
628
629
630
631
					.send(CandidateSelectionMessage::Collation(
						relay_parent,
						para_id,
						collator_id_clone,
632
633
634
635
636
637
638
					))
					.await
					.unwrap();
				std::mem::drop(to_job);

				while let Some(msg) = from_job.next().await {
					match msg {
639
						FromJobCommand::SendMessage(AllMessages::CandidateBacking(CandidateBackingMessage::Second(
640
641
642
							_got_relay_parent,
							_got_candidate_receipt,
							_got_pov,
643
						))) => {
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
							*was_seconded_clone.lock().await = true;
						}
						other => panic!("unexpected message from job: {:?}", other),
					}
				}
			},
			|job, job_result| {
				assert!(job_result.is_ok());
				assert_eq!(job.seconded_candidate.unwrap(), prev_collator_id);
			},
		);

		assert!(!Arc::try_unwrap(was_seconded).unwrap().into_inner());
	}

	/// reports of invalidity from candidate backing are propagated
	#[test]
	fn propagates_invalidity_reports() {
		let relay_parent = Hash::random();
		let collator_id = CollatorId::from_slice(&(0..32).collect::<Vec<u8>>());
		let collator_id_clone = collator_id.clone();

		let candidate_receipt = CandidateReceipt::default();

		let sent_report = Arc::new(Mutex::new(false));
		let sent_report_clone = sent_report.clone();

		test_harness(
			|job| job.seconded_candidate = Some(collator_id.clone()),
			|mut to_job, mut from_job| async move {
				to_job
675
					.send(CandidateSelectionMessage::Invalid(relay_parent, candidate_receipt))
676
677
678
679
680
681
					.await
					.unwrap();
				std::mem::drop(to_job);

				while let Some(msg) = from_job.next().await {
					match msg {
682
						FromJobCommand::SendMessage(AllMessages::CollatorProtocol(CollatorProtocolMessage::ReportCollator(
683
							got_collator_id,
684
						))) => {
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
							assert_eq!(got_collator_id, collator_id_clone);

							*sent_report_clone.lock().await = true;
						}
						other => panic!("unexpected message from job: {:?}", other),
					}
				}
			},
			|job, job_result| {
				assert!(job_result.is_ok());
				assert_eq!(job.seconded_candidate.unwrap(), collator_id);
			},
		);

		assert!(Arc::try_unwrap(sent_report).unwrap().into_inner());
	}
}