Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr committed Sep 25, 2023
1 parent 2ecdeb3 commit d004457
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cumulus/pallets/collator-selection/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use frame_support::{
traits::{Currency, OnInitialize},
};
use pallet_balances::Error as BalancesError;
use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin, BuildStorage, RuntimeAppPublic};
use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin, BuildStorage};

#[test]
fn basic_setup_works() {
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ pub(crate) fn bond_validator(who: AccountId, val: Balance) {
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(who),
SessionKeys { other: who.into() },
vec![]
SessionKeys { other: who.into() }.create_ownership_proof(&who.encode()).unwrap(),
));
}

Expand Down
18 changes: 14 additions & 4 deletions substrate/frame/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ fn staking_should_work() {
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(3),
SessionKeys { other: 4.into() },
vec![]
SessionKeys { other: 4.into() }
.create_ownership_proof(&AccountId::from(3u32).encode())
.unwrap(),
));

// No effects will be seen so far.
Expand Down Expand Up @@ -1861,7 +1863,9 @@ fn switching_roles() {
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(5),
SessionKeys { other: 6.into() },
vec![]
SessionKeys { other: 6.into() }
.create_ownership_proof(&AccountId::from(5u32).encode())
.unwrap(),
));

mock::start_active_era(1);
Expand All @@ -1874,7 +1878,9 @@ fn switching_roles() {
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(1),
SessionKeys { other: 2.into() },
vec![]
SessionKeys { other: 2.into() }
.create_ownership_proof(&AccountId::from(1u32).encode())
.unwrap(),
));
// new stakes:
// 11: 1000 self vote
Expand Down Expand Up @@ -1986,7 +1992,9 @@ fn bond_with_little_staked_value_bounded() {
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(1),
SessionKeys { other: 1.into() },
vec![]
SessionKeys { other: 1.into() }
.create_ownership_proof(&AccountId::from(1u32).encode())
.unwrap(),
));

// 1 era worth of reward. BUT, we set the timestamp after on_initialize, so outdated by
Expand Down Expand Up @@ -4638,6 +4646,7 @@ mod election_data_provider {
// maybe_max_len`.
#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn only_iterates_max_2_times_max_allowed_len() {
ExtBuilder::default()
.nominate(false)
Expand Down Expand Up @@ -5308,6 +5317,7 @@ fn min_commission_works() {

#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn change_of_absolute_max_nominations() {
use frame_election_provider_support::ElectionDataProvider;
ExtBuilder::default()
Expand Down

0 comments on commit d004457

Please sign in to comment.