Renaming and documentation for ApplyResult, ApplyOutcome and et al (#4134)

* Remove superflous errors from the system module

* Rename and document InclusionOutcome

* Rename InclusionError

* Remove unused inclusion errors.

I left the enumeration though since other elements might be used some day.

* Rename and document DispatchOutcome

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* TransactionValidityError instead of InclusionError

* Rename InclusionOutcome to ApplyExtrinsicResult

* Update docs.

* Update lib.rs

should be → is

* Bump the block builder API version.

* Fix the should_return_runtime_version test

* Clean the evidence
This commit is contained in:
Sergei Pepyakin
2019-11-22 17:15:58 +01:00
committed by GitHub
parent 86b6ac5571
commit 68351da29b
19 changed files with 186 additions and 129 deletions
+4 -6
View File
@@ -98,7 +98,7 @@ use rstd::fmt::Debug;
use sr_version::RuntimeVersion;
use sr_primitives::{
RuntimeDebug,
generic::{self, Era}, Perbill, ApplyError, ApplyOutcome, DispatchError,
generic::{self, Era}, Perbill, DispatchOutcome, DispatchError,
transaction_validity::{
ValidTransaction, TransactionPriority, TransactionLongevity, TransactionValidityError,
InvalidTransaction, TransactionValidity,
@@ -320,8 +320,6 @@ decl_event!(
decl_error! {
/// Error for the System module
pub enum Error {
BadSignature,
BlockFull,
RequireSignedOrigin,
RequireRootOrigin,
RequireNoOrigin,
@@ -754,7 +752,7 @@ impl<T: Trait> Module<T> {
}
/// To be called immediately after an extrinsic has been applied.
pub fn note_applied_extrinsic(r: &ApplyOutcome, _encoded_len: u32, info: DispatchInfo) {
pub fn note_applied_extrinsic(r: &DispatchOutcome, _encoded_len: u32, info: DispatchInfo) {
Self::deposit_event(
match r {
Ok(()) => Event::ExtrinsicSuccess(info),
@@ -865,7 +863,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> {
_call: &Self::Call,
info: Self::DispatchInfo,
len: usize,
) -> Result<(), ApplyError> {
) -> Result<(), TransactionValidityError> {
let next_len = Self::check_block_length(info, len)?;
AllExtrinsicsLen::put(next_len);
let next_weight = Self::check_weight(info)?;
@@ -945,7 +943,7 @@ impl<T: Trait> SignedExtension for CheckNonce<T> {
_call: &Self::Call,
_info: Self::DispatchInfo,
_len: usize,
) -> Result<(), ApplyError> {
) -> Result<(), TransactionValidityError> {
let expected = <AccountNonce<T>>::get(who);
if self.0 != expected {
return Err(