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
+14 -1
View File
@@ -161,6 +161,14 @@ pub mod pallet {
Ok(().into())
}
// Test for DispatchResult return type
#[pallet::weight(1)]
fn foo_no_post_info(
_origin: OriginFor<T>,
) -> DispatchResult {
Ok(())
}
}
#[pallet::error]
@@ -425,7 +433,7 @@ fn call_expand() {
assert_eq!(call_foo.get_call_name(), "foo");
assert_eq!(
pallet::Call::<Runtime>::get_call_names(),
&["foo", "foo_transactional"],
&["foo", "foo_transactional", "foo_no_post_info"],
);
}
@@ -669,6 +677,11 @@ fn metadata() {
" Doc comment put in metadata".to_string(),
]),
},
FunctionMetadata {
name: DecodeDifferent::Decoded("foo_no_post_info".to_string()),
arguments: DecodeDifferent::Decoded(vec![]),
documentation: DecodeDifferent::Decoded(vec![]),
},
])),
event: Some(DecodeDifferent::Decoded(vec![
EventMetadata {