You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
When adding a duplicate dispatchable in a pallet's decl_module the resulting error message is confusing:
error: Implicit conversion to privileged function has been removed. First parameter of dispatch should be marked `origin`. For root-matching dispatch, also add `ensure_root(origin)?`.
--> pallets/template/src/lib.rs:63:1
|
63 | / decl_module! {
64 | | /// The module declaration.
65 | | pub struct Module<T: Trait> for enum Call where origin: T::Origin {
66 | | // Initializing errors
... |
116 | | }
117 | | }
| |_^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Observed behavior: Error message complaining about implicit conversion to privileged function.
Expected behavior: Error message indicating that duplicate defintion of the same dispatchable is not allowed.
Quoting/Paraphrasing Shawn from the reproduction PR thread:
In the case of on_initialize this is a macro matching issue.
The first on_initialize() function is captured using our macro and is expected. The next one goes through our normal dispatch function logic, which does not allow any dispatchable that does not contain origin as the first parameter.
After the first instance, the function is treated like any arbitrary function, so the name is not considered for the parsing. At this point we only consider the function parameters, and we see that this dispatchable function is missing origin, so we complain.
I would guess this problem only occurs with "reserved functions" like on_initialize, on_finalize, on_runtime_upgrade, etc...
When adding a duplicate dispatchable in a pallet's
decl_module
the resulting error message is confusing:Observed behavior: Error message complaining about implicit conversion to privileged function.
Expected behavior: Error message indicating that duplicate defintion of the same dispatchable is not allowed.
See reproduction here: #6378
The text was updated successfully, but these errors were encountered: