-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
frame/scheduler/src/lib.rs
Outdated
@@ -680,21 +898,23 @@ impl<T: Config> Pallet<T> { | |||
) -> Result<TaskAddress<T::BlockNumber>, DispatchError> { | |||
let when = Self::resolve_time(when)?; | |||
call.ensure_requested::<T::PreimageProvider>(); | |||
let call = EncodedCallOrHashOf::<T>::new(call)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used here @shawntabrizi @KiChjang
frame/scheduler/src/lib.rs
Outdated
#[derive(MaxEncodedLen, Debug, Decode, Clone, Encode, PartialEq, Eq, scale_info::TypeInfo)] | ||
#[codec(mel_bound(T: Config))] | ||
#[scale_info(skip_type_params(T))] | ||
pub struct EncodedCallOrHashOf<T: Config>(pub BoundedVec<u8, <T as Config>::MaxCallLen>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined here @shawntabrizi @KiChjang
frame/scheduler/src/lib.rs
Outdated
@@ -93,12 +123,49 @@ struct ScheduledV1<Call, BlockNumber> { | |||
maybe_periodic: Option<schedule::Period<BlockNumber>>, | |||
} | |||
|
|||
// NOTE: use `Derivative` here until <https://github.com/rust-lang/rust/issues/26925> is fixed. | |||
// The problem is that `#[derive(Clone)]` requires `Clone` for ALL its generic types, | |||
// which does not make sense for `Get<>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means you should derive CloneNoBound
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was looking for something like this. Thank you, sir!
@@ -231,11 +310,37 @@ pub mod pallet { | |||
/// be used. This will only check if two given origins are equal. | |||
type OriginPrivilegeCmp: PrivilegeCmp<Self::PalletsOrigin>; | |||
|
|||
/// Maximum number of tasks that an be scheduled in total. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Maximum number of tasks that an be scheduled in total. | |
/// Maximum number of tasks that can be scheduled in total. |
|
||
if Agenda::<T>::try_append(until, s).is_err() { | ||
// There is not enough room in the future block where the call | ||
// should be re-scheduled. Nothing that we can do about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log a warning perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will maybe emit a Canceled
event here, last time I tried ti somehow did not work.
But yea, a log would also be useful.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Superseded by #11649 |
Fixes #11565
WIP:
Call
andOriginCaller
Changes:
MaxScheduledPerBlock
is now a hard instead of soft limit.Problems:
schedule
call is currently guaranteed to succeed if called with valid arguments. If we now bound the number of agendas per block because ofMaxEncodedLen
, then someone could pre-fill a block with agendas and the governanceschedule
call would fail. Currently this is not a problem since the number of schedules per block is unbound.Special attention from reviews please:
current_storage_version
toon_chain_current_storage_version
as it otherwise does not verify that the migration updated the storage versionEvent::CallLookupFailed
is unused, can I just remove it?