polkadot: pin one block per session (#1220)

* polkadot: propagate UnpinHandle to ActiveLeafUpdate

Also extract the leaf creation for tests
into a common function.

* dispute-coordinator: try pinned blocks for slashin

* apparently 1.72 is smarter than 1.70

* address nits

* rename fresh_leaf to new_leaf
This commit is contained in:
ordian
2023-09-07 12:24:40 +02:00
committed by GitHub
parent 1346143194
commit 15503883e2
33 changed files with 387 additions and 620 deletions
@@ -16,12 +16,13 @@
use std::collections::HashMap;
use std::{future::Future, sync::Arc};
use std::future::Future;
use futures::FutureExt;
use polkadot_node_network_protocol::jaeger;
use polkadot_node_primitives::{BlockData, ErasureChunk, PoV};
use polkadot_node_subsystem_test_helpers::mock::new_leaf;
use polkadot_node_subsystem_util::runtime::RuntimeInfo;
use polkadot_primitives::{
BlockNumber, CoreState, ExecutorParams, GroupIndex, Hash, Id as ParaId, ScheduledCore,
@@ -34,7 +35,7 @@ use polkadot_node_subsystem::{
AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage,
NetworkBridgeTxMessage, RuntimeApiMessage, RuntimeApiRequest,
},
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SpawnGlue,
ActiveLeavesUpdate, SpawnGlue,
};
use polkadot_node_subsystem_test_helpers::{
make_subsystem_context, mock::make_ferdie_keystore, TestSubsystemContext,
@@ -205,12 +206,7 @@ fn check_ancestry_lookup_in_same_session() {
let spans: HashMap<Hash, jaeger::PerLeafSpan> = HashMap::new();
let block_number = 1;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: Vec::new().into(),
};
@@ -225,12 +221,7 @@ fn check_ancestry_lookup_in_same_session() {
let block_number = 2;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: Vec::new().into(),
};
@@ -252,12 +243,7 @@ fn check_ancestry_lookup_in_same_session() {
// part of ancestry.
let block_number = 2 + Requester::LEAF_ANCESTRY_LEN_WITHIN_SESSION;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: test_state.relay_chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: vec![chain[1], chain[2]].into(),
};
requester
@@ -292,12 +278,7 @@ fn check_ancestry_lookup_in_different_sessions() {
let spans: HashMap<Hash, jaeger::PerLeafSpan> = HashMap::new();
let block_number = 3;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: Vec::new().into(),
};
@@ -310,12 +291,7 @@ fn check_ancestry_lookup_in_different_sessions() {
let block_number = 4;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: vec![chain[1], chain[2], chain[3]].into(),
};
@@ -328,12 +304,7 @@ fn check_ancestry_lookup_in_different_sessions() {
let block_number = 5;
let update = ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: chain[block_number],
number: block_number as u32,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(chain[block_number], block_number as u32)),
deactivated: vec![chain[4]].into(),
};
@@ -16,7 +16,6 @@
use std::{
collections::{HashMap, HashSet},
sync::Arc,
time::Duration,
};
@@ -34,9 +33,8 @@ use sc_network::{config as netconfig, config::RequestResponseConfig, IfDisconnec
use sp_core::{testing::TaskExecutor, traits::SpawnNamed};
use sp_keystore::KeystorePtr;
use polkadot_node_network_protocol::{
jaeger,
request_response::{v1, IncomingRequest, OutgoingRequest, Requests},
use polkadot_node_network_protocol::request_response::{
v1, IncomingRequest, OutgoingRequest, Requests,
};
use polkadot_node_primitives::ErasureChunk;
use polkadot_node_subsystem::{
@@ -44,14 +42,14 @@ use polkadot_node_subsystem::{
AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage, ChainApiMessage,
NetworkBridgeTxMessage, RuntimeApiMessage, RuntimeApiRequest,
},
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::{
CandidateHash, CoreState, ExecutorParams, GroupIndex, Hash, Id as ParaId, ScheduledCore,
SessionInfo, ValidatorIndex,
};
use test_helpers::mock::make_ferdie_keystore;
use test_helpers::mock::{make_ferdie_keystore, new_leaf};
use super::mock::{make_session_info, OccupiedCoreBuilder};
use crate::LOG_TARGET;
@@ -175,12 +173,7 @@ impl TestState {
.iter()
.zip(advanced)
.map(|(old, new)| ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: *new,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
activated: Some(new_leaf(*new, 1)),
deactivated: vec![*old].into(),
})
.collect::<Vec<_>>()
@@ -29,12 +29,10 @@ use sc_network::config::RequestResponseConfig;
use polkadot_erasure_coding::{branches, obtain_chunks_v1 as obtain_chunks};
use polkadot_node_primitives::{BlockData, PoV, Proof};
use polkadot_node_subsystem::{
jaeger,
messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest},
ActivatedLeaf, LeafStatus,
use polkadot_node_subsystem::messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest};
use polkadot_node_subsystem_test_helpers::{
make_subsystem_context, mock::new_leaf, TestSubsystemContextHandle,
};
use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle};
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_primitives::{
AuthorityDiscoveryId, Hash, HeadData, IndexedVec, PersistedValidationData, ValidatorId,
@@ -561,12 +559,10 @@ fn availability_is_recovered_from_chunks_if_no_group_provided() {
test_harness_fast_path(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -647,12 +643,10 @@ fn availability_is_recovered_from_chunks_even_if_backing_group_supplied_if_chunk
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -733,12 +727,10 @@ fn bad_merkle_path_leads_to_recovery_error() {
test_harness_fast_path(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -791,12 +783,10 @@ fn wrong_chunk_index_leads_to_recovery_error() {
test_harness_fast_path(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -865,12 +855,10 @@ fn invalid_erasure_coding_leads_to_invalid_error() {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -914,12 +902,10 @@ fn fast_path_backing_group_recovers() {
test_harness_fast_path(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -964,12 +950,10 @@ fn recovers_from_only_chunks_if_pov_large() {
test_harness_chunks_if_pov_large(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1068,12 +1052,10 @@ fn fast_path_backing_group_recovers_if_pov_small() {
test_harness_chunks_if_pov_large(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1127,12 +1109,10 @@ fn no_answers_in_fast_path_causes_chunk_requests() {
test_harness_fast_path(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1189,12 +1169,10 @@ fn task_canceled_when_receivers_dropped() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1231,12 +1209,10 @@ fn chunks_retry_until_all_nodes_respond() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1292,12 +1268,10 @@ fn not_returning_requests_wont_stall_retrieval() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1364,12 +1338,10 @@ fn all_not_returning_requests_still_recovers_on_return() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1441,12 +1413,10 @@ fn returns_early_if_we_have_the_data() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1478,12 +1448,10 @@ fn does_not_query_local_validator() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
@@ -1537,12 +1505,10 @@ fn invalid_local_chunk_is_ignored() {
test_harness_chunks_only(|mut virtual_overseer, req_cfg| async move {
overseer_signal(
&mut virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.current,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.current,
1,
))),
)
.await;
+13 -58
View File
@@ -16,8 +16,9 @@
use super::*;
use futures::{channel::oneshot, executor, stream::BoxStream};
use overseer::jaeger;
use polkadot_node_network_protocol::{self as net_protocol, OurView};
use polkadot_node_subsystem::{messages::NetworkBridgeEvent, ActivatedLeaf};
use polkadot_node_subsystem::messages::NetworkBridgeEvent;
use assert_matches::assert_matches;
use async_trait::async_trait;
@@ -36,15 +37,14 @@ use polkadot_node_network_protocol::{
view, ObservedRole, Versioned,
};
use polkadot_node_subsystem::{
jaeger,
messages::{
AllMessages, ApprovalDistributionMessage, BitfieldDistributionMessage,
GossipSupportMessage, StatementDistributionMessage,
},
ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal,
ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
};
use polkadot_node_subsystem_test_helpers::{
SingleItemSink, SingleItemStream, TestSubsystemContextHandle,
mock::new_leaf, SingleItemSink, SingleItemStream, TestSubsystemContextHandle,
};
use polkadot_node_subsystem_util::metered;
use polkadot_primitives::{AuthorityDiscoveryId, CandidateHash, Hash};
@@ -427,12 +427,7 @@ fn send_our_view_upon_connection() {
let head = Hash::repeat_byte(1);
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: head,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(head, 1)),
)))
.await;
@@ -514,12 +509,7 @@ fn sends_view_updates_to_peers() {
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -585,12 +575,7 @@ fn do_not_send_view_update_until_synced() {
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -601,12 +586,7 @@ fn do_not_send_view_update_until_synced() {
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_b,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_b, 1)),
)))
.await;
@@ -672,12 +652,7 @@ fn do_not_send_view_update_when_only_finalized_block_changed() {
// This should trigger the view update to our peers.
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -895,12 +870,7 @@ fn peer_disconnect_from_just_one_peerset() {
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -1132,12 +1102,7 @@ fn sent_views_include_finalized_number_update() {
.await;
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_b,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_b, 1)),
)))
.await;
@@ -1211,12 +1176,7 @@ fn our_view_updates_decreasing_order_and_limited_to_max() {
// get the correct view.
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash,
number: i as _,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash, i as _)),
)))
.await;
}
@@ -1265,12 +1225,7 @@ fn network_protocol_versioning_view_update() {
let head = Hash::repeat_byte(1);
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: head,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(head, 1)),
)))
.await;
@@ -40,7 +40,7 @@ use polkadot_node_subsystem::{
errors::RuntimeApiError,
jaeger,
messages::{AllMessages, ReportPeerMessage, RuntimeApiMessage, RuntimeApiRequest},
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
ActiveLeavesUpdate,
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::{reputation::add_reputation, TimeoutExt};
@@ -49,6 +49,7 @@ use polkadot_primitives::{
ScheduledCore, SessionIndex, SessionInfo, ValidatorId, ValidatorIndex,
};
use polkadot_primitives_test_helpers::TestCandidateBuilder;
use test_helpers::mock::new_leaf;
mod prospective_parachains;
@@ -310,12 +311,10 @@ async fn setup_system(virtual_overseer: &mut VirtualOverseer, test_state: &TestS
overseer_signal(
virtual_overseer,
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: test_state.relay_parent,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
})),
OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(new_leaf(
test_state.relay_parent,
1,
))),
)
.await;
@@ -19,7 +19,6 @@
use std::{
collections::HashSet,
sync::Arc,
task::Poll,
time::{Duration, Instant},
};
@@ -51,10 +50,11 @@ use polkadot_node_subsystem::{
AllMessages, DisputeCoordinatorMessage, DisputeDistributionMessage, ImportStatementsResult,
NetworkBridgeTxMessage, RuntimeApiMessage, RuntimeApiRequest,
},
ActivatedLeaf, ActiveLeavesUpdate, FromOrchestra, LeafStatus, OverseerSignal, Span,
ActiveLeavesUpdate, FromOrchestra, OverseerSignal,
};
use polkadot_node_subsystem_test_helpers::{
mock::make_ferdie_keystore, subsystem_test_harness, TestSubsystemContextHandle,
mock::{make_ferdie_keystore, new_leaf},
subsystem_test_harness, TestSubsystemContextHandle,
};
use polkadot_primitives::{
AuthorityDiscoveryId, CandidateHash, CandidateReceipt, ExecutorParams, Hash, SessionIndex,
@@ -735,12 +735,7 @@ async fn activate_leaf(
) {
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate {
activated: Some(ActivatedLeaf {
hash: activate,
number: 10,
status: LeafStatus::Fresh,
span: Arc::new(Span::Disabled),
}),
activated: Some(new_leaf(activate, 10)),
deactivated: deactivate.into_iter().collect(),
})))
.await;
@@ -16,7 +16,7 @@
//! Unit tests for Gossip Support Subsystem.
use std::{collections::HashSet, sync::Arc, time::Duration};
use std::{collections::HashSet, time::Duration};
use assert_matches::assert_matches;
use async_trait::async_trait;
@@ -30,15 +30,11 @@ use sp_core::crypto::Pair as PairT;
use sp_keyring::Sr25519Keyring;
use polkadot_node_network_protocol::grid_topology::{SessionGridTopology, TopologyPeerInfo};
use polkadot_node_subsystem::{
jaeger,
messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest},
ActivatedLeaf, LeafStatus,
};
use polkadot_node_subsystem::messages::{AllMessages, RuntimeApiMessage, RuntimeApiRequest};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::TimeoutExt as _;
use polkadot_primitives::{GroupIndex, IndexedVec};
use test_helpers::mock::make_ferdie_keystore;
use test_helpers::mock::{make_ferdie_keystore, new_leaf};
use super::*;
@@ -196,12 +192,7 @@ fn test_harness<T: Future<Output = VirtualOverseer>, AD: AuthorityDiscovery>(
const TIMEOUT: Duration = Duration::from_millis(100);
async fn overseer_signal_active_leaves(overseer: &mut VirtualOverseer, leaf: Hash) {
let leaf = ActivatedLeaf {
hash: leaf,
number: 0xdeadcafe,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
};
let leaf = new_leaf(leaf, 0xdeadcafe);
overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(
leaf,
@@ -36,13 +36,12 @@ use polkadot_node_primitives::{
SignedFullStatementWithPVD, Statement, UncheckedSignedFullStatement,
};
use polkadot_node_subsystem::{
jaeger,
messages::{
network_bridge_event, AllMessages, ReportPeerMessage, RuntimeApiMessage, RuntimeApiRequest,
},
ActivatedLeaf, LeafStatus, RuntimeApiError,
RuntimeApiError,
};
use polkadot_node_subsystem_test_helpers::mock::make_ferdie_keystore;
use polkadot_node_subsystem_test_helpers::mock::{make_ferdie_keystore, new_leaf};
use polkadot_primitives::{
ExecutorParams, GroupIndex, Hash, HeadData, Id as ParaId, IndexedVec, SessionInfo,
ValidationCode,
@@ -787,12 +786,7 @@ fn receiving_from_one_sends_to_another_and_to_candidate_backing() {
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -1032,12 +1026,7 @@ fn receiving_large_statement_from_one_sends_to_another_and_to_candidate_backing(
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -1567,12 +1556,7 @@ fn delay_reputation_changes() {
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -2052,12 +2036,7 @@ fn share_prioritizes_backing_group() {
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -2379,12 +2358,7 @@ fn peer_cant_flood_with_large_statements() {
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: hash_a,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(hash_a, 1)),
)))
.await;
@@ -2609,12 +2583,7 @@ fn handle_multiple_seconded_statements() {
// register our active heads.
handle
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(
ActiveLeavesUpdate::start_work(ActivatedLeaf {
hash: relay_parent_hash,
number: 1,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
}),
ActiveLeavesUpdate::start_work(new_leaf(relay_parent_hash, 1)),
)))
.await;
@@ -30,7 +30,6 @@ use polkadot_node_subsystem::messages::{
RuntimeApiMessage, RuntimeApiRequest,
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_types::{jaeger, ActivatedLeaf, LeafStatus};
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_primitives::vstaging::{
AssignmentPair, AsyncBackingParams, BlockNumber, CommittedCandidateReceipt, CoreState,
@@ -46,6 +45,7 @@ use assert_matches::assert_matches;
use futures::Future;
use parity_scale_codec::Encode;
use rand::{Rng, SeedableRng};
use test_helpers::mock::new_leaf;
use std::sync::Arc;
@@ -358,12 +358,7 @@ async fn activate_leaf(
test_state: &TestState,
is_new_session: bool,
) {
let activated = ActivatedLeaf {
hash: leaf.hash,
number: leaf.number,
status: LeafStatus::Fresh,
span: Arc::new(jaeger::Span::Disabled),
};
let activated = new_leaf(leaf.hash, leaf.number);
virtual_overseer
.send(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate::start_work(