mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
cargo +nightly fmt (#3540)
* cargo +nightly fmt * add cargo-fmt check to ci * update ci * fmt * fmt * skip macro * ignore bridges
This commit is contained in:
@@ -18,35 +18,23 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use futures::{
|
||||
channel::mpsc,
|
||||
future::FutureExt,
|
||||
join,
|
||||
select,
|
||||
sink::SinkExt,
|
||||
stream::StreamExt,
|
||||
};
|
||||
use polkadot_node_primitives::{
|
||||
CollationGenerationConfig, AvailableData, PoV,
|
||||
};
|
||||
use futures::{channel::mpsc, future::FutureExt, join, select, sink::SinkExt, stream::StreamExt};
|
||||
use parity_scale_codec::Encode;
|
||||
use polkadot_node_primitives::{AvailableData, CollationGenerationConfig, PoV};
|
||||
use polkadot_node_subsystem::{
|
||||
ActiveLeavesUpdate,
|
||||
messages::{AllMessages, CollationGenerationMessage, CollatorProtocolMessage},
|
||||
SpawnedSubsystem, SubsystemContext, SubsystemResult,
|
||||
SubsystemError, FromOverseer, OverseerSignal,
|
||||
overseer,
|
||||
overseer, ActiveLeavesUpdate, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext,
|
||||
SubsystemError, SubsystemResult,
|
||||
};
|
||||
use polkadot_node_subsystem_util::{
|
||||
request_availability_cores, request_persisted_validation_data,
|
||||
request_validators, request_validation_code,
|
||||
metrics::{self, prometheus},
|
||||
request_availability_cores, request_persisted_validation_data, request_validation_code,
|
||||
request_validators,
|
||||
};
|
||||
use polkadot_primitives::v1::{
|
||||
collator_signature_payload, CandidateCommitments,
|
||||
CandidateDescriptor, CandidateReceipt, CoreState, Hash, OccupiedCoreAssumption,
|
||||
PersistedValidationData,
|
||||
collator_signature_payload, CandidateCommitments, CandidateDescriptor, CandidateReceipt,
|
||||
CoreState, Hash, OccupiedCoreAssumption, PersistedValidationData,
|
||||
};
|
||||
use parity_scale_codec::Encode;
|
||||
use sp_core::crypto::Pair;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -66,10 +54,7 @@ pub struct CollationGenerationSubsystem {
|
||||
impl CollationGenerationSubsystem {
|
||||
/// Create a new instance of the `CollationGenerationSubsystem`.
|
||||
pub fn new(metrics: Metrics) -> Self {
|
||||
Self {
|
||||
config: None,
|
||||
metrics,
|
||||
}
|
||||
Self { config: None, metrics }
|
||||
}
|
||||
|
||||
/// Run this subsystem
|
||||
@@ -127,7 +112,10 @@ impl CollationGenerationSubsystem {
|
||||
Context: overseer::SubsystemContext<Message = CollationGenerationMessage>,
|
||||
{
|
||||
match incoming {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, .. }))) => {
|
||||
Ok(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
|
||||
activated,
|
||||
..
|
||||
}))) => {
|
||||
// follow the procedure from the guide
|
||||
if let Some(config) = &self.config {
|
||||
let metrics = self.metrics.clone();
|
||||
@@ -137,13 +125,15 @@ impl CollationGenerationSubsystem {
|
||||
ctx,
|
||||
metrics,
|
||||
sender,
|
||||
).await {
|
||||
)
|
||||
.await
|
||||
{
|
||||
tracing::warn!(target: LOG_TARGET, err = ?err, "failed to handle new activations");
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
},
|
||||
Ok(FromOverseer::Signal(OverseerSignal::Conclude)) => true,
|
||||
Ok(FromOverseer::Communication {
|
||||
msg: CollationGenerationMessage::Initialize(config),
|
||||
@@ -154,7 +144,7 @@ impl CollationGenerationSubsystem {
|
||||
self.config = Some(Arc::new(config));
|
||||
}
|
||||
false
|
||||
}
|
||||
},
|
||||
Ok(FromOverseer::Signal(OverseerSignal::BlockFinalized(..))) => false,
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
@@ -164,7 +154,7 @@ impl CollationGenerationSubsystem {
|
||||
err
|
||||
);
|
||||
true
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,12 +168,10 @@ where
|
||||
let future = async move {
|
||||
self.run(ctx).await;
|
||||
Ok(())
|
||||
}.boxed();
|
||||
|
||||
SpawnedSubsystem {
|
||||
name: "collation-generation-subsystem",
|
||||
future,
|
||||
}
|
||||
.boxed();
|
||||
|
||||
SpawnedSubsystem { name: "collation-generation-subsystem", future }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,9 +202,8 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
let _availability_core_timer = metrics.time_new_activations_availability_core();
|
||||
|
||||
let (scheduled_core, assumption) = match core {
|
||||
CoreState::Scheduled(scheduled_core) => {
|
||||
(scheduled_core, OccupiedCoreAssumption::Free)
|
||||
}
|
||||
CoreState::Scheduled(scheduled_core) =>
|
||||
(scheduled_core, OccupiedCoreAssumption::Free),
|
||||
CoreState::Occupied(_occupied_core) => {
|
||||
// TODO: https://github.com/paritytech/polkadot/issues/1573
|
||||
tracing::trace!(
|
||||
@@ -225,8 +212,8 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
relay_parent = ?relay_parent,
|
||||
"core is occupied. Keep going.",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
continue
|
||||
},
|
||||
CoreState::Free => {
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
@@ -234,7 +221,7 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
"core is free. Keep going.",
|
||||
);
|
||||
continue
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if scheduled_core.para_id != config.para_id {
|
||||
@@ -246,7 +233,7 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
their_para = %scheduled_core.para_id,
|
||||
"core is not assigned to our para. Keep going.",
|
||||
);
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
|
||||
// we get validation data and validation code synchronously for each core instead of
|
||||
@@ -273,7 +260,7 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
"validation data is not available",
|
||||
);
|
||||
continue
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let validation_code = match request_validation_code(
|
||||
@@ -296,125 +283,131 @@ async fn handle_new_activations<Context: SubsystemContext>(
|
||||
"validation code is not available",
|
||||
);
|
||||
continue
|
||||
}
|
||||
},
|
||||
};
|
||||
let validation_code_hash = validation_code.hash();
|
||||
|
||||
let task_config = config.clone();
|
||||
let mut task_sender = sender.clone();
|
||||
let metrics = metrics.clone();
|
||||
ctx.spawn("collation generation collation builder", Box::pin(async move {
|
||||
let persisted_validation_data_hash = validation_data.hash();
|
||||
ctx.spawn(
|
||||
"collation generation collation builder",
|
||||
Box::pin(async move {
|
||||
let persisted_validation_data_hash = validation_data.hash();
|
||||
|
||||
let (collation, result_sender) = match (task_config.collator)(relay_parent, &validation_data).await {
|
||||
Some(collation) => collation.into_inner(),
|
||||
None => {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
"collator returned no collation on collate",
|
||||
let (collation, result_sender) =
|
||||
match (task_config.collator)(relay_parent, &validation_data).await {
|
||||
Some(collation) => collation.into_inner(),
|
||||
None => {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
"collator returned no collation on collate",
|
||||
);
|
||||
return
|
||||
},
|
||||
};
|
||||
|
||||
// Apply compression to the block data.
|
||||
let pov = {
|
||||
let pov = polkadot_node_primitives::maybe_compress_pov(
|
||||
collation.proof_of_validity,
|
||||
);
|
||||
return
|
||||
}
|
||||
};
|
||||
let encoded_size = pov.encoded_size();
|
||||
|
||||
// Apply compression to the block data.
|
||||
let pov = {
|
||||
let pov = polkadot_node_primitives::maybe_compress_pov(collation.proof_of_validity);
|
||||
let encoded_size = pov.encoded_size();
|
||||
// As long as `POV_BOMB_LIMIT` is at least `max_pov_size`, this ensures
|
||||
// that honest collators never produce a PoV which is uncompressed.
|
||||
//
|
||||
// As such, honest collators never produce an uncompressed PoV which starts with
|
||||
// a compression magic number, which would lead validators to reject the collation.
|
||||
if encoded_size > validation_data.max_pov_size as usize {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
size = encoded_size,
|
||||
max_size = validation_data.max_pov_size,
|
||||
"PoV exceeded maximum size"
|
||||
);
|
||||
|
||||
// As long as `POV_BOMB_LIMIT` is at least `max_pov_size`, this ensures
|
||||
// that honest collators never produce a PoV which is uncompressed.
|
||||
//
|
||||
// As such, honest collators never produce an uncompressed PoV which starts with
|
||||
// a compression magic number, which would lead validators to reject the collation.
|
||||
if encoded_size > validation_data.max_pov_size as usize {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
size = encoded_size,
|
||||
max_size = validation_data.max_pov_size,
|
||||
"PoV exceeded maximum size"
|
||||
);
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
pov
|
||||
};
|
||||
|
||||
pov
|
||||
};
|
||||
let pov_hash = pov.hash();
|
||||
|
||||
let pov_hash = pov.hash();
|
||||
let signature_payload = collator_signature_payload(
|
||||
&relay_parent,
|
||||
&scheduled_core.para_id,
|
||||
&persisted_validation_data_hash,
|
||||
&pov_hash,
|
||||
&validation_code_hash,
|
||||
);
|
||||
|
||||
let signature_payload = collator_signature_payload(
|
||||
&relay_parent,
|
||||
&scheduled_core.para_id,
|
||||
&persisted_validation_data_hash,
|
||||
&pov_hash,
|
||||
&validation_code_hash,
|
||||
);
|
||||
let erasure_root =
|
||||
match erasure_root(n_validators, validation_data, pov.clone()) {
|
||||
Ok(erasure_root) => erasure_root,
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
err = ?err,
|
||||
"failed to calculate erasure root",
|
||||
);
|
||||
return
|
||||
},
|
||||
};
|
||||
|
||||
let erasure_root = match erasure_root(
|
||||
n_validators,
|
||||
validation_data,
|
||||
pov.clone(),
|
||||
) {
|
||||
Ok(erasure_root) => erasure_root,
|
||||
Err(err) => {
|
||||
tracing::error!(
|
||||
let commitments = CandidateCommitments {
|
||||
upward_messages: collation.upward_messages,
|
||||
horizontal_messages: collation.horizontal_messages,
|
||||
new_validation_code: collation.new_validation_code,
|
||||
head_data: collation.head_data,
|
||||
processed_downward_messages: collation.processed_downward_messages,
|
||||
hrmp_watermark: collation.hrmp_watermark,
|
||||
};
|
||||
|
||||
let ccr = CandidateReceipt {
|
||||
commitments_hash: commitments.hash(),
|
||||
descriptor: CandidateDescriptor {
|
||||
signature: task_config.key.sign(&signature_payload),
|
||||
para_id: scheduled_core.para_id,
|
||||
relay_parent,
|
||||
collator: task_config.key.public(),
|
||||
persisted_validation_data_hash,
|
||||
pov_hash,
|
||||
erasure_root,
|
||||
para_head: commitments.head_data.hash(),
|
||||
validation_code_hash,
|
||||
},
|
||||
};
|
||||
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
candidate_hash = ?ccr.hash(),
|
||||
?pov_hash,
|
||||
?relay_parent,
|
||||
para_id = %scheduled_core.para_id,
|
||||
"candidate is generated",
|
||||
);
|
||||
metrics.on_collation_generated();
|
||||
|
||||
if let Err(err) = task_sender
|
||||
.send(AllMessages::CollatorProtocol(
|
||||
CollatorProtocolMessage::DistributeCollation(ccr, pov, result_sender),
|
||||
))
|
||||
.await
|
||||
{
|
||||
tracing::warn!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
err = ?err,
|
||||
"failed to calculate erasure root",
|
||||
"failed to send collation result",
|
||||
);
|
||||
return
|
||||
}
|
||||
};
|
||||
|
||||
let commitments = CandidateCommitments {
|
||||
upward_messages: collation.upward_messages,
|
||||
horizontal_messages: collation.horizontal_messages,
|
||||
new_validation_code: collation.new_validation_code,
|
||||
head_data: collation.head_data,
|
||||
processed_downward_messages: collation.processed_downward_messages,
|
||||
hrmp_watermark: collation.hrmp_watermark,
|
||||
};
|
||||
|
||||
let ccr = CandidateReceipt {
|
||||
commitments_hash: commitments.hash(),
|
||||
descriptor: CandidateDescriptor {
|
||||
signature: task_config.key.sign(&signature_payload),
|
||||
para_id: scheduled_core.para_id,
|
||||
relay_parent,
|
||||
collator: task_config.key.public(),
|
||||
persisted_validation_data_hash,
|
||||
pov_hash,
|
||||
erasure_root,
|
||||
para_head: commitments.head_data.hash(),
|
||||
validation_code_hash: validation_code_hash,
|
||||
},
|
||||
};
|
||||
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
candidate_hash = ?ccr.hash(),
|
||||
?pov_hash,
|
||||
?relay_parent,
|
||||
para_id = %scheduled_core.para_id,
|
||||
"candidate is generated",
|
||||
);
|
||||
metrics.on_collation_generated();
|
||||
|
||||
if let Err(err) = task_sender.send(AllMessages::CollatorProtocol(
|
||||
CollatorProtocolMessage::DistributeCollation(ccr, pov, result_sender)
|
||||
)).await {
|
||||
tracing::warn!(
|
||||
target: LOG_TARGET,
|
||||
para_id = %scheduled_core.para_id,
|
||||
err = ?err,
|
||||
"failed to send collation result",
|
||||
);
|
||||
}
|
||||
}))?;
|
||||
}),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,10 +419,8 @@ fn erasure_root(
|
||||
persisted_validation: PersistedValidationData,
|
||||
pov: PoV,
|
||||
) -> crate::error::Result<Hash> {
|
||||
let available_data = AvailableData {
|
||||
validation_data: persisted_validation,
|
||||
pov: Arc::new(pov),
|
||||
};
|
||||
let available_data =
|
||||
AvailableData { validation_data: persisted_validation, pov: Arc::new(pov) };
|
||||
|
||||
let chunks = polkadot_erasure_coding::obtain_chunks_v1(n_validators, &available_data)?;
|
||||
Ok(polkadot_erasure_coding::branches(&chunks).root())
|
||||
@@ -460,13 +451,21 @@ impl Metrics {
|
||||
}
|
||||
|
||||
/// Provide a timer per relay parents which updates on drop.
|
||||
fn time_new_activations_relay_parent(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.new_activations_per_relay_parent.start_timer())
|
||||
fn time_new_activations_relay_parent(
|
||||
&self,
|
||||
) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0
|
||||
.as_ref()
|
||||
.map(|metrics| metrics.new_activations_per_relay_parent.start_timer())
|
||||
}
|
||||
|
||||
/// Provide a timer per availability core which updates on drop.
|
||||
fn time_new_activations_availability_core(&self) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0.as_ref().map(|metrics| metrics.new_activations_per_availability_core.start_timer())
|
||||
fn time_new_activations_availability_core(
|
||||
&self,
|
||||
) -> Option<metrics::prometheus::prometheus::HistogramTimer> {
|
||||
self.0
|
||||
.as_ref()
|
||||
.map(|metrics| metrics.new_activations_per_availability_core.start_timer())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,8 @@ mod handle_new_activations {
|
||||
task::{Context as FuturesContext, Poll},
|
||||
Future,
|
||||
};
|
||||
use polkadot_node_primitives::{Collation, CollationResult, BlockData, PoV, POV_BOMB_LIMIT};
|
||||
use polkadot_node_subsystem::messages::{
|
||||
AllMessages, RuntimeApiMessage, RuntimeApiRequest,
|
||||
};
|
||||
use polkadot_node_primitives::{BlockData, Collation, CollationResult, PoV, POV_BOMB_LIMIT};
|
||||
use polkadot_node_subsystem::messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest};
|
||||
use polkadot_node_subsystem_test_helpers::{
|
||||
subsystem_test_harness, TestSubsystemContextHandle,
|
||||
};
|
||||
@@ -39,9 +37,7 @@ mod handle_new_activations {
|
||||
horizontal_messages: Default::default(),
|
||||
new_validation_code: Default::default(),
|
||||
head_data: Default::default(),
|
||||
proof_of_validity: PoV {
|
||||
block_data: BlockData(Vec::new()),
|
||||
},
|
||||
proof_of_validity: PoV { block_data: BlockData(Vec::new()) },
|
||||
processed_downward_messages: Default::default(),
|
||||
hrmp_watermark: Default::default(),
|
||||
}
|
||||
@@ -50,10 +46,13 @@ mod handle_new_activations {
|
||||
fn test_collation_compressed() -> Collation {
|
||||
let mut collation = test_collation();
|
||||
let compressed = PoV {
|
||||
block_data: BlockData(sp_maybe_compressed_blob::compress(
|
||||
&collation.proof_of_validity.block_data.0,
|
||||
POV_BOMB_LIMIT,
|
||||
).unwrap())
|
||||
block_data: BlockData(
|
||||
sp_maybe_compressed_blob::compress(
|
||||
&collation.proof_of_validity.block_data.0,
|
||||
POV_BOMB_LIMIT,
|
||||
)
|
||||
.unwrap(),
|
||||
),
|
||||
};
|
||||
collation.proof_of_validity = compressed;
|
||||
collation
|
||||
@@ -81,28 +80,19 @@ mod handle_new_activations {
|
||||
fn test_config<Id: Into<ParaId>>(para_id: Id) -> Arc<CollationGenerationConfig> {
|
||||
Arc::new(CollationGenerationConfig {
|
||||
key: CollatorPair::generate().0,
|
||||
collator: Box::new(|_: Hash, _vd: &PersistedValidationData| {
|
||||
TestCollator.boxed()
|
||||
}),
|
||||
collator: Box::new(|_: Hash, _vd: &PersistedValidationData| TestCollator.boxed()),
|
||||
para_id: para_id.into(),
|
||||
})
|
||||
}
|
||||
|
||||
fn scheduled_core_for<Id: Into<ParaId>>(para_id: Id) -> ScheduledCore {
|
||||
ScheduledCore {
|
||||
para_id: para_id.into(),
|
||||
collator: None,
|
||||
}
|
||||
ScheduledCore { para_id: para_id.into(), collator: None }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn requests_availability_per_relay_parent() {
|
||||
let activated_hashes: Vec<Hash> = vec![
|
||||
[1; 32].into(),
|
||||
[4; 32].into(),
|
||||
[9; 32].into(),
|
||||
[16; 32].into(),
|
||||
];
|
||||
let activated_hashes: Vec<Hash> =
|
||||
vec![[1; 32].into(), [4; 32].into(), [9; 32].into(), [16; 32].into()];
|
||||
|
||||
let requested_availability_cores = Arc::new(Mutex::new(Vec::new()));
|
||||
|
||||
@@ -177,7 +167,7 @@ mod handle_new_activations {
|
||||
)),
|
||||
]))
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
|
||||
hash,
|
||||
RuntimeApiRequest::PersistedValidationData(
|
||||
@@ -186,21 +176,18 @@ mod handle_new_activations {
|
||||
tx,
|
||||
),
|
||||
))) => {
|
||||
overseer_requested_validation_data
|
||||
.lock()
|
||||
.await
|
||||
.push(hash);
|
||||
overseer_requested_validation_data.lock().await.push(hash);
|
||||
tx.send(Ok(Default::default())).unwrap();
|
||||
}
|
||||
},
|
||||
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
|
||||
_hash,
|
||||
RuntimeApiRequest::Validators(tx),
|
||||
))) => {
|
||||
tx.send(Ok(vec![Default::default(); 3])).unwrap();
|
||||
}
|
||||
},
|
||||
Some(msg) => {
|
||||
panic!("didn't expect any other overseer requests; got {:?}", msg)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -252,7 +239,7 @@ mod handle_new_activations {
|
||||
)),
|
||||
]))
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
|
||||
_hash,
|
||||
RuntimeApiRequest::PersistedValidationData(
|
||||
@@ -262,13 +249,13 @@ mod handle_new_activations {
|
||||
),
|
||||
))) => {
|
||||
tx.send(Ok(Some(test_validation_data()))).unwrap();
|
||||
}
|
||||
},
|
||||
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
|
||||
_hash,
|
||||
RuntimeApiRequest::Validators(tx),
|
||||
))) => {
|
||||
tx.send(Ok(vec![Default::default(); 3])).unwrap();
|
||||
}
|
||||
},
|
||||
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
|
||||
_hash,
|
||||
RuntimeApiRequest::ValidationCode(
|
||||
@@ -278,10 +265,10 @@ mod handle_new_activations {
|
||||
),
|
||||
))) => {
|
||||
tx.send(Ok(Some(ValidationCode(vec![1, 2, 3])))).unwrap();
|
||||
}
|
||||
},
|
||||
Some(msg) => {
|
||||
panic!("didn't expect any other overseer requests; got {:?}", msg)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -295,9 +282,15 @@ mod handle_new_activations {
|
||||
let sent_messages = Arc::new(Mutex::new(Vec::new()));
|
||||
let subsystem_sent_messages = sent_messages.clone();
|
||||
subsystem_test_harness(overseer, |mut ctx| async move {
|
||||
handle_new_activations(subsystem_config, activated_hashes, &mut ctx, Metrics(None), &tx)
|
||||
.await
|
||||
.unwrap();
|
||||
handle_new_activations(
|
||||
subsystem_config,
|
||||
activated_hashes,
|
||||
&mut ctx,
|
||||
Metrics(None),
|
||||
&tx,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
std::mem::drop(tx);
|
||||
|
||||
@@ -340,7 +333,7 @@ mod handle_new_activations {
|
||||
AllMessages::CollatorProtocol(CollatorProtocolMessage::DistributeCollation(
|
||||
CandidateReceipt { descriptor, .. },
|
||||
_pov,
|
||||
..
|
||||
..,
|
||||
)) => {
|
||||
// signature generation is non-deterministic, so we can't just assert that the
|
||||
// expected descriptor is correct. What we can do is validate that the produced
|
||||
@@ -365,7 +358,7 @@ mod handle_new_activations {
|
||||
expect_descriptor
|
||||
};
|
||||
assert_eq!(descriptor, &expect_descriptor);
|
||||
}
|
||||
},
|
||||
_ => panic!("received wrong message type"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user