Elastic scaling: use an assumed CoreIndex in candidate-backing (#3229)

First step in implementing
https://github.com/paritytech/polkadot-sdk/issues/3144

### Summary of changes
- switch statement `Table` candidate mapping from `ParaId` to
`CoreIndex`
- introduce experimental `InjectCoreIndex`  node feature.
- determine and assume a `CoreIndex` for a candidate based on statement
validator index. If the signature is valid it means validator controls
the validator that index and we can easily map it to a validator
group/core.
- introduce a temporary provisioner fix until we fully enable elastic
scaling in the subystem. The fix ensures we don't fetch the same
backable candidate when calling `get_backable_candidate` for each core.

TODO:
- [x] fix backing tests
- [x] fix statement table tests
- [x] add new test

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: alindima <alin@parity.io>
Co-authored-by: alindima <alin@parity.io>
This commit is contained in:
Andrei Sandu
2024-02-22 15:22:31 +07:00
committed by GitHub
parent e76b244853
commit 60e537b95f
13 changed files with 462 additions and 96 deletions
+10 -2
View File
@@ -681,10 +681,17 @@ async fn request_backable_candidates(
CoreState::Free => continue,
};
// We should be calling this once per para rather than per core.
// TODO: Will be fixed in https://github.com/paritytech/polkadot-sdk/pull/3233.
// For now, at least make sure we don't supply the same candidate multiple times in case a
// para has multiple cores scheduled.
let response = get_backable_candidate(relay_parent, para_id, required_path, sender).await?;
match response {
Some((hash, relay_parent)) => selected_candidates.push((hash, relay_parent)),
Some((hash, relay_parent)) => {
if !selected_candidates.iter().any(|bc| &(hash, relay_parent) == bc) {
selected_candidates.push((hash, relay_parent))
}
},
None => {
gum::debug!(
target: LOG_TARGET,
@@ -726,6 +733,7 @@ async fn select_candidates(
)
.await?,
};
gum::debug!(target: LOG_TARGET, ?selected_candidates, "Got backable candidates");
// now get the backed candidates corresponding to these candidate receipts
let (tx, rx) = oneshot::channel();