It reminds me about what I wrote here: Undocumented Duniter concepts - #7 by HugoTrentesaux
But now I understood the interest of having this apparent redundancy.
If we look at the two occurrences:
in types.rs
:
/// events related to identity
pub enum IdtyEvent<T: crate::Config> {
/// creation of a new identity by an other
Created { creator: T::IdtyIndex },
/// confirmation of an identity (with a given name)
Confirmed,
/// validation of an identity
Validated,
/// changing the owner key of the identity
ChangedOwnerKey { new_owner_key: T::AccountId },
/// removing an identity
Removed { status: IdtyStatus },
}
in lib.rs
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A new identity has been created
/// [idty_index, owner_key]
IdtyCreated {
idty_index: T::IdtyIndex,
owner_key: T::AccountId,
},
/// An identity has been confirmed by its owner
/// [idty_index, owner_key, name]
IdtyConfirmed {
idty_index: T::IdtyIndex,
owner_key: T::AccountId,
name: IdtyName,
},
/// An identity has been validated
/// [idty_index]
IdtyValidated { idty_index: T::IdtyIndex },
IdtyChangedOwnerKey {
idty_index: T::IdtyIndex,
new_owner_key: T::AccountId,
},
/// An identity has been removed
/// [idty_index]
IdtyRemoved { idty_index: T::IdtyIndex },
}
As we can see, these events are not totally similar. The first one are used internally for modules to cooperate together while the second one are here to inform the outside world about what is happening on chain.
I think blockchain events should never be used internally because we want to be able to change them easily if we find out client need more information. On the opposite, internal events should only be modified when it is necessary for other pallets to know a bit more about what happened in an other pallet.
Sorry for the delay, I was in Britain to work with @flodef on the indexer and gcli.