mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 10:27:59 +00:00
Allow modules to validate transaction, second attempt (#2463)
* first impl * rename origin::inherent to none * fix * fix * Apply suggestions from code review Co-Authored-By: thiolliere <gui.thiolliere@gmail.com> * comment * better error * doc * (add unsigned module 🤦) * doc * fix * implement for node-template as well * add validated unsigned to executor * fix * fix * bump version * testing xt * remove extraneous logic * licence * impl test
This commit is contained in:
@@ -29,7 +29,7 @@ use srml_support::StorageValue;
|
||||
use primitives::traits::{As, One, Zero};
|
||||
use rstd::{prelude::*, result, cmp, vec};
|
||||
use parity_codec::Decode;
|
||||
use srml_system::{ensure_inherent, Trait as SystemTrait};
|
||||
use srml_system::{ensure_none, Trait as SystemTrait};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use parity_codec::Encode;
|
||||
@@ -117,7 +117,7 @@ decl_module! {
|
||||
/// Hint that the author of this block thinks the best finalized
|
||||
/// block is the given number.
|
||||
fn final_hint(origin, #[compact] hint: T::BlockNumber) {
|
||||
ensure_inherent(origin)?;
|
||||
ensure_none(origin)?;
|
||||
assert!(!<Self as Store>::Update::exists(), "Final hint must be updated only once in the block");
|
||||
assert!(
|
||||
srml_system::Module::<T>::block_number() >= hint,
|
||||
@@ -372,7 +372,7 @@ mod tests {
|
||||
System::initialize(&i, &parent_hash, &Default::default());
|
||||
assert_ok!(FinalityTracker::dispatch(
|
||||
Call::final_hint(i-1),
|
||||
Origin::INHERENT,
|
||||
Origin::NONE,
|
||||
));
|
||||
FinalityTracker::on_finalize(i);
|
||||
let hdr = System::finalize();
|
||||
|
||||
Reference in New Issue
Block a user