mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 16:17:59 +00:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user