Unverified Commit e4159a01 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

rococo-runtime: Switch to latest `construct_runtime!` syntax (#4389)

* rococo-runtime: Switch to latest `construct_runtime!` syntax

Besides that it fixes pallet macro errors in other crates that popped up
because of this switch.

* FMT
parent c600fef7
Pipeline #168521 passed with stages
in 44 minutes and 39 seconds
...@@ -366,7 +366,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene ...@@ -366,7 +366,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
paras: Default::default(), paras: Default::default(),
xcm_pallet: polkadot::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -550,7 +550,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi ...@@ -550,7 +550,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: westend_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -746,7 +746,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC ...@@ -746,7 +746,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
}, },
gilt: Default::default(), gilt: Default::default(),
paras: Default::default(), paras: Default::default(),
xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -1043,7 +1043,8 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime:: ...@@ -1043,7 +1043,8 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: rococo_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
transaction_payment: Default::default(),
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { // bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(endowed_accounts[0].clone()), // owner: Some(endowed_accounts[0].clone()),
// ..Default::default() // ..Default::default()
...@@ -1311,7 +1312,7 @@ pub fn polkadot_testnet_genesis( ...@@ -1311,7 +1312,7 @@ pub fn polkadot_testnet_genesis(
config: default_parachains_host_configuration(), config: default_parachains_host_configuration(),
}, },
paras: Default::default(), paras: Default::default(),
xcm_pallet: polkadot::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -1398,7 +1399,7 @@ pub fn kusama_testnet_genesis( ...@@ -1398,7 +1399,7 @@ pub fn kusama_testnet_genesis(
}, },
gilt: Default::default(), gilt: Default::default(),
paras: Default::default(), paras: Default::default(),
xcm_pallet: kusama::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -1478,7 +1479,7 @@ pub fn westend_testnet_genesis( ...@@ -1478,7 +1479,7 @@ pub fn westend_testnet_genesis(
registrar: westend_runtime::RegistrarConfig { registrar: westend_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: westend_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
} }
} }
...@@ -1552,7 +1553,8 @@ pub fn rococo_testnet_genesis( ...@@ -1552,7 +1553,8 @@ pub fn rococo_testnet_genesis(
registrar: rococo_runtime::RegistrarConfig { registrar: rococo_runtime::RegistrarConfig {
next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID, next_free_para_id: polkadot_primitives::v1::LOWEST_PUBLIC_ID,
}, },
xcm_pallet: rococo_runtime::XcmPalletConfig { safe_xcm_version: Some(2) }, xcm_pallet: Default::default(),
transaction_payment: Default::default(),
// bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig { // bridge_rococo_grandpa: rococo_runtime::BridgeRococoGrandpaConfig {
// owner: Some(root_key.clone()), // owner: Some(root_key.clone()),
// ..Default::default() // ..Default::default()
......
...@@ -32,7 +32,9 @@ use frame_system::EnsureRoot; ...@@ -32,7 +32,9 @@ use frame_system::EnsureRoot;
use primitives::v1::{ use primitives::v1::{
BlockNumber, HeadData, Header, Id as ParaId, ValidationCode, LOWEST_PUBLIC_ID, BlockNumber, HeadData, Header, Id as ParaId, ValidationCode, LOWEST_PUBLIC_ID,
}; };
use runtime_parachains::{configuration, paras, shared, Origin as ParaOrigin, ParaLifecycle}; use runtime_parachains::{
configuration, origin, paras, shared, Origin as ParaOrigin, ParaLifecycle,
};
use sp_core::{crypto::KeyTypeId, H256}; use sp_core::{crypto::KeyTypeId, H256};
use sp_io::TestExternalities; use sp_io::TestExternalities;
use sp_keystore::{testing::KeyStore, KeystoreExt}; use sp_keystore::{testing::KeyStore, KeystoreExt};
...@@ -59,8 +61,9 @@ frame_support::construct_runtime!( ...@@ -59,8 +61,9 @@ frame_support::construct_runtime!(
// Parachains Runtime // Parachains Runtime
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config}, Paras: paras::{Pallet, Call, Storage, Event, Config},
ParasShared: shared::{Pallet, Call, Storage}, ParasShared: shared::{Pallet, Call, Storage},
ParachainsOrigin: origin::{Pallet, Origin},
// Para Onboarding Pallets // Para Onboarding Pallets
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
...@@ -164,8 +167,9 @@ impl configuration::Config for Test { ...@@ -164,8 +167,9 @@ impl configuration::Config for Test {
impl shared::Config for Test {} impl shared::Config for Test {}
impl origin::Config for Test {}
impl paras::Config for Test { impl paras::Config for Test {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = paras::TestWeightInfo; type WeightInfo = paras::TestWeightInfo;
} }
......
...@@ -578,7 +578,7 @@ mod tests { ...@@ -578,7 +578,7 @@ mod tests {
use frame_system::limits; use frame_system::limits;
use pallet_balances::Error as BalancesError; use pallet_balances::Error as BalancesError;
use primitives::v1::{Balance, BlockNumber, Header}; use primitives::v1::{Balance, BlockNumber, Header};
use runtime_parachains::{configuration, shared}; use runtime_parachains::{configuration, origin, shared};
use sp_core::H256; use sp_core::H256;
use sp_io::TestExternalities; use sp_io::TestExternalities;
use sp_runtime::{ use sp_runtime::{
...@@ -598,9 +598,10 @@ mod tests { ...@@ -598,9 +598,10 @@ mod tests {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration::{Pallet, Call, Storage, Config<T>},
Parachains: paras::{Pallet, Origin, Call, Storage, Config, Event}, Parachains: paras::{Pallet, Call, Storage, Config, Event},
ParasShared: shared::{Pallet, Call, Storage}, ParasShared: shared::{Pallet, Call, Storage},
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>}, Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>},
ParachainsOrigin: origin::{Pallet, Origin},
} }
); );
...@@ -657,8 +658,9 @@ mod tests { ...@@ -657,8 +658,9 @@ mod tests {
impl shared::Config for Test {} impl shared::Config for Test {}
impl origin::Config for Test {}
impl paras::Config for Test { impl paras::Config for Test {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = paras::TestWeightInfo; type WeightInfo = paras::TestWeightInfo;
} }
......
...@@ -1178,7 +1178,6 @@ impl parachains_inclusion::Config for Runtime { ...@@ -1178,7 +1178,6 @@ impl parachains_inclusion::Config for Runtime {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
} }
......
...@@ -41,8 +41,6 @@ use sp_std::{collections::btree_set::BTreeSet, prelude::*}; ...@@ -41,8 +41,6 @@ use sp_std::{collections::btree_set::BTreeSet, prelude::*};
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
mod benchmarking; mod benchmarking;
pub use crate::Origin as ParachainOrigin;
/// Whether the dispute is local or remote. /// Whether the dispute is local or remote.
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum DisputeLocation { pub enum DisputeLocation {
...@@ -345,9 +343,6 @@ pub mod pallet { ...@@ -345,9 +343,6 @@ pub mod pallet {
SingleSidedDispute, SingleSidedDispute,
} }
#[pallet::origin]
pub type Origin = ParachainOrigin;
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
#[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())] #[pallet::weight(<T as Config>::WeightInfo::force_unfreeze())]
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
//! Mocks for all the traits. //! Mocks for all the traits.
use crate::{ use crate::{
configuration, disputes, dmp, hrmp, inclusion, initializer, paras, paras_inherent, scheduler, configuration, disputes, dmp, hrmp, inclusion, initializer, origin, paras, paras_inherent,
session_info, shared, scheduler, session_info, shared,
ump::{self, MessageId, UmpSink}, ump::{self, MessageId, UmpSink},
ParaId, ParaId,
}; };
...@@ -51,21 +51,22 @@ frame_support::construct_runtime!( ...@@ -51,21 +51,22 @@ frame_support::construct_runtime!(
NodeBlock = Block, NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances,
Paras: paras::{Pallet, Origin, Call, Storage, Event, Config}, Paras: paras,
Configuration: configuration::{Pallet, Call, Storage, Config<T>}, Configuration: configuration,
ParasShared: shared::{Pallet, Call, Storage}, ParasShared: shared,
ParaInclusion: inclusion::{Pallet, Call, Storage, Event<T>}, ParaInclusion: inclusion,
ParaInherent: paras_inherent::{Pallet, Call, Storage}, ParaInherent: paras_inherent,
Scheduler: scheduler::{Pallet, Storage}, Scheduler: scheduler,
Initializer: initializer::{Pallet, Call, Storage}, Initializer: initializer,
Dmp: dmp::{Pallet, Call, Storage}, Dmp: dmp,
Ump: ump::{Pallet, Call, Storage, Event}, Ump: ump,
Hrmp: hrmp::{Pallet, Call, Storage, Event<T>}, Hrmp: hrmp,
SessionInfo: session_info::{Pallet, Storage}, ParachainsOrigin: origin,
Disputes: disputes::{Pallet, Storage, Event<T>}, SessionInfo: session_info,
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, Disputes: disputes,
Babe: pallet_babe,
} }
); );
...@@ -177,8 +178,9 @@ impl crate::configuration::Config for Test { ...@@ -177,8 +178,9 @@ impl crate::configuration::Config for Test {
impl crate::shared::Config for Test {} impl crate::shared::Config for Test {}
impl origin::Config for Test {}
impl crate::paras::Config for Test { impl crate::paras::Config for Test {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = crate::paras::TestWeightInfo; type WeightInfo = crate::paras::TestWeightInfo;
} }
......
...@@ -34,7 +34,7 @@ use primitives::v1::{ ...@@ -34,7 +34,7 @@ use primitives::v1::{
use scale_info::TypeInfo; use scale_info::TypeInfo;
use sp_core::RuntimeDebug; use sp_core::RuntimeDebug;
use sp_runtime::{traits::One, DispatchResult, SaturatedConversion}; use sp_runtime::{traits::One, DispatchResult, SaturatedConversion};
use sp_std::{prelude::*, result}; use sp_std::prelude::*;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
...@@ -307,11 +307,6 @@ pub mod pallet { ...@@ -307,11 +307,6 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + shared::Config { pub trait Config: frame_system::Config + configuration::Config + shared::Config {
/// The outer origin type.
type Origin: From<Origin>
+ From<<Self as frame_system::Config>::Origin>
+ Into<result::Result<Origin, <Self as Config>::Origin>>;
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>; type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
/// Weight information for extrinsics in this pallet. /// Weight information for extrinsics in this pallet.
...@@ -518,9 +513,6 @@ pub mod pallet { ...@@ -518,9 +513,6 @@ pub mod pallet {
} }
} }
#[pallet::origin]
pub type Origin = ParachainOrigin;
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Set the storage for the parachain validation code immediately. /// Set the storage for the parachain validation code immediately.
......
...@@ -1171,7 +1171,6 @@ impl parachains_inclusion::Config for Runtime { ...@@ -1171,7 +1171,6 @@ impl parachains_inclusion::Config for Runtime {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
} }
......
...@@ -202,54 +202,54 @@ construct_runtime! { ...@@ -202,54 +202,54 @@ construct_runtime! {
NodeBlock = primitives::v1::Block, NodeBlock = primitives::v1::Block,
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
System: frame_system::{Pallet, Call, Storage, Config, Event<T>}, System: frame_system,
// Must be before session. // Must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned}, Babe: pallet_babe,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Timestamp: pallet_timestamp,
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>}, Indices: pallet_indices,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, TransactionPayment: pallet_transaction_payment,
// Consensus support. // Consensus support.
Authorship: pallet_authorship::{Pallet, Call, Storage}, Authorship: pallet_authorship,
Offences: pallet_offences::{Pallet, Storage, Event}, Offences: pallet_offences,
Historical: session_historical::{Pallet}, Historical: session_historical,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>}, Session: pallet_session,
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event, ValidateUnsigned}, Grandpa: pallet_grandpa,
ImOnline: pallet_im_online::{Pallet, Call, Storage, Event<T>, ValidateUnsigned, Config<T>}, ImOnline: pallet_im_online,
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config}, AuthorityDiscovery: pallet_authority_discovery,
// Parachains modules. // Parachains modules.
ParachainsOrigin: parachains_origin::{Pallet, Origin}, ParachainsOrigin: parachains_origin,
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>}, Configuration: parachains_configuration,
ParasShared: parachains_shared::{Pallet, Call, Storage}, ParasShared: parachains_shared,
ParaInclusion: parachains_inclusion::{Pallet, Call, Storage, Event<T>}, ParaInclusion: parachains_inclusion,
ParaInherent: parachains_paras_inherent::{Pallet, Call, Storage, Inherent}, ParaInherent: parachains_paras_inherent,
ParaScheduler: parachains_scheduler::{Pallet, Storage}, ParaScheduler: parachains_scheduler,
Paras: parachains_paras::{Pallet, Call, Storage, Event, Config}, Paras: parachains_paras,
Initializer: parachains_initializer::{Pallet, Call, Storage}, Initializer: parachains_initializer,
Dmp: parachains_dmp::{Pallet, Call, Storage}, Dmp: parachains_dmp,
Ump: parachains_ump::{Pallet, Call, Storage, Event}, Ump: parachains_ump,
Hrmp: parachains_hrmp::{Pallet, Call, Storage, Event<T>, Config}, Hrmp: parachains_hrmp,
ParaSessionInfo: parachains_session_info::{Pallet, Storage}, ParaSessionInfo: parachains_session_info,
ParasDisputes: parachains_disputes::{Pallet, Call, Storage, Event<T>}, ParasDisputes: parachains_disputes,
// Parachain Onboarding Pallets // Parachain Onboarding Pallets
Registrar: paras_registrar::{Pallet, Call, Storage, Event<T>, Config}, Registrar: paras_registrar,
Auctions: auctions::{Pallet, Call, Storage, Event<T>}, Auctions: auctions,
Crowdloan: crowdloan::{Pallet, Call, Storage, Event<T>}, Crowdloan: crowdloan,
Slots: slots::{Pallet, Call, Storage, Event<T>}, Slots: slots,
ParasSudoWrapper: paras_sudo_wrapper::{Pallet, Call}, ParasSudoWrapper: paras_sudo_wrapper,
// Sudo // Sudo
Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>}, Sudo: pallet_sudo,
// Bridges support. // Bridges support.
Mmr: pallet_mmr::{Pallet, Storage}, Mmr: pallet_mmr,
Beefy: pallet_beefy::{Pallet, Config<T>, Storage}, Beefy: pallet_beefy,
MmrLeaf: pallet_beefy_mmr::{Pallet, Storage}, MmrLeaf: pallet_beefy_mmr,
// It might seem strange that we add both sides of the bridge to the same runtime. We do this because this // It might seem strange that we add both sides of the bridge to the same runtime. We do this because this
// runtime as shared by both the Rococo and Wococo chains. When running as Rococo we only use // runtime as shared by both the Rococo and Wococo chains. When running as Rococo we only use
...@@ -258,7 +258,7 @@ construct_runtime! { ...@@ -258,7 +258,7 @@ construct_runtime! {
// BridgeWococoGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Storage, Config<T>} = 41, // BridgeWococoGrandpa: pallet_bridge_grandpa::<Instance1>::{Pallet, Call, Storage, Config<T>} = 41,
// Validator Manager pallet. // Validator Manager pallet.
ValidatorManager: validator_manager::{Pallet, Call, Storage, Event<T>}, ValidatorManager: validator_manager,
// Bridge messages support. The same story as with the bridge grandpa pallet above ^^^ - when we're // Bridge messages support. The same story as with the bridge grandpa pallet above ^^^ - when we're
// running as Rococo we only use `BridgeWococoMessages`/`BridgeWococoMessagesDispatch`, and vice versa. // running as Rococo we only use `BridgeWococoMessages`/`BridgeWococoMessagesDispatch`, and vice versa.
...@@ -268,15 +268,15 @@ construct_runtime! { ...@@ -268,15 +268,15 @@ construct_runtime! {
// BridgeWococoMessagesDispatch: pallet_bridge_dispatch::<Instance1>::{Pallet, Event<T>} = 46, // BridgeWococoMessagesDispatch: pallet_bridge_dispatch::<Instance1>::{Pallet, Event<T>} = 46,
// A "council" // A "council"
Collective: pallet_collective::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 80, Collective: pallet_collective = 80,
Membership: pallet_membership::{Pallet, Call, Storage, Event<T>, Config<T>} = 81, Membership: pallet_membership = 81,
Utility: pallet_utility::{Pallet, Call, Event} = 90, Utility: pallet_utility = 90,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 91, Proxy: pallet_proxy = 91,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>}, Multisig: pallet_multisig,
// Pallet for sending XCM. // Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99, XcmPallet: pallet_xcm = 99,
} }
} }
...@@ -614,7 +614,6 @@ impl parachains_inclusion::Config for Runtime { ...@@ -614,7 +614,6 @@ impl parachains_inclusion::Config for Runtime {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Origin = Origin;
type Event = Event; type Event = Event;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
} }
......
...@@ -16,84 +16,87 @@ ...@@ -16,84 +16,87 @@
//! A pallet for managing validators on Rococo. //! A pallet for managing validators on Rococo.
use frame_support::{decl_error, decl_event, decl_module, decl_storage, traits::EnsureOrigin};
use sp_staking::SessionIndex; use sp_staking::SessionIndex;
use sp_std::vec::Vec; use sp_std::vec::Vec;
pub use pallet::*;
type Session<T> = pallet_session::Pallet<T>; type Session<T> = pallet_session::Pallet<T>;
/// Configuration for the parachain proposer. #[frame_support::pallet]
pub trait Config: pallet_session::Config { pub mod pallet {
/// The overreaching event type. use super::*;
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>; use frame_support::{dispatch::DispatchResult, pallet_prelude::*, traits::EnsureOrigin};
use frame_system::pallet_prelude::*;
/// Privileged origin that can add or remove validators. #[pallet::pallet]
type PrivilegedOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>; pub struct Pallet<T>(_);
}
decl_event! { /// Configuration for the parachain proposer.
pub enum Event<T> where ValidatorId = <T as pallet_session::Config>::ValidatorId { #[pallet::config]
/// New validators were added to the set. pub trait Config: frame_system::Config + pallet_session::Config {
ValidatorsRegistered(Vec<ValidatorId>), /// The overreaching event type.
/// Validators were removed from the set. type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
ValidatorsDeregistered(Vec<ValidatorId>),
}
}
decl_error! { /// Privileged origin that can add or remove validators.
pub enum Error for Module<T: Config> {}