mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 03:18:01 +00:00
Introduce in-origin filtering (#6318)
* impl filter in origin * remove IsCallable usage. Breaking: utility::batch(root, calls) no longer bypass BasicCallFilter * rename BasicCallFilter -> BaseCallFilter * refactor code * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * remove forgotten temporar comment * better add suggestion in another PR * refactor: use Clone instead of mem::replace * fix tests * fix tests * fix tests * fix benchmarks * Make root bypass filter in utility::batch * fix unused imports Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
97cac4ce8b
commit
c2ad27271b
@@ -481,8 +481,9 @@ mod tests {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
impl system::Trait for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = ();
|
||||
type Call = Call;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
@@ -702,14 +703,14 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = Box::new(Call::Logger(logger::Call::log(69, 1000)));
|
||||
let call2 = Box::new(Call::Logger(logger::Call::log(42, 1000)));
|
||||
assert_ok!(Scheduler::schedule_named(Origin::ROOT, 1u32.encode(), 4, None, 127, call));
|
||||
assert_ok!(Scheduler::schedule(Origin::ROOT, 4, None, 127, call2));
|
||||
assert_ok!(Scheduler::schedule_named(Origin::root(), 1u32.encode(), 4, None, 127, call));
|
||||
assert_ok!(Scheduler::schedule(Origin::root(), 4, None, 127, call2));
|
||||
run_to_block(3);
|
||||
// Scheduled calls are in the agenda.
|
||||
assert_eq!(Agenda::<Test>::get(4).len(), 2);
|
||||
assert!(logger::log().is_empty());
|
||||
assert_ok!(Scheduler::cancel_named(Origin::ROOT, 1u32.encode()));
|
||||
assert_ok!(Scheduler::cancel(Origin::ROOT, 4, 1));
|
||||
assert_ok!(Scheduler::cancel_named(Origin::root(), 1u32.encode()));
|
||||
assert_ok!(Scheduler::cancel(Origin::root(), 4, 1));
|
||||
// Scheduled calls are made NONE, so should not effect state
|
||||
run_to_block(100);
|
||||
assert!(logger::log().is_empty());
|
||||
|
||||
Reference in New Issue
Block a user