Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSUB-899: Add pallet_scheduler #168

Merged
merged 3 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ jobs:
SUDO_SEED: ${{ secrets.DEVNET_SUDO_SEED }}
run: |
node dist/scripts/runtimeUpgrade.js "$DEVNET_URL" \
../wasm/runtime/target/srtool/release/wbuild/creditcoin3-runtime/creditcoin3_runtime.compact.compressed.wasm "$SUDO_SEED" 0
../wasm/runtime/target/srtool/release/wbuild/creditcoin3-runtime/creditcoin3_runtime.compact.compressed.wasm "$SUDO_SEED" 5
25 changes: 22 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["node", "runtime", "runtime/generate-bags"]
resolver = "2"

[workspace.package]
version = "3.13.0"
version = "3.14.0"
authors = ["Gluwa Inc.", "Nathan Whitaker <nathan.whitaker@gluwa.com>"]
edition = "2021"
license = "Unlicense"
Expand Down Expand Up @@ -131,6 +131,7 @@ pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/gluwa/polkadot-sdk", branch = "release-polkadot-v1.1.0-patch" }
pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/gluwa/polkadot-sdk", branch = "release-polkadot-v1.1.0-patch", default-features = false }
pallet-utility = { version = "4.0.0-dev", git = "https://github.com/gluwa/polkadot-sdk", branch = "release-polkadot-v1.1.0-patch", default-features = false }
pallet-scheduler = { version = "4.0.0-dev", git = "https://github.com/gluwa/polkadot-sdk.git", branch="release-polkadot-v1.1.0-patch", default-features = false }
# Substrate Utility
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/gluwa/polkadot-sdk", branch = "release-polkadot-v1.1.0-patch" }
substrate-prometheus-endpoint = { version = "0.10.0-dev", git = "https://github.com/gluwa/polkadot-sdk", branch = "release-polkadot-v1.1.0-patch" }
Expand Down
2 changes: 1 addition & 1 deletion cli/creditcoin.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions cli/src/lib/interfaces/augment-api-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
FrameSystemLimitsBlockWeights,
SpVersionRuntimeVersion,
SpWeightsRuntimeDbWeight,
SpWeightsWeightV2Weight,
} from '@polkadot/types/lookup';

