Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ pub mod pallet {
let old = <TotalSelected<T>>::get();
ensure!(old != new, Error::<T>::NoWritingSameValue);
ensure!(
new <= <Round<T>>::get().length,
new < <Round<T>>::get().length,
Error::<T>::RoundLengthMustBeGreaterThanTotalSelectedCollators,
);
<TotalSelected<T>>::put(new);
Expand Down Expand Up @@ -895,7 +895,7 @@ pub mod pallet {
let (now, first, old) = (round.current, round.first, round.length);
ensure!(old != new, Error::<T>::NoWritingSameValue);
ensure!(
new >= <TotalSelected<T>>::get(),
new > <TotalSelected<T>>::get(),
Error::<T>::RoundLengthMustBeGreaterThanTotalSelectedCollators,
);
round.length = new;
Expand Down
24 changes: 12 additions & 12 deletions pallets/parachain-staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn set_total_selected_event_emits_correctly() {
// before we can bump total_selected we must bump the blocks per round
assert_ok!(ParachainStaking::set_blocks_per_round(
RuntimeOrigin::root(),
6u32
7u32
));
roll_blocks(1);
assert_ok!(ParachainStaking::set_total_selected(
Expand All @@ -93,16 +93,16 @@ fn set_total_selected_fails_if_above_blocks_per_round() {
}

#[test]
fn set_total_selected_passes_if_equal_to_blocks_per_round() {
fn set_total_selected_fails_if_equal_to_blocks_per_round() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ParachainStaking::set_blocks_per_round(
RuntimeOrigin::root(),
10u32
));
assert_ok!(ParachainStaking::set_total_selected(
RuntimeOrigin::root(),
10u32
));
assert_noop!(
ParachainStaking::set_total_selected(RuntimeOrigin::root(), 10u32),
Error::<Test>::RoundLengthMustBeGreaterThanTotalSelectedCollators,
);
});
}

Expand Down Expand Up @@ -139,7 +139,7 @@ fn set_blocks_per_round_fails_if_below_total_selected() {
}

#[test]
fn set_blocks_per_round_passes_if_equal_to_total_selected() {
fn set_blocks_per_round_fails_if_equal_to_total_selected() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ParachainStaking::set_blocks_per_round(
RuntimeOrigin::root(),
Expand All @@ -149,10 +149,10 @@ fn set_blocks_per_round_passes_if_equal_to_total_selected() {
RuntimeOrigin::root(),
9u32
));
assert_ok!(ParachainStaking::set_blocks_per_round(
RuntimeOrigin::root(),
9u32
));
assert_noop!(
ParachainStaking::set_blocks_per_round(RuntimeOrigin::root(), 9u32),
Error::<Test>::RoundLengthMustBeGreaterThanTotalSelectedCollators,
);
});
}

Expand Down Expand Up @@ -330,7 +330,7 @@ fn round_immediately_jumps_if_current_duration_exceeds_new_blocks_per_round() {
roll_to(17);
assert_ok!(ParachainStaking::set_blocks_per_round(
RuntimeOrigin::root(),
5u32
6u32
));
roll_to(18);
assert_events_emitted!(Event::NewRound {
Expand Down