Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for #11981 #1563

Merged
merged 36 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
97982f0
Companion for #11981
Szegoo Aug 22, 2022
0c01783
rename
Szegoo Aug 22, 2022
ec86a04
Event to RuntimeEvent in imports
Szegoo Aug 22, 2022
805fbe7
missed rename
Szegoo Aug 22, 2022
01c035c
undo
Szegoo Aug 25, 2022
9386892
revert
Szegoo Aug 25, 2022
b631a12
rename type Call & Event
Szegoo Aug 25, 2022
3d65710
commit
Szegoo Aug 26, 2022
e300434
...
Szegoo Aug 26, 2022
ebc13dc
fix
Szegoo Aug 27, 2022
8f9d7e9
fix errors
Szegoo Aug 28, 2022
9b656e2
fixes
Szegoo Aug 28, 2022
1e29e52
fmt
Szegoo Aug 28, 2022
a0146d6
fix imports
Szegoo Aug 28, 2022
8f616c1
final fix?
Szegoo Aug 28, 2022
6e69cb5
fmt
Szegoo Aug 28, 2022
c02134b
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Aug 29, 2022
ee5fc1d
fix?
Szegoo Aug 29, 2022
8713d1b
Merge branch 'master' into rename-outer-enum
Szegoo Aug 31, 2022
46a7093
fixes after merge
Szegoo Aug 31, 2022
e515a4d
Merge branch 'master' into rename-outer-enum
Szegoo Sep 1, 2022
cc1c5e3
small fix
Szegoo Sep 1, 2022
33f80de
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 2, 2022
482ea43
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 2, 2022
a969ac8
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 3, 2022
7479d5a
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 5, 2022
a5568b1
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 5, 2022
5e84d47
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 6, 2022
dd0c175
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 7, 2022
4321830
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 8, 2022
d05045f
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 11, 2022
292e213
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 12, 2022
be366e4
cargo update -p polkadot-runtime-common
shawntabrizi Sep 12, 2022
954b824
cargo +nightly fmt
shawntabrizi Sep 12, 2022
a690841
update lockfile for {"polkadot", "substrate"}
Sep 12, 2022
18965e2
fix
shawntabrizi Sep 12, 2022
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
4 changes: 2 additions & 2 deletions pallets/collator-selection/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ macro_rules! whitelist {
};
}

fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::Event = generic_event.into();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// Overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The currency mechanism.
type Currency: ReservableCurrency<Self::AccountId>;
Expand Down
10 changes: 5 additions & 5 deletions pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ impl system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand All @@ -88,7 +88,7 @@ parameter_types! {

impl pallet_balances::Config for Test {
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
Expand Down Expand Up @@ -171,7 +171,7 @@ parameter_types! {
}

impl pallet_session::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
// we don't have stash and controller, thus we don't need the convert as well.
type ValidatorIdOf = IdentityCollator;
Expand Down Expand Up @@ -207,7 +207,7 @@ impl ValidatorRegistration<u64> for IsRegistered {
}

impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type UpdateOrigin = EnsureSignedBy<RootAccount, u64>;
type PotId = PotId;
Expand Down
24 changes: 13 additions & 11 deletions pallets/dmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

type XcmExecutor: ExecuteXcm<Self::Call>;
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;

/// Origin which is allowed to execute overweight messages.
type ExecuteOverweightOrigin: EnsureOrigin<Self::Origin>;
Expand Down Expand Up @@ -224,11 +224,11 @@ pub mod pallet {
mut data: &[u8],
) -> Result<Weight, (MessageId, Weight)> {
let message_id = sp_io::hashing::blake2_256(data);
let maybe_msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
let maybe_msg = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
MAX_XCM_DECODE_DEPTH,
&mut data,
)
.map(Xcm::<T::Call>::try_from);
.map(Xcm::<T::RuntimeCall>::try_from);
match maybe_msg {
Err(_) => {
Self::deposit_event(Event::InvalidFormat { message_id });
Expand Down Expand Up @@ -353,7 +353,7 @@ mod tests {

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
type Xcm = xcm::latest::Xcm<Call>;
type Xcm = xcm::latest::Xcm<RuntimeCall>;

frame_support::construct_runtime!(
pub enum Test where
Expand Down Expand Up @@ -387,15 +387,15 @@ mod tests {

impl frame_system::Config for Test {
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
type BlockWeights = ();
Expand Down Expand Up @@ -425,7 +425,7 @@ mod tests {
}

pub struct MockExec;
impl ExecuteXcm<Call> for MockExec {
impl ExecuteXcm<RuntimeCall> for MockExec {
fn execute_xcm_in_credit(
_origin: impl Into<MultiLocation>,
message: Xcm,
Expand All @@ -449,7 +449,7 @@ mod tests {
}

impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = MockExec;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
}
Expand All @@ -465,7 +465,7 @@ mod tests {
index.end_used,
enqueued
.iter()
.map(|m| (0, VersionedXcm::<Call>::from(m.clone()).encode()))
.map(|m| (0, VersionedXcm::<RuntimeCall>::from(m.clone()).encode()))
.collect::<Vec<_>>(),
);
index.end_used += 1;
Expand All @@ -474,7 +474,9 @@ mod tests {
}

fn handle_messages(incoming: &[Xcm], limit: Weight) -> Weight {
let iter = incoming.iter().map(|m| (0, VersionedXcm::<Call>::from(m.clone()).encode()));
let iter = incoming
.iter()
.map(|m| (0, VersionedXcm::<RuntimeCall>::from(m.clone()).encode()));
DmpQueue::handle_dmp_messages(iter, limit)
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config<OnSetCode = ParachainSetCode<Self>> {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Something which can be notified when the validation data is set.
type OnSystemEvent: OnSystemEvent;
Expand Down
12 changes: 6 additions & 6 deletions pallets/parachain-system/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ parameter_types! {
}
impl frame_system::Config for Test {
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
type BlockWeights = ();
Expand All @@ -99,7 +99,7 @@ impl frame_system::Config for Test {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type SelfParaId = ParachainId;
type OutboundXcmpMessageSource = FromThreadLocal;
Expand Down Expand Up @@ -403,7 +403,7 @@ fn events() {
let events = System::events();
assert_eq!(
events[0].event,
Event::ParachainSystem(crate::Event::ValidationFunctionStored.into())
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored.into())
);
},
)
Expand All @@ -414,7 +414,7 @@ fn events() {
let events = System::events();
assert_eq!(
events[0].event,
Event::ParachainSystem(
RuntimeEvent::ParachainSystem(
crate::Event::ValidationFunctionApplied { relay_chain_block_num: 1234 }
.into()
)
Expand Down Expand Up @@ -490,7 +490,7 @@ fn aborted_upgrade() {
let events = System::events();
assert_eq!(
events[0].event,
Event::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into())
RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into())
);
},
);
Expand Down
6 changes: 3 additions & 3 deletions pallets/solo-to-para/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub mod pallet {
pub trait Config:
frame_system::Config + parachain_system::Config + pallet_sudo::Config
{
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}

#[pallet::pallet]
Expand Down Expand Up @@ -133,10 +133,10 @@ pub mod pallet {

impl<T: Config + Send + Sync> SignedExtension for CheckSudo<T>
where
<T as frame_system::Config>::Call: Dispatchable<Info = DispatchInfo>,
<T as frame_system::Config>::RuntimeCall: Dispatchable<Info = DispatchInfo>,
{
type AccountId = T::AccountId;
type Call = <T as frame_system::Config>::Call;
type Call = <T as frame_system::Config>::RuntimeCall;
type AdditionalSigned = ();
type Pre = ();
const IDENTIFIER: &'static str = "CheckSudo";
Expand Down
12 changes: 6 additions & 6 deletions pallets/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

type XcmExecutor: ExecuteXcm<Self::Call>;
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
}

#[pallet::error]
Expand Down Expand Up @@ -114,11 +114,11 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
let mut used = Weight::zero();
for (_sent_at, data) in iter {
let id = sp_io::hashing::twox_64(&data[..]);
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
let msg = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
MAX_XCM_DECODE_DEPTH,
&mut data.as_slice(),
)
.map(Xcm::<T::Call>::try_from);
.map(Xcm::<T::RuntimeCall>::try_from);
match msg {
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Expand Down Expand Up @@ -147,11 +147,11 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
let mut used = Weight::zero();
for (_sent_at, data) in iter {
let id = sp_io::hashing::twox_64(&data[..]);
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
let msg = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
MAX_XCM_DECODE_DEPTH,
&mut data.as_slice(),
)
.map(Xcm::<T::Call>::try_from);
.map(Xcm::<T::RuntimeCall>::try_from);
match msg {
Err(_) => Pallet::<T>::deposit_event(Event::InvalidFormat(id)),
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Expand Down
12 changes: 6 additions & 6 deletions pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ pub mod pallet {

#[pallet::config]
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Something to execute an XCM message. We need this to service the XCMoXCMP queue.
type XcmExecutor: ExecuteXcm<Self::Call>;
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;

/// Information on the avaialble XCMP channels.
type ChannelInfo: GetChannelInfo;
Expand Down Expand Up @@ -140,7 +140,7 @@ pub mod pallet {

let (sender, sent_at, data) =
Overweight::<T>::get(index).ok_or(Error::<T>::BadOverweightIndex)?;
let xcm = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
let xcm = VersionedXcm::<T::RuntimeCall>::decode_all_with_depth_limit(
MAX_XCM_DECODE_DEPTH,
&mut data.as_slice(),
)
Expand Down Expand Up @@ -596,12 +596,12 @@ impl<T: Config> Pallet<T> {
fn handle_xcm_message(
sender: ParaId,
_sent_at: RelayBlockNumber,
xcm: VersionedXcm<T::Call>,
xcm: VersionedXcm<T::RuntimeCall>,
max_weight: Weight,
) -> Result<Weight, XcmError> {
let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
log::debug!("Processing XCMP-XCM: {:?}", &hash);
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
let (result, event) = match Xcm::<T::RuntimeCall>::try_from(xcm) {
Ok(xcm) => {
let location = (1, Parachain(sender.into()));

Expand Down Expand Up @@ -650,7 +650,7 @@ impl<T: Config> Pallet<T> {
XcmpMessageFormat::ConcatenatedVersionedXcm => {
while !remaining_fragments.is_empty() {
last_remaining_fragments = remaining_fragments;
if let Ok(xcm) = VersionedXcm::<T::Call>::decode_with_depth_limit(
if let Ok(xcm) = VersionedXcm::<T::RuntimeCall>::decode_with_depth_limit(
MAX_XCM_DECODE_DEPTH,
&mut remaining_fragments,
) {
Expand Down
14 changes: 7 additions & 7 deletions pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ impl frame_system::Config for Test {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand All @@ -91,7 +91,7 @@ parameter_types! {

impl pallet_balances::Config for Test {
type Balance = u64;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
Expand All @@ -102,7 +102,7 @@ impl pallet_balances::Config for Test {
}

impl cumulus_pallet_parachain_system::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type SelfParaId = ();
type OutboundXcmpMessageSource = XcmpQueue;
Expand Down Expand Up @@ -138,7 +138,7 @@ pub type LocationToAccountId = (ParentIsPreset<AccountId>,);

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type Call = Call;
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
// How to withdraw and deposit an asset.
type AssetTransactor = LocalAssetTransactor;
Expand All @@ -147,7 +147,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = NativeAsset;
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = ();
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = ();
type ResponseHandler = ();
type AssetTrap = ();
Expand Down Expand Up @@ -183,7 +183,7 @@ impl<Origin: OriginTrait> ConvertOrigin<Origin> for SystemParachainAsSuperuser<O
}

impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = ();
Expand Down
Loading