First step in implementing #4386 (#4437)

* First step in implementing https://github.com/paritytech/polkadot/issues/4386

This PR:

- Reduces MAX_UNSHARED_UPLOAD_TIME to 150ms
- Increases timeout on collation fetching to 1200ms
- Reduces limit on needed backing votes in the runtime

This PR does not yet reduce the number of needed backing votes on the
node as this can only be meaningfully enacted once the changed limit in
the runtime is live.

* Fix tests.

* Guide updates.

* Review remarks.

* Bump minimum required backing votes to 2 in runtime.

* Make sure node side code won't make runtime vomit.

* cargo +nightly fmt
This commit is contained in:
Robert Klotzner
2021-12-23 17:41:34 +01:00
committed by GitHub
parent 4689ccffce
commit 846828f61c
6 changed files with 44 additions and 19 deletions
+11 -3
View File
@@ -190,8 +190,16 @@ struct AttestingData {
backing: Vec<ValidatorIndex>,
}
const fn group_quorum(n_validators: usize) -> usize {
(n_validators / 2) + 1
/// How many votes we need to consider a candidate backed.
fn minimum_votes(n_validators: usize) -> usize {
// Runtime change going live, see: https://github.com/paritytech/polkadot/pull/4437
let old_runtime_value = n_validators / 2 + 1;
let new_runtime_value = std::cmp::min(2, n_validators);
// Until new runtime is live everywhere and we don't yet have
// https://github.com/paritytech/polkadot/issues/4576, we want to err on the higher value for
// secured block production:
std::cmp::max(old_runtime_value, new_runtime_value)
}
#[derive(Default)]
@@ -223,7 +231,7 @@ impl TableContextTrait for TableContext {
}
fn requisite_votes(&self, group: &ParaId) -> usize {
self.groups.get(group).map_or(usize::MAX, |g| group_quorum(g.len()))
self.groups.get(group).map_or(usize::MAX, |g| minimum_votes(g.len()))
}
}