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
@@ -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(