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

Companion for #11981 #5915

Merged
merged 55 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
b839c2a
Companion for #11981
Szegoo Aug 22, 2022
8b5cf18
more renaming
Szegoo Aug 22, 2022
aa3d405
fmt
Szegoo Aug 22, 2022
5103db1
fixes
Szegoo Aug 22, 2022
6e57d6f
add generic type
Szegoo Aug 22, 2022
f314d54
Companion for #11831
Szegoo Jul 16, 2022
a681bee
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Aug 23, 2022
418dc9e
fix
Szegoo Aug 23, 2022
0cac730
revert changes
Szegoo Aug 25, 2022
4661fd3
Delete rename-outer-enum.diff
Szegoo Aug 25, 2022
e54d8fa
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Aug 25, 2022
b65102b
revert
Szegoo Aug 25, 2022
edb2496
Update run_benches_for_runtime.sh
Szegoo Aug 25, 2022
c359f5f
rename type Call & type Event
Szegoo Aug 25, 2022
7821347
passing tests
Szegoo Aug 25, 2022
6bba1ed
fmt
Szegoo Aug 25, 2022
1670083
small fixes
Szegoo Aug 25, 2022
a2756b5
commit
Szegoo Aug 26, 2022
1cac521
fix
Szegoo Aug 27, 2022
3d1306d
fmt
Szegoo Aug 27, 2022
ab62e87
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Aug 27, 2022
37d2b2d
commit
Szegoo Aug 27, 2022
afd2386
error fixes
Szegoo Aug 28, 2022
28d87c2
fix
Szegoo Aug 28, 2022
122baa8
Merge branch 'master' into rename-outer-enum
Szegoo Aug 28, 2022
595752f
small fix in test
Szegoo Aug 28, 2022
f9887a6
Merge branch 'master' into rename-outer-enum
Szegoo Aug 31, 2022
dff2859
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 1, 2022
e46b8a0
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 1, 2022
d3685eb
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 2, 2022
5dbcf5d
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 2, 2022
c270e37
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 3, 2022
5ef784f
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 5, 2022
b1f2122
Update lib.rs
Szegoo Sep 5, 2022
1b3b37c
Update lib.rs
Szegoo Sep 5, 2022
acf1cca
Update lib.rs
Szegoo Sep 5, 2022
9746310
Update lib.rs
Szegoo Sep 5, 2022
334e3dc
Update lib.rs
Szegoo Sep 5, 2022
8c0346b
Update lib.rs
Szegoo Sep 5, 2022
bb203a9
Update lib.rs
Szegoo Sep 5, 2022
7792686
remove RuntimeCall from pallet_grandpa
Szegoo Sep 5, 2022
8ec5738
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 6, 2022
ca46f19
last fix
Szegoo Sep 6, 2022
7a501b8
commit
Szegoo Sep 6, 2022
381f105
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 6, 2022
15b47e8
rename
Szegoo Sep 8, 2022
e2bfea2
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 8, 2022
10f2191
Merge branch 'master' into rename-outer-enum
Szegoo Sep 9, 2022
d29b550
merge fix
Szegoo Sep 9, 2022
0f3c48a
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 9, 2022
4d24a49
Merge branch 'master' into rename-outer-enum
Szegoo Sep 10, 2022
50fc84d
Merge branch 'paritytech:master' into rename-outer-enum
Szegoo Sep 12, 2022
1d578a3
update lockfile for {"substrate"}
Sep 12, 2022
e021194
cargo +nightly fmt
shawntabrizi Sep 12, 2022
50d9a7c
fix
shawntabrizi Sep 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
32 changes: 16 additions & 16 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 Expand Up @@ -1546,9 +1546,9 @@ mod benchmarking {
Preclaims::<T>::insert(&account, eth_address);
assert_eq!(Claims::<T>::get(eth_address), Some(VALUE.into()));

let call = super::Call::<T>::attest { statement: StatementKind::Regular.to_text().to_vec() };
let call = super::RuntimeCall::<T>::attest { statement: StatementKind::Regular.to_text().to_vec() };
// We have to copy the validate statement here because of trait issues... :(
let validate = |who: &T::AccountId, call: &super::Call<T>| -> DispatchResult {
let validate = |who: &T::AccountId, call: &super::RuntimeCall<T>| -> DispatchResult {
if let Call::attest{ statement: attested_statement } = call {
let signer = Preclaims::<T>::get(who).ok_or("signer has no claim")?;
if let Some(s) = Signing::<T>::get(signer) {
Expand Down
Loading