Allow pallet::call to return DispatchResult (#8241)

* allow dispatch result

* remove custom error message

* format

* add forgotten UI test

* fix test

* fix tests
This commit is contained in:
Guillaume Thiolliere
2021-03-03 13:14:07 +01:00
committed by GitHub
parent 4de4662480
commit fb8da7ea92
6 changed files with 71 additions and 6 deletions
+4 -3
View File
@@ -1078,7 +1078,7 @@ pub mod pallet_prelude {
Twox128, Blake2_256, Blake2_128, Identity, Twox64Concat, Blake2_128Concat, ensure,
RuntimeDebug, storage,
traits::{Get, Hooks, IsType, GetPalletVersion, EnsureOrigin},
dispatch::{DispatchResultWithPostInfo, Parameter, DispatchError},
dispatch::{DispatchResultWithPostInfo, Parameter, DispatchError, DispatchResult},
weights::{DispatchClass, Pays, Weight},
storage::types::{StorageValue, StorageMap, StorageDoubleMap, ValueQuery, OptionQuery},
};
@@ -1244,7 +1244,7 @@ pub mod pallet_prelude {
/// $some_arg: $some_type,
/// // or with compact attribute: #[pallet::compact] $some_arg: $some_type,
/// ...
/// ) -> DispatchResultWithPostInfo {
/// ) -> DispatchResultWithPostInfo { // or `-> DispatchResult`
/// ...
/// }
/// ...
@@ -1255,7 +1255,8 @@ pub mod pallet_prelude {
///
/// Each dispatchable needs to define a weight with `#[pallet::weight($expr)]` attribute,
/// the first argument must be `origin: OriginFor<T>`, compact encoding for argument can be used
/// using `#[pallet::compact]`, function must return DispatchResultWithPostInfo.
/// using `#[pallet::compact]`, function must return `DispatchResultWithPostInfo` or
/// `DispatchResult`.
///
/// All arguments must implement `Debug`, `PartialEq`, `Eq`, `Decode`, `Encode`, `Clone`. For ease
/// of use, bound the trait `Member` available in frame_support::pallet_prelude.