diff --git a/pallets/configuration/src/lib.rs b/pallets/configuration/src/lib.rs index 867a0240a6..ebc2465d67 100644 --- a/pallets/configuration/src/lib.rs +++ b/pallets/configuration/src/lib.rs @@ -69,6 +69,7 @@ pub struct HostConfiguration { pub min_orchestrator_collators: u32, pub max_orchestrator_collators: u32, pub collators_per_container: u32, + // If this value is 0 means that there is no rotation pub full_rotation_period: u32, } @@ -94,8 +95,6 @@ pub enum InconsistentError { MinOrchestratorCollatorsTooLow, /// `max_collators` must be at least 1 MaxCollatorsTooLow, - /// `full_rotation_period` must be at least 1 - FullRotationPeriodTooLow, } impl HostConfiguration { @@ -114,9 +113,6 @@ impl HostConfiguration { if self.max_orchestrator_collators < self.min_orchestrator_collators { return Err(InconsistentError::MaxCollatorsLowerThanMinCollators); } - if self.full_rotation_period < 1 { - return Err(InconsistentError::FullRotationPeriodTooLow); - } Ok(()) } diff --git a/pallets/configuration/src/tests.rs b/pallets/configuration/src/tests.rs index 9ba88a7fb7..54883d9491 100644 --- a/pallets/configuration/src/tests.rs +++ b/pallets/configuration/src/tests.rs @@ -97,6 +97,53 @@ fn config_set_value() { }); } +#[test] +fn config_set_full_rotation_period_to_zero_works() { + new_test_ext_with_genesis(HostConfiguration { + max_collators: 100, + min_orchestrator_collators: 2, + max_orchestrator_collators: 5, + collators_per_container: 2, + full_rotation_period: 24, + }) + .execute_with(|| { + run_to_block(1); + assert_eq!(Configuration::config().full_rotation_period, 24); + assert_ok!( + Configuration::set_full_rotation_period(RuntimeOrigin::root(), 0), + () + ); + + assert_eq!( + PendingConfigs::::get(), + vec![( + 2, + HostConfiguration { + max_collators: 100, + min_orchestrator_collators: 2, + max_orchestrator_collators: 5, + collators_per_container: 2, + full_rotation_period: 0, + } + )] + ); + + // The session delay is set to 2, and one session is 5 blocks, + // so the change should not happen until block 11 + assert_eq!(Configuration::config().full_rotation_period, 24); + run_to_block(2); + assert_eq!(Configuration::config().full_rotation_period, 24); + // First block of session 1 + run_to_block(6); + assert_eq!(Configuration::config().full_rotation_period, 24); + run_to_block(10); + assert_eq!(Configuration::config().full_rotation_period, 24); + // First block of session 2 + run_to_block(11); + assert_eq!(Configuration::config().full_rotation_period, 0); + }); +} + #[test] fn config_set_many_values_same_block() { new_test_ext_with_genesis(HostConfiguration { diff --git a/test/suites/para/test_tanssi_containers.ts b/test/suites/para/test_tanssi_containers.ts index add517cdf0..386dea72ee 100644 --- a/test/suites/para/test_tanssi_containers.ts +++ b/test/suites/para/test_tanssi_containers.ts @@ -278,7 +278,7 @@ describeSuite({ it({ id: "T13", title: "Blocks are being produced on container 2002", - timeout: 60000, + timeout: 90000, test: async function () { let blockNum = (await container2002Api.rpc.chain.getBlock()).block.header.number.toNumber();