Add feature flag to enable v2 assignments (#2444)

Scaffold everything, so that we can enable v2 assignments via a node
feature bit, once all nodes have upgraded to the new protocol.

Implements: https://github.com/paritytech/polkadot-sdk/issues/628

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
This commit is contained in:
Alexandru Gheorghe
2023-12-11 12:49:11 +02:00
committed by GitHub
parent 6cedb0c78d
commit 84c932cd8a
12 changed files with 397 additions and 170 deletions
@@ -37,8 +37,8 @@ use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_node_subsystem_util::TimeoutExt;
use polkadot_overseer::HeadSupportsParachains;
use polkadot_primitives::{
CandidateCommitments, CandidateEvent, CoreIndex, GroupIndex, Header, Id as ParaId, IndexedVec,
ValidationCode, ValidatorSignature,
vstaging::NodeFeatures, CandidateCommitments, CandidateEvent, CoreIndex, GroupIndex, Header,
Id as ParaId, IndexedVec, ValidationCode, ValidatorSignature,
};
use std::time::Duration;
@@ -243,6 +243,7 @@ where
polkadot_primitives::CoreIndex,
polkadot_primitives::GroupIndex,
)>,
_enable_assignments_v2: bool,
) -> HashMap<polkadot_primitives::CoreIndex, criteria::OurAssignment> {
self.0()
}
@@ -1003,6 +1004,15 @@ async fn import_block(
si_tx.send(Ok(Some(ExecutorParams::default()))).unwrap();
}
);
assert_matches!(
overseer_recv(overseer).await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(_, RuntimeApiRequest::NodeFeatures(_, si_tx), )
) => {
si_tx.send(Ok(NodeFeatures::EMPTY)).unwrap();
}
);
}
assert_matches!(