Skip to content

Commit

Permalink
runtime fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed Aug 15, 2023
1 parent 8833d46 commit cf474a4
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use frame_support::{
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Currency, Everything, FindAuthor,
Imbalance, OnFinalize, OnUnbalanced,
Imbalance, OnFinalize, OnUnbalanced, EitherOfDiverse
},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight},
PalletId,
Expand All @@ -51,9 +51,10 @@ use frame_system::{
EnsureRoot, EnsureSigned,
};
use pallet_balances::NegativeImbalance;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_config::{RelayLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
Expand Down Expand Up @@ -514,10 +515,15 @@ parameter_types! {
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const MaxInvulnerables: u32 = 100;
pub const ExecutiveBody: BodyId = BodyId::Executive;
// StakingAdmin pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Defense;
}

// We allow root only to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EnsureRoot<AccountId>;
/// We allow root and the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>,
>;

impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down Expand Up @@ -747,7 +753,7 @@ impl pallet_template::Config for Runtime {

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic,
Expand All @@ -766,7 +772,7 @@ construct_runtime!(
Balances: pallet_balances = 10,
TransactionPayment: pallet_transaction_payment = 11,

// Governance and Utility
// Governance
Sudo: pallet_sudo = 15,
Council: pallet_collective::<Instance1> = 16,
Motion: pallet_motion = 17,
Expand Down Expand Up @@ -890,6 +896,7 @@ mod benches {
define_benchmarks!(
[frame_system, SystemBench::<Runtime>]
[pallet_balances, Balances]
[pallet_assets, Assets]
[pallet_session, SessionBench::<Runtime>]
[pallet_timestamp, Timestamp]
[pallet_collator_selection, CollatorSelection]
Expand Down Expand Up @@ -1329,7 +1336,7 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
use pallet_evm::Pallet as PalletEvmBench;
use pallet_hotfix_sufficients::Pallet as PalletHotfixSufficients;

Expand All @@ -1340,7 +1347,7 @@ impl_runtime_apis! {
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

use frame_support::traits::WhitelistedStorageKeys;
let whitelist = AllPalletWithSystem::whitelisted_storage_keys();
let whitelist = AllPalletsWithSystem::whitelisted_storage_keys();

let mut batches = Vec::<BenchmarkBatch>::new();
let params = (&config, &whitelist);
Expand Down

0 comments on commit cf474a4

Please sign in to comment.