From d00445748de58b09ff55d1d96121f44f74d5d2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 25 Sep 2023 23:42:00 +0200 Subject: [PATCH] Fix more tests --- .../pallets/collator-selection/src/tests.rs | 2 +- substrate/frame/staking/src/mock.rs | 2 +- substrate/frame/staking/src/tests.rs | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cumulus/pallets/collator-selection/src/tests.rs b/cumulus/pallets/collator-selection/src/tests.rs index 584efd5c663f..2daa2757f1ed 100644 --- a/cumulus/pallets/collator-selection/src/tests.rs +++ b/cumulus/pallets/collator-selection/src/tests.rs @@ -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() { diff --git a/substrate/frame/staking/src/mock.rs b/substrate/frame/staking/src/mock.rs index cf08f8be1f27..9ea195ed9333 100644 --- a/substrate/frame/staking/src/mock.rs +++ b/substrate/frame/staking/src/mock.rs @@ -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(), )); } diff --git a/substrate/frame/staking/src/tests.rs b/substrate/frame/staking/src/tests.rs index 78183cfde929..d15f9cb1b59e 100644 --- a/substrate/frame/staking/src/tests.rs +++ b/substrate/frame/staking/src/tests.rs @@ -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. @@ -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); @@ -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 @@ -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 @@ -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) @@ -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()