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
@@ -1016,8 +1016,9 @@ impl StatementDistribution {
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, .. })) => {
let _timer = metrics.time_active_leaves_update();
for (relay_parent, span) in activated {
let span = PerLeafSpan::new(span, "statement-distribution");
for activated in activated {
let relay_parent = activated.hash;
let span = PerLeafSpan::new(activated.span, "statement-distribution");
let (validators, session_index) = {
let (val_tx, val_rx) = oneshot::channel();
@@ -1187,7 +1188,7 @@ mod tests {
use sp_keystore::{CryptoStore, SyncCryptoStorePtr, SyncCryptoStore};
use sc_keystore::LocalKeystore;
use polkadot_node_network_protocol::{view, ObservedRole, our_view};
use polkadot_subsystem::jaeger;
use polkadot_subsystem::{jaeger, ActivatedLeaf};
#[test]
fn active_head_accepts_only_2_seconded_per_validator() {
@@ -1743,7 +1744,11 @@ mod tests {
let test_fut = async move {
// register our active heads.
handle.send(FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: vec![(hash_a, Arc::new(jaeger::Span::Disabled))].into(),
activated: vec![ActivatedLeaf {
hash: hash_a,
number: 1,
span: Arc::new(jaeger::Span::Disabled),
}].into(),
deactivated: vec![].into(),
}))).await;