Make Dispatchable return the actual weight consumed (#5458)

* Make Dispatchable return the actual weight consumed

Add PostInfo associated type to Dispatchable and have frame implement
Dispatchable { type PostInfo = PostDispatchInfo } where PostDispatchInfo
contains the actual weight consumed.

* Fix whitespace issues in docs
This commit is contained in:
Alexander Theißen
2020-04-03 16:45:30 +02:00
committed by GitHub
parent 14505471ee
commit 8f819f4ba6
11 changed files with 202 additions and 23 deletions
+1 -3
View File
@@ -87,7 +87,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use sp_std::prelude::*;
use sp_runtime::{traits::{StaticLookup, Dispatchable}, DispatchError};
use sp_runtime::traits::{StaticLookup, Dispatchable};
use frame_support::{
Parameter, decl_module, decl_event, decl_storage, decl_error, ensure,
@@ -133,7 +133,6 @@ decl_module! {
let res = match call.dispatch(frame_system::RawOrigin::Root.into()) {
Ok(_) => true,
Err(e) => {
let e: DispatchError = e.into();
sp_runtime::print(e);
false
}
@@ -192,7 +191,6 @@ decl_module! {
let res = match call.dispatch(frame_system::RawOrigin::Signed(who).into()) {
Ok(_) => true,
Err(e) => {
let e: DispatchError = e.into();
sp_runtime::print(e);
false
}