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

wip update test with new mock

parent e7bfc8ca
No related branches found
No related tags found
No related merge requests found
Pipeline #18988 passed
...@@ -21,12 +21,12 @@ use frame_support::{ ...@@ -21,12 +21,12 @@ use frame_support::{
traits::{Everything, GenesisBuild, OnFinalize, OnInitialize}, traits::{Everything, GenesisBuild, OnFinalize, OnInitialize},
}; };
use frame_system as system; use frame_system as system;
use sp_core::H256; use sp_core::{Pair, H256};
use sp_keystore::{testing::KeyStore, KeystoreExt}; use sp_keystore::{testing::KeyStore, KeystoreExt};
use sp_runtime::{ use sp_runtime::{
testing::{Header, UintAuthorityId}, testing::Header,
traits::{BlakeTwo256, IdentityLookup}, traits::{BlakeTwo256, IdentityLookup},
MultiSignature, MultiSignature, MultiSigner,
}; };
use std::sync::Arc; use std::sync::Arc;
...@@ -36,10 +36,9 @@ pub type Signature = MultiSignature; ...@@ -36,10 +36,9 @@ pub type Signature = MultiSignature;
pub type AccountPublic = <Signature as Verify>::Signer; pub type AccountPublic = <Signature as Verify>::Signer;
pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId; pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
type AccountIdOf<Test> = <Test as frame_system::Config>::AccountId; fn account(id: u8) -> AccountId {
let pair = sp_core::sr25519::Pair::from_seed(&[id; 32]);
fn account(id: u8) -> AccountIdOf<Test> { MultiSigner::Sr25519(pair.public()).into_account()
[id; 32].into()
} }
// Configure a mock runtime to test the pallet. // Configure a mock runtime to test the pallet.
......
...@@ -21,9 +21,31 @@ use crate::{ ...@@ -21,9 +21,31 @@ use crate::{
}; };
use codec::Encode; use codec::Encode;
use frame_support::{assert_noop, assert_ok}; use frame_support::{assert_noop, assert_ok};
use sp_runtime::testing::TestSignature; use sp_core::sr25519::Pair as KeyPair;
use sp_core::Pair;
use sp_runtime::{traits::IdentifyAccount, MultiSignature, MultiSigner};
type IdtyVal = IdtyValue<u64, u64, ()>; type IdtyVal = IdtyValue<u64, AccountId, ()>;
// Store the account id and the key pair to sign payload
struct Account {
id: AccountId,
signer: KeyPair,
}
// Create an Account given a u8
fn account(id: u8) -> Account {
let pair = sp_core::sr25519::Pair::from_seed(&[id; 32]);
Account {
id: MultiSigner::Sr25519(pair.public()).into_account(),
signer: pair,
}
}
// Sign a payload using a key pair
fn test_signature(key_pair: KeyPair, payload: Vec<u8>) -> MultiSignature {
MultiSignature::Sr25519(key_pair.sign(&payload))
}
fn alice() -> GenesisIdty<Test> { fn alice() -> GenesisIdty<Test> {
GenesisIdty { GenesisIdty {
...@@ -33,7 +55,7 @@ fn alice() -> GenesisIdty<Test> { ...@@ -33,7 +55,7 @@ fn alice() -> GenesisIdty<Test> {
data: (), data: (),
next_creatable_identity_on: 0, next_creatable_identity_on: 0,
old_owner_key: None, old_owner_key: None,
owner_key: 1, owner_key: account(1).id,
removable_on: 0, removable_on: 0,
status: crate::IdtyStatus::Validated, status: crate::IdtyStatus::Validated,
}, },
...@@ -48,7 +70,7 @@ fn bob() -> GenesisIdty<Test> { ...@@ -48,7 +70,7 @@ fn bob() -> GenesisIdty<Test> {
data: (), data: (),
next_creatable_identity_on: 0, next_creatable_identity_on: 0,
old_owner_key: None, old_owner_key: None,
owner_key: 2, owner_key: account(2).id,
removable_on: 0, removable_on: 0,
status: crate::IdtyStatus::Validated, status: crate::IdtyStatus::Validated,
}, },
...@@ -75,11 +97,14 @@ fn test_create_identity_ok() { ...@@ -75,11 +97,14 @@ fn test_create_identity_ok() {
run_to_block(1); run_to_block(1);
// Alice should be able to create an identity // Alice should be able to create an identity
assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 2)); assert_ok!(Identity::create_identity(
RuntimeOrigin::signed(account(1).id),
account(2).id
));
System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated { System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated {
idty_index: 2, idty_index: 2,
owner_key: 2, owner_key: account(2).id,
})); }));
}); });
} }
...@@ -94,7 +119,10 @@ fn test_create_identity_but_not_confirm_it() { ...@@ -94,7 +119,10 @@ fn test_create_identity_but_not_confirm_it() {
run_to_block(1); run_to_block(1);
// Alice should be able to create an identity // Alice should be able to create an identity
assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 2)); assert_ok!(Identity::create_identity(
RuntimeOrigin::signed(account(1).id),
account(2).id
));
// The identity shoud expire in blocs #3 // The identity shoud expire in blocs #3
run_to_block(3); run_to_block(3);
...@@ -105,11 +133,14 @@ fn test_create_identity_but_not_confirm_it() { ...@@ -105,11 +133,14 @@ fn test_create_identity_but_not_confirm_it() {
// We shoud be able to recreate the identity // We shoud be able to recreate the identity
run_to_block(4); run_to_block(4);
assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 2)); assert_ok!(Identity::create_identity(
RuntimeOrigin::signed(account(1).id),
account(2).id
));
System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated { System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated {
idty_index: 3, idty_index: 3,
owner_key: 2, owner_key: account(2).id,
})); }));
}); });
} }
...@@ -124,11 +155,14 @@ fn test_idty_creation_period() { ...@@ -124,11 +155,14 @@ fn test_idty_creation_period() {
run_to_block(1); run_to_block(1);
// Alice should be able to create an identity // Alice should be able to create an identity
assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 2)); assert_ok!(Identity::create_identity(
RuntimeOrigin::signed(account(1).id),
account(2).id
));
System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated { System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated {
idty_index: 2, idty_index: 2,
owner_key: 2, owner_key: account(2).id,
})); }));
assert_eq!(Identity::identity(1).unwrap().next_creatable_identity_on, 4); assert_eq!(Identity::identity(1).unwrap().next_creatable_identity_on, 4);
...@@ -136,21 +170,25 @@ fn test_idty_creation_period() { ...@@ -136,21 +170,25 @@ fn test_idty_creation_period() {
// Alice cannot create a new identity before block #4 // Alice cannot create a new identity before block #4
run_to_block(2); run_to_block(2);
assert_eq!( assert_eq!(
Identity::create_identity(RuntimeOrigin::signed(1), 3), Identity::create_identity(RuntimeOrigin::signed(account(1).id), account(3).id),
Err(Error::<Test>::NotRespectIdtyCreationPeriod.into()) Err(Error::<Test>::NotRespectIdtyCreationPeriod.into())
); );
// Alice should be able to create a second identity after block #4 // Alice should be able to create a second identity after block #4
run_to_block(4); run_to_block(4);
assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 3)); assert_ok!(Identity::create_identity(
RuntimeOrigin::signed(account(1).id),
account(3).id
));
System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated { System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyCreated {
idty_index: 3, idty_index: 3,
owner_key: 3, owner_key: account(3).id,
})); }));
}); });
} }
//
#[test] #[test]
fn test_change_owner_key() { fn test_change_owner_key() {
new_test_ext(IdentityConfig { new_test_ext(IdentityConfig {
...@@ -158,7 +196,7 @@ fn test_change_owner_key() { ...@@ -158,7 +196,7 @@ fn test_change_owner_key() {
}) })
.execute_with(|| { .execute_with(|| {
let genesis_hash = System::block_hash(0); let genesis_hash = System::block_hash(0);
let old_owner_key = 1u64; let old_owner_key = account(1).id;
let mut new_key_payload = NewOwnerKeyPayload { let mut new_key_payload = NewOwnerKeyPayload {
genesis_hash: &genesis_hash, genesis_hash: &genesis_hash,
idty_index: 1u64, idty_index: 1u64,
...@@ -169,25 +207,29 @@ fn test_change_owner_key() { ...@@ -169,25 +207,29 @@ fn test_change_owner_key() {
run_to_block(1); run_to_block(1);
// Verify genesis data // Verify genesis data
assert_eq!(System::sufficients(&1), 1); assert_eq!(System::sufficients(&account(1).id), 1);
assert_eq!(System::sufficients(&10), 0); assert_eq!(System::sufficients(&account(10).id), 0);
// Caller should have an associated identity // Caller should have an associated identity
assert_noop!( assert_noop!(
Identity::change_owner_key( Identity::change_owner_key(
RuntimeOrigin::signed(42), RuntimeOrigin::signed(account(42).id),
10, account(10).id,
TestSignature(10, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(10).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
)
), ),
Error::<Test>::IdtyIndexNotFound Error::<Test>::IdtyIndexNotFound
); );
// Payload must be signed by the new key // Payload must be signed by the new key
assert_noop!( assert_noop!(
Identity::change_owner_key( Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
10, account(10).id,
TestSignature(42, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(42).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
)
), ),
Error::<Test>::InvalidNewOwnerKeySig Error::<Test>::InvalidNewOwnerKeySig
); );
...@@ -195,9 +237,9 @@ fn test_change_owner_key() { ...@@ -195,9 +237,9 @@ fn test_change_owner_key() {
// Payload must be prefixed // Payload must be prefixed
assert_noop!( assert_noop!(
Identity::change_owner_key( Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
10, account(10).id,
TestSignature(10, new_key_payload.encode()) test_signature(account(10).signer, new_key_payload.clone().encode())
), ),
Error::<Test>::InvalidNewOwnerKeySig Error::<Test>::InvalidNewOwnerKeySig
); );
...@@ -205,46 +247,53 @@ fn test_change_owner_key() { ...@@ -205,46 +247,53 @@ fn test_change_owner_key() {
// New owner key should not be used by another identity // New owner key should not be used by another identity
assert_noop!( assert_noop!(
Identity::change_owner_key( Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
2, account(2).id,
TestSignature(2, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(2).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
)
), ),
Error::<Test>::OwnerKeyAlreadyUsed Error::<Test>::OwnerKeyAlreadyUsed
); );
// Alice can change her owner key // Alice can change her owner key
assert_ok!(Identity::change_owner_key( assert_ok!(Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
10, account(10).id,
TestSignature(10, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(10).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
)
)); ));
assert_eq!( assert_eq!(
Identity::identity(1), Identity::identity(1),
Some(IdtyVal { Some(IdtyVal {
data: (), data: (),
next_creatable_identity_on: 0, next_creatable_identity_on: 0,
old_owner_key: Some((1, 1)), old_owner_key: Some((account(1).id, 1)),
owner_key: 10, owner_key: account(10).id,
removable_on: 0, removable_on: 0,
status: crate::IdtyStatus::Validated, status: crate::IdtyStatus::Validated,
}) })
); );
// Alice still sufficient // Alice still sufficient
assert_eq!(System::sufficients(&1), 1); assert_eq!(System::sufficients(&account(1).id), 1);
// New owner key should become a sufficient account // New owner key should become a sufficient account
assert_eq!(System::sufficients(&10), 1); assert_eq!(System::sufficients(&account(10).id), 1);
run_to_block(2); run_to_block(2);
//
// Alice can't re-change her owner key too early // Alice can't re-change her owner key too early
new_key_payload.old_owner_key = &10; let old = account(10).id;
new_key_payload.old_owner_key = &old;
assert_noop!( assert_noop!(
Identity::change_owner_key( Identity::change_owner_key(
RuntimeOrigin::signed(10), RuntimeOrigin::signed(account(10).id),
100, account(100).id,
TestSignature( test_signature(
100, account(100).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode() (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
) )
), ),
Error::<Test>::OwnerKeyAlreadyRecentlyChanged Error::<Test>::OwnerKeyAlreadyRecentlyChanged
...@@ -253,27 +302,27 @@ fn test_change_owner_key() { ...@@ -253,27 +302,27 @@ fn test_change_owner_key() {
// Alice can re-change her owner key after ChangeOwnerKeyPeriod blocs // Alice can re-change her owner key after ChangeOwnerKeyPeriod blocs
run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get()); run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get());
assert_ok!(Identity::change_owner_key( assert_ok!(Identity::change_owner_key(
RuntimeOrigin::signed(10), RuntimeOrigin::signed(account(10).id),
100, account(100).id,
TestSignature( test_signature(
100, account(100).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode() (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload.clone()).encode()
) )
)); ));
// Old old owner key should not be sufficient anymore // Old old owner key should not be sufficient anymore
assert_eq!(System::sufficients(&1), 0); assert_eq!(System::sufficients(&account(1).id), 0);
// Old owner key should still sufficient // Old owner key should still sufficient
assert_eq!(System::sufficients(&10), 1); assert_eq!(System::sufficients(&account(10).id), 1);
// New owner key should become a sufficient account // New owner key should become a sufficient account
assert_eq!(System::sufficients(&100), 1); assert_eq!(System::sufficients(&account(100).id), 1);
// Revoke identity 1 // Revoke identity 1
assert_ok!(Identity::revoke_identity( assert_ok!(Identity::revoke_identity(
RuntimeOrigin::signed(42), RuntimeOrigin::signed(account(42).id),
1, 1,
100, account(100).id,
TestSignature( test_signature(
100, account(100).signer,
( (
REVOCATION_PAYLOAD_PREFIX, REVOCATION_PAYLOAD_PREFIX,
RevocationPayload { RevocationPayload {
...@@ -285,9 +334,9 @@ fn test_change_owner_key() { ...@@ -285,9 +334,9 @@ fn test_change_owner_key() {
) )
)); ));
// Old owner key should not be sufficient anymore // Old owner key should not be sufficient anymore
assert_eq!(System::sufficients(&10), 0); assert_eq!(System::sufficients(&account(10).id), 0);
// Last owner key should not be sufficient anymore // Last owner key should not be sufficient anymore
assert_eq!(System::sufficients(&100), 0); assert_eq!(System::sufficients(&account(100).id), 0);
}); });
} }
...@@ -301,7 +350,7 @@ fn test_idty_revocation_with_old_key() { ...@@ -301,7 +350,7 @@ fn test_idty_revocation_with_old_key() {
let new_key_payload = NewOwnerKeyPayload { let new_key_payload = NewOwnerKeyPayload {
genesis_hash: &genesis_hash, genesis_hash: &genesis_hash,
idty_index: 1u64, idty_index: 1u64,
old_owner_key: &1u64, old_owner_key: &account(1).id,
}; };
let revocation_payload = RevocationPayload { let revocation_payload = RevocationPayload {
idty_index: 1u64, idty_index: 1u64,
...@@ -313,22 +362,28 @@ fn test_idty_revocation_with_old_key() { ...@@ -313,22 +362,28 @@ fn test_idty_revocation_with_old_key() {
// Change alice owner key // Change alice owner key
assert_ok!(Identity::change_owner_key( assert_ok!(Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
10, account(10).id,
TestSignature(10, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(10).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()
)
)); ));
assert!(Identity::identity(&1).is_some()); assert!(Identity::identity(&1).is_some());
let idty_val = Identity::identity(&1).unwrap(); let idty_val = Identity::identity(&1).unwrap();
assert_eq!(idty_val.owner_key, 10); assert_eq!(idty_val.owner_key, account(10).id);
assert_eq!(idty_val.old_owner_key, Some((1, 1))); assert_eq!(idty_val.old_owner_key, Some((account(1).id, 1)));
// We should be able to revoke Alice identity with old key // We should be able to revoke Alice identity with old key
run_to_block(2); run_to_block(2);
assert_ok!(Identity::revoke_identity( assert_ok!(Identity::revoke_identity(
RuntimeOrigin::signed(42), RuntimeOrigin::signed(account(42).id),
1,
1, 1,
TestSignature(1, (REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()) account(1).id,
test_signature(
account(1).signer,
(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()
)
)); ));
//run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get()); //run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get());
...@@ -345,7 +400,7 @@ fn test_idty_revocation_with_old_key_after_old_key_expiration() { ...@@ -345,7 +400,7 @@ fn test_idty_revocation_with_old_key_after_old_key_expiration() {
let new_key_payload = NewOwnerKeyPayload { let new_key_payload = NewOwnerKeyPayload {
genesis_hash: &genesis_hash, genesis_hash: &genesis_hash,
idty_index: 1u64, idty_index: 1u64,
old_owner_key: &1u64, old_owner_key: &account(1).id,
}; };
let revocation_payload = RevocationPayload { let revocation_payload = RevocationPayload {
idty_index: 1u64, idty_index: 1u64,
...@@ -357,23 +412,29 @@ fn test_idty_revocation_with_old_key_after_old_key_expiration() { ...@@ -357,23 +412,29 @@ fn test_idty_revocation_with_old_key_after_old_key_expiration() {
// Change alice owner key // Change alice owner key
assert_ok!(Identity::change_owner_key( assert_ok!(Identity::change_owner_key(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
10, account(10).id,
TestSignature(10, (NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()) test_signature(
account(10).signer,
(NEW_OWNER_KEY_PAYLOAD_PREFIX, new_key_payload).encode()
)
)); ));
assert!(Identity::identity(&1).is_some()); assert!(Identity::identity(&1).is_some());
let idty_val = Identity::identity(&1).unwrap(); let idty_val = Identity::identity(&1).unwrap();
assert_eq!(idty_val.owner_key, 10); assert_eq!(idty_val.owner_key, account(10).id);
assert_eq!(idty_val.old_owner_key, Some((1, 1))); assert_eq!(idty_val.old_owner_key, Some((account(1).id, 1)));
// We should not be able to revoke Alice identity with old key after ChangeOwnerKeyPeriod // We should not be able to revoke Alice identity with old key after ChangeOwnerKeyPeriod
run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get()); run_to_block(2 + <Test as crate::Config>::ChangeOwnerKeyPeriod::get());
assert_noop!( assert_noop!(
Identity::revoke_identity( Identity::revoke_identity(
RuntimeOrigin::signed(42), RuntimeOrigin::signed(account(42).id),
1,
1, 1,
TestSignature(1, (REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()) account(1).id,
test_signature(
account(1).signer,
(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()
)
), ),
Error::<Test>::InvalidRevocationKey Error::<Test>::InvalidRevocationKey
); );
...@@ -397,10 +458,13 @@ fn test_idty_revocation() { ...@@ -397,10 +458,13 @@ fn test_idty_revocation() {
// Payload must be signed by the right identity // Payload must be signed by the right identity
assert_eq!( assert_eq!(
Identity::revoke_identity( Identity::revoke_identity(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
1, 1,
42, account(42).id,
TestSignature(42, (REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()) test_signature(
account(42).signer,
(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()
)
), ),
Err(Error::<Test>::InvalidRevocationKey.into()) Err(Error::<Test>::InvalidRevocationKey.into())
); );
...@@ -408,24 +472,27 @@ fn test_idty_revocation() { ...@@ -408,24 +472,27 @@ fn test_idty_revocation() {
// Payload must be prefixed // Payload must be prefixed
assert_eq!( assert_eq!(
Identity::revoke_identity( Identity::revoke_identity(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
1,
1, 1,
TestSignature(1, revocation_payload.encode()) account(1).id,
test_signature(account(1).signer, revocation_payload.encode())
), ),
Err(Error::<Test>::InvalidRevocationSig.into()) Err(Error::<Test>::InvalidRevocationSig.into())
); );
// Anyone can submit a revocation payload // Anyone can submit a revocation payload
assert_ok!(Identity::revoke_identity( assert_ok!(Identity::revoke_identity(
RuntimeOrigin::signed(42), RuntimeOrigin::signed(account(42).id),
1, 1,
1, account(1).id,
TestSignature(1, (REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()) test_signature(
account(1).signer,
(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()
)
)); ));
System::assert_has_event(RuntimeEvent::System(frame_system::Event::KilledAccount { System::assert_has_event(RuntimeEvent::System(frame_system::Event::KilledAccount {
account: 1, account: account(1).id,
})); }));
System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyRemoved { System::assert_has_event(RuntimeEvent::Identity(crate::Event::IdtyRemoved {
idty_index: 1, idty_index: 1,
...@@ -436,10 +503,13 @@ fn test_idty_revocation() { ...@@ -436,10 +503,13 @@ fn test_idty_revocation() {
// The identity no longer exists // The identity no longer exists
assert_eq!( assert_eq!(
Identity::revoke_identity( Identity::revoke_identity(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(account(1).id),
1, 1,
1, account(1).id,
TestSignature(1, (REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()) test_signature(
account(1).signer,
(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()
)
), ),
Err(Error::<Test>::IdtyNotFound.into()) Err(Error::<Test>::IdtyNotFound.into())
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment