Companion for #11981 (#5915)

* Companion for #11981

* more renaming

* fmt

* fixes

* add generic type

* Companion for #11831

* fix

* revert changes

* Delete rename-outer-enum.diff

* revert

* Update run_benches_for_runtime.sh

* rename type Call & type Event

* passing tests

* fmt

* small fixes

* commit

* fix

* fmt

* commit

* error fixes

* fix

* small fix in test

* Update lib.rs

* Update lib.rs

* Update lib.rs

* Update lib.rs

* Update lib.rs

* Update lib.rs

* Update lib.rs

* remove RuntimeCall from pallet_grandpa

* last fix

* commit

* rename

* merge fix

* update lockfile for {"substrate"}

* cargo +nightly fmt

* fix

Co-authored-by: parity-processbot <>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergej Sakac
2022-09-13 01:03:47 +02:00
committed by GitHub
parent db0fc60344
commit 8ea6076fe5
73 changed files with 1241 additions and 1151 deletions
+215 -195
View File
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -49,9 +49,9 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> { fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
with_client! { with_client! {
self.client.as_ref(), client, { self.client.as_ref(), client, {
use runtime::{Call, SystemCall}; use runtime::{RuntimeCall, SystemCall};
let call = Call::System(SystemCall::remark { remark: vec![] }); let call = RuntimeCall::System(SystemCall::remark { remark: vec![] });
let signer = Sr25519Keyring::Bob.pair(); let signer = Sr25519Keyring::Bob.pair();
let period = polkadot_runtime_common::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; let period = polkadot_runtime_common::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
@@ -92,9 +92,9 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> { fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
with_client! { with_client! {
self.client.as_ref(), client, { self.client.as_ref(), client, {
use runtime::{Call, BalancesCall}; use runtime::{RuntimeCall, BalancesCall};
let call = Call::Balances(BalancesCall::transfer_keep_alive { let call = RuntimeCall::Balances(BalancesCall::transfer_keep_alive {
dest: self.dest.clone().into(), dest: self.dest.clone().into(),
value: self.value.into(), value: self.value.into(),
}); });
@@ -113,14 +113,14 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
/// ///
/// Should only be used for benchmarking since it makes strong assumptions /// Should only be used for benchmarking since it makes strong assumptions
/// about the chain state that these calls will be valid for. /// about the chain state that these calls will be valid for.
trait BenchmarkCallSigner<Call: Encode + Clone, Signer: Pair> { trait BenchmarkCallSigner<RuntimeCall: Encode + Clone, Signer: Pair> {
/// Signs a call together with the signed extensions of the specific runtime. /// Signs a call together with the signed extensions of the specific runtime.
/// ///
/// Only works if the current block is the genesis block since the /// Only works if the current block is the genesis block since the
/// `CheckMortality` check is mocked by using the genesis block. /// `CheckMortality` check is mocked by using the genesis block.
fn sign_call( fn sign_call(
&self, &self,
call: Call, call: RuntimeCall,
nonce: u32, nonce: u32,
current_block: u64, current_block: u64,
period: u64, period: u64,
@@ -130,12 +130,12 @@ trait BenchmarkCallSigner<Call: Encode + Clone, Signer: Pair> {
} }
#[cfg(feature = "polkadot")] #[cfg(feature = "polkadot")]
impl BenchmarkCallSigner<polkadot_runtime::Call, sp_core::sr25519::Pair> impl BenchmarkCallSigner<polkadot_runtime::RuntimeCall, sp_core::sr25519::Pair>
for FullClient<polkadot_runtime::RuntimeApi, PolkadotExecutorDispatch> for FullClient<polkadot_runtime::RuntimeApi, PolkadotExecutorDispatch>
{ {
fn sign_call( fn sign_call(
&self, &self,
call: polkadot_runtime::Call, call: polkadot_runtime::RuntimeCall,
nonce: u32, nonce: u32,
current_block: u64, current_block: u64,
period: u64, period: u64,
@@ -186,12 +186,12 @@ impl BenchmarkCallSigner<polkadot_runtime::Call, sp_core::sr25519::Pair>
} }
#[cfg(feature = "westend")] #[cfg(feature = "westend")]
impl BenchmarkCallSigner<westend_runtime::Call, sp_core::sr25519::Pair> impl BenchmarkCallSigner<westend_runtime::RuntimeCall, sp_core::sr25519::Pair>
for FullClient<westend_runtime::RuntimeApi, WestendExecutorDispatch> for FullClient<westend_runtime::RuntimeApi, WestendExecutorDispatch>
{ {
fn sign_call( fn sign_call(
&self, &self,
call: westend_runtime::Call, call: westend_runtime::RuntimeCall,
nonce: u32, nonce: u32,
current_block: u64, current_block: u64,
period: u64, period: u64,
@@ -240,12 +240,12 @@ impl BenchmarkCallSigner<westend_runtime::Call, sp_core::sr25519::Pair>
} }
#[cfg(feature = "kusama")] #[cfg(feature = "kusama")]
impl BenchmarkCallSigner<kusama_runtime::Call, sp_core::sr25519::Pair> impl BenchmarkCallSigner<kusama_runtime::RuntimeCall, sp_core::sr25519::Pair>
for FullClient<kusama_runtime::RuntimeApi, KusamaExecutorDispatch> for FullClient<kusama_runtime::RuntimeApi, KusamaExecutorDispatch>
{ {
fn sign_call( fn sign_call(
&self, &self,
call: kusama_runtime::Call, call: kusama_runtime::RuntimeCall,
nonce: u32, nonce: u32,
current_block: u64, current_block: u64,
period: u64, period: u64,
@@ -294,12 +294,12 @@ impl BenchmarkCallSigner<kusama_runtime::Call, sp_core::sr25519::Pair>
} }
#[cfg(feature = "rococo")] #[cfg(feature = "rococo")]
impl BenchmarkCallSigner<rococo_runtime::Call, sp_core::sr25519::Pair> impl BenchmarkCallSigner<rococo_runtime::RuntimeCall, sp_core::sr25519::Pair>
for FullClient<rococo_runtime::RuntimeApi, RococoExecutorDispatch> for FullClient<rococo_runtime::RuntimeApi, RococoExecutorDispatch>
{ {
fn sign_call( fn sign_call(
&self, &self,
call: rococo_runtime::Call, call: rococo_runtime::RuntimeCall,
nonce: u32, nonce: u32,
current_block: u64, current_block: u64,
period: u64, period: u64,
+3 -3
View File
@@ -288,7 +288,7 @@ impl PolkadotTestNode {
/// Send an extrinsic to this node. /// Send an extrinsic to this node.
pub async fn send_extrinsic( pub async fn send_extrinsic(
&self, &self,
function: impl Into<polkadot_test_runtime::Call>, function: impl Into<polkadot_test_runtime::RuntimeCall>,
caller: Sr25519Keyring, caller: Sr25519Keyring,
) -> Result<RpcTransactionOutput, RpcTransactionError> { ) -> Result<RpcTransactionOutput, RpcTransactionError> {
let extrinsic = construct_extrinsic(&*self.client, function, caller, 0); let extrinsic = construct_extrinsic(&*self.client, function, caller, 0);
@@ -345,7 +345,7 @@ impl PolkadotTestNode {
/// Construct an extrinsic that can be applied to the test runtime. /// Construct an extrinsic that can be applied to the test runtime.
pub fn construct_extrinsic( pub fn construct_extrinsic(
client: &Client, client: &Client,
function: impl Into<polkadot_test_runtime::Call>, function: impl Into<polkadot_test_runtime::RuntimeCall>,
caller: Sr25519Keyring, caller: Sr25519Keyring,
nonce: u32, nonce: u32,
) -> UncheckedExtrinsic { ) -> UncheckedExtrinsic {
@@ -396,7 +396,7 @@ pub fn construct_transfer_extrinsic(
dest: sp_keyring::AccountKeyring, dest: sp_keyring::AccountKeyring,
value: Balance, value: Balance,
) -> UncheckedExtrinsic { ) -> UncheckedExtrinsic {
let function = polkadot_test_runtime::Call::Balances(pallet_balances::Call::transfer { let function = polkadot_test_runtime::RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: MultiSigner::from(dest.public()).into_account().into(), dest: MultiSigner::from(dest.public()).into_account().into(),
value, value,
}); });
@@ -24,7 +24,7 @@ async fn call_function_actually_work() {
let alice = run_validator_node(alice_config, None); let alice = run_validator_node(alice_config, None);
let function = polkadot_test_runtime::Call::Balances(pallet_balances::Call::transfer { let function = polkadot_test_runtime::RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: Charlie.to_account_id().into(), dest: Charlie.to_account_id().into(),
value: 1, value: 1,
}); });
@@ -85,7 +85,7 @@ pub mod pallet {
#[pallet::disable_frame_system_supertrait_check] #[pallet::disable_frame_system_supertrait_check]
pub trait Config: configuration::Config + paras::Config + slots::Config { pub trait Config: configuration::Config + paras::Config + slots::Config {
/// The overarching event type. /// 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>;
/// Origin for assigning slots. /// Origin for assigning slots.
type AssignSlotOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>; type AssignSlotOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>;
@@ -579,10 +579,10 @@ mod tests {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -593,7 +593,7 @@ mod tests {
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -601,7 +601,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = (); type DbWeight = ();
type Version = (); type Version = ();
@@ -621,7 +621,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -640,7 +640,7 @@ mod tests {
} }
impl parachains_paras::Config for Test { impl parachains_paras::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = parachains_paras::TestWeightInfo; type WeightInfo = parachains_paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = crate::mock::TestNextSessionRotation; type NextSessionRotation = crate::mock::TestNextSessionRotation;
@@ -655,7 +655,7 @@ mod tests {
} }
impl slots::Config for Test { impl slots::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = TestRegistrar<Test>; type Registrar = TestRegistrar<Test>;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -673,7 +673,7 @@ mod tests {
} }
impl assigned_slots::Config for Test { impl assigned_slots::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AssignSlotOrigin = EnsureRoot<Self::AccountId>; type AssignSlotOrigin = EnsureRoot<Self::AccountId>;
type Leaser = Slots; type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
+7 -7
View File
@@ -91,7 +91,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// 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>;
/// The type representing the leasing system. /// The type representing the leasing system.
type Leaser: Leaser< type Leaser: Leaser<
@@ -710,7 +710,7 @@ mod tests {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -718,7 +718,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -739,7 +739,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type WeightInfo = (); type WeightInfo = ();
@@ -867,7 +867,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = TestLeaser; type Leaser = TestLeaser;
type Registrar = TestRegistrar<Self>; type Registrar = TestRegistrar<Self>;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -1729,9 +1729,9 @@ mod benchmarking {
use frame_benchmarking::{account, benchmarks, whitelisted_caller}; use frame_benchmarking::{account, benchmarks, whitelisted_caller};
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
+14 -14
View File
@@ -172,7 +172,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// 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 VestingSchedule: VestingSchedule<Self::AccountId, Moment = Self::BlockNumber>; type VestingSchedule: VestingSchedule<Self::AccountId, Moment = Self::BlockNumber>;
#[pallet::constant] #[pallet::constant]
type Prefix: Get<&'static [u8]>; type Prefix: Get<&'static [u8]>;
@@ -597,11 +597,11 @@ impl<T: Config> Pallet<T> {
#[scale_info(skip_type_params(T))] #[scale_info(skip_type_params(T))]
pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>) pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>)
where where
<T as frame_system::Config>::Call: IsSubType<Call<T>>; <T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>;
impl<T: Config + Send + Sync> Debug for PrevalidateAttests<T> impl<T: Config + Send + Sync> Debug for PrevalidateAttests<T>
where where
<T as frame_system::Config>::Call: IsSubType<Call<T>>, <T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{ {
#[cfg(feature = "std")] #[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
@@ -616,7 +616,7 @@ where
impl<T: Config + Send + Sync> PrevalidateAttests<T> impl<T: Config + Send + Sync> PrevalidateAttests<T>
where where
<T as frame_system::Config>::Call: IsSubType<Call<T>>, <T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{ {
/// Create new `SignedExtension` to check runtime version. /// Create new `SignedExtension` to check runtime version.
pub fn new() -> Self { pub fn new() -> Self {
@@ -626,10 +626,10 @@ where
impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T> impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T>
where where
<T as frame_system::Config>::Call: IsSubType<Call<T>>, <T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{ {
type AccountId = T::AccountId; type AccountId = T::AccountId;
type Call = <T as frame_system::Config>::Call; type Call = <T as frame_system::Config>::RuntimeCall;
type AdditionalSigned = (); type AdditionalSigned = ();
type Pre = (); type Pre = ();
const IDENTIFIER: &'static str = "PrevalidateAttests"; const IDENTIFIER: &'static str = "PrevalidateAttests";
@@ -752,7 +752,7 @@ mod tests {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -760,7 +760,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<u64>; type Lookup = IdentityLookup<u64>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -779,7 +779,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -794,7 +794,7 @@ mod tests {
} }
impl pallet_vesting::Config for Test { impl pallet_vesting::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = Identity; type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -810,7 +810,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type Prefix = Prefix; type Prefix = Prefix;
type MoveClaimOrigin = frame_system::EnsureSignedBy<Six, u64>; type MoveClaimOrigin = frame_system::EnsureSignedBy<Six, u64>;
@@ -1052,7 +1052,7 @@ mod tests {
fn valid_attest_transactions_are_free() { fn valid_attest_transactions_are_free() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let p = PrevalidateAttests::<Test>::new(); let p = PrevalidateAttests::<Test>::new();
let c = Call::Claims(ClaimsCall::attest { let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Saft.to_text().to_vec(), statement: StatementKind::Saft.to_text().to_vec(),
}); });
let di = c.get_dispatch_info(); let di = c.get_dispatch_info();
@@ -1066,13 +1066,13 @@ mod tests {
fn invalid_attest_transactions_are_recognized() { fn invalid_attest_transactions_are_recognized() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
let p = PrevalidateAttests::<Test>::new(); let p = PrevalidateAttests::<Test>::new();
let c = Call::Claims(ClaimsCall::attest { let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Regular.to_text().to_vec(), statement: StatementKind::Regular.to_text().to_vec(),
}); });
let di = c.get_dispatch_info(); let di = c.get_dispatch_info();
let r = p.validate(&42, &c, &di, 20); let r = p.validate(&42, &c, &di, 20);
assert!(r.is_err()); assert!(r.is_err());
let c = Call::Claims(ClaimsCall::attest { let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Saft.to_text().to_vec(), statement: StatementKind::Saft.to_text().to_vec(),
}); });
let di = c.get_dispatch_info(); let di = c.get_dispatch_info();
+9 -9
View File
@@ -189,7 +189,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::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>;
/// `PalletId` for the crowdloan pallet. An appropriate value could be `PalletId(*b"py/cfund")` /// `PalletId` for the crowdloan pallet. An appropriate value could be `PalletId(*b"py/cfund")`
#[pallet::constant] #[pallet::constant]
@@ -893,7 +893,7 @@ mod tests {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -901,7 +901,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -920,7 +920,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -1072,7 +1072,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
type PalletId = CrowdloanPalletId; type PalletId = CrowdloanPalletId;
@@ -1129,8 +1129,8 @@ mod tests {
} }
} }
fn last_event() -> Event { fn last_event() -> RuntimeEvent {
System::events().pop().expect("Event expected").event System::events().pop().expect("RuntimeEvent expected").event
} }
#[test] #[test]
@@ -1906,9 +1906,9 @@ mod benchmarking {
use frame_benchmarking::{account, benchmarks, whitelisted_caller}; use frame_benchmarking::{account, benchmarks, whitelisted_caller};
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
+4 -4
View File
@@ -112,13 +112,13 @@ mod tests {
type Origin = Origin; type Origin = Origin;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Call = Call; type RuntimeCall = RuntimeCall;
type Hash = H256; type Hash = H256;
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockLength = BlockLength; type BlockLength = BlockLength;
type BlockWeights = BlockWeights; type BlockWeights = BlockWeights;
@@ -136,7 +136,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = (); type ExistentialDeposit = ();
type AccountStore = System; type AccountStore = System;
@@ -155,7 +155,7 @@ mod tests {
type Currency = pallet_balances::Pallet<Test>; type Currency = pallet_balances::Pallet<Test>;
type ApproveOrigin = frame_system::EnsureRoot<AccountId>; type ApproveOrigin = frame_system::EnsureRoot<AccountId>;
type RejectOrigin = frame_system::EnsureRoot<AccountId>; type RejectOrigin = frame_system::EnsureRoot<AccountId>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnSlash = (); type OnSlash = ();
type ProposalBond = (); type ProposalBond = ();
type ProposalBondMinimum = (); type ProposalBondMinimum = ();
@@ -93,10 +93,10 @@ frame_support::construct_runtime!(
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
use crate::{auctions::Error as AuctionsError, crowdloan::Error as CrowdloanError}; use crate::{auctions::Error as AuctionsError, crowdloan::Error as CrowdloanError};
@@ -113,7 +113,7 @@ impl frame_system::Config for Test {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -121,7 +121,7 @@ impl frame_system::Config for Test {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<AccountId>; type Lookup = IdentityLookup<AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -179,7 +179,7 @@ parameter_types! {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type MaxLocks = (); type MaxLocks = ();
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -201,7 +201,7 @@ parameter_types! {
} }
impl paras::Config for Test { impl paras::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = paras::TestWeightInfo; type WeightInfo = paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = crate::mock::TestNextSessionRotation; type NextSessionRotation = crate::mock::TestNextSessionRotation;
@@ -213,7 +213,7 @@ parameter_types! {
} }
impl paras_registrar::Config for Test { impl paras_registrar::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnSwap = (Crowdloan, Slots); type OnSwap = (Crowdloan, Slots);
type ParaDeposit = ParaDeposit; type ParaDeposit = ParaDeposit;
type DataDepositPerByte = DataDepositPerByte; type DataDepositPerByte = DataDepositPerByte;
@@ -228,7 +228,7 @@ parameter_types! {
} }
impl auctions::Config for Test { impl auctions::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = Slots; type Leaser = Slots;
type Registrar = Registrar; type Registrar = Registrar;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -244,7 +244,7 @@ parameter_types! {
} }
impl slots::Config for Test { impl slots::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -262,7 +262,7 @@ parameter_types! {
} }
impl crowdloan::Config for Test { impl crowdloan::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId; type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
@@ -343,11 +343,11 @@ fn run_to_session(n: u32) {
run_to_block(block_number); run_to_block(block_number);
} }
fn last_event() -> Event { fn last_event() -> RuntimeEvent {
System::events().pop().expect("Event expected").event System::events().pop().expect("RuntimeEvent expected").event
} }
fn contains_event(event: Event) -> bool { fn contains_event(event: RuntimeEvent) -> bool {
System::events().iter().any(|x| x.event == event) System::events().iter().any(|x| x.event == event)
} }
+10 -10
View File
@@ -96,7 +96,7 @@ pub mod pallet {
#[pallet::disable_frame_system_supertrait_check] #[pallet::disable_frame_system_supertrait_check]
pub trait Config: configuration::Config + paras::Config { pub trait Config: configuration::Config + paras::Config {
/// The overarching event type. /// 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>;
/// The aggregated origin type must support the `parachains` origin. We require that we can /// The aggregated origin type must support the `parachains` origin. We require that we can
/// infallibly convert between this origin and the system origin, but in reality, they're the /// infallibly convert between this origin and the system origin, but in reality, they're the
@@ -631,10 +631,10 @@ mod tests {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
const NORMAL_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_RATIO: Perbill = Perbill::from_percent(75);
@@ -649,7 +649,7 @@ mod tests {
impl frame_system::Config for Test { impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything; type BaseCallFilter = frame_support::traits::Everything;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -657,7 +657,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<u64>; type Lookup = IdentityLookup<u64>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = (); type DbWeight = ();
type BlockWeights = BlockWeights; type BlockWeights = BlockWeights;
@@ -680,7 +680,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u128; type Balance = u128;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = (); type MaxLocks = ();
@@ -698,7 +698,7 @@ mod tests {
} }
impl paras::Config for Test { impl paras::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = paras::TestWeightInfo; type WeightInfo = paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = crate::mock::TestNextSessionRotation; type NextSessionRotation = crate::mock::TestNextSessionRotation;
@@ -715,7 +715,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type OnSwap = MockSwap; type OnSwap = MockSwap;
@@ -1226,9 +1226,9 @@ mod benchmarking {
use frame_benchmarking::{account, benchmarks, whitelisted_caller}; use frame_benchmarking::{account, benchmarks, whitelisted_caller};
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
+7 -7
View File
@@ -98,7 +98,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// 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>;
/// Balances Pallet /// Balances Pallet
type Currency: Currency<Self::AccountId>; type Currency: Currency<Self::AccountId>;
@@ -511,7 +511,7 @@ mod tests {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -519,7 +519,7 @@ mod tests {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<AccountId>; type Lookup = IdentityLookup<AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -538,7 +538,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -553,7 +553,7 @@ mod tests {
} }
impl pallet_vesting::Config for Test { impl pallet_vesting::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = Identity; type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -574,7 +574,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type ValidityOrigin = frame_system::EnsureSignedBy<ValidityOrigin, AccountId>; type ValidityOrigin = frame_system::EnsureSignedBy<ValidityOrigin, AccountId>;
@@ -1081,7 +1081,7 @@ mod tests {
); );
// Vesting lock is removed in whole on block 101 (100 blocks after block 1) // Vesting lock is removed in whole on block 101 (100 blocks after block 1)
System::set_block_number(100); System::set_block_number(100);
let vest_call = Call::Vesting(pallet_vesting::Call::<Test>::vest {}); let vest_call = RuntimeCall::Vesting(pallet_vesting::Call::<Test>::vest {});
assert_ok!(vest_call.clone().dispatch(Origin::signed(alice()))); assert_ok!(vest_call.clone().dispatch(Origin::signed(alice())));
assert_ok!(vest_call.clone().dispatch(Origin::signed(bob()))); assert_ok!(vest_call.clone().dispatch(Origin::signed(bob())));
assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45)); assert_eq!(<Test as Config>::VestingSchedule::vesting_balance(&alice()), Some(45));
+7 -7
View File
@@ -74,7 +74,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// 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>;
/// The currency type used for bidding. /// The currency type used for bidding.
type Currency: ReservableCurrency<Self::AccountId>; type Currency: ReservableCurrency<Self::AccountId>;
@@ -530,7 +530,7 @@ mod tests {
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -538,7 +538,7 @@ mod tests {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = (); type DbWeight = ();
type Version = (); type Version = ();
@@ -558,7 +558,7 @@ mod tests {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type Balance = u64; type Balance = u64;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -575,7 +575,7 @@ mod tests {
} }
impl Config for Test { impl Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = TestRegistrar<Test>; type Registrar = TestRegistrar<Test>;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -988,9 +988,9 @@ mod benchmarking {
use crate::slots::Pallet as Slots; use crate::slots::Pallet as Slots;
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
@@ -32,8 +32,8 @@ parameter_types! {
} }
impl pallet_democracy::Config for Runtime { impl pallet_democracy::Config for Runtime {
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod; type EnactmentPeriod = EnactmentPeriod;
type VoteLockingPeriod = EnactmentPeriod; type VoteLockingPeriod = EnactmentPeriod;
@@ -93,8 +93,8 @@ parameter_types! {
pub type CouncilCollective = pallet_collective::Instance1; pub type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime { impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration; type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals; type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers; type MaxMembers = CouncilMaxMembers;
@@ -121,7 +121,7 @@ parameter_types! {
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime { impl pallet_elections_phragmen::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ChangeMembers = Council; type ChangeMembers = Council;
type InitializeMembers = Council; type InitializeMembers = Council;
@@ -149,8 +149,8 @@ parameter_types! {
pub type TechnicalCollective = pallet_collective::Instance2; pub type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime { impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration; type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals; type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers; type MaxMembers = TechnicalMaxMembers;
@@ -159,7 +159,7 @@ impl pallet_collective::Config<TechnicalCollective> for Runtime {
} }
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime { impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AddOrigin = MoreThanHalfCouncil; type AddOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil; type RemoveOrigin = MoreThanHalfCouncil;
type SwapOrigin = MoreThanHalfCouncil; type SwapOrigin = MoreThanHalfCouncil;
+125 -116
View File
@@ -157,7 +157,7 @@ impl frame_system::Config for Runtime {
type BlockWeights = BlockWeights; type BlockWeights = BlockWeights;
type BlockLength = BlockLength; type BlockLength = BlockLength;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = Nonce; type Index = Nonce;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = Hash; type Hash = Hash;
@@ -165,7 +165,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = AccountIdLookup<AccountId, ()>; type Lookup = AccountIdLookup<AccountId, ()>;
type Header = generic::Header<BlockNumber, BlakeTwo256>; type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = RocksDbWeight; type DbWeight = RocksDbWeight;
type Version = Version; type Version = Version;
@@ -215,10 +215,10 @@ impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
} }
impl pallet_scheduler::Config for Runtime { impl pallet_scheduler::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type Call = Call; type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight; type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = ScheduleOrigin; type ScheduleOrigin = ScheduleOrigin;
type MaxScheduledPerBlock = MaxScheduledPerBlock; type MaxScheduledPerBlock = MaxScheduledPerBlock;
@@ -236,7 +236,7 @@ parameter_types! {
impl pallet_preimage::Config for Runtime { impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>; type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>; type ManagerOrigin = EnsureRoot<AccountId>;
type MaxSize = PreimageMaxSize; type MaxSize = PreimageMaxSize;
@@ -292,7 +292,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex; type AccountIndex = AccountIndex;
type Currency = Balances; type Currency = Balances;
type Deposit = IndexDeposit; type Deposit = IndexDeposit;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>; type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>;
} }
@@ -305,7 +305,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
@@ -322,7 +322,7 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Self>>; type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Self>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
@@ -363,7 +363,7 @@ impl_opaque_keys! {
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>; type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
@@ -455,7 +455,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
} }
impl pallet_election_provider_multi_phase::Config for Runtime { impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EstimateCallFee = TransactionPayment; type EstimateCallFee = TransactionPayment;
type UnsignedPhase = UnsignedPhase; type UnsignedPhase = UnsignedPhase;
@@ -501,7 +501,7 @@ parameter_types! {
} }
impl pallet_bags_list::Config for Runtime { impl pallet_bags_list::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking; type ScoreProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>; type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type BagThresholds = BagThresholds; type BagThresholds = BagThresholds;
@@ -597,7 +597,7 @@ impl pallet_staking::Config for Runtime {
type ElectionProvider = ElectionProviderMultiPhase; type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>; type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type RewardRemainder = Treasury; type RewardRemainder = Treasury;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Slash = Treasury; type Slash = Treasury;
type Reward = (); type Reward = ();
type SessionsPerEra = SessionsPerEra; type SessionsPerEra = SessionsPerEra;
@@ -646,7 +646,7 @@ impl pallet_treasury::Config for Runtime {
type Currency = Balances; type Currency = Balances;
type ApproveOrigin = ApproveOrigin; type ApproveOrigin = ApproveOrigin;
type RejectOrigin = MoreThanHalfCouncil; type RejectOrigin = MoreThanHalfCouncil;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury; type OnSlash = Treasury;
type ProposalBond = ProposalBond; type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum; type ProposalBondMinimum = ProposalBondMinimum;
@@ -681,7 +681,7 @@ impl pallet_bounties::Config for Runtime {
type BountyValueMinimum = BountyValueMinimum; type BountyValueMinimum = BountyValueMinimum;
type ChildBountyManager = ChildBounties; type ChildBountyManager = ChildBounties;
type DataDepositPerByte = DataDepositPerByte; type DataDepositPerByte = DataDepositPerByte;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MaximumReasonLength = MaximumReasonLength; type MaximumReasonLength = MaximumReasonLength;
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>; type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
} }
@@ -692,7 +692,7 @@ parameter_types! {
} }
impl pallet_child_bounties::Config for Runtime { impl pallet_child_bounties::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = MaxActiveChildBountyCount; type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
type ChildBountyValueMinimum = ChildBountyValueMinimum; type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>; type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>;
@@ -705,12 +705,12 @@ impl pallet_tips::Config for Runtime {
type TipCountdown = TipCountdown; type TipCountdown = TipCountdown;
type TipFindersFee = TipFindersFee; type TipFindersFee = TipFindersFee;
type TipReportDepositBase = TipReportDepositBase; type TipReportDepositBase = TipReportDepositBase;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_tips::WeightInfo<Runtime>; type WeightInfo = weights::pallet_tips::WeightInfo<Runtime>;
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking; type OnOffenceHandler = Staking;
} }
@@ -725,7 +725,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime { impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical; type ValidatorSet = Historical;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
@@ -737,8 +737,7 @@ impl pallet_im_online::Config for Runtime {
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call;
type KeyOwnerProof = type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
@@ -764,14 +763,14 @@ impl pallet_grandpa::Config for Runtime {
/// format of the chain. /// format of the chain.
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where where
Call: From<LocalCall>, RuntimeCall: From<LocalCall>,
{ {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call, call: RuntimeCall,
public: <Signature as Verify>::Signer, public: <Signature as Verify>::Signer,
account: AccountId, account: AccountId,
nonce: <Runtime as frame_system::Config>::Index, nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> { ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup; use sp_runtime::traits::StaticLookup;
// take the biggest period possible. // take the biggest period possible.
let period = let period =
@@ -815,10 +814,10 @@ impl frame_system::offchain::SigningTypes for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -826,7 +825,7 @@ parameter_types! {
} }
impl claims::Config for Runtime { impl claims::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type Prefix = Prefix; type Prefix = Prefix;
type MoveClaimOrigin = type MoveClaimOrigin =
@@ -845,7 +844,7 @@ parameter_types! {
} }
impl pallet_identity::Config for Runtime { impl pallet_identity::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BasicDeposit = BasicDeposit; type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit; type FieldDeposit = FieldDeposit;
@@ -860,8 +859,8 @@ impl pallet_identity::Config for Runtime {
} }
impl pallet_utility::Config for Runtime { impl pallet_utility::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>; type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
} }
@@ -875,8 +874,8 @@ parameter_types! {
} }
impl pallet_multisig::Config for Runtime { impl pallet_multisig::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type DepositBase = DepositBase; type DepositBase = DepositBase;
type DepositFactor = DepositFactor; type DepositFactor = DepositFactor;
@@ -892,9 +891,9 @@ parameter_types! {
} }
impl pallet_recovery::Config for Runtime { impl pallet_recovery::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase; type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor; type FriendDepositFactor = FriendDepositFactor;
@@ -915,7 +914,7 @@ parameter_types! {
} }
impl pallet_society::Config for Runtime { impl pallet_society::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>; type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type CandidateDeposit = CandidateDeposit; type CandidateDeposit = CandidateDeposit;
@@ -938,7 +937,7 @@ parameter_types! {
} }
impl pallet_vesting::Config for Runtime { impl pallet_vesting::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = ConvertInto; type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -988,86 +987,95 @@ impl Default for ProxyType {
} }
} }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &Call) -> bool { fn filter(&self, c: &RuntimeCall) -> bool {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => matches!( ProxyType::NonTransfer => matches!(
c, c,
Call::System(..) | RuntimeCall::System(..) |
Call::Babe(..) | RuntimeCall::Babe(..) |
Call::Timestamp(..) | RuntimeCall::Timestamp(..) |
Call::Indices(pallet_indices::Call::claim {..}) | RuntimeCall::Indices(pallet_indices::Call::claim {..}) |
Call::Indices(pallet_indices::Call::free {..}) | RuntimeCall::Indices(pallet_indices::Call::free {..}) |
Call::Indices(pallet_indices::Call::freeze {..}) | RuntimeCall::Indices(pallet_indices::Call::freeze {..}) |
// Specifically omitting Indices `transfer`, `force_transfer` // Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet // Specifically omitting the entire Balances pallet
Call::Authorship(..) | RuntimeCall::Authorship(..) |
Call::Staking(..) | RuntimeCall::Staking(..) |
Call::Session(..) | RuntimeCall::Session(..) |
Call::Grandpa(..) | RuntimeCall::Grandpa(..) |
Call::ImOnline(..) | RuntimeCall::ImOnline(..) |
Call::Democracy(..) | RuntimeCall::Democracy(..) |
Call::Council(..) | RuntimeCall::Council(..) |
Call::TechnicalCommittee(..) | RuntimeCall::TechnicalCommittee(..) |
Call::PhragmenElection(..) | RuntimeCall::PhragmenElection(..) |
Call::TechnicalMembership(..) | RuntimeCall::TechnicalMembership(..) |
Call::Treasury(..) | RuntimeCall::Treasury(..) |
Call::Bounties(..) | RuntimeCall::Bounties(..) |
Call::ChildBounties(..) | RuntimeCall::ChildBounties(..) |
Call::Tips(..) | RuntimeCall::Tips(..) |
Call::Claims(..) | RuntimeCall::Claims(..) |
Call::Utility(..) | RuntimeCall::Utility(..) |
Call::Identity(..) | RuntimeCall::Identity(..) |
Call::Society(..) | RuntimeCall::Society(..) |
Call::Recovery(pallet_recovery::Call::as_recovered {..}) | RuntimeCall::Recovery(pallet_recovery::Call::as_recovered {..}) |
Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::vouch_recovery {..}) |
Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::claim_recovery {..}) |
Call::Recovery(pallet_recovery::Call::close_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::close_recovery {..}) |
Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::remove_recovery {..}) |
Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | RuntimeCall::Recovery(pallet_recovery::Call::cancel_recovered {..}) |
// Specifically omitting Recovery `create_recovery`, `initiate_recovery` // Specifically omitting Recovery `create_recovery`, `initiate_recovery`
Call::Vesting(pallet_vesting::Call::vest {..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest {..}) |
Call::Vesting(pallet_vesting::Call::vest_other {..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest_other {..}) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Scheduler(..) | RuntimeCall::Scheduler(..) |
Call::Proxy(..) | RuntimeCall::Proxy(..) |
Call::Multisig(..) | RuntimeCall::Multisig(..) |
Call::Gilt(..) | RuntimeCall::Gilt(..) |
Call::Registrar(paras_registrar::Call::register {..}) | RuntimeCall::Registrar(paras_registrar::Call::register {..}) |
Call::Registrar(paras_registrar::Call::deregister {..}) | RuntimeCall::Registrar(paras_registrar::Call::deregister {..}) |
// Specifically omitting Registrar `swap` // Specifically omitting Registrar `swap`
Call::Registrar(paras_registrar::Call::reserve {..}) | RuntimeCall::Registrar(paras_registrar::Call::reserve {..}) |
Call::Crowdloan(..) | RuntimeCall::Crowdloan(..) |
Call::Slots(..) | RuntimeCall::Slots(..) |
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet RuntimeCall::Auctions(..) | // Specifically omitting the entire XCM Pallet
Call::VoterList(..) | RuntimeCall::VoterList(..) |
Call::NominationPools(..) RuntimeCall::NominationPools(..)
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..) |
Call::Council(..) | Call::TechnicalCommittee(..) |
Call::PhragmenElection(..) |
Call::Treasury(..) | Call::Bounties(..) |
Call::Tips(..) | Call::Utility(..) |
Call::ChildBounties(..)
), ),
ProxyType::Governance =>
matches!(
c,
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::Tips(..) | RuntimeCall::Utility(..) |
RuntimeCall::ChildBounties(..)
),
ProxyType::Staking => { ProxyType::Staking => {
matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) matches!(
c,
RuntimeCall::Staking(..) | RuntimeCall::Session(..) | RuntimeCall::Utility(..)
)
}, },
ProxyType::IdentityJudgement => matches!( ProxyType::IdentityJudgement => matches!(
c, c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
), ),
ProxyType::CancelProxy => { ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
}, },
ProxyType::Auction => matches!( ProxyType::Auction => matches!(
c, c,
Call::Auctions(..) | Call::Crowdloan(..) | Call::Registrar(..) | Call::Slots(..) RuntimeCall::Auctions(..) |
RuntimeCall::Crowdloan(..) |
RuntimeCall::Registrar(..) |
RuntimeCall::Slots(..)
), ),
ProxyType::Society => matches!(c, Call::Society(..)), ProxyType::Society => matches!(c, RuntimeCall::Society(..)),
} }
} }
fn is_superset(&self, o: &Self) -> bool { fn is_superset(&self, o: &Self) -> bool {
@@ -1082,8 +1090,8 @@ impl InstanceFilter<Call> for ProxyType {
} }
impl pallet_proxy::Config for Runtime { impl pallet_proxy::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ProxyType = ProxyType; type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase; type ProxyDepositBase = ProxyDepositBase;
@@ -1109,7 +1117,7 @@ impl parachains_session_info::Config for Runtime {
} }
impl parachains_inclusion::Config for Runtime { impl parachains_inclusion::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = ParasDisputes; type DisputesHandler = ParasDisputes;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
} }
@@ -1119,7 +1127,7 @@ parameter_types! {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
@@ -1130,7 +1138,7 @@ parameter_types! {
} }
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = type UmpSink =
crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>; crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
@@ -1141,7 +1149,7 @@ impl parachains_ump::Config for Runtime {
impl parachains_dmp::Config for Runtime {} impl parachains_dmp::Config for Runtime {}
impl parachains_hrmp::Config for Runtime { impl parachains_hrmp::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Runtime>;
@@ -1160,7 +1168,7 @@ impl parachains_initializer::Config for Runtime {
} }
impl parachains_disputes::Config for Runtime { impl parachains_disputes::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
type PunishValidators = (); type PunishValidators = ();
type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>;
@@ -1171,7 +1179,7 @@ parameter_types! {
} }
impl paras_registrar::Config for Runtime { impl paras_registrar::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type OnSwap = (Crowdloan, Slots); type OnSwap = (Crowdloan, Slots);
@@ -1186,7 +1194,7 @@ parameter_types! {
} }
impl slots::Config for Runtime { impl slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -1205,7 +1213,7 @@ parameter_types! {
} }
impl crowdloan::Config for Runtime { impl crowdloan::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId; type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
@@ -1230,7 +1238,7 @@ type AuctionInitiate = EitherOfDiverse<
>; >;
impl auctions::Config for Runtime { impl auctions::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = Slots; type Leaser = Slots;
type Registrar = Registrar; type Registrar = Registrar;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -1252,7 +1260,7 @@ parameter_types! {
} }
impl pallet_gilt::Config for Runtime { impl pallet_gilt::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type CurrencyBalance = Balance; type CurrencyBalance = Balance;
type AdminOrigin = MoreThanHalfCouncil; type AdminOrigin = MoreThanHalfCouncil;
@@ -1275,7 +1283,7 @@ parameter_types! {
} }
impl pallet_nomination_pools::Config for Runtime { impl pallet_nomination_pools::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>; type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
type Currency = Balances; type Currency = Balances;
type CurrencyBalance = Balance; type CurrencyBalance = Balance;
@@ -1425,7 +1433,8 @@ pub type SignedExtra = (
pallet_transaction_payment::ChargeTransactionPayment<Runtime>, pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -1436,7 +1445,7 @@ pub type Executive = frame_executive::Executive<
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>, pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
>; >;
/// The payload being signed in the transactions. /// The payload being signed in the transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>; pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
#[macro_use] #[macro_use]
@@ -1608,7 +1617,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> { fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| { parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev { match ev {
Event::ParaInclusion(ev) => { RuntimeEvent::ParaInclusion(ev) => {
Some(ev) Some(ev)
} }
_ => None, _ => None,
@@ -1834,13 +1843,13 @@ sp_api::impl_runtime_apis! {
} }
} }
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call> impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime for Runtime
{ {
fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance> { fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len) TransactionPayment::query_call_info(call, len)
} }
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance> { fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len) TransactionPayment::query_call_fee_details(call, len)
} }
} }
@@ -1965,7 +1974,7 @@ sp_api::impl_runtime_apis! {
} }
impl pallet_xcm_benchmarks::generic::Config for Runtime { impl pallet_xcm_benchmarks::generic::Config for Runtime {
type Call = Call; type RuntimeCall = RuntimeCall;
fn worst_case_response() -> (u64, Response) { fn worst_case_response() -> (u64, Response) {
(0u64, Response::Version(Default::default())) (0u64, Response::Version(Default::default()))
@@ -2084,7 +2093,7 @@ mod multiplier_tests {
println!("calling {:?}", call); println!("calling {:?}", call);
let info = call.get_dispatch_info(); let info = call.get_dispatch_info();
// convert to outer call. // convert to outer call.
let call = Call::System(call); let call = RuntimeCall::System(call);
let len = call.using_encoded(|e| e.len()) as u32; let len = call.using_encoded(|e| e.len()) as u32;
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default()
+2 -2
View File
@@ -87,7 +87,7 @@ fn transfer_cost_min_multiplier() {
}; };
let info = call.get_dispatch_info(); let info = call.get_dispatch_info();
// convert to outer call. // convert to outer call.
let call = Call::Balances(call); let call = RuntimeCall::Balances(call);
let len = call.using_encoded(|e| e.len()) as u32; let len = call.using_encoded(|e| e.len()) as u32;
let mut ext = sp_io::TestExternalities::new_empty(); let mut ext = sp_io::TestExternalities::new_empty();
@@ -173,5 +173,5 @@ fn era_payout_should_give_sensible_results() {
#[test] #[test]
fn call_size() { fn call_size() {
Call::assert_size_under(230); RuntimeCall::assert_size_under(230);
} }
@@ -72,8 +72,8 @@ impl WeighMultiAssets for MultiAssets {
} }
} }
pub struct KusamaXcmWeight<Call>(core::marker::PhantomData<Call>); pub struct KusamaXcmWeight<RuntimeCall>(core::marker::PhantomData<RuntimeCall>);
impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> { impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for KusamaXcmWeight<RuntimeCall> {
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset()) assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset())
} }
@@ -99,7 +99,7 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
fn transact( fn transact(
_origin_type: &OriginKind, _origin_type: &OriginKind,
_require_weight_at_most: &u64, _require_weight_at_most: &u64,
_call: &DoubleEncoded<Call>, _call: &DoubleEncoded<RuntimeCall>,
) -> XCMWeight { ) -> XCMWeight {
XcmGeneric::<Runtime>::transact().ref_time() XcmGeneric::<Runtime>::transact().ref_time()
} }
@@ -179,10 +179,10 @@ impl<Call> XcmWeightInfo<Call> for KusamaXcmWeight<Call> {
fn refund_surplus() -> XCMWeight { fn refund_surplus() -> XCMWeight {
XcmGeneric::<Runtime>::refund_surplus().ref_time() XcmGeneric::<Runtime>::refund_surplus().ref_time()
} }
fn set_error_handler(_xcm: &Xcm<Call>) -> XCMWeight { fn set_error_handler(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
XcmGeneric::<Runtime>::set_error_handler().ref_time() XcmGeneric::<Runtime>::set_error_handler().ref_time()
} }
fn set_appendix(_xcm: &Xcm<Call>) -> XCMWeight { fn set_appendix(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
XcmGeneric::<Runtime>::set_appendix().ref_time() XcmGeneric::<Runtime>::set_appendix().ref_time()
} }
fn clear_error() -> XCMWeight { fn clear_error() -> XCMWeight {
+11 -8
View File
@@ -17,8 +17,8 @@
//! XCM configurations for the Kusama runtime. //! XCM configurations for the Kusama runtime.
use super::{ use super::{
parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, parachains_origin, AccountId, Balances, CouncilCollective, Origin, ParaId, Runtime,
Runtime, WeightToFee, XcmPallet, RuntimeCall, RuntimeEvent, WeightToFee, XcmPallet,
}; };
use frame_support::{match_types, parameter_types, traits::Everything}; use frame_support::{match_types, parameter_types, traits::Everything};
use runtime_common::{xcm_sender, ToAuthor}; use runtime_common::{xcm_sender, ToAuthor};
@@ -131,7 +131,7 @@ pub type Barrier = (
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -139,8 +139,11 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = type Weigher = WeightInfoBounds<
WeightInfoBounds<crate::weights::xcm::KusamaXcmWeight<Call>, Call, MaxInstructions>; crate::weights::xcm::KusamaXcmWeight<RuntimeCall>,
RuntimeCall,
MaxInstructions,
>;
// The weight trader piggybacks on the existing transaction-fee conversion logic. // The weight trader piggybacks on the existing transaction-fee conversion logic.
type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>; type Trader = UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
@@ -170,7 +173,7 @@ pub type LocalOriginToLocation = (
SignedToAccountId32<Origin, AccountId, KusamaNetwork>, SignedToAccountId32<Origin, AccountId, KusamaNetwork>,
); );
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
// We only allow the council to send messages. This is basically safe to enable for everyone // We only allow the council to send messages. This is basically safe to enable for everyone
// (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to // (safe the possibility of someone spamming the parachain if they're willing to pay the KSM to
// send from the Relay-chain), but it's useless until we bring in XCM v3 which will make // send from the Relay-chain), but it's useless until we bring in XCM v3 which will make
@@ -186,10 +189,10 @@ impl pallet_xcm::Config for Runtime {
// Anyone is able to use reserve transfers regardless of who they are and what they want to // Anyone is able to use reserve transfers regardless of who they are and what they want to
// transfer. // transfer.
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
+1 -1
View File
@@ -410,7 +410,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + configuration::Config + session_info::Config { pub trait Config: frame_system::Config + configuration::Config + session_info::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>;
type RewardValidators: RewardValidators; type RewardValidators: RewardValidators;
type PunishValidators: PunishValidators; type PunishValidators: PunishValidators;
+1 -1
View File
@@ -239,7 +239,7 @@ pub mod pallet {
frame_system::Config + configuration::Config + paras::Config + dmp::Config frame_system::Config + configuration::Config + paras::Config + dmp::Config
{ {
/// The outer event type. /// The outer 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 Origin: From<crate::Origin> type Origin: From<crate::Origin>
+ From<<Self as frame_system::Config>::Origin> + From<<Self as frame_system::Config>::Origin>
@@ -39,9 +39,9 @@ fn register_parachain_with_balance<T: Config>(id: ParaId, balance: BalanceOf<T>)
T::Currency::make_free_balance_be(&id.into_account_truncating(), balance); T::Currency::make_free_balance_be(&id.into_account_truncating(), balance);
} }
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
@@ -16,8 +16,8 @@
use super::*; use super::*;
use crate::mock::{ use crate::mock::{
new_test_ext, Configuration, Event as MockEvent, Hrmp, MockGenesisConfig, Paras, ParasShared, new_test_ext, Configuration, Hrmp, MockGenesisConfig, Paras, ParasShared,
System, Test, RuntimeEvent as MockEvent, System, Test,
}; };
use frame_support::{assert_noop, assert_ok, traits::Currency as _}; use frame_support::{assert_noop, assert_ok, traits::Currency as _};
use primitives::v2::BlockNumber; use primitives::v2::BlockNumber;
@@ -198,7 +198,7 @@ pub mod pallet {
+ hrmp::Config + hrmp::Config
+ configuration::Config + configuration::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>;
type DisputesHandler: disputes::DisputesHandler<Self::BlockNumber>; type DisputesHandler: disputes::DisputesHandler<Self::BlockNumber>;
type RewardValidators: RewardValidators; type RewardValidators: RewardValidators;
} }
+12 -12
View File
@@ -73,10 +73,10 @@ frame_support::construct_runtime!(
impl<C> frame_system::offchain::SendTransactionTypes<C> for Test impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -93,7 +93,7 @@ impl frame_system::Config for Test {
type BlockLength = (); type BlockLength = ();
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
@@ -101,7 +101,7 @@ impl frame_system::Config for Test {
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<u64>; type Lookup = IdentityLookup<u64>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -123,7 +123,7 @@ impl pallet_balances::Config for Test {
type MaxReserves = (); type MaxReserves = ();
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -213,7 +213,7 @@ impl frame_support::traits::EstimateNextSessionRotation<u32> for TestNextSession
} }
impl crate::paras::Config for Test { impl crate::paras::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = crate::paras::TestWeightInfo; type WeightInfo = crate::paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = TestNextSessionRotation; type NextSessionRotation = TestNextSessionRotation;
@@ -226,7 +226,7 @@ parameter_types! {
} }
impl crate::ump::Config for Test { impl crate::ump::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = TestUmpSink; type UmpSink = TestUmpSink;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>; type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
@@ -234,14 +234,14 @@ impl crate::ump::Config for Test {
} }
impl crate::hrmp::Config for Test { impl crate::hrmp::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = pallet_balances::Pallet<Test>; type Currency = pallet_balances::Pallet<Test>;
type WeightInfo = crate::hrmp::TestWeightInfo; type WeightInfo = crate::hrmp::TestWeightInfo;
} }
impl crate::disputes::Config for Test { impl crate::disputes::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = Self; type RewardValidators = Self;
type PunishValidators = Self; type PunishValidators = Self;
type WeightInfo = crate::disputes::TestWeightInfo; type WeightInfo = crate::disputes::TestWeightInfo;
@@ -292,7 +292,7 @@ impl crate::disputes::PunishValidators for Test {
impl crate::scheduler::Config for Test {} impl crate::scheduler::Config for Test {}
impl crate::inclusion::Config for Test { impl crate::inclusion::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = Disputes; type DisputesHandler = Disputes;
type RewardValidators = TestRewardValidators; type RewardValidators = TestRewardValidators;
} }
@@ -455,9 +455,9 @@ pub struct MockGenesisConfig {
pub paras: crate::paras::GenesisConfig, pub paras: crate::paras::GenesisConfig,
} }
pub fn assert_last_event(generic_event: Event) { pub fn assert_last_event(generic_event: RuntimeEvent) {
let events = frame_system::Pallet::<Test>::events(); let events = frame_system::Pallet::<Test>::events();
let system_event: <Test as frame_system::Config>::Event = generic_event.into(); let system_event: <Test as frame_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
@@ -31,9 +31,9 @@ use self::pvf_check::{VoteCause, VoteOutcome};
// shouldn't exceed this number. // shouldn't exceed this number.
const SAMPLE_SIZE: u32 = 1024; const SAMPLE_SIZE: u32 = 1024;
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 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event); assert_eq!(event, &system_event);
+1 -1
View File
@@ -473,7 +473,7 @@ pub mod pallet {
+ shared::Config + shared::Config
+ frame_system::offchain::SendTransactionTypes<Call<Self>> + frame_system::offchain::SendTransactionTypes<Call<Self>>
{ {
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>; type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
#[pallet::constant] #[pallet::constant]
type UnsignedPriority: Get<TransactionPriority>; type UnsignedPriority: Get<TransactionPriority>;
@@ -112,8 +112,12 @@ fn check_code_is_not_stored(validation_code: &ValidationCode) {
/// An utility for checking that certain events were deposited. /// An utility for checking that certain events were deposited.
struct EventValidator { struct EventValidator {
events: events: Vec<
Vec<frame_system::EventRecord<<Test as frame_system::Config>::Event, primitives::v2::Hash>>, frame_system::EventRecord<
<Test as frame_system::Config>::RuntimeEvent,
primitives::v2::Hash,
>,
>,
} }
impl EventValidator { impl EventValidator {
@@ -323,7 +323,7 @@ pub fn candidate_pending_availability<T: initializer::Config>(
pub fn candidate_events<T, F>(extract_event: F) -> Vec<CandidateEvent<T::Hash>> pub fn candidate_events<T, F>(extract_event: F) -> Vec<CandidateEvent<T::Hash>>
where where
T: initializer::Config, T: initializer::Config,
F: Fn(<T as frame_system::Config>::Event) -> Option<inclusion::Event<T>>, F: Fn(<T as frame_system::Config>::RuntimeEvent) -> Option<inclusion::Event<T>>,
{ {
use inclusion::Event as RawEvent; use inclusion::Event as RawEvent;
+6 -4
View File
@@ -93,7 +93,9 @@ fn upward_message_id(data: &[u8]) -> MessageId {
sp_io::hashing::blake2_256(data) sp_io::hashing::blake2_256(data)
} }
impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSink<XcmExecutor, C> { impl<XcmExecutor: xcm::latest::ExecuteXcm<C::RuntimeCall>, C: Config> UmpSink
for XcmSink<XcmExecutor, C>
{
fn process_upward_message( fn process_upward_message(
origin: ParaId, origin: ParaId,
mut data: &[u8], mut data: &[u8],
@@ -106,13 +108,13 @@ impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSi
}; };
let id = upward_message_id(&data[..]); let id = upward_message_id(&data[..]);
let maybe_msg_and_weight = VersionedXcm::<C::Call>::decode_all_with_depth_limit( let maybe_msg_and_weight = VersionedXcm::<C::RuntimeCall>::decode_all_with_depth_limit(
xcm::MAX_XCM_DECODE_DEPTH, xcm::MAX_XCM_DECODE_DEPTH,
&mut data, &mut data,
) )
.map(|xcm| { .map(|xcm| {
( (
Xcm::<C::Call>::try_from(xcm), Xcm::<C::RuntimeCall>::try_from(xcm),
// NOTE: We are overestimating slightly here. // NOTE: We are overestimating slightly here.
// The benchmark is timing this whole function with different message sizes and a NOOP extrinsic to // The benchmark is timing this whole function with different message sizes and a NOOP extrinsic to
// measure the size-dependent weight. But as we use the weight funtion **in** the benchmarked funtion we // measure the size-dependent weight. But as we use the weight funtion **in** the benchmarked funtion we
@@ -218,7 +220,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + configuration::Config { pub trait Config: frame_system::Config + configuration::Config {
/// The aggregate event. /// The aggregate event.
type Event: From<Event> + IsType<<Self as frame_system::Config>::Event>; type RuntimeEvent: From<Event> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// A place where all received upward messages are funneled. /// A place where all received upward messages are funneled.
type UmpSink: UmpSink; type UmpSink: UmpSink;
@@ -18,9 +18,9 @@ use super::{Pallet as Ump, *};
use frame_system::RawOrigin; use frame_system::RawOrigin;
use xcm::prelude::*; use xcm::prelude::*;
fn assert_last_event_type<T: Config>(generic_event: <T as Config>::Event) { fn assert_last_event_type<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events(); 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 // compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1]; let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(sp_std::mem::discriminant(event), sp_std::mem::discriminant(&system_event)); assert_eq!(sp_std::mem::discriminant(event), sp_std::mem::discriminant(&system_event));
+124 -115
View File
@@ -147,7 +147,7 @@ impl frame_system::Config for Runtime {
type BlockWeights = BlockWeights; type BlockWeights = BlockWeights;
type BlockLength = BlockLength; type BlockLength = BlockLength;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = Nonce; type Index = Nonce;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = Hash; type Hash = Hash;
@@ -155,7 +155,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = AccountIdLookup<AccountId, ()>; type Lookup = AccountIdLookup<AccountId, ()>;
type Header = generic::Header<BlockNumber, BlakeTwo256>; type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = RocksDbWeight; type DbWeight = RocksDbWeight;
type Version = Version; type Version = Version;
@@ -205,10 +205,10 @@ impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
} }
impl pallet_scheduler::Config for Runtime { impl pallet_scheduler::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type Call = Call; type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight; type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = ScheduleOrigin; type ScheduleOrigin = ScheduleOrigin;
type MaxScheduledPerBlock = MaxScheduledPerBlock; type MaxScheduledPerBlock = MaxScheduledPerBlock;
@@ -226,7 +226,7 @@ parameter_types! {
impl pallet_preimage::Config for Runtime { impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>; type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>; type ManagerOrigin = EnsureRoot<AccountId>;
type MaxSize = PreimageMaxSize; type MaxSize = PreimageMaxSize;
@@ -282,7 +282,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex; type AccountIndex = AccountIndex;
type Currency = Balances; type Currency = Balances;
type Deposit = IndexDeposit; type Deposit = IndexDeposit;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>; type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>;
} }
@@ -295,7 +295,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
@@ -312,7 +312,7 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>; type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
@@ -354,7 +354,7 @@ impl_opaque_keys! {
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>; type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
@@ -446,7 +446,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
} }
impl pallet_election_provider_multi_phase::Config for Runtime { impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EstimateCallFee = TransactionPayment; type EstimateCallFee = TransactionPayment;
type SignedPhase = SignedPhase; type SignedPhase = SignedPhase;
@@ -492,7 +492,7 @@ parameter_types! {
} }
impl pallet_bags_list::Config for Runtime { impl pallet_bags_list::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking; type ScoreProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>; type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type BagThresholds = BagThresholds; type BagThresholds = BagThresholds;
@@ -540,7 +540,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote; type CurrencyToVote = CurrencyToVote;
type RewardRemainder = Treasury; type RewardRemainder = Treasury;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Slash = Treasury; type Slash = Treasury;
type Reward = (); type Reward = ();
type SessionsPerEra = SessionsPerEra; type SessionsPerEra = SessionsPerEra;
@@ -573,7 +573,7 @@ parameter_types! {
} }
impl pallet_identity::Config for Runtime { impl pallet_identity::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BasicDeposit = BasicDeposit; type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit; type FieldDeposit = FieldDeposit;
@@ -600,8 +600,8 @@ parameter_types! {
} }
impl pallet_democracy::Config for Runtime { impl pallet_democracy::Config for Runtime {
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod; type EnactmentPeriod = EnactmentPeriod;
type VoteLockingPeriod = EnactmentPeriod; type VoteLockingPeriod = EnactmentPeriod;
@@ -671,8 +671,8 @@ parameter_types! {
pub type CouncilCollective = pallet_collective::Instance1; pub type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime { impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration; type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals; type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers; type MaxMembers = CouncilMaxMembers;
@@ -699,7 +699,7 @@ parameter_types! {
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime { impl pallet_elections_phragmen::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = PhragmenElectionPalletId; type PalletId = PhragmenElectionPalletId;
type Currency = Balances; type Currency = Balances;
type ChangeMembers = Council; type ChangeMembers = Council;
@@ -727,8 +727,8 @@ parameter_types! {
pub type TechnicalCollective = pallet_collective::Instance2; pub type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime { impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration; type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals; type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers; type MaxMembers = TechnicalMaxMembers;
@@ -737,7 +737,7 @@ impl pallet_collective::Config<TechnicalCollective> for Runtime {
} }
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime { impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AddOrigin = MoreThanHalfCouncil; type AddOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil; type RemoveOrigin = MoreThanHalfCouncil;
type SwapOrigin = MoreThanHalfCouncil; type SwapOrigin = MoreThanHalfCouncil;
@@ -778,7 +778,7 @@ impl pallet_treasury::Config for Runtime {
type Currency = Balances; type Currency = Balances;
type ApproveOrigin = ApproveOrigin; type ApproveOrigin = ApproveOrigin;
type RejectOrigin = MoreThanHalfCouncil; type RejectOrigin = MoreThanHalfCouncil;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury; type OnSlash = Treasury;
type ProposalBond = ProposalBond; type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum; type ProposalBondMinimum = ProposalBondMinimum;
@@ -804,7 +804,7 @@ parameter_types! {
} }
impl pallet_bounties::Config for Runtime { impl pallet_bounties::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = BountyDepositBase; type BountyDepositBase = BountyDepositBase;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay; type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod; type BountyUpdatePeriod = BountyUpdatePeriod;
@@ -824,14 +824,14 @@ parameter_types! {
} }
impl pallet_child_bounties::Config for Runtime { impl pallet_child_bounties::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = MaxActiveChildBountyCount; type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
type ChildBountyValueMinimum = ChildBountyValueMinimum; type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>; type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>;
} }
impl pallet_tips::Config for Runtime { impl pallet_tips::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DataDepositPerByte = DataDepositPerByte; type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength; type MaximumReasonLength = MaximumReasonLength;
type Tippers = PhragmenElection; type Tippers = PhragmenElection;
@@ -842,7 +842,7 @@ impl pallet_tips::Config for Runtime {
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking; type OnOffenceHandler = Staking;
} }
@@ -859,7 +859,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime { impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical; type ValidatorSet = Historical;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
@@ -871,8 +871,7 @@ impl pallet_im_online::Config for Runtime {
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call;
type KeyOwnerProof = type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
@@ -898,14 +897,14 @@ impl pallet_grandpa::Config for Runtime {
/// format of the chain. /// format of the chain.
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where where
Call: From<LocalCall>, RuntimeCall: From<LocalCall>,
{ {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call, call: RuntimeCall,
public: <Signature as Verify>::Signer, public: <Signature as Verify>::Signer,
account: AccountId, account: AccountId,
nonce: <Runtime as frame_system::Config>::Index, nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> { ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup; use sp_runtime::traits::StaticLookup;
// take the biggest period possible. // take the biggest period possible.
let period = let period =
@@ -950,10 +949,10 @@ impl frame_system::offchain::SigningTypes for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -966,7 +965,7 @@ parameter_types! {
} }
impl claims::Config for Runtime { impl claims::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type Prefix = Prefix; type Prefix = Prefix;
/// At least 3/4 of the council must agree to a claim move before it can happen. /// At least 3/4 of the council must agree to a claim move before it can happen.
@@ -980,7 +979,7 @@ parameter_types! {
} }
impl pallet_vesting::Config for Runtime { impl pallet_vesting::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = ConvertInto; type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -989,8 +988,8 @@ impl pallet_vesting::Config for Runtime {
} }
impl pallet_utility::Config for Runtime { impl pallet_utility::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>; type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
} }
@@ -1004,8 +1003,8 @@ parameter_types! {
} }
impl pallet_multisig::Config for Runtime { impl pallet_multisig::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type DepositBase = DepositBase; type DepositBase = DepositBase;
type DepositFactor = DepositFactor; type DepositFactor = DepositFactor;
@@ -1085,75 +1084,84 @@ impl Default for ProxyType {
Self::Any Self::Any
} }
} }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &Call) -> bool { fn filter(&self, c: &RuntimeCall) -> bool {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => matches!( ProxyType::NonTransfer => matches!(
c, c,
Call::System(..) | RuntimeCall::System(..) |
Call::Scheduler(..) | RuntimeCall::Scheduler(..) |
Call::Babe(..) | RuntimeCall::Babe(..) |
Call::Timestamp(..) | RuntimeCall::Timestamp(..) |
Call::Indices(pallet_indices::Call::claim{..}) | RuntimeCall::Indices(pallet_indices::Call::claim{..}) |
Call::Indices(pallet_indices::Call::free{..}) | RuntimeCall::Indices(pallet_indices::Call::free{..}) |
Call::Indices(pallet_indices::Call::freeze{..}) | RuntimeCall::Indices(pallet_indices::Call::freeze{..}) |
// Specifically omitting Indices `transfer`, `force_transfer` // Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet // Specifically omitting the entire Balances pallet
Call::Authorship(..) | RuntimeCall::Authorship(..) |
Call::Staking(..) | RuntimeCall::Staking(..) |
Call::Session(..) | RuntimeCall::Session(..) |
Call::Grandpa(..) | RuntimeCall::Grandpa(..) |
Call::ImOnline(..) | RuntimeCall::ImOnline(..) |
Call::Democracy(..) | RuntimeCall::Democracy(..) |
Call::Council(..) | RuntimeCall::Council(..) |
Call::TechnicalCommittee(..) | RuntimeCall::TechnicalCommittee(..) |
Call::PhragmenElection(..) | RuntimeCall::PhragmenElection(..) |
Call::TechnicalMembership(..) | RuntimeCall::TechnicalMembership(..) |
Call::Treasury(..) | RuntimeCall::Treasury(..) |
Call::Bounties(..) | RuntimeCall::Bounties(..) |
Call::ChildBounties(..) | RuntimeCall::ChildBounties(..) |
Call::Tips(..) | RuntimeCall::Tips(..) |
Call::Claims(..) | RuntimeCall::Claims(..) |
Call::Vesting(pallet_vesting::Call::vest{..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest{..}) |
Call::Vesting(pallet_vesting::Call::vest_other{..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..}) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Utility(..) | RuntimeCall::Utility(..) |
Call::Identity(..) | RuntimeCall::Identity(..) |
Call::Proxy(..) | RuntimeCall::Proxy(..) |
Call::Multisig(..) | RuntimeCall::Multisig(..) |
Call::Registrar(paras_registrar::Call::register {..}) | RuntimeCall::Registrar(paras_registrar::Call::register {..}) |
Call::Registrar(paras_registrar::Call::deregister {..}) | RuntimeCall::Registrar(paras_registrar::Call::deregister {..}) |
// Specifically omitting Registrar `swap` // Specifically omitting Registrar `swap`
Call::Registrar(paras_registrar::Call::reserve {..}) | RuntimeCall::Registrar(paras_registrar::Call::reserve {..}) |
Call::Crowdloan(..) | RuntimeCall::Crowdloan(..) |
Call::Slots(..) | RuntimeCall::Slots(..) |
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet RuntimeCall::Auctions(..) | // Specifically omitting the entire XCM Pallet
Call::VoterList(..) | RuntimeCall::VoterList(..) |
Call::NominationPools(..) RuntimeCall::NominationPools(..)
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..) |
Call::Council(..) | Call::TechnicalCommittee(..) |
Call::PhragmenElection(..) |
Call::Treasury(..) | Call::Bounties(..) |
Call::Tips(..) | Call::Utility(..) |
Call::ChildBounties(..)
), ),
ProxyType::Governance =>
matches!(
c,
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::Tips(..) | RuntimeCall::Utility(..) |
RuntimeCall::ChildBounties(..)
),
ProxyType::Staking => { ProxyType::Staking => {
matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) matches!(
c,
RuntimeCall::Staking(..) | RuntimeCall::Session(..) | RuntimeCall::Utility(..)
)
}, },
ProxyType::IdentityJudgement => matches!( ProxyType::IdentityJudgement => matches!(
c, c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
), ),
ProxyType::CancelProxy => { ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
}, },
ProxyType::Auction => matches!( ProxyType::Auction => matches!(
c, c,
Call::Auctions(..) | Call::Crowdloan(..) | Call::Registrar(..) | Call::Slots(..) RuntimeCall::Auctions(..) |
RuntimeCall::Crowdloan(..) |
RuntimeCall::Registrar(..) |
RuntimeCall::Slots(..)
), ),
} }
} }
@@ -1169,8 +1177,8 @@ impl InstanceFilter<Call> for ProxyType {
} }
impl pallet_proxy::Config for Runtime { impl pallet_proxy::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ProxyType = ProxyType; type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase; type ProxyDepositBase = ProxyDepositBase;
@@ -1196,7 +1204,7 @@ impl parachains_session_info::Config for Runtime {
} }
impl parachains_inclusion::Config for Runtime { impl parachains_inclusion::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = ParasDisputes; type DisputesHandler = ParasDisputes;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
} }
@@ -1206,7 +1214,7 @@ parameter_types! {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
@@ -1217,7 +1225,7 @@ parameter_types! {
} }
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = type UmpSink =
crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>; crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
@@ -1228,7 +1236,7 @@ impl parachains_ump::Config for Runtime {
impl parachains_dmp::Config for Runtime {} impl parachains_dmp::Config for Runtime {}
impl parachains_hrmp::Config for Runtime { impl parachains_hrmp::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Self>; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Self>;
@@ -1247,7 +1255,7 @@ impl parachains_initializer::Config for Runtime {
} }
impl parachains_disputes::Config for Runtime { impl parachains_disputes::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = (); type RewardValidators = ();
type PunishValidators = (); type PunishValidators = ();
type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>;
@@ -1261,7 +1269,7 @@ parameter_types! {
} }
impl paras_registrar::Config for Runtime { impl paras_registrar::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type OnSwap = (Crowdloan, Slots); type OnSwap = (Crowdloan, Slots);
@@ -1282,7 +1290,7 @@ parameter_types! {
} }
impl slots::Config for Runtime { impl slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -1304,7 +1312,7 @@ parameter_types! {
} }
impl crowdloan::Config for Runtime { impl crowdloan::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId; type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
@@ -1329,7 +1337,7 @@ type AuctionInitiate = EitherOfDiverse<
>; >;
impl auctions::Config for Runtime { impl auctions::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = Slots; type Leaser = Slots;
type Registrar = Registrar; type Registrar = Registrar;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -1346,7 +1354,7 @@ parameter_types! {
} }
impl pallet_nomination_pools::Config for Runtime { impl pallet_nomination_pools::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type CurrencyBalance = Balance; type CurrencyBalance = Balance;
type RewardCounter = FixedU128; type RewardCounter = FixedU128;
@@ -1507,7 +1515,8 @@ pub type SignedExtra = (
claims::PrevalidateAttests<Runtime>, claims::PrevalidateAttests<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -1518,7 +1527,7 @@ pub type Executive = frame_executive::Executive<
(InitiateNominationPools, pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>), (InitiateNominationPools, pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>),
>; >;
/// The payload being signed in transactions. /// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>; pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
#[macro_use] #[macro_use]
@@ -1694,7 +1703,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> { fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| { parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev { match ev {
Event::ParaInclusion(ev) => { RuntimeEvent::ParaInclusion(ev) => {
Some(ev) Some(ev)
} }
_ => None, _ => None,
@@ -1920,13 +1929,13 @@ sp_api::impl_runtime_apis! {
} }
} }
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call> impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime for Runtime
{ {
fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance> { fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len) TransactionPayment::query_call_info(call, len)
} }
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance> { fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len) TransactionPayment::query_call_fee_details(call, len)
} }
} }
@@ -2079,8 +2088,8 @@ mod test_fees {
}; };
let info = call.get_dispatch_info(); let info = call.get_dispatch_info();
println!("call = {:?} / info = {:?}", call, info); println!("call = {:?} / info = {:?}", call, info);
// convert to outer call. // convert to runtime call.
let call = Call::Balances(call); let call = RuntimeCall::Balances(call);
let extra: SignedExtra = ( let extra: SignedExtra = (
frame_system::CheckNonZeroSender::<Runtime>::new(), frame_system::CheckNonZeroSender::<Runtime>::new(),
frame_system::CheckSpecVersion::<Runtime>::new(), frame_system::CheckSpecVersion::<Runtime>::new(),
@@ -2204,9 +2213,9 @@ mod test {
#[test] #[test]
fn call_size() { fn call_size() {
assert!( assert!(
core::mem::size_of::<Call>() <= 230, core::mem::size_of::<RuntimeCall>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to \ "size of RuntimeCall is more than 230 bytes: some calls have too big arguments, use Box to \
reduce the size of Call. reduce the size of RuntimeCall.
If the limit is too strong, maybe consider increase the limit", If the limit is too strong, maybe consider increase the limit",
); );
} }
@@ -2266,7 +2275,7 @@ mod multiplier_tests {
println!("calling {:?}", call); println!("calling {:?}", call);
let info = call.get_dispatch_info(); let info = call.get_dispatch_info();
// convert to outer call. // convert to outer call.
let call = Call::System(call); let call = RuntimeCall::System(call);
let len = call.using_encoded(|e| e.len()) as u32; let len = call.using_encoded(|e| e.len()) as u32;
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default()
+7 -7
View File
@@ -17,8 +17,8 @@
//! XCM configuration for Polkadot. //! XCM configuration for Polkadot.
use super::{ use super::{
parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, parachains_origin, AccountId, Balances, CouncilCollective, Origin, ParaId, Runtime,
Runtime, WeightToFee, XcmPallet, RuntimeCall, RuntimeEvent, WeightToFee, XcmPallet,
}; };
use frame_support::{ use frame_support::{
match_types, parameter_types, match_types, parameter_types,
@@ -132,7 +132,7 @@ pub type Barrier = (
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -141,7 +141,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
// The weight trader piggybacks on the existing transaction-fee conversion logic. // The weight trader piggybacks on the existing transaction-fee conversion logic.
type Trader = UsingComponents<WeightToFee, DotLocation, AccountId, Balances, ToAuthor<Runtime>>; type Trader = UsingComponents<WeightToFee, DotLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
@@ -174,7 +174,7 @@ pub type LocalOriginToLocation = (
); );
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
// Only allow the council to send messages. // Only allow the council to send messages.
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, CouncilToPlurality>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
@@ -185,10 +185,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>; type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; // == Allow All type XcmTeleportFilter = Everything; // == Allow All
type XcmReserveTransferFilter = Everything; // == Allow All type XcmReserveTransferFilter = Everything; // == Allow All
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = AdvertisedXcmVersion; type AdvertisedXcmVersion = AdvertisedXcmVersion;
} }
+125 -121
View File
@@ -132,8 +132,8 @@ pub fn native_version() -> NativeVersion {
/// We currently allow all calls. /// We currently allow all calls.
pub struct BaseFilter; pub struct BaseFilter;
impl Contains<Call> for BaseFilter { impl Contains<RuntimeCall> for BaseFilter {
fn contains(_call: &Call) -> bool { fn contains(_call: &RuntimeCall) -> bool {
true true
} }
} }
@@ -149,7 +149,7 @@ impl frame_system::Config for Runtime {
type BlockLength = BlockLength; type BlockLength = BlockLength;
type DbWeight = RocksDbWeight; type DbWeight = RocksDbWeight;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = Nonce; type Index = Nonce;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = Hash; type Hash = Hash;
@@ -157,7 +157,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = AccountIdLookup<AccountId, ()>; type Lookup = AccountIdLookup<AccountId, ()>;
type Header = generic::Header<BlockNumber, BlakeTwo256>; type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = Version; type Version = Version;
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -206,10 +206,10 @@ impl PrivilegeCmp<OriginCaller> for OriginPrivilegeCmp {
} }
impl pallet_scheduler::Config for Runtime { impl pallet_scheduler::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type Call = Call; type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight; type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = ScheduleOrigin; type ScheduleOrigin = ScheduleOrigin;
type MaxScheduledPerBlock = MaxScheduledPerBlock; type MaxScheduledPerBlock = MaxScheduledPerBlock;
@@ -227,7 +227,7 @@ parameter_types! {
impl pallet_preimage::Config for Runtime { impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>; type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>; type ManagerOrigin = EnsureRoot<AccountId>;
type MaxSize = PreimageMaxSize; type MaxSize = PreimageMaxSize;
@@ -277,7 +277,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex; type AccountIndex = AccountIndex;
type Currency = Balances; type Currency = Balances;
type Deposit = IndexDeposit; type Deposit = IndexDeposit;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>; type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>;
} }
@@ -290,7 +290,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
@@ -307,7 +307,7 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>; type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
@@ -357,7 +357,7 @@ impl sp_runtime::traits::Convert<AccountId, Option<AccountId>> for ValidatorIdOf
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = ValidatorIdOf; type ValidatorIdOf = ValidatorIdOf;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
@@ -398,8 +398,8 @@ parameter_types! {
} }
impl pallet_democracy::Config for Runtime { impl pallet_democracy::Config for Runtime {
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EnactmentPeriod = EnactmentPeriod; type EnactmentPeriod = EnactmentPeriod;
type VoteLockingPeriod = EnactmentPeriod; type VoteLockingPeriod = EnactmentPeriod;
@@ -459,8 +459,8 @@ parameter_types! {
type CouncilCollective = pallet_collective::Instance1; type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime { impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = CouncilMotionDuration; type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals; type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers; type MaxMembers = CouncilMaxMembers;
@@ -487,7 +487,7 @@ parameter_types! {
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime { impl pallet_elections_phragmen::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ChangeMembers = Council; type ChangeMembers = Council;
type InitializeMembers = Council; type InitializeMembers = Council;
@@ -515,8 +515,8 @@ parameter_types! {
type TechnicalCollective = pallet_collective::Instance2; type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime { impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin; type Origin = Origin;
type Proposal = Call; type Proposal = RuntimeCall;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration; type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals; type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers; type MaxMembers = TechnicalMaxMembers;
@@ -530,7 +530,7 @@ type MoreThanHalfCouncil = EitherOfDiverse<
>; >;
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime { impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AddOrigin = MoreThanHalfCouncil; type AddOrigin = MoreThanHalfCouncil;
type RemoveOrigin = MoreThanHalfCouncil; type RemoveOrigin = MoreThanHalfCouncil;
type SwapOrigin = MoreThanHalfCouncil; type SwapOrigin = MoreThanHalfCouncil;
@@ -571,7 +571,7 @@ impl pallet_treasury::Config for Runtime {
type Currency = Balances; type Currency = Balances;
type ApproveOrigin = ApproveOrigin; type ApproveOrigin = ApproveOrigin;
type RejectOrigin = MoreThanHalfCouncil; type RejectOrigin = MoreThanHalfCouncil;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury; type OnSlash = Treasury;
type ProposalBond = ProposalBond; type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum; type ProposalBondMinimum = ProposalBondMinimum;
@@ -606,7 +606,7 @@ impl pallet_bounties::Config for Runtime {
type BountyValueMinimum = BountyValueMinimum; type BountyValueMinimum = BountyValueMinimum;
type ChildBountyManager = ChildBounties; type ChildBountyManager = ChildBounties;
type DataDepositPerByte = DataDepositPerByte; type DataDepositPerByte = DataDepositPerByte;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MaximumReasonLength = MaximumReasonLength; type MaximumReasonLength = MaximumReasonLength;
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>; type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
} }
@@ -617,7 +617,7 @@ parameter_types! {
} }
impl pallet_child_bounties::Config for Runtime { impl pallet_child_bounties::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = MaxActiveChildBountyCount; type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
type ChildBountyValueMinimum = ChildBountyValueMinimum; type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>; type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>;
@@ -630,12 +630,12 @@ impl pallet_tips::Config for Runtime {
type TipCountdown = TipCountdown; type TipCountdown = TipCountdown;
type TipFindersFee = TipFindersFee; type TipFindersFee = TipFindersFee;
type TipReportDepositBase = TipReportDepositBase; type TipReportDepositBase = TipReportDepositBase;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_tips::WeightInfo<Runtime>; type WeightInfo = weights::pallet_tips::WeightInfo<Runtime>;
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = (); type OnOffenceHandler = ();
} }
@@ -650,7 +650,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime { impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical; type ValidatorSet = Historical;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
@@ -662,8 +662,7 @@ impl pallet_im_online::Config for Runtime {
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call;
type KeyOwnerProof = type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
@@ -689,14 +688,14 @@ impl pallet_grandpa::Config for Runtime {
/// format of the chain. /// format of the chain.
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where where
Call: From<LocalCall>, RuntimeCall: From<LocalCall>,
{ {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call, call: RuntimeCall,
public: <Signature as Verify>::Signer, public: <Signature as Verify>::Signer,
account: AccountId, account: AccountId,
nonce: <Runtime as frame_system::Config>::Index, nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> { ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup; use sp_runtime::traits::StaticLookup;
// take the biggest period possible. // take the biggest period possible.
let period = let period =
@@ -740,10 +739,10 @@ impl frame_system::offchain::SigningTypes for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -751,7 +750,7 @@ parameter_types! {
} }
impl claims::Config for Runtime { impl claims::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type Prefix = Prefix; type Prefix = Prefix;
type MoveClaimOrigin = type MoveClaimOrigin =
@@ -770,7 +769,7 @@ parameter_types! {
} }
impl pallet_identity::Config for Runtime { impl pallet_identity::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BasicDeposit = BasicDeposit; type BasicDeposit = BasicDeposit;
type FieldDeposit = FieldDeposit; type FieldDeposit = FieldDeposit;
@@ -785,8 +784,8 @@ impl pallet_identity::Config for Runtime {
} }
impl pallet_utility::Config for Runtime { impl pallet_utility::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>; type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
} }
@@ -800,8 +799,8 @@ parameter_types! {
} }
impl pallet_multisig::Config for Runtime { impl pallet_multisig::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type DepositBase = DepositBase; type DepositBase = DepositBase;
type DepositFactor = DepositFactor; type DepositFactor = DepositFactor;
@@ -817,9 +816,9 @@ parameter_types! {
} }
impl pallet_recovery::Config for Runtime { impl pallet_recovery::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase; type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor; type FriendDepositFactor = FriendDepositFactor;
@@ -840,7 +839,7 @@ parameter_types! {
} }
impl pallet_society::Config for Runtime { impl pallet_society::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>; type Randomness = pallet_babe::RandomnessFromOneEpochAgo<Runtime>;
type CandidateDeposit = CandidateDeposit; type CandidateDeposit = CandidateDeposit;
@@ -863,7 +862,7 @@ parameter_types! {
} }
impl pallet_vesting::Config for Runtime { impl pallet_vesting::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = ConvertInto; type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -910,83 +909,87 @@ impl Default for ProxyType {
Self::Any Self::Any
} }
} }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &Call) -> bool { fn filter(&self, c: &RuntimeCall) -> bool {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => matches!( ProxyType::NonTransfer => matches!(
c, c,
Call::System(..) | RuntimeCall::System(..) |
Call::Babe(..) | RuntimeCall::Babe(..) |
Call::Timestamp(..) | RuntimeCall::Timestamp(..) |
Call::Indices(pallet_indices::Call::claim {..}) | RuntimeCall::Indices(pallet_indices::Call::claim {..}) |
Call::Indices(pallet_indices::Call::free {..}) | RuntimeCall::Indices(pallet_indices::Call::free {..}) |
Call::Indices(pallet_indices::Call::freeze {..}) | RuntimeCall::Indices(pallet_indices::Call::freeze {..}) |
// Specifically omitting Indices `transfer`, `force_transfer` // Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet // Specifically omitting the entire Balances pallet
Call::Authorship(..) | RuntimeCall::Authorship(..) |
Call::Session(..) | RuntimeCall::Session(..) |
Call::Grandpa(..) | RuntimeCall::Grandpa(..) |
Call::ImOnline(..) | RuntimeCall::ImOnline(..) |
Call::Democracy(..) | RuntimeCall::Democracy(..) |
Call::Council(..) | RuntimeCall::Council(..) |
Call::TechnicalCommittee(..) | RuntimeCall::TechnicalCommittee(..) |
Call::PhragmenElection(..) | RuntimeCall::PhragmenElection(..) |
Call::TechnicalMembership(..) | RuntimeCall::TechnicalMembership(..) |
Call::Treasury(..) | RuntimeCall::Treasury(..) |
Call::Bounties(..) | RuntimeCall::Bounties(..) |
Call::ChildBounties(..) | RuntimeCall::ChildBounties(..) |
Call::Tips(..) | RuntimeCall::Tips(..) |
Call::Claims(..) | RuntimeCall::Claims(..) |
Call::Utility(..) | RuntimeCall::Utility(..) |
Call::Identity(..) | RuntimeCall::Identity(..) |
Call::Society(..) | RuntimeCall::Society(..) |
Call::Recovery(pallet_recovery::Call::as_recovered {..}) | RuntimeCall::Recovery(pallet_recovery::Call::as_recovered {..}) |
Call::Recovery(pallet_recovery::Call::vouch_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::vouch_recovery {..}) |
Call::Recovery(pallet_recovery::Call::claim_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::claim_recovery {..}) |
Call::Recovery(pallet_recovery::Call::close_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::close_recovery {..}) |
Call::Recovery(pallet_recovery::Call::remove_recovery {..}) | RuntimeCall::Recovery(pallet_recovery::Call::remove_recovery {..}) |
Call::Recovery(pallet_recovery::Call::cancel_recovered {..}) | RuntimeCall::Recovery(pallet_recovery::Call::cancel_recovered {..}) |
// Specifically omitting Recovery `create_recovery`, `initiate_recovery` // Specifically omitting Recovery `create_recovery`, `initiate_recovery`
Call::Vesting(pallet_vesting::Call::vest {..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest {..}) |
Call::Vesting(pallet_vesting::Call::vest_other {..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest_other {..}) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Scheduler(..) | RuntimeCall::Scheduler(..) |
Call::Proxy(..) | RuntimeCall::Proxy(..) |
Call::Multisig(..) | RuntimeCall::Multisig(..) |
Call::Gilt(..) | RuntimeCall::Gilt(..) |
Call::Registrar(paras_registrar::Call::register {..}) | RuntimeCall::Registrar(paras_registrar::Call::register {..}) |
Call::Registrar(paras_registrar::Call::deregister {..}) | RuntimeCall::Registrar(paras_registrar::Call::deregister {..}) |
// Specifically omitting Registrar `swap` // Specifically omitting Registrar `swap`
Call::Registrar(paras_registrar::Call::reserve {..}) | RuntimeCall::Registrar(paras_registrar::Call::reserve {..}) |
Call::Crowdloan(..) | RuntimeCall::Crowdloan(..) |
Call::Slots(..) | RuntimeCall::Slots(..) |
Call::Auctions(..) // Specifically omitting the entire XCM Pallet RuntimeCall::Auctions(..) // Specifically omitting the entire XCM Pallet
),
ProxyType::Governance => matches!(
c,
Call::Democracy(..) |
Call::Council(..) | Call::TechnicalCommittee(..) |
Call::PhragmenElection(..) |
Call::Treasury(..) | Call::Bounties(..) |
Call::Tips(..) | Call::Utility(..) |
Call::ChildBounties(..)
), ),
ProxyType::Governance =>
matches!(
c,
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::Tips(..) | RuntimeCall::Utility(..) |
RuntimeCall::ChildBounties(..)
),
ProxyType::IdentityJudgement => matches!( ProxyType::IdentityJudgement => matches!(
c, c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
), ),
ProxyType::CancelProxy => { ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
}, },
ProxyType::Auction => matches!( ProxyType::Auction => matches!(
c, c,
Call::Auctions { .. } | RuntimeCall::Auctions { .. } |
Call::Crowdloan { .. } | RuntimeCall::Crowdloan { .. } |
Call::Registrar { .. } | RuntimeCall::Registrar { .. } |
Call::Multisig(..) | Call::Slots { .. } RuntimeCall::Multisig(..) |
RuntimeCall::Slots { .. }
), ),
ProxyType::Society => matches!(c, Call::Society(..)), ProxyType::Society => matches!(c, RuntimeCall::Society(..)),
} }
} }
fn is_superset(&self, o: &Self) -> bool { fn is_superset(&self, o: &Self) -> bool {
@@ -1001,8 +1004,8 @@ impl InstanceFilter<Call> for ProxyType {
} }
impl pallet_proxy::Config for Runtime { impl pallet_proxy::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ProxyType = ProxyType; type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase; type ProxyDepositBase = ProxyDepositBase;
@@ -1035,7 +1038,7 @@ impl runtime_parachains::inclusion::RewardValidators for RewardValidators {
} }
impl parachains_inclusion::Config for Runtime { impl parachains_inclusion::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = ParasDisputes; type DisputesHandler = ParasDisputes;
type RewardValidators = RewardValidators; type RewardValidators = RewardValidators;
} }
@@ -1045,7 +1048,7 @@ parameter_types! {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
@@ -1056,7 +1059,7 @@ parameter_types! {
} }
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = type UmpSink =
crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>; crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
@@ -1067,7 +1070,7 @@ impl parachains_ump::Config for Runtime {
impl parachains_dmp::Config for Runtime {} impl parachains_dmp::Config for Runtime {}
impl parachains_hrmp::Config for Runtime { impl parachains_hrmp::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Runtime>;
@@ -1086,7 +1089,7 @@ impl parachains_initializer::Config for Runtime {
} }
impl parachains_disputes::Config for Runtime { impl parachains_disputes::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = (); type RewardValidators = ();
type PunishValidators = (); type PunishValidators = ();
type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>;
@@ -1097,7 +1100,7 @@ parameter_types! {
} }
impl paras_registrar::Config for Runtime { impl paras_registrar::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type OnSwap = (Crowdloan, Slots); type OnSwap = (Crowdloan, Slots);
@@ -1111,7 +1114,7 @@ parameter_types! {
} }
impl slots::Config for Runtime { impl slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -1130,7 +1133,7 @@ parameter_types! {
} }
impl crowdloan::Config for Runtime { impl crowdloan::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId; type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
@@ -1155,7 +1158,7 @@ type AuctionInitiate = EitherOfDiverse<
>; >;
impl auctions::Config for Runtime { impl auctions::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = Slots; type Leaser = Slots;
type Registrar = Registrar; type Registrar = Registrar;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -1177,7 +1180,7 @@ parameter_types! {
} }
impl pallet_gilt::Config for Runtime { impl pallet_gilt::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type CurrencyBalance = Balance; type CurrencyBalance = Balance;
type AdminOrigin = MoreThanHalfCouncil; type AdminOrigin = MoreThanHalfCouncil;
@@ -1261,7 +1264,7 @@ parameter_types! {
} }
impl assigned_slots::Config for Runtime { impl assigned_slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AssignSlotOrigin = EnsureRoot<AccountId>; type AssignSlotOrigin = EnsureRoot<AccountId>;
type Leaser = Slots; type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
@@ -1272,13 +1275,13 @@ impl assigned_slots::Config for Runtime {
} }
impl validator_manager::Config for Runtime { impl validator_manager::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PrivilegedOrigin = EnsureRoot<AccountId>; type PrivilegedOrigin = EnsureRoot<AccountId>;
} }
impl pallet_sudo::Config for Runtime { impl pallet_sudo::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
} }
construct_runtime! { construct_runtime! {
@@ -1422,7 +1425,8 @@ pub type SignedExtra = (
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -1432,7 +1436,7 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem, AllPalletsWithSystem,
>; >;
/// The payload being signed in transactions. /// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>; pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
#[macro_use] #[macro_use]
@@ -1599,7 +1603,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> { fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| { parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev { match ev {
Event::ParaInclusion(ev) => { RuntimeEvent::ParaInclusion(ev) => {
Some(ev) Some(ev)
} }
_ => None, _ => None,
@@ -1926,7 +1930,7 @@ sp_api::impl_runtime_apis! {
} }
impl pallet_xcm_benchmarks::generic::Config for Runtime { impl pallet_xcm_benchmarks::generic::Config for Runtime {
type Call = Call; type RuntimeCall = RuntimeCall;
fn worst_case_response() -> (u64, Response) { fn worst_case_response() -> (u64, Response) {
(0u64, Response::Version(Default::default())) (0u64, Response::Version(Default::default()))
@@ -37,7 +37,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + pallet_session::Config { pub trait Config: frame_system::Config + pallet_session::Config {
/// The overreaching event type. /// The overreaching 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>;
/// Privileged origin that can add or remove validators. /// Privileged origin that can add or remove validators.
type PrivilegedOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>; type PrivilegedOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>;
+11 -8
View File
@@ -17,8 +17,8 @@
//! XCM configuration for Rococo. //! XCM configuration for Rococo.
use super::{ use super::{
parachains_origin, AccountId, Balances, Call, CouncilCollective, Event, Origin, ParaId, parachains_origin, AccountId, Balances, CouncilCollective, Origin, ParaId, Runtime,
Runtime, WeightToFee, XcmPallet, RuntimeCall, RuntimeEvent, WeightToFee, XcmPallet,
}; };
use frame_support::{match_types, parameter_types, traits::Everything}; use frame_support::{match_types, parameter_types, traits::Everything};
use runtime_common::{xcm_sender, ToAuthor}; use runtime_common::{xcm_sender, ToAuthor};
@@ -145,7 +145,7 @@ pub type Barrier = (
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -153,8 +153,11 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = type Weigher = WeightInfoBounds<
WeightInfoBounds<crate::weights::xcm::RococoXcmWeight<Call>, Call, MaxInstructions>; crate::weights::xcm::RococoXcmWeight<RuntimeCall>,
RuntimeCall,
MaxInstructions,
>;
// The weight trader piggybacks on the existing transaction-fee conversion logic. // The weight trader piggybacks on the existing transaction-fee conversion logic.
type Trader = UsingComponents<WeightToFee, RocLocation, AccountId, Balances, ToAuthor<Runtime>>; type Trader = UsingComponents<WeightToFee, RocLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
@@ -188,7 +191,7 @@ pub type LocalOriginToLocation = (
SignedToAccountId32<Origin, AccountId, RococoNetwork>, SignedToAccountId32<Origin, AccountId, RococoNetwork>,
); );
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally. // Anyone can execute XCM messages locally.
@@ -200,10 +203,10 @@ impl pallet_xcm::Config for Runtime {
// Anyone is able to use reserve transfers regardless of who they are and what they want to // Anyone is able to use reserve transfers regardless of who they are and what they want to
// transfer. // transfer.
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
+37 -37
View File
@@ -137,7 +137,7 @@ impl frame_system::Config for Runtime {
type BlockLength = BlockLength; type BlockLength = BlockLength;
type DbWeight = (); type DbWeight = ();
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = Nonce; type Index = Nonce;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = HashT; type Hash = HashT;
@@ -145,7 +145,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = Indices; type Lookup = Indices;
type Header = generic::Header<BlockNumber, BlakeTwo256>; type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = Version; type Version = Version;
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -160,9 +160,9 @@ impl frame_system::Config for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
} }
@@ -206,7 +206,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex; type AccountIndex = AccountIndex;
type Currency = Balances; type Currency = Balances;
type Deposit = IndexDeposit; type Deposit = IndexDeposit;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
} }
@@ -219,7 +219,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
@@ -236,7 +236,7 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ()>; type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
@@ -282,7 +282,7 @@ impl_opaque_keys! {
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>; type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
@@ -337,7 +337,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote; type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
type RewardRemainder = (); type RewardRemainder = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Slash = (); type Slash = ();
type Reward = (); type Reward = ();
type SessionsPerEra = SessionsPerEra; type SessionsPerEra = SessionsPerEra;
@@ -362,8 +362,7 @@ impl pallet_staking::Config for Runtime {
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call;
type KeyOwnerProofSystem = (); type KeyOwnerProofSystem = ();
@@ -383,14 +382,14 @@ impl pallet_grandpa::Config for Runtime {
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where where
Call: From<LocalCall>, RuntimeCall: From<LocalCall>,
{ {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call, call: RuntimeCall,
public: <Signature as Verify>::Signer, public: <Signature as Verify>::Signer,
account: AccountId, account: AccountId,
nonce: <Runtime as frame_system::Config>::Index, nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> { ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
let period = let period =
BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
@@ -427,7 +426,7 @@ impl frame_system::offchain::SigningTypes for Runtime {
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking; type OnOffenceHandler = Staking;
} }
@@ -446,7 +445,7 @@ parameter_types! {
} }
impl claims::Config for Runtime { impl claims::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting; type VestingSchedule = Vesting;
type Prefix = Prefix; type Prefix = Prefix;
type MoveClaimOrigin = frame_system::EnsureRoot<AccountId>; type MoveClaimOrigin = frame_system::EnsureRoot<AccountId>;
@@ -458,7 +457,7 @@ parameter_types! {
} }
impl pallet_vesting::Config for Runtime { impl pallet_vesting::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = ConvertInto; type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -467,8 +466,8 @@ impl pallet_vesting::Config for Runtime {
} }
impl pallet_sudo::Config for Runtime { impl pallet_sudo::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
} }
impl parachains_configuration::Config for Runtime { impl parachains_configuration::Config for Runtime {
@@ -478,13 +477,13 @@ impl parachains_configuration::Config for Runtime {
impl parachains_shared::Config for Runtime {} impl parachains_shared::Config for Runtime {}
impl parachains_inclusion::Config for Runtime { impl parachains_inclusion::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = ParasDisputes; type DisputesHandler = ParasDisputes;
type RewardValidators = RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = RewardValidatorsWithEraPoints<Runtime>;
} }
impl parachains_disputes::Config for Runtime { impl parachains_disputes::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = (); type RewardValidators = ();
type PunishValidators = (); type PunishValidators = ();
type WeightInfo = parachains_disputes::TestWeightInfo; type WeightInfo = parachains_disputes::TestWeightInfo;
@@ -509,7 +508,7 @@ parameter_types! {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = parachains_paras::TestWeightInfo; type WeightInfo = parachains_paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
@@ -522,7 +521,7 @@ parameter_types! {
} }
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = (); type UmpSink = ();
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>; type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
@@ -540,24 +539,24 @@ pub type LocalOriginToLocation = xcm_builder::SignedToAccountId32<Origin, Accoun
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
// The config types here are entirely configurable, since the only one that is sorely needed // The config types here are entirely configurable, since the only one that is sorely needed
// is `XcmExecutor`, which will be used in unit tests located in xcm-executor. // is `XcmExecutor`, which will be used in unit tests located in xcm-executor.
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type LocationInverter = xcm_config::InvertNothing; type LocationInverter = xcm_config::InvertNothing;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = xcm_builder::FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type XcmRouter = xcm_config::DoNothingRouter; type XcmRouter = xcm_config::DoNothingRouter;
type XcmExecuteFilter = Everything; type XcmExecuteFilter = Everything;
type XcmExecutor = xcm_executor::XcmExecutor<xcm_config::XcmConfig>; type XcmExecutor = xcm_executor::XcmExecutor<xcm_config::XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
impl parachains_hrmp::Config for Runtime { impl parachains_hrmp::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type WeightInfo = parachains_hrmp::TestWeightInfo; type WeightInfo = parachains_hrmp::TestWeightInfo;
@@ -570,9 +569,9 @@ impl paras_sudo_wrapper::Config for Runtime {}
impl parachains_origin::Config for Runtime {} impl parachains_origin::Config for Runtime {}
impl pallet_test_notifier::Config for Runtime { impl pallet_test_notifier::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
} }
#[frame_support::pallet] #[frame_support::pallet]
@@ -589,10 +588,10 @@ pub mod pallet_test_notifier {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + pallet_xcm::Config { pub trait Config: frame_system::Config + pallet_xcm::Config {
type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>; type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
type Origin: IsType<<Self as frame_system::Config>::Origin> type Origin: IsType<<Self as frame_system::Config>::Origin>
+ Into<Result<pallet_xcm::Origin, <Self as Config>::Origin>>; + Into<Result<pallet_xcm::Origin, <Self as Config>::Origin>>;
type Call: IsType<<Self as pallet_xcm::Config>::Call> + From<Call<Self>>; type RuntimeCall: IsType<<Self as pallet_xcm::Config>::RuntimeCall> + From<Call<Self>>;
} }
#[pallet::event] #[pallet::event]
@@ -635,7 +634,7 @@ pub mod pallet_test_notifier {
Call::<T>::notification_received { query_id: 0, response: Default::default() }; Call::<T>::notification_received { query_id: 0, response: Default::default() };
let qid = pallet_xcm::Pallet::<T>::new_notify_query( let qid = pallet_xcm::Pallet::<T>::new_notify_query(
Junction::AccountId32 { network: Any, id }.into(), Junction::AccountId32 { network: Any, id }.into(),
<T as Config>::Call::from(call), <T as Config>::RuntimeCall::from(call),
100u32.into(), 100u32.into(),
); );
Self::deposit_event(Event::<T>::NotifyQueryPrepared(qid)); Self::deposit_event(Event::<T>::NotifyQueryPrepared(qid));
@@ -732,7 +731,8 @@ pub type SignedExtra = (
pallet_transaction_payment::ChargeTransactionPayment<Runtime>, pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -742,7 +742,7 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem, AllPalletsWithSystem,
>; >;
/// The payload being signed in transactions. /// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>; pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
pub type Hash = <Block as BlockT>::Hash; pub type Hash = <Block as BlockT>::Hash;
pub type Extrinsic = <Block as BlockT>::Extrinsic; pub type Extrinsic = <Block as BlockT>::Extrinsic;
@@ -1061,13 +1061,13 @@ sp_api::impl_runtime_apis! {
} }
} }
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call> impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime for Runtime
{ {
fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance> { fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len) TransactionPayment::query_call_info(call, len)
} }
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance> { fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len) TransactionPayment::query_call_fee_details(call, len)
} }
} }
@@ -78,7 +78,7 @@ impl InvertLocation for InvertNothing {
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = super::Call; type RuntimeCall = super::RuntimeCall;
type XcmSender = DoNothingRouter; type XcmSender = DoNothingRouter;
type AssetTransactor = DummyAssetTransactor; type AssetTransactor = DummyAssetTransactor;
type OriginConverter = pallet_xcm::XcmPassthrough<super::Origin>; type OriginConverter = pallet_xcm::XcmPassthrough<super::Origin>;
@@ -86,7 +86,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = InvertNothing; type LocationInverter = InvertNothing;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<super::BaseXcmWeight, super::Call, MaxInstructions>; type Weigher = FixedWeightBounds<super::BaseXcmWeight, super::RuntimeCall, MaxInstructions>;
type Trader = DummyWeightTrader; type Trader = DummyWeightTrader;
type ResponseHandler = super::Xcm; type ResponseHandler = super::Xcm;
type AssetTrap = super::Xcm; type AssetTrap = super::Xcm;
+99 -92
View File
@@ -139,7 +139,7 @@ impl frame_system::Config for Runtime {
type BlockWeights = BlockWeights; type BlockWeights = BlockWeights;
type BlockLength = BlockLength; type BlockLength = BlockLength;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = Nonce; type Index = Nonce;
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = Hash; type Hash = Hash;
@@ -147,7 +147,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = AccountIdLookup<AccountId, ()>; type Lookup = AccountIdLookup<AccountId, ()>;
type Header = generic::Header<BlockNumber, BlakeTwo256>; type Header = generic::Header<BlockNumber, BlakeTwo256>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type DbWeight = RocksDbWeight; type DbWeight = RocksDbWeight;
type Version = Version; type Version = Version;
@@ -169,10 +169,10 @@ parameter_types! {
} }
impl pallet_scheduler::Config for Runtime { impl pallet_scheduler::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type Call = Call; type RuntimeCall = RuntimeCall;
type MaximumWeight = MaximumSchedulerWeight; type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>; type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock; type MaxScheduledPerBlock = MaxScheduledPerBlock;
@@ -190,7 +190,7 @@ parameter_types! {
impl pallet_preimage::Config for Runtime { impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>; type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>; type ManagerOrigin = EnsureRoot<AccountId>;
type MaxSize = PreimageMaxSize; type MaxSize = PreimageMaxSize;
@@ -245,7 +245,7 @@ impl pallet_indices::Config for Runtime {
type AccountIndex = AccountIndex; type AccountIndex = AccountIndex;
type Currency = Balances; type Currency = Balances;
type Deposit = IndexDeposit; type Deposit = IndexDeposit;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>; type WeightInfo = weights::pallet_indices::WeightInfo<Runtime>;
} }
@@ -258,7 +258,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
@@ -275,7 +275,7 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>; type OnChargeTransaction = CurrencyAdapter<Balances, ToAuthor<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = WeightToFee; type WeightToFee = WeightToFee;
@@ -321,7 +321,7 @@ impl_opaque_keys! {
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorId = AccountId; type ValidatorId = AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>; type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe; type ShouldEndSession = Babe;
@@ -408,7 +408,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
} }
impl pallet_election_provider_multi_phase::Config for Runtime { impl pallet_election_provider_multi_phase::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EstimateCallFee = TransactionPayment; type EstimateCallFee = TransactionPayment;
type SignedPhase = SignedPhase; type SignedPhase = SignedPhase;
@@ -451,7 +451,7 @@ parameter_types! {
} }
impl pallet_bags_list::Config for Runtime { impl pallet_bags_list::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking; type ScoreProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>; type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type BagThresholds = BagThresholds; type BagThresholds = BagThresholds;
@@ -489,7 +489,7 @@ impl pallet_staking::Config for Runtime {
type UnixTime = Timestamp; type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote; type CurrencyToVote = CurrencyToVote;
type RewardRemainder = (); type RewardRemainder = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Slash = (); type Slash = ();
type Reward = (); type Reward = ();
type SessionsPerEra = SessionsPerEra; type SessionsPerEra = SessionsPerEra;
@@ -516,7 +516,7 @@ parameter_types! {
} }
impl pallet_offences::Config for Runtime { impl pallet_offences::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>; type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking; type OnOffenceHandler = Staking;
} }
@@ -535,7 +535,7 @@ parameter_types! {
impl pallet_im_online::Config for Runtime { impl pallet_im_online::Config for Runtime {
type AuthorityId = ImOnlineId; type AuthorityId = ImOnlineId;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ValidatorSet = Historical; type ValidatorSet = Historical;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
@@ -547,8 +547,7 @@ impl pallet_im_online::Config for Runtime {
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call;
type KeyOwnerProofSystem = Historical; type KeyOwnerProofSystem = Historical;
@@ -574,14 +573,14 @@ impl pallet_grandpa::Config for Runtime {
/// format of the chain. /// format of the chain.
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
where where
Call: From<LocalCall>, RuntimeCall: From<LocalCall>,
{ {
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call, call: RuntimeCall,
public: <Signature as Verify>::Signer, public: <Signature as Verify>::Signer,
account: AccountId, account: AccountId,
nonce: <Runtime as frame_system::Config>::Index, nonce: <Runtime as frame_system::Config>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> { ) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup; use sp_runtime::traits::StaticLookup;
// take the biggest period possible. // take the biggest period possible.
let period = let period =
@@ -625,9 +624,9 @@ impl frame_system::offchain::SigningTypes for Runtime {
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime
where where
Call: From<C>, RuntimeCall: From<C>,
{ {
type OverarchingCall = Call; type OverarchingCall = RuntimeCall;
type Extrinsic = UncheckedExtrinsic; type Extrinsic = UncheckedExtrinsic;
} }
@@ -642,7 +641,7 @@ parameter_types! {
} }
impl pallet_identity::Config for Runtime { impl pallet_identity::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Slashed = (); type Slashed = ();
type BasicDeposit = BasicDeposit; type BasicDeposit = BasicDeposit;
@@ -657,8 +656,8 @@ impl pallet_identity::Config for Runtime {
} }
impl pallet_utility::Config for Runtime { impl pallet_utility::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type PalletsOrigin = OriginCaller; type PalletsOrigin = OriginCaller;
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>; type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
} }
@@ -672,8 +671,8 @@ parameter_types! {
} }
impl pallet_multisig::Config for Runtime { impl pallet_multisig::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type DepositBase = DepositBase; type DepositBase = DepositBase;
type DepositFactor = DepositFactor; type DepositFactor = DepositFactor;
@@ -689,9 +688,9 @@ parameter_types! {
} }
impl pallet_recovery::Config for Runtime { impl pallet_recovery::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase; type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor; type FriendDepositFactor = FriendDepositFactor;
@@ -704,7 +703,7 @@ parameter_types! {
} }
impl pallet_vesting::Config for Runtime { impl pallet_vesting::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type BlockNumberToBalance = ConvertInto; type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer; type MinVestedTransfer = MinVestedTransfer;
@@ -713,8 +712,8 @@ impl pallet_vesting::Config for Runtime {
} }
impl pallet_sudo::Config for Runtime { impl pallet_sudo::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
} }
parameter_types! { parameter_types! {
@@ -756,71 +755,78 @@ impl Default for ProxyType {
Self::Any Self::Any
} }
} }
impl InstanceFilter<Call> for ProxyType { impl InstanceFilter<RuntimeCall> for ProxyType {
fn filter(&self, c: &Call) -> bool { fn filter(&self, c: &RuntimeCall) -> bool {
match self { match self {
ProxyType::Any => true, ProxyType::Any => true,
ProxyType::NonTransfer => matches!( ProxyType::NonTransfer => matches!(
c, c,
Call::System(..) | RuntimeCall::System(..) |
Call::Babe(..) | RuntimeCall::Babe(..) |
Call::Timestamp(..) | RuntimeCall::Timestamp(..) |
Call::Indices(pallet_indices::Call::claim{..}) | RuntimeCall::Indices(pallet_indices::Call::claim{..}) |
Call::Indices(pallet_indices::Call::free{..}) | RuntimeCall::Indices(pallet_indices::Call::free{..}) |
Call::Indices(pallet_indices::Call::freeze{..}) | RuntimeCall::Indices(pallet_indices::Call::freeze{..}) |
// Specifically omitting Indices `transfer`, `force_transfer` // Specifically omitting Indices `transfer`, `force_transfer`
// Specifically omitting the entire Balances pallet // Specifically omitting the entire Balances pallet
Call::Authorship(..) | RuntimeCall::Authorship(..) |
Call::Staking(..) | RuntimeCall::Staking(..) |
Call::Session(..) | RuntimeCall::Session(..) |
Call::Grandpa(..) | RuntimeCall::Grandpa(..) |
Call::ImOnline(..) | RuntimeCall::ImOnline(..) |
Call::Utility(..) | RuntimeCall::Utility(..) |
Call::Identity(..) | RuntimeCall::Identity(..) |
Call::Recovery(pallet_recovery::Call::as_recovered{..}) | RuntimeCall::Recovery(pallet_recovery::Call::as_recovered{..}) |
Call::Recovery(pallet_recovery::Call::vouch_recovery{..}) | RuntimeCall::Recovery(pallet_recovery::Call::vouch_recovery{..}) |
Call::Recovery(pallet_recovery::Call::claim_recovery{..}) | RuntimeCall::Recovery(pallet_recovery::Call::claim_recovery{..}) |
Call::Recovery(pallet_recovery::Call::close_recovery{..}) | RuntimeCall::Recovery(pallet_recovery::Call::close_recovery{..}) |
Call::Recovery(pallet_recovery::Call::remove_recovery{..}) | RuntimeCall::Recovery(pallet_recovery::Call::remove_recovery{..}) |
Call::Recovery(pallet_recovery::Call::cancel_recovered{..}) | RuntimeCall::Recovery(pallet_recovery::Call::cancel_recovered{..}) |
// Specifically omitting Recovery `create_recovery`, `initiate_recovery` // Specifically omitting Recovery `create_recovery`, `initiate_recovery`
Call::Vesting(pallet_vesting::Call::vest{..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest{..}) |
Call::Vesting(pallet_vesting::Call::vest_other{..}) | RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..}) |
// Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer`
Call::Scheduler(..) | RuntimeCall::Scheduler(..) |
// Specifically omitting Sudo pallet // Specifically omitting Sudo pallet
Call::Proxy(..) | RuntimeCall::Proxy(..) |
Call::Multisig(..) | RuntimeCall::Multisig(..) |
Call::Registrar(paras_registrar::Call::register{..}) | RuntimeCall::Registrar(paras_registrar::Call::register{..}) |
Call::Registrar(paras_registrar::Call::deregister{..}) | RuntimeCall::Registrar(paras_registrar::Call::deregister{..}) |
// Specifically omitting Registrar `swap` // Specifically omitting Registrar `swap`
Call::Registrar(paras_registrar::Call::reserve{..}) | RuntimeCall::Registrar(paras_registrar::Call::reserve{..}) |
Call::Crowdloan(..) | RuntimeCall::Crowdloan(..) |
Call::Slots(..) | RuntimeCall::Slots(..) |
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet RuntimeCall::Auctions(..) | // Specifically omitting the entire XCM Pallet
Call::VoterList(..) | RuntimeCall::VoterList(..) |
Call::NominationPools(..) RuntimeCall::NominationPools(..)
), ),
ProxyType::Staking => { ProxyType::Staking => {
matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..)) matches!(
c,
RuntimeCall::Staking(..) | RuntimeCall::Session(..) | RuntimeCall::Utility(..)
)
}, },
ProxyType::SudoBalances => match c { ProxyType::SudoBalances => match c {
Call::Sudo(pallet_sudo::Call::sudo { call: ref x }) => { RuntimeCall::Sudo(pallet_sudo::Call::sudo { call: ref x }) => {
matches!(x.as_ref(), &Call::Balances(..)) matches!(x.as_ref(), &RuntimeCall::Balances(..))
}, },
Call::Utility(..) => true, RuntimeCall::Utility(..) => true,
_ => false, _ => false,
}, },
ProxyType::IdentityJudgement => matches!( ProxyType::IdentityJudgement => matches!(
c, c,
Call::Identity(pallet_identity::Call::provide_judgement { .. }) | Call::Utility(..) RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
), ),
ProxyType::CancelProxy => { ProxyType::CancelProxy => {
matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement { .. })) matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
}, },
ProxyType::Auction => matches!( ProxyType::Auction => matches!(
c, c,
Call::Auctions(..) | Call::Crowdloan(..) | Call::Registrar(..) | Call::Slots(..) RuntimeCall::Auctions(..) |
RuntimeCall::Crowdloan(..) |
RuntimeCall::Registrar(..) |
RuntimeCall::Slots(..)
), ),
} }
} }
@@ -836,8 +842,8 @@ impl InstanceFilter<Call> for ProxyType {
} }
impl pallet_proxy::Config for Runtime { impl pallet_proxy::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Call = Call; type RuntimeCall = RuntimeCall;
type Currency = Balances; type Currency = Balances;
type ProxyType = ProxyType; type ProxyType = ProxyType;
type ProxyDepositBase = ProxyDepositBase; type ProxyDepositBase = ProxyDepositBase;
@@ -863,7 +869,7 @@ impl parachains_session_info::Config for Runtime {
} }
impl parachains_inclusion::Config for Runtime { impl parachains_inclusion::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DisputesHandler = ParasDisputes; type DisputesHandler = ParasDisputes;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
} }
@@ -873,7 +879,7 @@ parameter_types! {
} }
impl parachains_paras::Config for Runtime { impl parachains_paras::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_paras::WeightInfo<Runtime>;
type UnsignedPriority = ParasUnsignedPriority; type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = Babe; type NextSessionRotation = Babe;
@@ -884,7 +890,7 @@ parameter_types! {
} }
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = type UmpSink =
crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>; crate::parachains_ump::XcmSink<xcm_executor::XcmExecutor<xcm_config::XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
@@ -895,7 +901,7 @@ impl parachains_ump::Config for Runtime {
impl parachains_dmp::Config for Runtime {} impl parachains_dmp::Config for Runtime {}
impl parachains_hrmp::Config for Runtime { impl parachains_hrmp::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Self>; type WeightInfo = weights::runtime_parachains_hrmp::WeightInfo<Self>;
@@ -924,7 +930,7 @@ parameter_types! {
} }
impl assigned_slots::Config for Runtime { impl assigned_slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type AssignSlotOrigin = EnsureRoot<AccountId>; type AssignSlotOrigin = EnsureRoot<AccountId>;
type Leaser = Slots; type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength; type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
@@ -935,7 +941,7 @@ impl assigned_slots::Config for Runtime {
} }
impl parachains_disputes::Config for Runtime { impl parachains_disputes::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>; type RewardValidators = parachains_reward_points::RewardValidatorsWithEraPoints<Runtime>;
type PunishValidators = (); type PunishValidators = ();
type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>; type WeightInfo = weights::runtime_parachains_disputes::WeightInfo<Runtime>;
@@ -947,7 +953,7 @@ parameter_types! {
} }
impl paras_registrar::Config for Runtime { impl paras_registrar::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Currency = Balances; type Currency = Balances;
type OnSwap = (Crowdloan, Slots); type OnSwap = (Crowdloan, Slots);
@@ -961,7 +967,7 @@ parameter_types! {
} }
impl slots::Config for Runtime { impl slots::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type Registrar = Registrar; type Registrar = Registrar;
type LeasePeriod = LeasePeriod; type LeasePeriod = LeasePeriod;
@@ -980,7 +986,7 @@ parameter_types! {
} }
impl crowdloan::Config for Runtime { impl crowdloan::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type PalletId = CrowdloanId; type PalletId = CrowdloanId;
type SubmissionDeposit = SubmissionDeposit; type SubmissionDeposit = SubmissionDeposit;
type MinContribution = MinContribution; type MinContribution = MinContribution;
@@ -1000,7 +1006,7 @@ parameter_types! {
} }
impl auctions::Config for Runtime { impl auctions::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Leaser = Slots; type Leaser = Slots;
type Registrar = Registrar; type Registrar = Registrar;
type EndingPeriod = EndingPeriod; type EndingPeriod = EndingPeriod;
@@ -1016,7 +1022,7 @@ parameter_types! {
} }
impl pallet_nomination_pools::Config for Runtime { impl pallet_nomination_pools::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>; type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
type Currency = Balances; type Currency = Balances;
type CurrencyBalance = Balance; type CurrencyBalance = Balance;
@@ -1147,7 +1153,8 @@ pub type SignedExtra = (
pallet_transaction_payment::ChargeTransactionPayment<Runtime>, pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive< pub type Executive = frame_executive::Executive<
Runtime, Runtime,
@@ -1158,7 +1165,7 @@ pub type Executive = frame_executive::Executive<
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>, pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
>; >;
/// The payload being signed in transactions. /// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>; pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
#[macro_use] #[macro_use]
@@ -1319,7 +1326,7 @@ sp_api::impl_runtime_apis! {
fn candidate_events() -> Vec<CandidateEvent<Hash>> { fn candidate_events() -> Vec<CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| { parachains_runtime_api_impl::candidate_events::<Runtime, _>(|ev| {
match ev { match ev {
Event::ParaInclusion(ev) => { RuntimeEvent::ParaInclusion(ev) => {
Some(ev) Some(ev)
} }
_ => None, _ => None,
@@ -1552,13 +1559,13 @@ sp_api::impl_runtime_apis! {
} }
} }
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, Call> impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
for Runtime for Runtime
{ {
fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo<Balance> { fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo<Balance> {
TransactionPayment::query_call_info(call, len) TransactionPayment::query_call_info(call, len)
} }
fn query_call_fee_details(call: Call, len: u32) -> FeeDetails<Balance> { fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len) TransactionPayment::query_call_fee_details(call, len)
} }
} }
@@ -1687,7 +1694,7 @@ sp_api::impl_runtime_apis! {
} }
impl pallet_xcm_benchmarks::generic::Config for Runtime { impl pallet_xcm_benchmarks::generic::Config for Runtime {
type Call = Call; type RuntimeCall = RuntimeCall;
fn worst_case_response() -> (u64, Response) { fn worst_case_response() -> (u64, Response) {
(0u64, Response::Version(Default::default())) (0u64, Response::Version(Default::default()))
+3 -3
View File
@@ -43,9 +43,9 @@ fn sample_size_is_sensible() {
#[test] #[test]
fn call_size() { fn call_size() {
assert!( assert!(
core::mem::size_of::<Call>() <= 230, core::mem::size_of::<RuntimeCall>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to reduce \ "size of RuntimeCall is more than 230 bytes: some calls have too big arguments, use Box to reduce \
the size of Call. the size of RuntimeCall.
If the limit is too strong, maybe consider increase the limit to 300.", If the limit is too strong, maybe consider increase the limit to 300.",
); );
} }
@@ -72,8 +72,8 @@ impl WeighMultiAssets for MultiAssets {
} }
} }
pub struct WestendXcmWeight<Call>(core::marker::PhantomData<Call>); pub struct WestendXcmWeight<RuntimeCall>(core::marker::PhantomData<RuntimeCall>);
impl<Call> XcmWeightInfo<Call> for WestendXcmWeight<Call> { impl<RuntimeCall> XcmWeightInfo<RuntimeCall> for WestendXcmWeight<RuntimeCall> {
fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset()) assets.weigh_multi_assets(XcmBalancesWeight::<Runtime>::withdraw_asset())
} }
@@ -99,7 +99,7 @@ impl<Call> XcmWeightInfo<Call> for WestendXcmWeight<Call> {
fn transact( fn transact(
_origin_type: &OriginKind, _origin_type: &OriginKind,
_require_weight_at_most: &u64, _require_weight_at_most: &u64,
_call: &DoubleEncoded<Call>, _call: &DoubleEncoded<RuntimeCall>,
) -> XCMWeight { ) -> XCMWeight {
XcmGeneric::<Runtime>::transact().ref_time() XcmGeneric::<Runtime>::transact().ref_time()
} }
@@ -179,10 +179,10 @@ impl<Call> XcmWeightInfo<Call> for WestendXcmWeight<Call> {
fn refund_surplus() -> XCMWeight { fn refund_surplus() -> XCMWeight {
XcmGeneric::<Runtime>::refund_surplus().ref_time() XcmGeneric::<Runtime>::refund_surplus().ref_time()
} }
fn set_error_handler(_xcm: &Xcm<Call>) -> XCMWeight { fn set_error_handler(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
XcmGeneric::<Runtime>::set_error_handler().ref_time() XcmGeneric::<Runtime>::set_error_handler().ref_time()
} }
fn set_appendix(_xcm: &Xcm<Call>) -> XCMWeight { fn set_appendix(_xcm: &Xcm<RuntimeCall>) -> XCMWeight {
XcmGeneric::<Runtime>::set_appendix().ref_time() XcmGeneric::<Runtime>::set_appendix().ref_time()
} }
fn clear_error() -> XCMWeight { fn clear_error() -> XCMWeight {
+9 -7
View File
@@ -17,8 +17,8 @@
//! XCM configurations for Westend. //! XCM configurations for Westend.
use super::{ use super::{
parachains_origin, weights, AccountId, Balances, Call, Event, Origin, ParaId, Runtime, parachains_origin, weights, AccountId, Balances, Origin, ParaId, Runtime, RuntimeCall,
WeightToFee, XcmPallet, RuntimeEvent, WeightToFee, XcmPallet,
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
@@ -107,7 +107,7 @@ pub type Barrier = (
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -115,7 +115,8 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = WeightInfoBounds<weights::xcm::WestendXcmWeight<Call>, Call, MaxInstructions>; type Weigher =
WeightInfoBounds<weights::xcm::WestendXcmWeight<RuntimeCall>, RuntimeCall, MaxInstructions>;
type Trader = UsingComponents<WeightToFee, WndLocation, AccountId, Balances, ToAuthor<Runtime>>; type Trader = UsingComponents<WeightToFee, WndLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
type AssetTrap = XcmPallet; type AssetTrap = XcmPallet;
@@ -131,7 +132,7 @@ pub type LocalOriginToLocation = (
); );
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally... // Anyone can execute XCM messages locally...
@@ -141,10 +142,11 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>; type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = WeightInfoBounds<weights::xcm::WestendXcmWeight<Call>, Call, MaxInstructions>; type Weigher =
WeightInfoBounds<weights::xcm::WestendXcmWeight<RuntimeCall>, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
+1 -1
View File
@@ -94,7 +94,7 @@ macro_rules! construct_runtime_prelude {
let crate::signer::Signer { account, pair, .. } = signer; let crate::signer::Signer { account, pair, .. } = signer;
let local_call = EPMCall::<Runtime>::submit { raw_solution: Box::new(raw_solution) }; let local_call = EPMCall::<Runtime>::submit { raw_solution: Box::new(raw_solution) };
let call: Call = <EPMCall<Runtime> as std::convert::TryInto<Call>>::try_into(local_call) let call: RuntimeCall = <EPMCall<Runtime> as std::convert::TryInto<RuntimeCall>>::try_into(local_call)
.expect("election provider pallet must exist in the runtime, thus \ .expect("election provider pallet must exist in the runtime, thus \
inner call can be converted, qed." inner call can be converted, qed."
); );
+1 -1
View File
@@ -377,7 +377,7 @@ macro_rules! monitor_cmd_for { ($runtime:tt) => { paste::paste! {
); );
let events = match rpc.get_storage_and_decode::< let events = match rpc.get_storage_and_decode::<
Vec<frame_system::EventRecord<Event, <Block as BlockT>::Hash>>, Vec<frame_system::EventRecord<RuntimeEvent, <Block as BlockT>::Hash>>,
>(&key, Some(hash)) >(&key, Some(hash))
.await { .await {
Ok(rp) => rp.unwrap_or_default(), Ok(rp) => rp.unwrap_or_default(),
@@ -58,12 +58,12 @@ impl frame_system::Config for Test {
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
type Call = Call; type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -86,7 +86,7 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type Balance = u64; type Balance = u64;
type DustRemoval = (); type DustRemoval = ();
type Event = Event; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type WeightInfo = (); type WeightInfo = ();
@@ -128,7 +128,7 @@ parameter_types! {
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = DevNull; type XcmSender = DevNull;
type AssetTransactor = AssetTransactor; type AssetTransactor = AssetTransactor;
type OriginConverter = (); type OriginConverter = ();
@@ -136,7 +136,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = xcm_builder::LocationInverter<Ancestry>; type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
type Barrier = AllowUnpaidExecutionFrom<Everything>; type Barrier = AllowUnpaidExecutionFrom<Everything>;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = xcm_builder::FixedRateOfFungible<WeightPrice, ()>; type Trader = xcm_builder::FixedRateOfFungible<WeightPrice, ()>;
type ResponseHandler = DevNull; type ResponseHandler = DevNull;
type AssetTrap = (); type AssetTrap = ();
@@ -85,7 +85,7 @@ benchmarks! {
transact { transact {
let origin = T::transact_origin()?; let origin = T::transact_origin()?;
let mut executor = new_executor::<T>(origin); let mut executor = new_executor::<T>(origin);
let noop_call: <T as Config>::Call = frame_system::Call::remark_with_event { let noop_call: <T as Config>::RuntimeCall = frame_system::Call::remark_with_event {
remark: Default::default() remark: Default::default()
}.into(); }.into();
let double_encoded_noop_call: DoubleEncoded<_> = noop_call.encode().into(); let double_encoded_noop_call: DoubleEncoded<_> = noop_call.encode().into();
@@ -64,12 +64,12 @@ impl frame_system::Config for Test {
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
type Call = Call; type RuntimeCall = RuntimeCall;
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
type AccountId = u64; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
@@ -100,7 +100,7 @@ parameter_types! {
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = DevNull; type XcmSender = DevNull;
type AssetTransactor = NoAssetTransactor; type AssetTransactor = NoAssetTransactor;
type OriginConverter = AlwaysSignedByDefault<Origin>; type OriginConverter = AlwaysSignedByDefault<Origin>;
@@ -108,7 +108,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = xcm_builder::LocationInverter<Ancestry>; type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
type Barrier = AllowUnpaidExecutionFrom<Everything>; type Barrier = AllowUnpaidExecutionFrom<Everything>;
type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = xcm_builder::FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = xcm_builder::FixedRateOfFungible<WeightPrice, ()>; type Trader = xcm_builder::FixedRateOfFungible<WeightPrice, ()>;
type ResponseHandler = DevNull; type ResponseHandler = DevNull;
type AssetTrap = TestAssetTrap; type AssetTrap = TestAssetTrap;
@@ -131,7 +131,7 @@ impl crate::Config for Test {
} }
impl generic::Config for Test { impl generic::Config for Test {
type Call = Call; type RuntimeCall = RuntimeCall;
fn worst_case_response() -> (u64, Response) { fn worst_case_response() -> (u64, Response) {
let assets: MultiAssets = (Concrete(Here.into()), 100).into(); let assets: MultiAssets = (Concrete(Here.into()), 100).into();
@@ -12,7 +12,7 @@ pub mod pallet {
#[pallet::config] #[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config { pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
type Call: Dispatchable<Origin = Self::Origin> type RuntimeCall: Dispatchable<Origin = Self::Origin>
+ GetDispatchInfo + GetDispatchInfo
+ From<frame_system::Call<Self>> + From<frame_system::Call<Self>>
+ Encode; + Encode;
@@ -54,11 +54,11 @@ const SEED: u32 = 0;
/// The XCM executor to use for doing stuff. /// The XCM executor to use for doing stuff.
pub type ExecutorOf<T> = xcm_executor::XcmExecutor<<T as Config>::XcmConfig>; pub type ExecutorOf<T> = xcm_executor::XcmExecutor<<T as Config>::XcmConfig>;
/// The overarching call type. /// The overarching call type.
pub type OverArchingCallOf<T> = <T as frame_system::Config>::Call; pub type OverArchingCallOf<T> = <T as frame_system::Config>::RuntimeCall;
/// The asset transactor of our executor /// The asset transactor of our executor
pub type AssetTransactorOf<T> = <<T as Config>::XcmConfig as xcm_executor::Config>::AssetTransactor; pub type AssetTransactorOf<T> = <<T as Config>::XcmConfig as xcm_executor::Config>::AssetTransactor;
/// The call type of executor's config. Should eventually resolve to the same overarching call type. /// The call type of executor's config. Should eventually resolve to the same overarching call type.
pub type XcmCallOf<T> = <<T as Config>::XcmConfig as xcm_executor::Config>::Call; pub type XcmCallOf<T> = <<T as Config>::XcmConfig as xcm_executor::Config>::RuntimeCall;
pub fn mock_worst_case_holding() -> MultiAssets { pub fn mock_worst_case_holding() -> MultiAssets {
const HOLDING_FUNGIBLES: u32 = 99; const HOLDING_FUNGIBLES: u32 = 99;
+16 -16
View File
@@ -71,7 +71,7 @@ pub mod pallet {
/// The module configuration trait. /// The module configuration trait.
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// The overarching event type. /// 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>;
/// Required origin for sending XCM messages. If successful, it resolves to `MultiLocation` /// Required origin for sending XCM messages. If successful, it resolves to `MultiLocation`
/// which exists as an interior location within this chain's XCM context. /// which exists as an interior location within this chain's XCM context.
@@ -86,10 +86,10 @@ pub mod pallet {
type ExecuteXcmOrigin: EnsureOrigin<<Self as SysConfig>::Origin, Success = MultiLocation>; type ExecuteXcmOrigin: EnsureOrigin<<Self as SysConfig>::Origin, Success = MultiLocation>;
/// Our XCM filter which messages to be executed using `XcmExecutor` must pass. /// Our XCM filter which messages to be executed using `XcmExecutor` must pass.
type XcmExecuteFilter: Contains<(MultiLocation, Xcm<<Self as SysConfig>::Call>)>; type XcmExecuteFilter: Contains<(MultiLocation, Xcm<<Self as SysConfig>::RuntimeCall>)>;
/// Something to execute an XCM message. /// Something to execute an XCM message.
type XcmExecutor: ExecuteXcm<<Self as SysConfig>::Call>; type XcmExecutor: ExecuteXcm<<Self as SysConfig>::RuntimeCall>;
/// Our XCM filter which messages to be teleported using the dedicated extrinsic must pass. /// Our XCM filter which messages to be teleported using the dedicated extrinsic must pass.
type XcmTeleportFilter: Contains<(MultiLocation, Vec<MultiAsset>)>; type XcmTeleportFilter: Contains<(MultiLocation, Vec<MultiAsset>)>;
@@ -98,7 +98,7 @@ pub mod pallet {
type XcmReserveTransferFilter: Contains<(MultiLocation, Vec<MultiAsset>)>; type XcmReserveTransferFilter: Contains<(MultiLocation, Vec<MultiAsset>)>;
/// Means of measuring the weight consumed by an XCM message locally. /// Means of measuring the weight consumed by an XCM message locally.
type Weigher: WeightBounds<<Self as SysConfig>::Call>; type Weigher: WeightBounds<<Self as SysConfig>::RuntimeCall>;
/// Means of inverting a location. /// Means of inverting a location.
type LocationInverter: InvertLocation; type LocationInverter: InvertLocation;
@@ -107,9 +107,9 @@ pub mod pallet {
type Origin: From<Origin> + From<<Self as SysConfig>::Origin>; type Origin: From<Origin> + From<<Self as SysConfig>::Origin>;
/// The outer `Call` type. /// The outer `Call` type.
type Call: Parameter type RuntimeCall: Parameter
+ GetDispatchInfo + GetDispatchInfo
+ IsType<<Self as frame_system::Config>::Call> + IsType<<Self as frame_system::Config>::RuntimeCall>
+ Dispatchable<Origin = <Self as Config>::Origin, PostInfo = PostDispatchInfo>; + Dispatchable<Origin = <Self as Config>::Origin, PostInfo = PostDispatchInfo>;
const VERSION_DISCOVERY_QUEUE_SIZE: u32; const VERSION_DISCOVERY_QUEUE_SIZE: u32;
@@ -564,7 +564,7 @@ pub mod pallet {
#[pallet::weight(max_weight.saturating_add(Weight::from_ref_time(100_000_000u64)))] #[pallet::weight(max_weight.saturating_add(Weight::from_ref_time(100_000_000u64)))]
pub fn execute( pub fn execute(
origin: OriginFor<T>, origin: OriginFor<T>,
message: Box<VersionedXcm<<T as SysConfig>::Call>>, message: Box<VersionedXcm<<T as SysConfig>::RuntimeCall>>,
max_weight: Weight, max_weight: Weight,
) -> DispatchResultWithPostInfo { ) -> DispatchResultWithPostInfo {
let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin)?; let origin_location = T::ExecuteXcmOrigin::ensure_origin(origin)?;
@@ -1142,13 +1142,13 @@ pub mod pallet {
pub fn report_outcome_notify( pub fn report_outcome_notify(
message: &mut Xcm<()>, message: &mut Xcm<()>,
responder: impl Into<MultiLocation>, responder: impl Into<MultiLocation>,
notify: impl Into<<T as Config>::Call>, notify: impl Into<<T as Config>::RuntimeCall>,
timeout: T::BlockNumber, timeout: T::BlockNumber,
) -> Result<(), XcmError> { ) -> Result<(), XcmError> {
let responder = responder.into(); let responder = responder.into();
let dest = T::LocationInverter::invert_location(&responder) let dest = T::LocationInverter::invert_location(&responder)
.map_err(|()| XcmError::MultiLocationNotInvertible)?; .map_err(|()| XcmError::MultiLocationNotInvertible)?;
let notify: <T as Config>::Call = notify.into(); let notify: <T as Config>::RuntimeCall = notify.into();
let max_response_weight = notify.get_dispatch_info().weight; let max_response_weight = notify.get_dispatch_info().weight;
let query_id = Self::new_notify_query(responder, notify, timeout); let query_id = Self::new_notify_query(responder, notify, timeout);
let report_error = Xcm(vec![ReportError { let report_error = Xcm(vec![ReportError {
@@ -1169,7 +1169,7 @@ pub mod pallet {
/// which will call a dispatchable when a response happens. /// which will call a dispatchable when a response happens.
pub fn new_notify_query( pub fn new_notify_query(
responder: impl Into<MultiLocation>, responder: impl Into<MultiLocation>,
notify: impl Into<<T as Config>::Call>, notify: impl Into<<T as Config>::RuntimeCall>,
timeout: T::BlockNumber, timeout: T::BlockNumber,
) -> u64 { ) -> u64 {
let notify = let notify =
@@ -1214,10 +1214,10 @@ pub mod pallet {
} }
impl<T: Config> WrapVersion for Pallet<T> { impl<T: Config> WrapVersion for Pallet<T> {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
dest: &MultiLocation, dest: &MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()> { ) -> Result<VersionedXcm<RuntimeCall>, ()> {
SupportedVersion::<T>::get(XCM_VERSION, LatestVersionedMultiLocation(dest)) SupportedVersion::<T>::get(XCM_VERSION, LatestVersionedMultiLocation(dest))
.or_else(|| { .or_else(|| {
Self::note_unknown_version(dest); Self::note_unknown_version(dest);
@@ -1399,9 +1399,9 @@ pub mod pallet {
// be built by `(pallet_index: u8, call_index: u8, QueryId, Response)`. // be built by `(pallet_index: u8, call_index: u8, QueryId, Response)`.
// So we just encode that and then re-encode to a real Call. // So we just encode that and then re-encode to a real Call.
let bare = (pallet_index, call_index, query_id, response); let bare = (pallet_index, call_index, query_id, response);
if let Ok(call) = bare if let Ok(call) = bare.using_encoded(|mut bytes| {
.using_encoded(|mut bytes| <T as Config>::Call::decode(&mut bytes)) <T as Config>::RuntimeCall::decode(&mut bytes)
{ }) {
Queries::<T>::remove(query_id); Queries::<T>::remove(query_id);
let weight = call.get_dispatch_info().weight; let weight = call.get_dispatch_info().weight;
let max_weight = Weight::from_ref_time(max_weight); let max_weight = Weight::from_ref_time(max_weight);
+16 -16
View File
@@ -51,10 +51,10 @@ pub mod pallet_test_notifier {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + crate::Config { pub trait Config: frame_system::Config + crate::Config {
type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>; type RuntimeEvent: IsType<<Self as frame_system::Config>::RuntimeEvent> + From<Event<Self>>;
type Origin: IsType<<Self as frame_system::Config>::Origin> type Origin: IsType<<Self as frame_system::Config>::Origin>
+ Into<Result<crate::Origin, <Self as Config>::Origin>>; + Into<Result<crate::Origin, <Self as Config>::Origin>>;
type Call: IsType<<Self as crate::Config>::Call> + From<Call<Self>>; type RuntimeCall: IsType<<Self as crate::Config>::RuntimeCall> + From<Call<Self>>;
} }
#[pallet::event] #[pallet::event]
@@ -97,7 +97,7 @@ pub mod pallet_test_notifier {
Call::<T>::notification_received { query_id: 0, response: Default::default() }; Call::<T>::notification_received { query_id: 0, response: Default::default() };
let qid = crate::Pallet::<T>::new_notify_query( let qid = crate::Pallet::<T>::new_notify_query(
Junction::AccountId32 { network: Any, id }.into(), Junction::AccountId32 { network: Any, id }.into(),
<T as Config>::Call::from(call), <T as Config>::RuntimeCall::from(call),
100u32.into(), 100u32.into(),
); );
Self::deposit_event(Event::<T>::NotifyQueryPrepared(qid)); Self::deposit_event(Event::<T>::NotifyQueryPrepared(qid));
@@ -172,7 +172,7 @@ parameter_types! {
impl frame_system::Config for Test { impl frame_system::Config for Test {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -180,7 +180,7 @@ impl frame_system::Config for Test {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -206,7 +206,7 @@ parameter_types! {
impl pallet_balances::Config for Test { impl pallet_balances::Config for Test {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -251,7 +251,7 @@ pub type Barrier = (
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = TestSendXcm; type XcmSender = TestSendXcm;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -259,7 +259,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = Case<TrustedAssets>; type IsTeleporter = Case<TrustedAssets>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<CurrencyPerSecond, ()>; type Trader = FixedRateOfFungible<CurrencyPerSecond, ()>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
type AssetTrap = XcmPallet; type AssetTrap = XcmPallet;
@@ -274,7 +274,7 @@ parameter_types! {
} }
impl pallet_xcm::Config for Test { impl pallet_xcm::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = (TestSendXcmErrX8, TestSendXcm); type XcmRouter = (TestSendXcmErrX8, TestSendXcm);
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
@@ -282,10 +282,10 @@ impl pallet_xcm::Config for Test {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = AdvertisedXcmVersion; type AdvertisedXcmVersion = AdvertisedXcmVersion;
} }
@@ -293,16 +293,16 @@ impl pallet_xcm::Config for Test {
impl origin::Config for Test {} impl origin::Config for Test {}
impl pallet_test_notifier::Config for Test { impl pallet_test_notifier::Config for Test {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
} }
pub(crate) fn last_event() -> Event { pub(crate) fn last_event() -> RuntimeEvent {
System::events().pop().expect("Event expected").event System::events().pop().expect("RuntimeEvent expected").event
} }
pub(crate) fn last_events(n: usize) -> Vec<Event> { pub(crate) fn last_events(n: usize) -> Vec<RuntimeEvent> {
System::events().into_iter().map(|e| e.event).rev().take(n).rev().collect() System::events().into_iter().map(|e| e.event).rev().take(n).rev().collect()
} }
+18 -15
View File
@@ -50,7 +50,7 @@ fn report_outcome_notify_works() {
query_id: 0, query_id: 0,
response: Default::default(), response: Default::default(),
}; };
let notify = Call::TestNotifier(call); let notify = RuntimeCall::TestNotifier(call);
new_test_ext_with_balances(balances).execute_with(|| { new_test_ext_with_balances(balances).execute_with(|| {
XcmPallet::report_outcome_notify(&mut message, Parachain(PARA_ID).into(), notify, 100) XcmPallet::report_outcome_notify(&mut message, Parachain(PARA_ID).into(), notify, 100)
.unwrap(); .unwrap();
@@ -85,12 +85,12 @@ fn report_outcome_notify_works() {
assert_eq!( assert_eq!(
last_events(2), last_events(2),
vec![ vec![
Event::TestNotifier(pallet_test_notifier::Event::ResponseReceived( RuntimeEvent::TestNotifier(pallet_test_notifier::Event::ResponseReceived(
Parachain(PARA_ID).into(), Parachain(PARA_ID).into(),
0, 0,
Response::ExecutionResult(None), Response::ExecutionResult(None),
)), )),
Event::XcmPallet(crate::Event::Notified(0, 4, 2)), RuntimeEvent::XcmPallet(crate::Event::Notified(0, 4, 2)),
] ]
); );
assert_eq!(crate::Queries::<Test>::iter().collect::<Vec<_>>(), vec![]); assert_eq!(crate::Queries::<Test>::iter().collect::<Vec<_>>(), vec![]);
@@ -140,7 +140,10 @@ fn report_outcome_works() {
assert_eq!(r, Outcome::Complete(1_000)); assert_eq!(r, Outcome::Complete(1_000));
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::ResponseReady(0, Response::ExecutionResult(None),)) RuntimeEvent::XcmPallet(crate::Event::ResponseReady(
0,
Response::ExecutionResult(None),
))
); );
let response = Some((Response::ExecutionResult(None), 1)); let response = Some((Response::ExecutionResult(None), 1));
@@ -181,7 +184,7 @@ fn send_works() {
); );
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Sent(sender, RelayLocation::get(), message)) RuntimeEvent::XcmPallet(crate::Event::Sent(sender, RelayLocation::get(), message))
); );
}); });
} }
@@ -253,7 +256,7 @@ fn teleport_assets_works() {
let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap(); let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap();
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -297,7 +300,7 @@ fn limmited_teleport_assets_works() {
let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap(); let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap();
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -339,7 +342,7 @@ fn unlimmited_teleport_assets_works() {
); );
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -387,7 +390,7 @@ fn reserve_transfer_assets_works() {
let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap(); let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap();
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -436,7 +439,7 @@ fn limited_reserve_transfer_assets_works() {
let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap(); let _check_v0_ok: xcm::v0::Xcm<()> = versioned_sent.try_into().unwrap();
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -483,7 +486,7 @@ fn unlimited_reserve_transfer_assets_works() {
); );
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -516,7 +519,7 @@ fn execute_withdraw_to_deposit_works() {
assert_eq!(Balances::total_balance(&BOB), SEND_AMOUNT); assert_eq!(Balances::total_balance(&BOB), SEND_AMOUNT);
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight))) RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(weight)))
); );
}); });
} }
@@ -552,8 +555,8 @@ fn trapped_assets_can_be_claimed() {
assert_eq!( assert_eq!(
last_events(2), last_events(2),
vec![ vec![
Event::XcmPallet(crate::Event::AssetsTrapped(hash.clone(), source, vma)), RuntimeEvent::XcmPallet(crate::Event::AssetsTrapped(hash.clone(), source, vma)),
Event::XcmPallet(crate::Event::Attempted(Outcome::Complete( RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Complete(
5 * BaseXcmWeight::get() 5 * BaseXcmWeight::get()
))) )))
] ]
@@ -591,7 +594,7 @@ fn trapped_assets_can_be_claimed() {
)); ));
assert_eq!( assert_eq!(
last_event(), last_event(),
Event::XcmPallet(crate::Event::Attempted(Outcome::Incomplete( RuntimeEvent::XcmPallet(crate::Event::Attempted(Outcome::Incomplete(
BaseXcmWeight::get(), BaseXcmWeight::get(),
XcmError::UnknownClaim XcmError::UnknownClaim
))) )))
+35 -35
View File
@@ -308,11 +308,11 @@ impl TryFrom<VersionedMultiAssets> for v1::MultiAssets {
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum VersionedXcm<Call> { pub enum VersionedXcm<RuntimeCall> {
V0(v0::Xcm<Call>), V0(v0::Xcm<RuntimeCall>),
V1(v1::Xcm<Call>), V1(v1::Xcm<RuntimeCall>),
V2(v2::Xcm<Call>), V2(v2::Xcm<RuntimeCall>),
} }
impl<C> IntoVersion for VersionedXcm<C> { impl<C> IntoVersion for VersionedXcm<C> {
@@ -326,27 +326,27 @@ impl<C> IntoVersion for VersionedXcm<C> {
} }
} }
impl<Call> From<v0::Xcm<Call>> for VersionedXcm<Call> { impl<RuntimeCall> From<v0::Xcm<RuntimeCall>> for VersionedXcm<RuntimeCall> {
fn from(x: v0::Xcm<Call>) -> Self { fn from(x: v0::Xcm<RuntimeCall>) -> Self {
VersionedXcm::V0(x) VersionedXcm::V0(x)
} }
} }
impl<Call> From<v1::Xcm<Call>> for VersionedXcm<Call> { impl<RuntimeCall> From<v1::Xcm<RuntimeCall>> for VersionedXcm<RuntimeCall> {
fn from(x: v1::Xcm<Call>) -> Self { fn from(x: v1::Xcm<RuntimeCall>) -> Self {
VersionedXcm::V1(x) VersionedXcm::V1(x)
} }
} }
impl<Call> From<v2::Xcm<Call>> for VersionedXcm<Call> { impl<RuntimeCall> From<v2::Xcm<RuntimeCall>> for VersionedXcm<RuntimeCall> {
fn from(x: v2::Xcm<Call>) -> Self { fn from(x: v2::Xcm<RuntimeCall>) -> Self {
VersionedXcm::V2(x) VersionedXcm::V2(x)
} }
} }
impl<Call> TryFrom<VersionedXcm<Call>> for v0::Xcm<Call> { impl<RuntimeCall> TryFrom<VersionedXcm<RuntimeCall>> for v0::Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> { fn try_from(x: VersionedXcm<RuntimeCall>) -> Result<Self, ()> {
use VersionedXcm::*; use VersionedXcm::*;
match x { match x {
V0(x) => Ok(x), V0(x) => Ok(x),
@@ -356,9 +356,9 @@ impl<Call> TryFrom<VersionedXcm<Call>> for v0::Xcm<Call> {
} }
} }
impl<Call> TryFrom<VersionedXcm<Call>> for v1::Xcm<Call> { impl<RuntimeCall> TryFrom<VersionedXcm<RuntimeCall>> for v1::Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> { fn try_from(x: VersionedXcm<RuntimeCall>) -> Result<Self, ()> {
use VersionedXcm::*; use VersionedXcm::*;
match x { match x {
V0(x) => x.try_into(), V0(x) => x.try_into(),
@@ -368,9 +368,9 @@ impl<Call> TryFrom<VersionedXcm<Call>> for v1::Xcm<Call> {
} }
} }
impl<Call> TryFrom<VersionedXcm<Call>> for v2::Xcm<Call> { impl<RuntimeCall> TryFrom<VersionedXcm<RuntimeCall>> for v2::Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(x: VersionedXcm<Call>) -> Result<Self, ()> { fn try_from(x: VersionedXcm<RuntimeCall>) -> Result<Self, ()> {
use VersionedXcm::*; use VersionedXcm::*;
match x { match x {
V0(x) => V1(x.try_into()?).try_into(), V0(x) => V1(x.try_into()?).try_into(),
@@ -382,18 +382,18 @@ impl<Call> TryFrom<VersionedXcm<Call>> for v2::Xcm<Call> {
/// Convert an `Xcm` datum into a `VersionedXcm`, based on a destination `MultiLocation` which will interpret it. /// Convert an `Xcm` datum into a `VersionedXcm`, based on a destination `MultiLocation` which will interpret it.
pub trait WrapVersion { pub trait WrapVersion {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
dest: &latest::MultiLocation, dest: &latest::MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()>; ) -> Result<VersionedXcm<RuntimeCall>, ()>;
} }
/// `()` implementation does nothing with the XCM, just sending with whatever version it was authored as. /// `()` implementation does nothing with the XCM, just sending with whatever version it was authored as.
impl WrapVersion for () { impl WrapVersion for () {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
_: &latest::MultiLocation, _: &latest::MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()> { ) -> Result<VersionedXcm<RuntimeCall>, ()> {
Ok(xcm.into()) Ok(xcm.into())
} }
} }
@@ -401,33 +401,33 @@ impl WrapVersion for () {
/// `WrapVersion` implementation which attempts to always convert the XCM to version 0 before wrapping it. /// `WrapVersion` implementation which attempts to always convert the XCM to version 0 before wrapping it.
pub struct AlwaysV0; pub struct AlwaysV0;
impl WrapVersion for AlwaysV0 { impl WrapVersion for AlwaysV0 {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
_: &latest::MultiLocation, _: &latest::MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()> { ) -> Result<VersionedXcm<RuntimeCall>, ()> {
Ok(VersionedXcm::<Call>::V0(xcm.into().try_into()?)) Ok(VersionedXcm::<RuntimeCall>::V0(xcm.into().try_into()?))
} }
} }
/// `WrapVersion` implementation which attempts to always convert the XCM to version 1 before wrapping it. /// `WrapVersion` implementation which attempts to always convert the XCM to version 1 before wrapping it.
pub struct AlwaysV1; pub struct AlwaysV1;
impl WrapVersion for AlwaysV1 { impl WrapVersion for AlwaysV1 {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
_: &latest::MultiLocation, _: &latest::MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()> { ) -> Result<VersionedXcm<RuntimeCall>, ()> {
Ok(VersionedXcm::<Call>::V1(xcm.into().try_into()?)) Ok(VersionedXcm::<RuntimeCall>::V1(xcm.into().try_into()?))
} }
} }
/// `WrapVersion` implementation which attempts to always convert the XCM to version 2 before wrapping it. /// `WrapVersion` implementation which attempts to always convert the XCM to version 2 before wrapping it.
pub struct AlwaysV2; pub struct AlwaysV2;
impl WrapVersion for AlwaysV2 { impl WrapVersion for AlwaysV2 {
fn wrap_version<Call>( fn wrap_version<RuntimeCall>(
_: &latest::MultiLocation, _: &latest::MultiLocation,
xcm: impl Into<VersionedXcm<Call>>, xcm: impl Into<VersionedXcm<RuntimeCall>>,
) -> Result<VersionedXcm<Call>, ()> { ) -> Result<VersionedXcm<RuntimeCall>, ()> {
Ok(VersionedXcm::<Call>::V2(xcm.into().try_into()?)) Ok(VersionedXcm::<RuntimeCall>::V2(xcm.into().try_into()?))
} }
} }
+14 -10
View File
@@ -97,8 +97,8 @@ pub enum Response {
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum Xcm<Call> { pub enum Xcm<RuntimeCall> {
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the
/// orders (`effects`). /// orders (`effects`).
/// ///
@@ -109,7 +109,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 0)] #[codec(index = 0)]
WithdrawAsset { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> }, WithdrawAsset { assets: Vec<MultiAsset>, effects: Vec<Order<RuntimeCall>> },
/// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system. /// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system.
/// ///
@@ -126,7 +126,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 1)] #[codec(index = 1)]
ReserveAssetDeposit { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> }, ReserveAssetDeposit { assets: Vec<MultiAsset>, effects: Vec<Order<RuntimeCall>> },
/// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be /// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be
/// created on this system. /// created on this system.
@@ -144,7 +144,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 2)] #[codec(index = 2)]
TeleportAsset { assets: Vec<MultiAsset>, effects: Vec<Order<Call>> }, TeleportAsset { assets: Vec<MultiAsset>, effects: Vec<Order<RuntimeCall>> },
/// Indication of the contents of the holding account corresponding to the `QueryHolding` order of `query_id`. /// Indication of the contents of the holding account corresponding to the `QueryHolding` order of `query_id`.
/// ///
@@ -209,7 +209,11 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 6)] #[codec(index = 6)]
Transact { origin_type: OriginKind, require_weight_at_most: u64, call: DoubleEncoded<Call> }, Transact {
origin_type: OriginKind,
require_weight_at_most: u64,
call: DoubleEncoded<RuntimeCall>,
},
/// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the /// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the
/// relay-chain to a para. /// relay-chain to a para.
@@ -276,10 +280,10 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 10)] #[codec(index = 10)]
RelayedFrom { who: MultiLocation, message: alloc::boxed::Box<Xcm<Call>> }, RelayedFrom { who: MultiLocation, message: alloc::boxed::Box<Xcm<RuntimeCall>> },
} }
impl<Call> Xcm<Call> { impl<RuntimeCall> Xcm<RuntimeCall> {
pub fn into<C>(self) -> Xcm<C> { pub fn into<C>(self) -> Xcm<C> {
Xcm::from(self) Xcm::from(self)
} }
@@ -330,9 +334,9 @@ impl TryFrom<Response1> for Response {
} }
} }
impl<Call> TryFrom<Xcm1<Call>> for Xcm<Call> { impl<RuntimeCall> TryFrom<Xcm1<RuntimeCall>> for Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(x: Xcm1<Call>) -> result::Result<Xcm<Call>, ()> { fn try_from(x: Xcm1<RuntimeCall>) -> result::Result<Xcm<RuntimeCall>, ()> {
use Xcm::*; use Xcm::*;
Ok(match x { Ok(match x {
Xcm1::WithdrawAsset { assets, effects } => WithdrawAsset { Xcm1::WithdrawAsset { assets, effects } => WithdrawAsset {
+7 -7
View File
@@ -27,8 +27,8 @@ use parity_scale_codec::{self, Decode, Encode};
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum Order<Call> { pub enum Order<RuntimeCall> {
/// Do nothing. Not generally used. /// Do nothing. Not generally used.
#[codec(index = 0)] #[codec(index = 0)]
Null, Null,
@@ -122,7 +122,7 @@ pub enum Order<Call> {
weight: u64, weight: u64,
debt: u64, debt: u64,
halt_on_error: bool, halt_on_error: bool,
xcm: Vec<Xcm<Call>>, xcm: Vec<Xcm<RuntimeCall>>,
}, },
} }
@@ -130,7 +130,7 @@ pub mod opaque {
pub type Order = super::Order<()>; pub type Order = super::Order<()>;
} }
impl<Call> Order<Call> { impl<RuntimeCall> Order<RuntimeCall> {
pub fn into<C>(self) -> Order<C> { pub fn into<C>(self) -> Order<C> {
Order::from(self) Order::from(self)
} }
@@ -155,9 +155,9 @@ impl<Call> Order<Call> {
} }
} }
impl<Call> TryFrom<Order1<Call>> for Order<Call> { impl<RuntimeCall> TryFrom<Order1<RuntimeCall>> for Order<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: Order1<Call>) -> result::Result<Order<Call>, ()> { fn try_from(old: Order1<RuntimeCall>) -> result::Result<Order<RuntimeCall>, ()> {
use Order::*; use Order::*;
Ok(match old { Ok(match old {
Order1::Noop => Null, Order1::Noop => Null,
@@ -195,7 +195,7 @@ impl<Call> TryFrom<Order1<Call>> for Order<Call> {
Order1::BuyExecution { fees, weight, debt, halt_on_error, instructions } => { Order1::BuyExecution { fees, weight, debt, halt_on_error, instructions } => {
let xcm = instructions let xcm = instructions
.into_iter() .into_iter()
.map(Xcm::<Call>::try_from) .map(Xcm::<RuntimeCall>::try_from)
.collect::<result::Result<_, _>>()?; .collect::<result::Result<_, _>>()?;
BuyExecution { fees: fees.try_into()?, weight, debt, halt_on_error, xcm } BuyExecution { fees: fees.try_into()?, weight, debt, halt_on_error, xcm }
}, },
+7 -3
View File
@@ -139,11 +139,15 @@ impl Outcome {
} }
/// Type of XCM message executor. /// Type of XCM message executor.
pub trait ExecuteXcm<Call> { pub trait ExecuteXcm<RuntimeCall> {
/// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is /// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is
/// a basic hard-limit and the implementation may place further restrictions or requirements on weight and /// a basic hard-limit and the implementation may place further restrictions or requirements on weight and
/// other aspects. /// other aspects.
fn execute_xcm(origin: MultiLocation, message: Xcm<Call>, weight_limit: Weight) -> Outcome { fn execute_xcm(
origin: MultiLocation,
message: Xcm<RuntimeCall>,
weight_limit: Weight,
) -> Outcome {
log::debug!( log::debug!(
target: "xcm::execute_xcm", target: "xcm::execute_xcm",
"origin: {:?}, message: {:?}, weight_limit: {:?}", "origin: {:?}, message: {:?}, weight_limit: {:?}",
@@ -160,7 +164,7 @@ pub trait ExecuteXcm<Call> {
/// execution without associated payment. /// execution without associated payment.
fn execute_xcm_in_credit( fn execute_xcm_in_credit(
origin: MultiLocation, origin: MultiLocation,
message: Xcm<Call>, message: Xcm<RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
weight_credit: Weight, weight_credit: Weight,
) -> Outcome; ) -> Outcome;
+16 -12
View File
@@ -136,8 +136,8 @@ pub enum Response {
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum Xcm<Call> { pub enum Xcm<RuntimeCall> {
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into `holding`. Execute the
/// orders (`effects`). /// orders (`effects`).
/// ///
@@ -148,7 +148,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 0)] #[codec(index = 0)]
WithdrawAsset { assets: MultiAssets, effects: Vec<Order<Call>> }, WithdrawAsset { assets: MultiAssets, effects: Vec<Order<RuntimeCall>> },
/// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system. /// Asset(s) (`assets`) have been received into the ownership of this system on the `origin` system.
/// ///
@@ -165,7 +165,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 1)] #[codec(index = 1)]
ReserveAssetDeposited { assets: MultiAssets, effects: Vec<Order<Call>> }, ReserveAssetDeposited { assets: MultiAssets, effects: Vec<Order<RuntimeCall>> },
/// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be /// Asset(s) (`assets`) have been destroyed on the `origin` system and equivalent assets should be
/// created on this system. /// created on this system.
@@ -183,7 +183,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 2)] #[codec(index = 2)]
ReceiveTeleportedAsset { assets: MultiAssets, effects: Vec<Order<Call>> }, ReceiveTeleportedAsset { assets: MultiAssets, effects: Vec<Order<RuntimeCall>> },
/// Indication of the contents of the holding register corresponding to the `QueryHolding` order of `query_id`. /// Indication of the contents of the holding register corresponding to the `QueryHolding` order of `query_id`.
/// ///
@@ -249,7 +249,11 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 6)] #[codec(index = 6)]
Transact { origin_type: OriginKind, require_weight_at_most: u64, call: DoubleEncoded<Call> }, Transact {
origin_type: OriginKind,
require_weight_at_most: u64,
call: DoubleEncoded<RuntimeCall>,
},
/// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the /// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the
/// relay-chain to a para. /// relay-chain to a para.
@@ -313,7 +317,7 @@ pub enum Xcm<Call> {
/// ///
/// Errors: /// Errors:
#[codec(index = 10)] #[codec(index = 10)]
RelayedFrom { who: InteriorMultiLocation, message: alloc::boxed::Box<Xcm<Call>> }, RelayedFrom { who: InteriorMultiLocation, message: alloc::boxed::Box<Xcm<RuntimeCall>> },
/// Ask the destination system to respond with the most recent version of XCM that they /// Ask the destination system to respond with the most recent version of XCM that they
/// support in a `QueryResponse` instruction. Any changes to this should also elicit similar /// support in a `QueryResponse` instruction. Any changes to this should also elicit similar
@@ -335,7 +339,7 @@ pub enum Xcm<Call> {
UnsubscribeVersion, UnsubscribeVersion,
} }
impl<Call> Xcm<Call> { impl<RuntimeCall> Xcm<RuntimeCall> {
pub fn into<C>(self) -> Xcm<C> { pub fn into<C>(self) -> Xcm<C> {
Xcm::from(self) Xcm::from(self)
} }
@@ -390,9 +394,9 @@ impl TryFrom<OldResponse> for Response {
} }
} }
impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> { impl<RuntimeCall> TryFrom<OldXcm<RuntimeCall>> for Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: OldXcm<Call>) -> result::Result<Xcm<Call>, ()> { fn try_from(old: OldXcm<RuntimeCall>) -> result::Result<Xcm<RuntimeCall>, ()> {
use Xcm::*; use Xcm::*;
Ok(match old { Ok(match old {
OldXcm::WithdrawAsset { assets, effects } => WithdrawAsset { OldXcm::WithdrawAsset { assets, effects } => WithdrawAsset {
@@ -443,9 +447,9 @@ impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> {
} }
} }
impl<Call> TryFrom<NewXcm<Call>> for Xcm<Call> { impl<RuntimeCall> TryFrom<NewXcm<RuntimeCall>> for Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: NewXcm<Call>) -> result::Result<Xcm<Call>, ()> { fn try_from(old: NewXcm<RuntimeCall>) -> result::Result<Xcm<RuntimeCall>, ()> {
use Xcm::*; use Xcm::*;
let mut iter = old.0.into_iter(); let mut iter = old.0.into_iter();
let instruction = iter.next().ok_or(())?; let instruction = iter.next().ok_or(())?;
+12 -10
View File
@@ -29,8 +29,8 @@ use scale_info::TypeInfo;
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum Order<Call> { pub enum Order<RuntimeCall> {
/// Do nothing. Not generally used. /// Do nothing. Not generally used.
#[codec(index = 0)] #[codec(index = 0)]
Noop, Noop,
@@ -148,7 +148,7 @@ pub enum Order<Call> {
weight: u64, weight: u64,
debt: u64, debt: u64,
halt_on_error: bool, halt_on_error: bool,
instructions: Vec<Xcm<Call>>, instructions: Vec<Xcm<RuntimeCall>>,
}, },
} }
@@ -156,7 +156,7 @@ pub mod opaque {
pub type Order = super::Order<()>; pub type Order = super::Order<()>;
} }
impl<Call> Order<Call> { impl<RuntimeCall> Order<RuntimeCall> {
pub fn into<C>(self) -> Order<C> { pub fn into<C>(self) -> Order<C> {
Order::from(self) Order::from(self)
} }
@@ -182,9 +182,9 @@ impl<Call> Order<Call> {
} }
} }
impl<Call> TryFrom<OldOrder<Call>> for Order<Call> { impl<RuntimeCall> TryFrom<OldOrder<RuntimeCall>> for Order<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: OldOrder<Call>) -> result::Result<Order<Call>, ()> { fn try_from(old: OldOrder<RuntimeCall>) -> result::Result<Order<RuntimeCall>, ()> {
use Order::*; use Order::*;
Ok(match old { Ok(match old {
OldOrder::Null => Noop, OldOrder::Null => Noop,
@@ -224,17 +224,19 @@ impl<Call> TryFrom<OldOrder<Call>> for Order<Call> {
OldOrder::QueryHolding { query_id, dest, assets } => OldOrder::QueryHolding { query_id, dest, assets } =>
QueryHolding { query_id, dest: dest.try_into()?, assets: assets.try_into()? }, QueryHolding { query_id, dest: dest.try_into()?, assets: assets.try_into()? },
OldOrder::BuyExecution { fees, weight, debt, halt_on_error, xcm } => { OldOrder::BuyExecution { fees, weight, debt, halt_on_error, xcm } => {
let instructions = let instructions = xcm
xcm.into_iter().map(Xcm::<Call>::try_from).collect::<result::Result<_, _>>()?; .into_iter()
.map(Xcm::<RuntimeCall>::try_from)
.collect::<result::Result<_, _>>()?;
BuyExecution { fees: fees.try_into()?, weight, debt, halt_on_error, instructions } BuyExecution { fees: fees.try_into()?, weight, debt, halt_on_error, instructions }
}, },
}) })
} }
} }
impl<Call> TryFrom<Instruction<Call>> for Order<Call> { impl<RuntimeCall> TryFrom<Instruction<RuntimeCall>> for Order<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: Instruction<Call>) -> result::Result<Order<Call>, ()> { fn try_from(old: Instruction<RuntimeCall>) -> result::Result<Order<RuntimeCall>, ()> {
use Order::*; use Order::*;
Ok(match old { Ok(match old {
Instruction::DepositAsset { assets, max_assets, beneficiary } => Instruction::DepositAsset { assets, max_assets, beneficiary } =>
+3 -3
View File
@@ -142,13 +142,13 @@ impl Outcome {
} }
/// Type of XCM message executor. /// Type of XCM message executor.
pub trait ExecuteXcm<Call> { pub trait ExecuteXcm<RuntimeCall> {
/// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is /// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is
/// a basic hard-limit and the implementation may place further restrictions or requirements on weight and /// a basic hard-limit and the implementation may place further restrictions or requirements on weight and
/// other aspects. /// other aspects.
fn execute_xcm( fn execute_xcm(
origin: impl Into<MultiLocation>, origin: impl Into<MultiLocation>,
message: Xcm<Call>, message: Xcm<RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
) -> Outcome { ) -> Outcome {
let origin = origin.into(); let origin = origin.into();
@@ -168,7 +168,7 @@ pub trait ExecuteXcm<Call> {
/// execution without associated payment. /// execution without associated payment.
fn execute_xcm_in_credit( fn execute_xcm_in_credit(
origin: impl Into<MultiLocation>, origin: impl Into<MultiLocation>,
message: Xcm<Call>, message: Xcm<RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
weight_credit: Weight, weight_credit: Weight,
) -> Outcome; ) -> Outcome;
+20 -20
View File
@@ -78,10 +78,10 @@ pub type QueryId = u64;
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub struct Xcm<Call>(pub Vec<Instruction<Call>>); pub struct Xcm<RuntimeCall>(pub Vec<Instruction<RuntimeCall>>);
impl<Call> Xcm<Call> { impl<RuntimeCall> Xcm<RuntimeCall> {
/// Create an empty instance. /// Create an empty instance.
pub fn new() -> Self { pub fn new() -> Self {
Self(vec![]) Self(vec![])
@@ -108,17 +108,17 @@ impl<Call> Xcm<Call> {
} }
/// Return the first instruction, if any. /// Return the first instruction, if any.
pub fn first(&self) -> Option<&Instruction<Call>> { pub fn first(&self) -> Option<&Instruction<RuntimeCall>> {
self.0.first() self.0.first()
} }
/// Return the last instruction, if any. /// Return the last instruction, if any.
pub fn last(&self) -> Option<&Instruction<Call>> { pub fn last(&self) -> Option<&Instruction<RuntimeCall>> {
self.0.last() self.0.last()
} }
/// Return the only instruction, contained in `Self`, iff only one exists (`None` otherwise). /// Return the only instruction, contained in `Self`, iff only one exists (`None` otherwise).
pub fn only(&self) -> Option<&Instruction<Call>> { pub fn only(&self) -> Option<&Instruction<RuntimeCall>> {
if self.0.len() == 1 { if self.0.len() == 1 {
self.0.first() self.0.first()
} else { } else {
@@ -128,7 +128,7 @@ impl<Call> Xcm<Call> {
/// Return the only instruction, contained in `Self`, iff only one exists (returns `self` /// Return the only instruction, contained in `Self`, iff only one exists (returns `self`
/// otherwise). /// otherwise).
pub fn into_only(mut self) -> core::result::Result<Instruction<Call>, Self> { pub fn into_only(mut self) -> core::result::Result<Instruction<RuntimeCall>, Self> {
if self.0.len() == 1 { if self.0.len() == 1 {
self.0.pop().ok_or(self) self.0.pop().ok_or(self)
} else { } else {
@@ -233,8 +233,8 @@ pub type Weight = u64;
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))] #[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
#[codec(encode_bound())] #[codec(encode_bound())]
#[codec(decode_bound())] #[codec(decode_bound())]
#[scale_info(bounds(), skip_type_params(Call))] #[scale_info(bounds(), skip_type_params(RuntimeCall))]
pub enum Instruction<Call> { pub enum Instruction<RuntimeCall> {
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into the Holding /// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into the Holding
/// Register. /// Register.
/// ///
@@ -340,7 +340,7 @@ pub enum Instruction<Call> {
origin_type: OriginKind, origin_type: OriginKind,
#[codec(compact)] #[codec(compact)]
require_weight_at_most: u64, require_weight_at_most: u64,
call: DoubleEncoded<Call>, call: DoubleEncoded<RuntimeCall>,
}, },
/// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the /// A message to notify about a new incoming HRMP channel. This message is meant to be sent by the
@@ -584,7 +584,7 @@ pub enum Instruction<Call> {
/// Kind: *Instruction* /// Kind: *Instruction*
/// ///
/// Errors: None. /// Errors: None.
SetErrorHandler(Xcm<Call>), SetErrorHandler(Xcm<RuntimeCall>),
/// Set the Appendix Register. This is code that should be called after code execution /// Set the Appendix Register. This is code that should be called after code execution
/// (including the error handler if any) is finished. This will be called regardless of whether /// (including the error handler if any) is finished. This will be called regardless of whether
@@ -600,7 +600,7 @@ pub enum Instruction<Call> {
/// Kind: *Instruction* /// Kind: *Instruction*
/// ///
/// Errors: None. /// Errors: None.
SetAppendix(Xcm<Call>), SetAppendix(Xcm<RuntimeCall>),
/// Clear the Error Register. /// Clear the Error Register.
/// ///
@@ -647,16 +647,16 @@ pub enum Instruction<Call> {
UnsubscribeVersion, UnsubscribeVersion,
} }
impl<Call> Xcm<Call> { impl<RuntimeCall> Xcm<RuntimeCall> {
pub fn into<C>(self) -> Xcm<C> { pub fn into<C>(self) -> Xcm<C> {
Xcm::from(self) Xcm::from(self)
} }
pub fn from<C>(xcm: Xcm<C>) -> Self { pub fn from<C>(xcm: Xcm<C>) -> Self {
Self(xcm.0.into_iter().map(Instruction::<Call>::from).collect()) Self(xcm.0.into_iter().map(Instruction::<RuntimeCall>::from).collect())
} }
} }
impl<Call> Instruction<Call> { impl<RuntimeCall> Instruction<RuntimeCall> {
pub fn into<C>(self) -> Instruction<C> { pub fn into<C>(self) -> Instruction<C> {
Instruction::from(self) Instruction::from(self)
} }
@@ -707,7 +707,7 @@ impl<Call> Instruction<Call> {
} }
// TODO: Automate Generation // TODO: Automate Generation
impl<Call, W: XcmWeightInfo<Call>> GetWeight<W> for Instruction<Call> { impl<RuntimeCall, W: XcmWeightInfo<RuntimeCall>> GetWeight<W> for Instruction<RuntimeCall> {
fn weight(&self) -> Weight { fn weight(&self) -> Weight {
use Instruction::*; use Instruction::*;
match self { match self {
@@ -775,9 +775,9 @@ impl TryFrom<OldResponse> for Response {
} }
} }
impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> { impl<RuntimeCall> TryFrom<OldXcm<RuntimeCall>> for Xcm<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: OldXcm<Call>) -> result::Result<Xcm<Call>, ()> { fn try_from(old: OldXcm<RuntimeCall>) -> result::Result<Xcm<RuntimeCall>, ()> {
use Instruction::*; use Instruction::*;
Ok(Xcm(match old { Ok(Xcm(match old {
OldXcm::WithdrawAsset { assets, effects } => Some(Ok(WithdrawAsset(assets))) OldXcm::WithdrawAsset { assets, effects } => Some(Ok(WithdrawAsset(assets)))
@@ -827,9 +827,9 @@ impl<Call> TryFrom<OldXcm<Call>> for Xcm<Call> {
} }
} }
impl<Call> TryFrom<OldOrder<Call>> for Instruction<Call> { impl<RuntimeCall> TryFrom<OldOrder<RuntimeCall>> for Instruction<RuntimeCall> {
type Error = (); type Error = ();
fn try_from(old: OldOrder<Call>) -> result::Result<Instruction<Call>, ()> { fn try_from(old: OldOrder<RuntimeCall>) -> result::Result<Instruction<RuntimeCall>, ()> {
use Instruction::*; use Instruction::*;
Ok(match old { Ok(match old {
OldOrder::Noop => return Err(()), OldOrder::Noop => return Err(()),
+3 -3
View File
@@ -160,13 +160,13 @@ impl Outcome {
} }
/// Type of XCM message executor. /// Type of XCM message executor.
pub trait ExecuteXcm<Call> { pub trait ExecuteXcm<RuntimeCall> {
/// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is /// Execute some XCM `message` from `origin` using no more than `weight_limit` weight. The weight limit is
/// a basic hard-limit and the implementation may place further restrictions or requirements on weight and /// a basic hard-limit and the implementation may place further restrictions or requirements on weight and
/// other aspects. /// other aspects.
fn execute_xcm( fn execute_xcm(
origin: impl Into<MultiLocation>, origin: impl Into<MultiLocation>,
message: Xcm<Call>, message: Xcm<RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
) -> Outcome { ) -> Outcome {
let origin = origin.into(); let origin = origin.into();
@@ -186,7 +186,7 @@ pub trait ExecuteXcm<Call> {
/// execution without associated payment. /// execution without associated payment.
fn execute_xcm_in_credit( fn execute_xcm_in_credit(
origin: impl Into<MultiLocation>, origin: impl Into<MultiLocation>,
message: Xcm<Call>, message: Xcm<RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
weight_credit: Weight, weight_credit: Weight,
) -> Outcome; ) -> Outcome;
+10 -10
View File
@@ -31,9 +31,9 @@ use xcm_executor::traits::{OnResponse, ShouldExecute};
/// out of the local chain to another one. /// out of the local chain to another one.
pub struct TakeWeightCredit; pub struct TakeWeightCredit;
impl ShouldExecute for TakeWeightCredit { impl ShouldExecute for TakeWeightCredit {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
_origin: &MultiLocation, _origin: &MultiLocation,
_message: &mut Xcm<Call>, _message: &mut Xcm<RuntimeCall>,
max_weight: Weight, max_weight: Weight,
weight_credit: &mut Weight, weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
@@ -54,9 +54,9 @@ impl ShouldExecute for TakeWeightCredit {
/// because they are the only ones that place assets in the Holding Register to pay for execution. /// because they are the only ones that place assets in the Holding Register to pay for execution.
pub struct AllowTopLevelPaidExecutionFrom<T>(PhantomData<T>); pub struct AllowTopLevelPaidExecutionFrom<T>(PhantomData<T>);
impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionFrom<T> { impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionFrom<T> {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
message: &mut Xcm<Call>, message: &mut Xcm<RuntimeCall>,
max_weight: Weight, max_weight: Weight,
_weight_credit: &mut Weight, _weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
@@ -97,9 +97,9 @@ impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionFro
/// Use only for executions from trusted origin groups. /// Use only for executions from trusted origin groups.
pub struct AllowUnpaidExecutionFrom<T>(PhantomData<T>); pub struct AllowUnpaidExecutionFrom<T>(PhantomData<T>);
impl<T: Contains<MultiLocation>> ShouldExecute for AllowUnpaidExecutionFrom<T> { impl<T: Contains<MultiLocation>> ShouldExecute for AllowUnpaidExecutionFrom<T> {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
_message: &mut Xcm<Call>, _message: &mut Xcm<RuntimeCall>,
_max_weight: Weight, _max_weight: Weight,
_weight_credit: &mut Weight, _weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
@@ -128,9 +128,9 @@ impl<ParaId: IsSystem + From<u32>> Contains<MultiLocation> for IsChildSystemPara
/// Allows only messages if the generic `ResponseHandler` expects them via `expecting_response`. /// Allows only messages if the generic `ResponseHandler` expects them via `expecting_response`.
pub struct AllowKnownQueryResponses<ResponseHandler>(PhantomData<ResponseHandler>); pub struct AllowKnownQueryResponses<ResponseHandler>(PhantomData<ResponseHandler>);
impl<ResponseHandler: OnResponse> ShouldExecute for AllowKnownQueryResponses<ResponseHandler> { impl<ResponseHandler: OnResponse> ShouldExecute for AllowKnownQueryResponses<ResponseHandler> {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
message: &mut Xcm<Call>, message: &mut Xcm<RuntimeCall>,
_max_weight: Weight, _max_weight: Weight,
_weight_credit: &mut Weight, _weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
@@ -152,9 +152,9 @@ impl<ResponseHandler: OnResponse> ShouldExecute for AllowKnownQueryResponses<Res
/// `UnsubscribeVersion` instruction. /// `UnsubscribeVersion` instruction.
pub struct AllowSubscriptionsFrom<T>(PhantomData<T>); pub struct AllowSubscriptionsFrom<T>(PhantomData<T>);
impl<T: Contains<MultiLocation>> ShouldExecute for AllowSubscriptionsFrom<T> { impl<T: Contains<MultiLocation>> ShouldExecute for AllowSubscriptionsFrom<T> {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
message: &mut Xcm<Call>, message: &mut Xcm<RuntimeCall>,
_max_weight: Weight, _max_weight: Weight,
_weight_credit: &mut Weight, _weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
+1 -1
View File
@@ -277,7 +277,7 @@ pub type TestBarrier = (
pub struct TestConfig; pub struct TestConfig;
impl Config for TestConfig { impl Config for TestConfig {
type Call = TestCall; type RuntimeCall = TestCall;
type XcmSender = TestSendXcm; type XcmSender = TestSendXcm;
type AssetTransactor = TestAssetTransactor; type AssetTransactor = TestAssetTransactor;
type OriginConverter = TestOriginConverter; type OriginConverter = TestOriginConverter;
+8 -8
View File
@@ -62,7 +62,7 @@ parameter_types! {
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -70,7 +70,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -96,7 +96,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -160,7 +160,7 @@ pub type TrustedTeleporters = (xcm_builder::Case<KusamaForStatemine>,);
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = TestSendXcm; type XcmSender = TestSendXcm;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -168,7 +168,7 @@ impl xcm_executor::Config for XcmConfig {
type IsTeleporter = TrustedTeleporters; type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>; type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type ResponseHandler = XcmPallet; type ResponseHandler = XcmPallet;
type AssetTrap = XcmPallet; type AssetTrap = XcmPallet;
@@ -179,7 +179,7 @@ impl xcm_executor::Config for XcmConfig {
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = TestSendXcm; type XcmRouter = TestSendXcm;
@@ -189,8 +189,8 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type Call = Call; type RuntimeCall = RuntimeCall;
type Origin = Origin; type Origin = Origin;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
@@ -45,7 +45,7 @@ fn basic_buy_fees_message_executes() {
let execute = construct_extrinsic( let execute = construct_extrinsic(
&client, &client,
polkadot_test_runtime::Call::Xcm(pallet_xcm::Call::execute { polkadot_test_runtime::RuntimeCall::Xcm(pallet_xcm::Call::execute {
message: Box::new(VersionedXcm::from(msg)), message: Box::new(VersionedXcm::from(msg)),
max_weight: Weight::from_ref_time(1_000_000_000), max_weight: Weight::from_ref_time(1_000_000_000),
}), }),
@@ -67,9 +67,9 @@ fn basic_buy_fees_message_executes() {
.inspect_state(|| { .inspect_state(|| {
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!( assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
r.event, r.event,
polkadot_test_runtime::Event::Xcm(pallet_xcm::Event::Attempted(Outcome::Complete( polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::Attempted(
_ Outcome::Complete(_)
))), )),
))); )));
}); });
} }
@@ -78,7 +78,7 @@ fn basic_buy_fees_message_executes() {
fn query_response_fires() { fn query_response_fires() {
use pallet_test_notifier::Event::*; use pallet_test_notifier::Event::*;
use pallet_xcm::QueryStatus; use pallet_xcm::QueryStatus;
use polkadot_test_runtime::Event::TestNotifier; use polkadot_test_runtime::RuntimeEvent::TestNotifier;
sp_tracing::try_init_simple(); sp_tracing::try_init_simple();
let mut client = TestClientBuilder::new() let mut client = TestClientBuilder::new()
@@ -89,7 +89,9 @@ fn query_response_fires() {
let execute = construct_extrinsic( let execute = construct_extrinsic(
&client, &client,
polkadot_test_runtime::Call::TestNotifier(pallet_test_notifier::Call::prepare_new_query {}), polkadot_test_runtime::RuntimeCall::TestNotifier(
pallet_test_notifier::Call::prepare_new_query {},
),
sp_keyring::Sr25519Keyring::Alice, sp_keyring::Sr25519Keyring::Alice,
0, 0,
); );
@@ -125,7 +127,7 @@ fn query_response_fires() {
let execute = construct_extrinsic( let execute = construct_extrinsic(
&client, &client,
polkadot_test_runtime::Call::Xcm(pallet_xcm::Call::execute { polkadot_test_runtime::RuntimeCall::Xcm(pallet_xcm::Call::execute {
message: msg, message: msg,
max_weight: Weight::from_ref_time(1_000_000_000), max_weight: Weight::from_ref_time(1_000_000_000),
}), }),
@@ -147,7 +149,7 @@ fn query_response_fires() {
.inspect_state(|| { .inspect_state(|| {
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!( assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
r.event, r.event,
polkadot_test_runtime::Event::Xcm(pallet_xcm::Event::ResponseReady( polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::ResponseReady(
q, q,
Response::ExecutionResult(None), Response::ExecutionResult(None),
)) if q == query_id, )) if q == query_id,
@@ -165,7 +167,7 @@ fn query_response_fires() {
#[test] #[test]
fn query_response_elicits_handler() { fn query_response_elicits_handler() {
use pallet_test_notifier::Event::*; use pallet_test_notifier::Event::*;
use polkadot_test_runtime::Event::TestNotifier; use polkadot_test_runtime::RuntimeEvent::TestNotifier;
sp_tracing::try_init_simple(); sp_tracing::try_init_simple();
let mut client = TestClientBuilder::new() let mut client = TestClientBuilder::new()
@@ -176,7 +178,7 @@ fn query_response_elicits_handler() {
let execute = construct_extrinsic( let execute = construct_extrinsic(
&client, &client,
polkadot_test_runtime::Call::TestNotifier( polkadot_test_runtime::RuntimeCall::TestNotifier(
pallet_test_notifier::Call::prepare_new_notify_query {}, pallet_test_notifier::Call::prepare_new_notify_query {},
), ),
sp_keyring::Sr25519Keyring::Alice, sp_keyring::Sr25519Keyring::Alice,
@@ -213,7 +215,7 @@ fn query_response_elicits_handler() {
let execute = construct_extrinsic( let execute = construct_extrinsic(
&client, &client,
polkadot_test_runtime::Call::Xcm(pallet_xcm::Call::execute { polkadot_test_runtime::RuntimeCall::Xcm(pallet_xcm::Call::execute {
message: Box::new(VersionedXcm::from(msg)), message: Box::new(VersionedXcm::from(msg)),
max_weight: Weight::from_ref_time(1_000_000_000), max_weight: Weight::from_ref_time(1_000_000_000),
}), }),
+3 -3
View File
@@ -27,7 +27,7 @@ use xcm::latest::SendXcm;
/// The trait to parameterize the `XcmExecutor`. /// The trait to parameterize the `XcmExecutor`.
pub trait Config { pub trait Config {
/// The outer call dispatch type. /// The outer call dispatch type.
type Call: Parameter + Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo; type RuntimeCall: Parameter + Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo;
/// How to send an onward XCM message. /// How to send an onward XCM message.
type XcmSender: SendXcm; type XcmSender: SendXcm;
@@ -36,7 +36,7 @@ pub trait Config {
type AssetTransactor: TransactAsset; type AssetTransactor: TransactAsset;
/// How to get a call origin from a `OriginKind` value. /// How to get a call origin from a `OriginKind` value.
type OriginConverter: ConvertOrigin<<Self::Call as Dispatchable>::Origin>; type OriginConverter: ConvertOrigin<<Self::RuntimeCall as Dispatchable>::Origin>;
/// Combinations of (Location, Asset) pairs which we trust as reserves. /// Combinations of (Location, Asset) pairs which we trust as reserves.
type IsReserve: FilterAssetLocation; type IsReserve: FilterAssetLocation;
@@ -51,7 +51,7 @@ pub trait Config {
type Barrier: ShouldExecute; type Barrier: ShouldExecute;
/// The means of determining an XCM message's weight. /// The means of determining an XCM message's weight.
type Weigher: WeightBounds<Self::Call>; type Weigher: WeightBounds<Self::RuntimeCall>;
/// The means of purchasing weight credit for XCM execution. /// The means of purchasing weight credit for XCM execution.
type Trader: WeightTrader; type Trader: WeightTrader;
+14 -11
View File
@@ -51,9 +51,9 @@ pub struct XcmExecutor<Config: config::Config> {
/// the weight of dynamically determined instructions such as `Transact`). /// the weight of dynamically determined instructions such as `Transact`).
pub total_surplus: u64, pub total_surplus: u64,
pub total_refunded: u64, pub total_refunded: u64,
pub error_handler: Xcm<Config::Call>, pub error_handler: Xcm<Config::RuntimeCall>,
pub error_handler_weight: u64, pub error_handler_weight: u64,
pub appendix: Xcm<Config::Call>, pub appendix: Xcm<Config::RuntimeCall>,
pub appendix_weight: u64, pub appendix_weight: u64,
_config: PhantomData<Config>, _config: PhantomData<Config>,
} }
@@ -61,10 +61,10 @@ pub struct XcmExecutor<Config: config::Config> {
/// The maximum recursion limit for `execute_xcm` and `execute_effects`. /// The maximum recursion limit for `execute_xcm` and `execute_effects`.
pub const MAX_RECURSION_LIMIT: u32 = 8; pub const MAX_RECURSION_LIMIT: u32 = 8;
impl<Config: config::Config> ExecuteXcm<Config::Call> for XcmExecutor<Config> { impl<Config: config::Config> ExecuteXcm<Config::RuntimeCall> for XcmExecutor<Config> {
fn execute_xcm_in_credit( fn execute_xcm_in_credit(
origin: impl Into<MultiLocation>, origin: impl Into<MultiLocation>,
mut message: Xcm<Config::Call>, mut message: Xcm<Config::RuntimeCall>,
weight_limit: Weight, weight_limit: Weight,
mut weight_credit: Weight, mut weight_credit: Weight,
) -> Outcome { ) -> Outcome {
@@ -180,7 +180,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
/// Execute the XCM program fragment and report back the error and which instruction caused it, /// Execute the XCM program fragment and report back the error and which instruction caused it,
/// or `Ok` if there was no error. /// or `Ok` if there was no error.
pub fn execute(&mut self, xcm: Xcm<Config::Call>) -> Result<(), ExecutorError> { pub fn execute(&mut self, xcm: Xcm<Config::RuntimeCall>) -> Result<(), ExecutorError> {
log::trace!( log::trace!(
target: "xcm::execute", target: "xcm::execute",
"origin: {:?}, total_surplus/refunded: {:?}/{:?}, error_handler_weight: {:?}", "origin: {:?}, total_surplus/refunded: {:?}/{:?}, error_handler_weight: {:?}",
@@ -231,8 +231,8 @@ impl<Config: config::Config> XcmExecutor<Config> {
} }
/// Remove the registered error handler and return it. Do not refund its weight. /// Remove the registered error handler and return it. Do not refund its weight.
fn take_error_handler(&mut self) -> Xcm<Config::Call> { fn take_error_handler(&mut self) -> Xcm<Config::RuntimeCall> {
let mut r = Xcm::<Config::Call>(vec![]); let mut r = Xcm::<Config::RuntimeCall>(vec![]);
sp_std::mem::swap(&mut self.error_handler, &mut r); sp_std::mem::swap(&mut self.error_handler, &mut r);
self.error_handler_weight = 0; self.error_handler_weight = 0;
r r
@@ -240,14 +240,14 @@ impl<Config: config::Config> XcmExecutor<Config> {
/// Drop the registered error handler and refund its weight. /// Drop the registered error handler and refund its weight.
fn drop_error_handler(&mut self) { fn drop_error_handler(&mut self) {
self.error_handler = Xcm::<Config::Call>(vec![]); self.error_handler = Xcm::<Config::RuntimeCall>(vec![]);
self.total_surplus.saturating_accrue(self.error_handler_weight); self.total_surplus.saturating_accrue(self.error_handler_weight);
self.error_handler_weight = 0; self.error_handler_weight = 0;
} }
/// Remove the registered appendix and return it. /// Remove the registered appendix and return it.
fn take_appendix(&mut self) -> Xcm<Config::Call> { fn take_appendix(&mut self) -> Xcm<Config::RuntimeCall> {
let mut r = Xcm::<Config::Call>(vec![]); let mut r = Xcm::<Config::RuntimeCall>(vec![]);
sp_std::mem::swap(&mut self.appendix, &mut r); sp_std::mem::swap(&mut self.appendix, &mut r);
self.appendix_weight = 0; self.appendix_weight = 0;
r r
@@ -265,7 +265,10 @@ impl<Config: config::Config> XcmExecutor<Config> {
} }
/// Process a single XCM instruction, mutating the state of the XCM virtual machine. /// Process a single XCM instruction, mutating the state of the XCM virtual machine.
fn process_instruction(&mut self, instr: Instruction<Config::Call>) -> Result<(), XcmError> { fn process_instruction(
&mut self,
instr: Instruction<Config::RuntimeCall>,
) -> Result<(), XcmError> {
match instr { match instr {
WithdrawAsset(assets) => { WithdrawAsset(assets) => {
// Take `assets` from the origin account (on-chain) and place in holding. // Take `assets` from the origin account (on-chain) and place in holding.
@@ -30,9 +30,9 @@ pub trait ShouldExecute {
/// - `weight_credit`: The pre-established amount of weight that the system has determined this /// - `weight_credit`: The pre-established amount of weight that the system has determined this
/// message may utilize in its execution. Typically non-zero only because of prior fee /// message may utilize in its execution. Typically non-zero only because of prior fee
/// payment, but could in principle be due to other factors. /// payment, but could in principle be due to other factors.
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
message: &mut Xcm<Call>, message: &mut Xcm<RuntimeCall>,
max_weight: Weight, max_weight: Weight,
weight_credit: &mut Weight, weight_credit: &mut Weight,
) -> Result<(), ()>; ) -> Result<(), ()>;
@@ -40,9 +40,9 @@ pub trait ShouldExecute {
#[impl_trait_for_tuples::impl_for_tuples(30)] #[impl_trait_for_tuples::impl_for_tuples(30)]
impl ShouldExecute for Tuple { impl ShouldExecute for Tuple {
fn should_execute<Call>( fn should_execute<RuntimeCall>(
origin: &MultiLocation, origin: &MultiLocation,
message: &mut Xcm<Call>, message: &mut Xcm<RuntimeCall>,
max_weight: Weight, max_weight: Weight,
weight_credit: &mut Weight, weight_credit: &mut Weight,
) -> Result<(), ()> { ) -> Result<(), ()> {
@@ -19,14 +19,14 @@ use sp_std::result::Result;
use xcm::latest::{prelude::*, Weight}; use xcm::latest::{prelude::*, Weight};
/// Determine the weight of an XCM message. /// Determine the weight of an XCM message.
pub trait WeightBounds<Call> { pub trait WeightBounds<RuntimeCall> {
/// Return the maximum amount of weight that an attempted execution of this message could /// Return the maximum amount of weight that an attempted execution of this message could
/// consume. /// consume.
fn weight(message: &mut Xcm<Call>) -> Result<Weight, ()>; fn weight(message: &mut Xcm<RuntimeCall>) -> Result<Weight, ()>;
/// Return the maximum amount of weight that an attempted execution of this instruction could /// Return the maximum amount of weight that an attempted execution of this instruction could
/// consume. /// consume.
fn instr_weight(instruction: &Instruction<Call>) -> Result<Weight, ()>; fn instr_weight(instruction: &Instruction<RuntimeCall>) -> Result<Weight, ()>;
} }
/// A means of getting approximate weight consumption for a given destination message executor and a /// A means of getting approximate weight consumption for a given destination message executor and a
+22 -21
View File
@@ -118,10 +118,9 @@ mod tests {
fn dmp() { fn dmp() {
MockNet::reset(); MockNet::reset();
let remark = let remark = parachain::RuntimeCall::System(
parachain::Call::System(frame_system::Call::<parachain::Runtime>::remark_with_event { frame_system::Call::<parachain::Runtime>::remark_with_event { remark: vec![1, 2, 3] },
remark: vec![1, 2, 3], );
});
Relay::execute_with(|| { Relay::execute_with(|| {
assert_ok!(RelayChainPalletXcm::send_xcm( assert_ok!(RelayChainPalletXcm::send_xcm(
Here, Here,
@@ -135,10 +134,11 @@ mod tests {
}); });
ParaA::execute_with(|| { ParaA::execute_with(|| {
use parachain::{Event, System}; use parachain::{RuntimeEvent, System};
assert!(System::events() assert!(System::events().iter().any(|r| matches!(
.iter() r.event,
.any(|r| matches!(r.event, Event::System(frame_system::Event::Remarked { .. })))); RuntimeEvent::System(frame_system::Event::Remarked { .. })
)));
}); });
} }
@@ -146,7 +146,7 @@ mod tests {
fn ump() { fn ump() {
MockNet::reset(); MockNet::reset();
let remark = relay_chain::Call::System( let remark = relay_chain::RuntimeCall::System(
frame_system::Call::<relay_chain::Runtime>::remark_with_event { remark: vec![1, 2, 3] }, frame_system::Call::<relay_chain::Runtime>::remark_with_event { remark: vec![1, 2, 3] },
); );
ParaA::execute_with(|| { ParaA::execute_with(|| {
@@ -162,10 +162,11 @@ mod tests {
}); });
Relay::execute_with(|| { Relay::execute_with(|| {
use relay_chain::{Event, System}; use relay_chain::{RuntimeEvent, System};
assert!(System::events() assert!(System::events().iter().any(|r| matches!(
.iter() r.event,
.any(|r| matches!(r.event, Event::System(frame_system::Event::Remarked { .. })))); RuntimeEvent::System(frame_system::Event::Remarked { .. })
)));
}); });
} }
@@ -173,10 +174,9 @@ mod tests {
fn xcmp() { fn xcmp() {
MockNet::reset(); MockNet::reset();
let remark = let remark = parachain::RuntimeCall::System(
parachain::Call::System(frame_system::Call::<parachain::Runtime>::remark_with_event { frame_system::Call::<parachain::Runtime>::remark_with_event { remark: vec![1, 2, 3] },
remark: vec![1, 2, 3], );
});
ParaA::execute_with(|| { ParaA::execute_with(|| {
assert_ok!(ParachainPalletXcm::send_xcm( assert_ok!(ParachainPalletXcm::send_xcm(
Here, Here,
@@ -190,10 +190,11 @@ mod tests {
}); });
ParaB::execute_with(|| { ParaB::execute_with(|| {
use parachain::{Event, System}; use parachain::{RuntimeEvent, System};
assert!(System::events() assert!(System::events().iter().any(|r| matches!(
.iter() r.event,
.any(|r| matches!(r.event, Event::System(frame_system::Event::Remarked { .. })))); RuntimeEvent::System(frame_system::Event::Remarked { .. })
)));
}); });
} }
@@ -53,7 +53,7 @@ parameter_types! {
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -61,7 +61,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -87,7 +87,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -133,7 +133,7 @@ pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
pub struct XcmConfig; pub struct XcmConfig;
impl Config for XcmConfig { impl Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin; type OriginConverter = XcmOriginToCallOrigin;
@@ -141,7 +141,7 @@ impl Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>; type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type ResponseHandler = (); type ResponseHandler = ();
type AssetTrap = (); type AssetTrap = ();
@@ -156,8 +156,8 @@ pub mod mock_msg_queue {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::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>;
type XcmExecutor: ExecuteXcm<Self::Call>; type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
} }
#[pallet::call] #[pallet::call]
@@ -175,7 +175,7 @@ pub mod mock_msg_queue {
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn received_dmp)] #[pallet::getter(fn received_dmp)]
/// A queue of received DMP messages /// A queue of received DMP messages
pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::Call>>, ValueQuery>; pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::RuntimeCall>>, ValueQuery>;
impl<T: Config> Get<ParaId> for Pallet<T> { impl<T: Config> Get<ParaId> for Pallet<T> {
fn get() -> ParaId { fn get() -> ParaId {
@@ -215,11 +215,11 @@ pub mod mock_msg_queue {
fn handle_xcmp_message( fn handle_xcmp_message(
sender: ParaId, sender: ParaId,
_sent_at: RelayBlockNumber, _sent_at: RelayBlockNumber,
xcm: VersionedXcm<T::Call>, xcm: VersionedXcm<T::RuntimeCall>,
max_weight: Weight, max_weight: Weight,
) -> Result<Weight, XcmError> { ) -> Result<Weight, XcmError> {
let hash = Encode::using_encoded(&xcm, T::Hashing::hash); let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
let (result, event) = match Xcm::<T::Call>::try_from(xcm) { let (result, event) = match Xcm::<T::RuntimeCall>::try_from(xcm) {
Ok(xcm) => { Ok(xcm) => {
let location = (1, Parachain(sender.into())); let location = (1, Parachain(sender.into()));
match T::XcmExecutor::execute_xcm(location, xcm, max_weight.ref_time()) { match T::XcmExecutor::execute_xcm(location, xcm, max_weight.ref_time()) {
@@ -251,7 +251,9 @@ pub mod mock_msg_queue {
let mut remaining_fragments = &data_ref[..]; let mut remaining_fragments = &data_ref[..];
while !remaining_fragments.is_empty() { while !remaining_fragments.is_empty() {
if let Ok(xcm) = VersionedXcm::<T::Call>::decode(&mut remaining_fragments) { if let Ok(xcm) =
VersionedXcm::<T::RuntimeCall>::decode(&mut remaining_fragments)
{
let _ = Self::handle_xcmp_message(sender, sent_at, xcm, max_weight); let _ = Self::handle_xcmp_message(sender, sent_at, xcm, max_weight);
} else { } else {
debug_assert!(false, "Invalid incoming XCMP message data"); debug_assert!(false, "Invalid incoming XCMP message data");
@@ -269,8 +271,8 @@ pub mod mock_msg_queue {
) -> Weight { ) -> Weight {
for (_i, (_sent_at, data)) in iter.enumerate() { for (_i, (_sent_at, data)) in iter.enumerate() {
let id = sp_io::hashing::blake2_256(&data[..]); let id = sp_io::hashing::blake2_256(&data[..]);
let maybe_msg = let maybe_msg = VersionedXcm::<T::RuntimeCall>::decode(&mut &data[..])
VersionedXcm::<T::Call>::decode(&mut &data[..]).map(Xcm::<T::Call>::try_from); .map(Xcm::<T::RuntimeCall>::try_from);
match maybe_msg { match maybe_msg {
Err(_) => { Err(_) => {
Self::deposit_event(Event::InvalidFormat(id)); Self::deposit_event(Event::InvalidFormat(id));
@@ -292,14 +294,14 @@ pub mod mock_msg_queue {
} }
impl mock_msg_queue::Config for Runtime { impl mock_msg_queue::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
} }
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>; type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
@@ -307,10 +309,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing; type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
@@ -43,7 +43,7 @@ parameter_types! {
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -51,7 +51,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -77,7 +77,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -124,7 +124,7 @@ pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
pub struct XcmConfig; pub struct XcmConfig;
impl Config for XcmConfig { impl Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -132,7 +132,7 @@ impl Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>; type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type ResponseHandler = (); type ResponseHandler = ();
type AssetTrap = (); type AssetTrap = ();
@@ -143,7 +143,7 @@ impl Config for XcmConfig {
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally... // Anyone can execute XCM messages locally...
@@ -152,10 +152,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
@@ -165,7 +165,7 @@ parameter_types! {
} }
impl ump::Config for Runtime { impl ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>; type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>; type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
@@ -53,7 +53,7 @@ parameter_types! {
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -61,7 +61,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -87,7 +87,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -133,7 +133,7 @@ pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
pub struct XcmConfig; pub struct XcmConfig;
impl Config for XcmConfig { impl Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin; type OriginConverter = XcmOriginToCallOrigin;
@@ -141,7 +141,7 @@ impl Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>; type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type ResponseHandler = (); type ResponseHandler = ();
type AssetTrap = (); type AssetTrap = ();
@@ -156,8 +156,8 @@ pub mod mock_msg_queue {
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::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>;
type XcmExecutor: ExecuteXcm<Self::Call>; type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
} }
#[pallet::call] #[pallet::call]
@@ -175,7 +175,7 @@ pub mod mock_msg_queue {
#[pallet::storage] #[pallet::storage]
#[pallet::getter(fn received_dmp)] #[pallet::getter(fn received_dmp)]
/// A queue of received DMP messages /// A queue of received DMP messages
pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::Call>>, ValueQuery>; pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::RuntimeCall>>, ValueQuery>;
impl<T: Config> Get<ParaId> for Pallet<T> { impl<T: Config> Get<ParaId> for Pallet<T> {
fn get() -> ParaId { fn get() -> ParaId {
@@ -215,11 +215,11 @@ pub mod mock_msg_queue {
fn handle_xcmp_message( fn handle_xcmp_message(
sender: ParaId, sender: ParaId,
_sent_at: RelayBlockNumber, _sent_at: RelayBlockNumber,
xcm: VersionedXcm<T::Call>, xcm: VersionedXcm<T::RuntimeCall>,
max_weight: Weight, max_weight: Weight,
) -> Result<Weight, XcmError> { ) -> Result<Weight, XcmError> {
let hash = Encode::using_encoded(&xcm, T::Hashing::hash); let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
let (result, event) = match Xcm::<T::Call>::try_from(xcm) { let (result, event) = match Xcm::<T::RuntimeCall>::try_from(xcm) {
Ok(xcm) => { Ok(xcm) => {
let location = MultiLocation::new(1, X1(Parachain(sender.into()))); let location = MultiLocation::new(1, X1(Parachain(sender.into())));
match T::XcmExecutor::execute_xcm(location, xcm, max_weight.ref_time()) { match T::XcmExecutor::execute_xcm(location, xcm, max_weight.ref_time()) {
@@ -251,7 +251,9 @@ pub mod mock_msg_queue {
let mut remaining_fragments = &data_ref[..]; let mut remaining_fragments = &data_ref[..];
while !remaining_fragments.is_empty() { while !remaining_fragments.is_empty() {
if let Ok(xcm) = VersionedXcm::<T::Call>::decode(&mut remaining_fragments) { if let Ok(xcm) =
VersionedXcm::<T::RuntimeCall>::decode(&mut remaining_fragments)
{
let _ = Self::handle_xcmp_message(sender, sent_at, xcm, max_weight); let _ = Self::handle_xcmp_message(sender, sent_at, xcm, max_weight);
} else { } else {
debug_assert!(false, "Invalid incoming XCMP message data"); debug_assert!(false, "Invalid incoming XCMP message data");
@@ -269,8 +271,8 @@ pub mod mock_msg_queue {
) -> Weight { ) -> Weight {
for (_i, (_sent_at, data)) in iter.enumerate() { for (_i, (_sent_at, data)) in iter.enumerate() {
let id = sp_io::hashing::blake2_256(&data[..]); let id = sp_io::hashing::blake2_256(&data[..]);
let maybe_msg = let maybe_msg = VersionedXcm::<T::RuntimeCall>::decode(&mut &data[..])
VersionedXcm::<T::Call>::decode(&mut &data[..]).map(Xcm::<T::Call>::try_from); .map(Xcm::<T::RuntimeCall>::try_from);
match maybe_msg { match maybe_msg {
Err(_) => { Err(_) => {
Self::deposit_event(Event::InvalidFormat(id)); Self::deposit_event(Event::InvalidFormat(id));
@@ -292,14 +294,14 @@ pub mod mock_msg_queue {
} }
impl mock_msg_queue::Config for Runtime { impl mock_msg_queue::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
} }
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>; type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
@@ -307,10 +309,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing; type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>; type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
@@ -43,7 +43,7 @@ parameter_types! {
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
type Index = u64; type Index = u64;
type BlockNumber = u64; type BlockNumber = u64;
type Hash = H256; type Hash = H256;
@@ -51,7 +51,7 @@ impl frame_system::Config for Runtime {
type AccountId = AccountId; type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = BlockHashCount;
type BlockWeights = (); type BlockWeights = ();
type BlockLength = (); type BlockLength = ();
@@ -77,7 +77,7 @@ parameter_types! {
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks; type MaxLocks = MaxLocks;
type Balance = Balance; type Balance = Balance;
type Event = Event; type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
@@ -124,7 +124,7 @@ pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
pub struct XcmConfig; pub struct XcmConfig;
impl Config for XcmConfig { impl Config for XcmConfig {
type Call = Call; type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter; type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter; type OriginConverter = LocalOriginConverter;
@@ -132,7 +132,7 @@ impl Config for XcmConfig {
type IsTeleporter = (); type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type Trader = FixedRateOfFungible<KsmPerSecond, ()>; type Trader = FixedRateOfFungible<KsmPerSecond, ()>;
type ResponseHandler = (); type ResponseHandler = ();
type AssetTrap = (); type AssetTrap = ();
@@ -143,7 +143,7 @@ impl Config for XcmConfig {
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>; type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter; type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally... // Anyone can execute XCM messages locally...
@@ -152,10 +152,10 @@ impl pallet_xcm::Config for Runtime {
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything; type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything; type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; type Weigher = FixedWeightBounds<BaseXcmWeight, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>; type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin; type Origin = Origin;
type Call = Call; type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
} }
@@ -165,7 +165,7 @@ parameter_types! {
} }
impl ump::Config for Runtime { impl ump::Config for Runtime {
type Event = Event; type RuntimeEvent = RuntimeEvent;
type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>; type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>;
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = FirstMessageFactorPercent;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>; type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;