Add block number to activated leaves and associated fixes (#2718)

* add number to `ActivatedLeavesUpdate`

* update subsystem util and overseer

* use new ActivatedLeaf everywhere

* sort view

* sorted and limited view in network bridge

* use live block hash only if it's newer

* grumples
This commit is contained in:
Robert Habermeier
2021-03-26 13:06:40 +01:00
committed by GitHub
parent a4ed8aaab2
commit 064df81ee4
20 changed files with 286 additions and 97 deletions
+2 -2
View File
@@ -551,9 +551,9 @@ where
FromOverseer::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate { activated, .. })
) => {
for (activated, _span) in activated.into_iter() {
for activated in activated.into_iter() {
let _timer = subsystem.metrics.time_block_activated();
process_block_activated(ctx, subsystem, activated).await?;
process_block_activated(ctx, subsystem, activated.hash).await?;
}
}
FromOverseer::Signal(OverseerSignal::BlockFinalized(hash, number)) => {
+11 -3
View File
@@ -31,7 +31,7 @@ use polkadot_primitives::v1::{
};
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_subsystem::{
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages,
ActiveLeavesUpdate, errors::RuntimeApiError, jaeger, messages::AllMessages, ActivatedLeaf,
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use sp_keyring::Sr25519Keyring;
@@ -240,7 +240,11 @@ fn runtime_api_error_does_not_stop_the_subsystem() {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: vec![(new_leaf, Arc::new(jaeger::Span::Disabled))].into(),
activated: vec![ActivatedLeaf {
hash: new_leaf,
number: 1,
span: Arc::new(jaeger::Span::Disabled),
}].into(),
deactivated: vec![].into(),
}),
).await;
@@ -885,7 +889,11 @@ async fn import_leaf(
overseer_signal(
virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: vec![(new_leaf, Arc::new(jaeger::Span::Disabled))].into(),
activated: vec![ActivatedLeaf {
hash: new_leaf,
number: 1,
span: Arc::new(jaeger::Span::Disabled),
}].into(),
deactivated: vec![].into(),
}),
).await;