Replace bool by Result<(), dispatchError> for checks
closes #90 (closed)
Merge request reports
Activity
added RN-runtime S-doing labels
assigned to @HugoTrentesaux
I'm trying to replace
fn can_create_identity(creator: IdtyIndex) -> bool
by
fn check_create_identity(creator: IdtyIndex) -> Result<(), DispatchError>
However, when adding
#[pallet::error] pub enum Error<T> {
to the
#[frame_support::pallet]
section, I get the errorerror: Invalid generic declaration, trait is defined with instance but generic use none --> pallets/duniter-wot/src/lib.rs:99:20 | 99 | pub enum Error<T> { | ^
I need to explore more to see how error should be added.
Thanks to a guy on substrate stackexchage (https://substrate.stackexchange.com/questions/4959/invalid-generic-declaration-when-using-frame-macro-palleterror/4960#4960) I fixed it. I just did not know how to use genericity for instantiable pallets.
I dealt with all the points listed in the issue. The tests pass. I'm ready for a review.
I replaced "
is_***
" and "Ensure***
" by "check_***
" since the result is no more a boolean but a result.I removed generic error
CertNotAllowed
for more specific ones (likeMaxEmitedCertsReached
IssuerCanNotEmitCert
CertToUnconfirmedIdty
)Edited by Hugo Trentesauxchanged milestone to %runtime-500
requested review from @librelois
- Resolved by Hugo Trentesaux