Closed Romulus10 closed 2 years ago
@isaacadams So Ed and I just looked through the identity pallet - where did you see this coming in to play?
Anyone can call an extrinsic... right? They can input any number into the extrinsic calls that ask for an identity index. That is where it comes into play for extrinsic calls which alter an existing identity.
Most of the extrinsics check first if the identity requested is owned by the sender. Wouldn't that throw out any invalid identity IDs? I see how it would come into play during revocation though.
Actually, I don't think it's even needed there, is it? If the identity can't be removed nothing is committed to chain state anyway.
Yes, that is correct. This suggestion isn't a "saving our bacon" situation. It is a short-circuit / efficiency suggestion.
Doesn't it cost more weight to read from storage? If the identity index is invalid, why go through the trouble of indexing the IdentityList
if we can quickly check the validity of the identity index and return the error.
Add a check for an invalid identity index. For instance, if someone tries calling an extrinsic with an identity index greater than the IdentityNumber, we can short-circuit and throw an error "Invalid Identity Index" or "Identity does not exist".