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

Feat/1208686290667473 import scheduler pallet #328

Merged
merged 3 commits into from
Jan 22, 2025
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
6 changes: 6 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ sc-utils = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq
sp-staking = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq-polkadot-v1.7.2", default-features = false }
frame-try-runtime = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq-polkadot-v1.7.2", default-features = false }
try-runtime-cli = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq-polkadot-v1.7.2"}
pallet-scheduler = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq-polkadot-v1.7.2", default-features = false }
pallet-preimage = { git = "https://github.com/peaqnetwork/polkadot-sdk", branch = "peaq-polkadot-v1.7.2", default-features = false }

zenlink-protocol = { git = "https://github.com/peaqnetwork/Zenlink-DEX-Module", branch = "peaq-polkadot-v1.7.2", default-features = false }
zenlink-protocol-rpc = { git = "https://github.com/peaqnetwork/Zenlink-DEX-Module", branch = "peaq-polkadot-v1.7.2", default-features = false }
Expand Down
8 changes: 8 additions & 0 deletions runtime/krest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ pallet-evm-precompile-parachain-staking = { path = "../../precompiles/parachain-
pallet-evm-precompile-vesting = { path = "../../precompiles/vesting", default-features = false }
pallet-evm-precompile-balances-erc20 = { path = "../../precompiles/balances-erc20", default-features = false}
runtime-common = { path = "../common", default-features = false }
pallet-scheduler = { workspace = true, default-features = false }
pallet-preimage = { workspace = true, default-features = false }

xc-asset-config = { path = "../../pallets/xc-asset-config", default-features = false }
address-unification = { path = "../../pallets/address-unification", default-features = false }
Expand Down Expand Up @@ -178,6 +180,8 @@ runtime-benchmarks = [
"peaq-pallet-rbac/runtime-benchmarks",
"peaq-pallet-storage/runtime-benchmarks",
"inflation-manager/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks"
]

std = [
Expand Down Expand Up @@ -222,6 +226,8 @@ std = [
"pallet-treasury/std",
"pallet-collective/std",
"pallet-vesting/std",
"pallet-scheduler/std",
"pallet-preimage/std",

# ETH support
"sp-io/std",
Expand Down Expand Up @@ -342,6 +348,8 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-multisig/try-runtime",
"pallet-assets/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-preimage/try-runtime",

"orml-currencies/try-runtime",
"orml-xtokens/try-runtime",
Expand Down
46 changes: 45 additions & 1 deletion runtime/krest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ use peaq_pallet_storage::traits::Storage;
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use sp_runtime::traits::IdentityLookup;

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{
tokens::{fungible::HoldConsideration, PayFromAccount, UnityAssetBalanceConversion},
EqualPrivilegeOnly, LinearStoragePrice,
};
use smallvec::smallvec;
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -1034,6 +1037,43 @@ impl inflation_manager::Config for Runtime {
type BlockRewardBeforeInitialize = BlockRewardBeforeInitialize;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block;
}

impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = ConstU32<50>;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = Preimage;
}

parameter_types! {
pub const PreimageBaseDeposit: Balance = DOLLARS / 10;
pub const PreimageByteDeposit: Balance = DOLLARS;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down Expand Up @@ -1067,6 +1107,10 @@ construct_runtime!(
BlockReward: pallet_block_reward::{Pallet, Call, Storage, Config<T>, Event<T>} = 26,
// Remove StakingCoefficientRewardCalculator: 27

// Governance stuff
Scheduler: pallet_scheduler::{Pallet, Storage, Event<T>, Call} = 27,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 28,

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm = 31,
Expand Down
8 changes: 8 additions & 0 deletions runtime/peaq-dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ peaq-pallet-mor = { workspace = true, default-features = false }
xc-asset-config = { path = "../../pallets/xc-asset-config", default-features = false }
address-unification = { path = "../../pallets/address-unification", default-features = false }
inflation-manager = { path = "../../pallets/inflation-manager", default-features = false }
pallet-scheduler = { workspace = true, default-features = false }
pallet-preimage = { workspace = true, default-features = false }

zenlink-protocol = { workspace = true, default-features = false }
zenlink-protocol-runtime-api = { workspace = true, default-features = false }
Expand Down Expand Up @@ -179,6 +181,8 @@ runtime-benchmarks = [
"peaq-pallet-storage/runtime-benchmarks",
"peaq-pallet-mor/runtime-benchmarks",
"inflation-manager/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks"
]

std = [
Expand All @@ -198,6 +202,8 @@ std = [
"pallet-transaction-payment/std",
"pallet-multisig/std",
"pallet-assets/std",
"pallet-scheduler/std",
"pallet-preimage/std",

"sp-api/std",
"sp-block-builder/std",
Expand Down Expand Up @@ -344,6 +350,8 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-multisig/try-runtime",
"pallet-assets/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-preimage/try-runtime",

"orml-currencies/try-runtime",
"orml-xtokens/try-runtime",
Expand Down
46 changes: 45 additions & 1 deletion runtime/peaq-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ use peaq_pallet_storage::traits::Storage;
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use sp_runtime::traits::IdentityLookup;

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{
tokens::{fungible::HoldConsideration, PayFromAccount, UnityAssetBalanceConversion},
EqualPrivilegeOnly, LinearStoragePrice,
};
use smallvec::smallvec;
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -1048,6 +1051,43 @@ impl inflation_manager::Config for Runtime {
type BlockRewardBeforeInitialize = BlockRewardBeforeInitialize;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block;
}

impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = ConstU32<50>;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = Preimage;
}

parameter_types! {
pub const PreimageBaseDeposit: Balance = DOLLARS / 10;
pub const PreimageByteDeposit: Balance = DOLLARS;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down Expand Up @@ -1081,6 +1121,10 @@ construct_runtime!(
BlockReward: pallet_block_reward::{Pallet, Call, Storage, Config<T>, Event<T>} = 26,
// Remove StakingCoefficientRewardCalculator: 27

// Governance stuff
Scheduler: pallet_scheduler::{Pallet, Storage, Event<T>, Call} = 27,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 28,

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
PolkadotXcm: pallet_xcm = 31,
Expand Down
8 changes: 8 additions & 0 deletions runtime/peaq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pallet-evm-precompile-parachain-staking = { path = "../../precompiles/parachain-
pallet-evm-precompile-vesting = { path = "../../precompiles/vesting", default-features = false }
pallet-evm-precompile-balances-erc20 = { path = "../../precompiles/balances-erc20", default-features = false}
runtime-common = { path = "../common", default-features = false }
pallet-scheduler = { workspace = true, default-features = false }
pallet-preimage = { workspace = true, default-features = false }

xc-asset-config = { path = "../../pallets/xc-asset-config", default-features = false }
address-unification = { path = "../../pallets/address-unification", default-features = false }
Expand Down Expand Up @@ -177,6 +179,8 @@ runtime-benchmarks = [
"peaq-pallet-rbac/runtime-benchmarks",
"peaq-pallet-storage/runtime-benchmarks",
"inflation-manager/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks"
]

std = [
Expand Down Expand Up @@ -221,6 +225,8 @@ std = [
"pallet-treasury/std",
"pallet-collective/std",
"pallet-vesting/std",
"pallet-scheduler/std",
"pallet-preimage/std",

# ETH support
"sp-io/std",
Expand Down Expand Up @@ -339,6 +345,8 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-multisig/try-runtime",
"pallet-assets/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-preimage/try-runtime",

"orml-currencies/try-runtime",
"orml-xtokens/try-runtime",
Expand Down
47 changes: 46 additions & 1 deletion runtime/peaq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ use peaq_pallet_storage::traits::Storage;
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use sp_runtime::traits::IdentityLookup;

use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
use frame_support::traits::{
tokens::{fungible::HoldConsideration, PayFromAccount, UnityAssetBalanceConversion},
EqualPrivilegeOnly, LinearStoragePrice,
};

use smallvec::smallvec;
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -1066,6 +1070,43 @@ impl inflation_manager::Config for Runtime {
type BlockRewardBeforeInitialize = BlockRewardBeforeInitialize;
}

parameter_types! {
pub MaximumSchedulerWeight: Weight = NORMAL_DISPATCH_RATIO * RuntimeBlockWeights::get().max_block;
}

impl pallet_scheduler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type PalletsOrigin = OriginCaller;
type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = ConstU32<50>;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = Preimage;
}

parameter_types! {
pub const PreimageBaseDeposit: Balance = DOLLARS / 10;
pub const PreimageByteDeposit: Balance = DOLLARS;
pub const PreimageHoldReason: RuntimeHoldReason =
RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down Expand Up @@ -1098,6 +1139,10 @@ construct_runtime!(
ParachainInfo: parachain_info = 25,
BlockReward: pallet_block_reward::{Pallet, Call, Storage, Config<T>, Event<T>} = 26,
// Remove StakingCoefficientRewardCalculator: 27
//
// Governance stuff
Scheduler: pallet_scheduler::{Pallet, Storage, Event<T>, Call} = 27,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 28,

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
Expand Down