mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 17:17:56 +00:00
Fix account ref-counting in session (#8538)
* Fix account ref-counting in session. * Avoid needless check * fix compile * put back in check and conversion * Fix test to actually catch this error Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -18,8 +18,9 @@
|
||||
// Tests for the Session Pallet
|
||||
|
||||
use super::*;
|
||||
use mock::Test;
|
||||
use codec::Decode;
|
||||
use frame_support::{traits::OnInitialize, assert_ok};
|
||||
use frame_support::{traits::OnInitialize, assert_ok, assert_noop};
|
||||
use sp_core::crypto::key_types::DUMMY;
|
||||
use sp_runtime::testing::UintAuthorityId;
|
||||
use mock::{
|
||||
@@ -181,11 +182,14 @@ fn duplicates_are_not_allowed() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
Session::on_initialize(1);
|
||||
assert!(Session::set_keys(Origin::signed(4), UintAuthorityId(1).into(), vec![]).is_err());
|
||||
assert!(Session::set_keys(Origin::signed(1), UintAuthorityId(10).into(), vec![]).is_ok());
|
||||
assert_noop!(
|
||||
Session::set_keys(Origin::signed(4), UintAuthorityId(1).into(), vec![]),
|
||||
Error::<Test>::DuplicatedKey,
|
||||
);
|
||||
assert_ok!(Session::set_keys(Origin::signed(1), UintAuthorityId(10).into(), vec![]));
|
||||
|
||||
// is fine now that 1 has migrated off.
|
||||
assert!(Session::set_keys(Origin::signed(4), UintAuthorityId(1).into(), vec![]).is_ok());
|
||||
assert_ok!(Session::set_keys(Origin::signed(4), UintAuthorityId(1).into(), vec![]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -357,7 +361,6 @@ fn return_true_if_more_than_third_is_disabled() {
|
||||
#[test]
|
||||
fn upgrade_keys() {
|
||||
use frame_support::storage;
|
||||
use mock::Test;
|
||||
use sp_core::crypto::key_types::DUMMY;
|
||||
|
||||
// This test assumes certain mocks.
|
||||
|
||||
Reference in New Issue
Block a user