Harmonize and document events errors and calls
Refactoring pallets to adhere to the following guidelines:
Call
Custom Duniter pallet calls should adhere to the standard Substrate naming convention:
-
action_
for regular calls (e.g.,create_identity
). -
force_
for calls with a privileged origin (e.g.,force_remove_identity
).
Error
In the event of a call failure, it should trigger a pallet error with a self-explanatory name, for instance, IdtyNotFound
.
Event
Successful calls should deposit a system event to notify external entities of the change. The event name should be self-explanatory and structured in the form of a Rust struct with named fields, ensuring clarity in autogenerated documentation. An example is:
IdtyRemoved {
idty_index: T::IdtyIndex,
reason: IdtyRemovalReason<T::IdtyRemovalOtherReason>,
}
Hook
Hooks are inherently infallible, and no errors should be emitted within them. To monitor progression from inside the hook, events can be employed to inform external entities about changes or no-changes.
Internal Function
Internal functions should adhere to the following naming convention:
-
do_action
for regular functions executing the base logic of a call (e.g.,do_remove_identity
). These functions should directly emit events and trigger errors as needed. -
force_action
for privileged functions that bypass any checks. This can be useful for specific benchmarking functions. -
check_
for functions performing checks and triggering errors in case of failure.
Merge request reports
Activity
assigned to @bgallois
added 28 commits
-
19c90538...5fa3d533 - 27 commits from branch
nodes/rust:master
- a2e13377 - wip
-
19c90538...5fa3d533 - 27 commits from branch
added 1 commit
- 053ce7e8 - refactor events and errors pallet-authority-members
added 1 commit
- f76c9fe2 - refactor events and errors pallet-authority-members
added 5 commits
-
f33a327e...cca16dbb - 3 commits from branch
nodes/rust:master
- b3a2abaa - refactor events and errors pallet-authority-members
- fff2bc79 - refactor events and errors pallet-distance
-
f33a327e...cca16dbb - 3 commits from branch
added 1 commit
- bc72ebee - refactor documentation pallet-authority-members
added 6 commits
- edf14167 - refactor documentation pallet-certification
- b054bfa9 - refactor documentation pallet-distance
- 99fe09a8 - refactor documentation pallet-duniter-account
- d7cf3a12 - refactor documentation pallet-duniter-wot
- 3d1a8182 - refactor documentation pallet-identity
- b5986aaf - refactor documentation pallet-membership
Toggle commit listadded 13 commits
- 759661ad...4acd52a1 - 3 earlier commits
- 067f0db6 - refactor documentation pallet-duniter-account
- d5e70288 - refactor documentation pallet-duniter-wot
- b7bc8b06 - refactor documentation pallet-identity
- baed9951 - refactor documentation pallet-membership
- cfbe97de - refactor documentation pallet-offences
- ea545977 - refactor documentation pallet-oneshot-account
- 0fb17cd1 - refactor documentation pallet-provide-randomness
- afe43d02 - fix pallet-quota features
- c62fcb40 - refactor documentation pallet-quota
- a662a4cb - add events pallet-distance
Toggle commit listadded RN-runtime label
changed milestone to %runtime-701
added 2 commits