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
@@ -153,10 +153,11 @@ async fn handle_signal(
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, deactivated }) => {
let _timer = state.metrics.time_handle_signal();
for (relay_parent, span) in activated {
let _span = span.child("pov-dist")
for activated in activated {
let _span = activated.span.child("pov-dist")
.with_stage(jaeger::Stage::PoVDistribution);
let relay_parent = activated.hash;
match request_validators_ctx(relay_parent, ctx).await {
Ok(vals_rx) => {
let n_validators = match vals_rx.await? {
@@ -25,7 +25,7 @@ use tracing::trace;
use sp_keyring::Sr25519Keyring;
use polkadot_primitives::v1::{AuthorityDiscoveryId, BlockData, CoreState, GroupRotationInfo, Id as ParaId, ScheduledCore, SessionIndex, SessionInfo, ValidatorIndex};
use polkadot_subsystem::{messages::{RuntimeApiMessage, RuntimeApiRequest}, jaeger};
use polkadot_subsystem::{messages::{RuntimeApiMessage, RuntimeApiRequest}, jaeger, ActivatedLeaf};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_node_network_protocol::{view, our_view};
@@ -275,7 +275,11 @@ fn ask_validators_for_povs() {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: [(test_state.relay_parent, Arc::new(jaeger::Span::Disabled))][..].into(),
activated: vec![ActivatedLeaf {
hash: test_state.relay_parent,
number: 1,
span: Arc::new(jaeger::Span::Disabled),
}].into(),
deactivated: [][..].into(),
}),
).await;
@@ -447,7 +451,11 @@ fn ask_validators_for_povs() {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: [(next_leaf, Arc::new(jaeger::Span::Disabled))][..].into(),
activated: vec![ActivatedLeaf {
hash: next_leaf,
number: 2,
span: Arc::new(jaeger::Span::Disabled),
}].into(),
deactivated: [current.clone()][..].into(),
})
).await;