configuration: backport async backing parameters from the feature branch (#6961)

* Backport async backing params primitive

* migration follow-up

* link pr

* parameters -> params

* rustfmt::skip block ident
This commit is contained in:
Chris Sosnin
2023-03-28 17:55:24 +03:00
committed by GitHub
parent 22f404f092
commit 16e4661446
4 changed files with 62 additions and 2 deletions
@@ -19,6 +19,7 @@
use crate::configuration::{self, ActiveConfig, Config, Pallet, PendingConfigs, MAX_POV_SIZE};
use frame_support::{pallet_prelude::*, traits::StorageVersion, weights::Weight};
use frame_system::pallet_prelude::BlockNumberFor;
use primitives::vstaging::AsyncBackingParams;
use sp_std::vec::Vec;
/// The current storage version.
@@ -27,7 +28,7 @@ use sp_std::vec::Vec;
/// v1-v2: <https://github.com/paritytech/polkadot/pull/4420>
/// v2-v3: <https://github.com/paritytech/polkadot/pull/6091>
/// v3-v4: <https://github.com/paritytech/polkadot/pull/6345>
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937>
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937> + <https://github.com/paritytech/polkadot/pull/6961>
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(5);
pub mod v5 {
@@ -226,6 +227,9 @@ ump_max_individual_weight : pre.ump_max_individual_weight,
pvf_checking_enabled : pre.pvf_checking_enabled,
pvf_voting_ttl : pre.pvf_voting_ttl,
minimum_validation_upgrade_delay : pre.minimum_validation_upgrade_delay,
// Default values are zeroes, thus it's ensured allowed ancestry never crosses the upgrade block.
async_backing_params : AsyncBackingParams { max_candidate_depth: 0, allowed_ancestry_len: 0 },
}
};
@@ -383,6 +387,10 @@ mod tests {
assert_eq!(v4.pvf_voting_ttl , v5.pvf_voting_ttl);
assert_eq!(v4.minimum_validation_upgrade_delay , v5.minimum_validation_upgrade_delay);
}; // ; makes this a statement. `rustfmt::skip` cannot be put on an expression.
// additional checks for async backing.
assert_eq!(v5.async_backing_params.allowed_ancestry_len, 0);
assert_eq!(v5.async_backing_params.max_candidate_depth, 0);
}
});
}
@@ -281,6 +281,10 @@ fn consistency_bypass_works() {
fn setting_pending_config_members() {
new_test_ext(Default::default()).execute_with(|| {
let new_config = HostConfiguration {
async_backing_params: primitives::vstaging::AsyncBackingParams {
allowed_ancestry_len: 0,
max_candidate_depth: 0,
},
validation_upgrade_cooldown: 100,
validation_upgrade_delay: 10,
code_retention_period: 5,