export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;
Expand Down Expand Up @@ -231,6 +232,24 @@ declare module '@polkadot/api-base/types/consts' {
**/
[key: string]: Codec;
};
scheduler: {
/**
* The maximum weight that may be scheduled per block for any dispatchables.
**/
maximumWeight: SpWeightsWeightV2Weight & AugmentedConst<ApiType>;
/**
* The maximum number of scheduled calls in the queue for a single block.
*
* NOTE:
* + Dependent pallets' benchmarks might require a higher limit for the setting. Set a
* higher limit under `runtime-benchmarks` feature.
**/
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
/**
* Generic const
**/
[key: string]: Codec;
};
staking: {
/**
* Number of eras that staked funds must remain bonded for.
Expand Down
26 changes: 26 additions & 0 deletions cli/src/lib/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,32 @@ declare module '@polkadot/api-base/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
scheduler: {
/**
* Failed to schedule a call
**/
FailedToSchedule: AugmentedError<ApiType>;
/**
* Attempt to use a non-named function on a named task.
**/
Named: AugmentedError<ApiType>;
/**
* Cannot find the scheduled call.
**/
NotFound: AugmentedError<ApiType>;
/**
* Reschedule failed because it does not change scheduled time.
**/
RescheduleNoChange: AugmentedError<ApiType>;
/**
* Given target block number is in the past.
**/
TargetBlockNumberInPast: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
session: {
/**
* Registered duplicate key.
Expand Down
46 changes: 46 additions & 0 deletions cli/src/lib/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,52 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
scheduler: {
/**
* The call for the provided hash was not found so the task has been aborted.
**/
CallUnavailable: AugmentedEvent<
ApiType,
[task: ITuple<[u32, u32]>, id: Option<U8aFixed>],
{ task: ITuple<[u32, u32]>; id: Option<U8aFixed> }
>;
/**
* Canceled some task.
**/
Canceled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32; index: u32 }>;
/**
* Dispatched some task.
**/
Dispatched: AugmentedEvent<
ApiType,
[task: ITuple<[u32, u32]>, id: Option<U8aFixed>, result: Result<Null, SpRuntimeDispatchError>],
{ task: ITuple<[u32, u32]>; id: Option<U8aFixed>; result: Result<Null, SpRuntimeDispatchError> }
>;
/**
* The given task was unable to be renewed since the agenda is full at that block.
**/
PeriodicFailed: AugmentedEvent<
ApiType,
[task: ITuple<[u32, u32]>, id: Option<U8aFixed>],
{ task: ITuple<[u32, u32]>; id: Option<U8aFixed> }
>;
/**
* The given task can never be executed since it is overweight.
**/
PermanentlyOverweight: AugmentedEvent<
ApiType,
[task: ITuple<[u32, u32]>, id: Option<U8aFixed>],
{ task: ITuple<[u32, u32]>; id: Option<U8aFixed> }
>;
/**
* Scheduled some task.
**/
Scheduled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32; index: u32 }>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
session: {
/**
* New session has happened. Note that the argument is the session index, not the
Expand Down
30 changes: 30 additions & 0 deletions cli/src/lib/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import type {
PalletNominationPoolsSubPools,
PalletProxyAnnouncement,
PalletProxyProxyDefinition,
PalletSchedulerScheduled,
PalletStakingActiveEraInfo,
PalletStakingEraRewardPoints,
PalletStakingExposure,
Expand Down Expand Up @@ -785,6 +786,35 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
scheduler: {
/**
* Items to be executed, indexed by the block number that they should be executed on.
**/
agenda: AugmentedQuery<
ApiType,
(arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<Option<PalletSchedulerScheduled>>>,
[u32]
> &
QueryableStorageEntry<ApiType, [u32]>;
incompleteSince: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> &
QueryableStorageEntry<ApiType, []>;
/**
* Lookup from a name to the block number and index of the task.
*
* For v3 -> v4 the previously unbounded identities are Blake2-256 hashed to form the v4
* identities.
**/
lookup: AugmentedQuery<
ApiType,
(arg: U8aFixed | string | Uint8Array) => Observable<Option<ITuple<[u32, u32]>>>,
[U8aFixed]
> &
QueryableStorageEntry<ApiType, [U8aFixed]>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
session: {
/**
* Current index of the session.
Expand Down
95 changes: 94 additions & 1 deletion cli/src/lib/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
SubmittableExtrinsicFunction,
} from '@polkadot/api-base/types';
import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, U256, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { Bytes, Compact, Option, U256, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type {
AccountId32,
Expand Down Expand Up @@ -1330,6 +1330,99 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
scheduler: {
/**
* See [`Pallet::cancel`].
**/
cancel: AugmentedSubmittable<
(
when: u32 | AnyNumber | Uint8Array,
index: u32 | AnyNumber | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[u32, u32]
>;
/**
* See [`Pallet::cancel_named`].
**/
cancelNamed: AugmentedSubmittable<
(id: U8aFixed | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
[U8aFixed]
>;
/**
* See [`Pallet::schedule`].
**/
schedule: AugmentedSubmittable<
(
when: u32 | AnyNumber | Uint8Array,
maybePeriodic:
| Option<ITuple<[u32, u32]>>
| null
| Uint8Array
| ITuple<[u32, u32]>
| [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array],
priority: u8 | AnyNumber | Uint8Array,
call: Call | IMethod | string | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[u32, Option<ITuple<[u32, u32]>>, u8, Call]
>;
/**
* See [`Pallet::schedule_after`].
**/
scheduleAfter: AugmentedSubmittable<
(
after: u32 | AnyNumber | Uint8Array,
maybePeriodic:
| Option<ITuple<[u32, u32]>>
| null
| Uint8Array
| ITuple<[u32, u32]>
| [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array],
priority: u8 | AnyNumber | Uint8Array,
call: Call | IMethod | string | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[u32, Option<ITuple<[u32, u32]>>, u8, Call]
>;
/**
* See [`Pallet::schedule_named`].
**/
scheduleNamed: AugmentedSubmittable<
(
id: U8aFixed | string | Uint8Array,
when: u32 | AnyNumber | Uint8Array,
maybePeriodic:
| Option<ITuple<[u32, u32]>>
| null
| Uint8Array
| ITuple<[u32, u32]>
| [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array],
priority: u8 | AnyNumber | Uint8Array,
call: Call | IMethod | string | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[U8aFixed, u32, Option<ITuple<[u32, u32]>>, u8, Call]
>;
/**
* See [`Pallet::schedule_named_after`].
**/
scheduleNamedAfter: AugmentedSubmittable<
(
id: U8aFixed | string | Uint8Array,
after: u32 | AnyNumber | Uint8Array,
maybePeriodic:
| Option<ITuple<[u32, u32]>>
| null
| Uint8Array
| ITuple<[u32, u32]>
| [u32 | AnyNumber | Uint8Array, u32 | AnyNumber | Uint8Array],
priority: u8 | AnyNumber | Uint8Array,
call: Call | IMethod | string | Uint8Array,
) => SubmittableExtrinsic<ApiType>,
[U8aFixed, u32, Option<ITuple<[u32, u32]>>, u8, Call]
>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
session: {
/**
* See [`Pallet::purge_keys`].
Expand Down
Loading