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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mku-remove-canautho…
Browse files Browse the repository at this point in the history
…rwith
  • Loading branch information
parity-processbot committed Sep 13, 2022
2 parents ba8638d + 564f9b9 commit eb6e618
Show file tree
Hide file tree
Showing 73 changed files with 1,353 additions and 1,197 deletions.
556 changes: 324 additions & 232 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions node/client/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
with_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 period = polkadot_runtime_common::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64;
Expand Down Expand Up @@ -92,9 +92,9 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
with_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(),
value: self.value.into(),
});
Expand All @@ -113,14 +113,14 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
///
/// Should only be used for benchmarking since it makes strong assumptions
/// 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.
///
/// Only works if the current block is the genesis block since the
/// `CheckMortality` check is mocked by using the genesis block.
fn sign_call(
&self,
call: Call,
call: RuntimeCall,
nonce: u32,
current_block: u64,
period: u64,
Expand All @@ -130,12 +130,12 @@ trait BenchmarkCallSigner<Call: Encode + Clone, Signer: Pair> {
}

#[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>
{
fn sign_call(
&self,
call: polkadot_runtime::Call,
call: polkadot_runtime::RuntimeCall,
nonce: u32,
current_block: u64,
period: u64,
Expand Down Expand Up @@ -186,12 +186,12 @@ impl BenchmarkCallSigner<polkadot_runtime::Call, sp_core::sr25519::Pair>
}

#[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>
{
fn sign_call(
&self,
call: westend_runtime::Call,
call: westend_runtime::RuntimeCall,
nonce: u32,
current_block: u64,
period: u64,
Expand Down Expand Up @@ -240,12 +240,12 @@ impl BenchmarkCallSigner<westend_runtime::Call, sp_core::sr25519::Pair>
}

#[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>
{
fn sign_call(
&self,
call: kusama_runtime::Call,
call: kusama_runtime::RuntimeCall,
nonce: u32,
current_block: u64,
period: u64,
Expand Down Expand Up @@ -294,12 +294,12 @@ impl BenchmarkCallSigner<kusama_runtime::Call, sp_core::sr25519::Pair>
}

#[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>
{
fn sign_call(
&self,
call: rococo_runtime::Call,
call: rococo_runtime::RuntimeCall,
nonce: u32,
current_block: u64,
period: u64,
Expand Down
6 changes: 3 additions & 3 deletions node/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl PolkadotTestNode {
/// Send an extrinsic to this node.
pub async fn send_extrinsic(
&self,
function: impl Into<polkadot_test_runtime::Call>,
function: impl Into<polkadot_test_runtime::RuntimeCall>,
caller: Sr25519Keyring,
) -> Result<RpcTransactionOutput, RpcTransactionError> {
let extrinsic = construct_extrinsic(&*self.client, function, caller, 0);
Expand Down Expand Up @@ -345,7 +345,7 @@ impl PolkadotTestNode {
/// Construct an extrinsic that can be applied to the test runtime.
pub fn construct_extrinsic(
client: &Client,
function: impl Into<polkadot_test_runtime::Call>,
function: impl Into<polkadot_test_runtime::RuntimeCall>,
caller: Sr25519Keyring,
nonce: u32,
) -> UncheckedExtrinsic {
Expand Down Expand Up @@ -396,7 +396,7 @@ pub fn construct_transfer_extrinsic(
dest: sp_keyring::AccountKeyring,
value: Balance,
) -> 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(),
value,
});
Expand Down
2 changes: 1 addition & 1 deletion node/test/service/tests/call-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn call_function_actually_work() {

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(),
value: 1,
});
Expand Down
18 changes: 9 additions & 9 deletions runtime/common/src/assigned_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub mod pallet {
#[pallet::disable_frame_system_supertrait_check]
pub trait Config: configuration::Config + paras::Config + slots::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Origin for assigning slots.
type AssignSlotOrigin: EnsureOrigin<<Self as frame_system::Config>::Origin>;
Expand Down Expand Up @@ -579,10 +579,10 @@ mod tests {

impl<C> frame_system::offchain::SendTransactionTypes<C> for Test
where
Call: From<C>,
RuntimeCall: From<C>,
{
type Extrinsic = UncheckedExtrinsic;
type OverarchingCall = Call;
type OverarchingCall = RuntimeCall;
}

parameter_types! {
Expand All @@ -593,15 +593,15 @@ mod tests {
type BlockWeights = ();
type BlockLength = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
type Version = ();
Expand All @@ -621,7 +621,7 @@ mod tests {

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

impl parachains_paras::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = parachains_paras::TestWeightInfo;
type UnsignedPriority = ParasUnsignedPriority;
type NextSessionRotation = crate::mock::TestNextSessionRotation;
Expand All @@ -655,7 +655,7 @@ mod tests {
}

impl slots::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type Registrar = TestRegistrar<Test>;
type LeasePeriod = LeasePeriod;
Expand All @@ -673,7 +673,7 @@ mod tests {
}

impl assigned_slots::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type AssignSlotOrigin = EnsureRoot<Self::AccountId>;
type Leaser = Slots;
type PermanentSlotLeasePeriodLength = PermanentSlotLeasePeriodLength;
Expand Down
14 changes: 7 additions & 7 deletions runtime/common/src/auctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// The type representing the leasing system.
type Leaser: Leaser<
Expand Down Expand Up @@ -710,15 +710,15 @@ mod tests {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = BlockNumber;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand All @@ -739,7 +739,7 @@ mod tests {
impl pallet_balances::Config for Test {
type Balance = u64;
type DustRemoval = ();
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
Expand Down Expand Up @@ -867,7 +867,7 @@ mod tests {
}

impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Leaser = TestLeaser;
type Registrar = TestRegistrar<Self>;
type EndingPeriod = EndingPeriod;
Expand Down Expand Up @@ -1729,9 +1729,9 @@ mod benchmarking {

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 system_event: <T as frame_system::Config>::Event = generic_event.into();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
// compare to the last event record
let frame_system::EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
Expand Down
28 changes: 14 additions & 14 deletions runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config {
/// The overarching event type.
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type VestingSchedule: VestingSchedule<Self::AccountId, Moment = Self::BlockNumber>;
#[pallet::constant]
type Prefix: Get<&'static [u8]>;
Expand Down Expand Up @@ -597,11 +597,11 @@ impl<T: Config> Pallet<T> {
#[scale_info(skip_type_params(T))]
pub struct PrevalidateAttests<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>)
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>
where
<T as frame_system::Config>::Call: IsSubType<Call<T>>,
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Expand All @@ -616,7 +616,7 @@ where

impl<T: Config + Send + Sync> PrevalidateAttests<T>
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.
pub fn new() -> Self {
Expand All @@ -626,10 +626,10 @@ where

impl<T: Config + Send + Sync> SignedExtension for PrevalidateAttests<T>
where
<T as frame_system::Config>::Call: IsSubType<Call<T>>,
<T as frame_system::Config>::RuntimeCall: IsSubType<Call<T>>,
{
type AccountId = T::AccountId;
type Call = <T as frame_system::Config>::Call;
type Call = <T as frame_system::Config>::RuntimeCall;
type AdditionalSigned = ();
type Pre = ();
const IDENTIFIER: &'static str = "PrevalidateAttests";
Expand Down Expand Up @@ -752,15 +752,15 @@ mod tests {
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<u64>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand All @@ -779,7 +779,7 @@ mod tests {

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

impl pallet_vesting::Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type BlockNumberToBalance = Identity;
type MinVestedTransfer = MinVestedTransfer;
Expand All @@ -810,7 +810,7 @@ mod tests {
}

impl Config for Test {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting;
type Prefix = Prefix;
type MoveClaimOrigin = frame_system::EnsureSignedBy<Six, u64>;
Expand Down Expand Up @@ -1052,7 +1052,7 @@ mod tests {
fn valid_attest_transactions_are_free() {
new_test_ext().execute_with(|| {
let p = PrevalidateAttests::<Test>::new();
let c = Call::Claims(ClaimsCall::attest {
let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Saft.to_text().to_vec(),
});
let di = c.get_dispatch_info();
Expand All @@ -1066,13 +1066,13 @@ mod tests {
fn invalid_attest_transactions_are_recognized() {
new_test_ext().execute_with(|| {
let p = PrevalidateAttests::<Test>::new();
let c = Call::Claims(ClaimsCall::attest {
let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Regular.to_text().to_vec(),
});
let di = c.get_dispatch_info();
let r = p.validate(&42, &c, &di, 20);
assert!(r.is_err());
let c = Call::Claims(ClaimsCall::attest {
let c = RuntimeCall::Claims(ClaimsCall::attest {
statement: StatementKind::Saft.to_text().to_vec(),
});
let di = c.get_dispatch_info();
Expand Down
Loading

0 comments on commit eb6e618

Please sign in to comment.