Skip to content
Snippets Groups Projects
Unverified Commit 2fcc5ac0 authored by bgallois's avatar bgallois
Browse files

reproduce #291

parent 868198d1
No related branches found
No related tags found
No related merge requests found
......@@ -1499,6 +1499,36 @@ fn test_link_account() {
})
}
/// test change owner key
#[test]
fn test_change_owner_key_validator_keys_set() {
ExtBuilder::new(1, 3, 4).build().execute_with(|| {
let genesis_hash = System::block_hash(0);
let bob = AccountKeyring::Bob.to_account_id();
let ferdie = AccountKeyring::Ferdie.to_account_id();
let payload = (b"icok", genesis_hash, 2u32, bob.clone()).encode();
let signature = AccountKeyring::Bob.sign(&payload);
// Bob is not an online validator, but his identity/owner_key is already associated.
// He should not be able to change its owner_key.
assert_ok!(AuthorityMembers::set_session_keys(
RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()),
create_dummy_session_keys()
));
assert!(!pallet_authority_members::OnlineAuthorities::<Runtime>::get().contains(&2));
assert!(pallet_authority_members::Members::<Runtime>::get(2).is_some());
assert_noop!(
Identity::change_owner_key(
RuntimeOrigin::signed(bob.clone()),
ferdie.clone(),
signature.into()
),
pallet_identity::Error::<gdev_runtime::Runtime>::OwnerKeyUsedAsValidator
);
})
}
/// test change owner key
#[test]
fn test_change_owner_key_validator_online() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment