Fix executive test (#7243)

* fix executive test

* add unallowed unsigned test

* better to have also unsigned pre_dispatch check tested
This commit is contained in:
Guillaume Thiolliere
2020-10-01 14:40:45 +02:00
committed by GitHub
parent a2c4b38eb6
commit a31637def8
3 changed files with 83 additions and 55 deletions
+11 -4
View File
@@ -313,11 +313,17 @@ impl<Origin, Call, Extra> Applyable for TestXt<Call, Extra> where
/// Checks to see if this is a valid *transaction*. It returns information on it if so.
fn validate<U: ValidateUnsigned<Call=Self::Call>>(
&self,
_source: TransactionSource,
_info: &DispatchInfoOf<Self::Call>,
_len: usize,
source: TransactionSource,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> TransactionValidity {
Ok(Default::default())
if let Some((ref id, ref extra)) = self.signature {
Extra::validate(extra, id, &self.call, info, len)
} else {
let valid = Extra::validate_unsigned(&self.call, info, len)?;
let unsigned_validation = U::validate_unsigned(source, &self.call)?;
Ok(valid.combine_with(unsigned_validation))
}
}
/// Executes all necessary logic needed prior to dispatch and deconstructs into function call,
@@ -332,6 +338,7 @@ impl<Origin, Call, Extra> Applyable for TestXt<Call, Extra> where
Some(who)
} else {
Extra::pre_dispatch_unsigned(&self.call, info, len)?;
U::pre_dispatch(&self.call)?;
None
};