Skip to content

Commit a91fe20

Browse files
JMoore96CentrilNeopallium
authored
MESH-1792/ improving signer already linked errors (#1226)
* modified errors * update comment Co-authored-by: Mazdak Farrokhzad <[email protected]> Co-authored-by: Mazdak Farrokhzad <[email protected]> Co-authored-by: Robert Gabriel Jakabosky <[email protected]>
1 parent 3061fa6 commit a91fe20

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pallets/multisig/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,9 @@ decl_error! {
653653
/// Changing multisig parameters not allowed since multisig is a primary key.
654654
ChangeNotAllowed,
655655
/// Signer is an account key that is already associated with a multisig.
656-
SignerAlreadyLinked,
656+
SignerAlreadyLinkedToMultisig,
657+
/// Signer is an account key that is already associated with an identity.
658+
SignerAlreadyLinkedToIdentity,
657659
/// Current DID is missing
658660
MissingCurrentIdentity,
659661
/// The function can only be called by the primary key of the did
@@ -1046,16 +1048,16 @@ impl<T: Config> Module<T> {
10461048
// Don't allow a signer key that is already a secondary key on another multisig
10471049
ensure!(
10481050
!<KeyToMultiSig<T>>::contains_key(key),
1049-
Error::<T>::SignerAlreadyLinked
1051+
Error::<T>::SignerAlreadyLinkedToMultisig
10501052
);
10511053
// Don't allow a signer key that is already a secondary key on another identity
10521054
ensure!(
10531055
!<identity::KeyToIdentityIds<T>>::contains_key(key),
1054-
Error::<T>::SignerAlreadyLinked
1056+
Error::<T>::SignerAlreadyLinkedToIdentity
10551057
);
10561058
// Don't allow a multisig to add itself as a signer to itself
10571059
// NB - you can add a multisig as a signer to a different multisig
1058-
ensure!(key != &multisig, Error::<T>::SignerAlreadyLinked);
1060+
ensure!(key != &multisig, Error::<T>::SignerAlreadyLinkedToMultisig);
10591061
}
10601062

10611063
let ms_identity = <MultiSigToIdentity<T>>::get(&multisig);

pallets/runtime/tests/src/multisig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn join_multisig() {
9999
set_curr_did(Some(alice_did));
100100
assert_noop!(
101101
MultiSig::accept_multisig_signer_as_key(bob.clone(), bob_auth_id2),
102-
Error::SignerAlreadyLinked
102+
Error::SignerAlreadyLinkedToMultisig
103103
);
104104
});
105105
}

0 commit comments

Comments
 (0)