allow to specify schedule time as a relative value (#6578)

* allow to specify schedule time as a relative value

* bump version

* line width

* fix benchmarks

* rename and updates
This commit is contained in:
Xiliang Chen
2020-07-15 17:19:21 +12:00
committed by GitHub
parent c802d425d9
commit 8f4329823a
6 changed files with 169 additions and 39 deletions
@@ -22,7 +22,7 @@ use super::*;
use frame_benchmarking::{benchmarks, account};
use frame_support::{
IterableStorageMap,
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable},
traits::{Currency, Get, EnsureOrigin, OnInitialize, UnfilteredDispatchable, schedule::DispatchTime},
};
use frame_system::{RawOrigin, Module as System, self, EventRecord};
use sp_runtime::traits::{Bounded, One};
@@ -76,7 +76,7 @@ fn add_referendum<T: Trait>(n: u32) -> Result<ReferendumIndex, &'static str> {
let referendum_index: ReferendumIndex = ReferendumCount::get() - 1;
T::Scheduler::schedule_named(
(DEMOCRACY_ID, referendum_index).encode(),
1.into(),
DispatchTime::At(1.into()),
None,
63,
system::RawOrigin::Root.into(),
+2 -2
View File
@@ -163,7 +163,7 @@ use frame_support::{
weights::{Weight, DispatchClass},
traits::{
Currency, ReservableCurrency, LockableCurrency, WithdrawReason, LockIdentifier, Get,
OnUnbalanced, BalanceStatus, schedule::Named as ScheduleNamed, EnsureOrigin
OnUnbalanced, BalanceStatus, schedule::{Named as ScheduleNamed, DispatchTime}, EnsureOrigin
},
dispatch::DispatchResultWithPostInfo,
};
@@ -1688,7 +1688,7 @@ impl<T: Trait> Module<T> {
if T::Scheduler::schedule_named(
(DEMOCRACY_ID, index).encode(),
when,
DispatchTime::At(when),
None,
63,
system::RawOrigin::Root.into(),