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
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
- Resolved by Hugo Trentesaux
requested review from @tuxmain and removed review request for @librelois
- Resolved by Éloïs
- Resolved by Pascal Engélibert
- Resolved by Hugo Trentesaux
added 1 commit
- 20e30d6d - use exhaustive explicit match for idtystatus
- Resolved by Éloïs
Pardon je parlais du
#[allow(clippy::let_and_return)]
qui ne sert plus, pas du suffixeAllowed
.
Si ça ne vérifie que ça, autant garder leAllowed
pour la clarté...Oups, j'avais complètement oublié cette MR, pour moi c'était fini. J'ai du mal à me concentrer sur Duniter en ce moment avec tous les sujets de communication, mais maintenant que ça prend forme, je vais pouvoir revenir là dessus.
Du coup, je revert ce changement à ton avis ? J'avais même pas vu le
#[]
.Et aussi, j'ai du mal avec l'outil de review de GitLab qui affiche les messages dans un ordre non chronologique. Il faut que je prenne le pli.
@HugoTrentesaux peut tu rebase et demander une review finale par @tuxmain ? Quand il aura approuvé je ferait une review à mon tour et mergerai si tout est bon :)
added 20 commits
-
20e30d6d...dd0d6085 - 5 commits from branch
master
- e12322af - wip try replace identity creation check
- 02b81858 - wip fix generic type
- fc337913 - wip replace identity confirm check
- c5333d95 - wip replace identity validation check
- d5529377 - wip replace adress change check
- abea41e9 - wip replace identity removal check
- 62969d39 - wip replace cert allowed check
- 5f41de5f - wip rename check traits
- f37dbbac - wip merge membership traits
- f0c25e36 - wip fix tests
- 17119939 - fix fixme
- 34113e8b - review
- 2f5ecd74 - review tuxmain
- c3fb6102 - use exhaustive explicit match for idtystatus
- 223a5566 - revert variable name for more explicit
Toggle commit list-
20e30d6d...dd0d6085 - 5 commits from branch
- Resolved by Pascal Engélibert
mentioned in commit 7f72977a
changed milestone to %runtime-401