mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
* Companion for #11981 * rename * Event to RuntimeEvent in imports * missed rename * undo * revert * rename type Call & Event * commit * ... * fix * fix errors * fixes * fmt * fix imports * final fix? * fmt * fix? * fixes after merge * small fix * cargo update -p polkadot-runtime-common * cargo +nightly fmt * update lockfile for {"polkadot", "substrate"} * fix Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -60,7 +60,7 @@ 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;
|
||||
@@ -68,7 +68,7 @@ impl system::Config for Test {
|
||||
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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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>;
|
||||
@@ -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 });
|
||||
@@ -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
|
||||
@@ -387,7 +387,7 @@ 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;
|
||||
@@ -395,7 +395,7 @@ mod tests {
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockLength = ();
|
||||
type BlockWeights = ();
|
||||
@@ -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,
|
||||
@@ -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>;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -74,7 +74,7 @@ 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;
|
||||
@@ -82,7 +82,7 @@ impl frame_system::Config for Test {
|
||||
type AccountId = u64;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockLength = ();
|
||||
type BlockWeights = ();
|
||||
@@ -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;
|
||||
@@ -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())
|
||||
);
|
||||
},
|
||||
)
|
||||
@@ -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()
|
||||
)
|
||||
@@ -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())
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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]
|
||||
@@ -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";
|
||||
|
||||
@@ -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]
|
||||
@@ -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)),
|
||||
@@ -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)),
|
||||
|
||||
@@ -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;
|
||||
@@ -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(),
|
||||
)
|
||||
@@ -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()));
|
||||
|
||||
@@ -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,
|
||||
) {
|
||||
|
||||
@@ -63,7 +63,7 @@ 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;
|
||||
@@ -71,7 +71,7 @@ impl frame_system::Config for Test {
|
||||
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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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 = ();
|
||||
@@ -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 = ();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
use super::*;
|
||||
use cumulus_primitives_core::XcmpMessageHandler;
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
use mock::{new_test_ext, Call, Origin, Test, XcmpQueue};
|
||||
use mock::{new_test_ext, Origin, RuntimeCall, Test, XcmpQueue};
|
||||
use sp_runtime::traits::BadOrigin;
|
||||
|
||||
#[test]
|
||||
@@ -120,7 +120,9 @@ fn suspend_xcm_execution_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
QueueSuspended::<Test>::put(true);
|
||||
|
||||
let xcm = VersionedXcm::from(Xcm::<Call>(vec![Instruction::<Call>::ClearOrigin])).encode();
|
||||
let xcm =
|
||||
VersionedXcm::from(Xcm::<RuntimeCall>(vec![Instruction::<RuntimeCall>::ClearOrigin]))
|
||||
.encode();
|
||||
let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
||||
message_format.extend(xcm.clone());
|
||||
let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())];
|
||||
|
||||
Reference in New Issue
Block a user