Companion for #11981 (#1563)

* Companion for #11981

* rename

* Event to RuntimeEvent in imports

* missed rename

* undo

* revert

* rename type Call & Event

* commit

* ...

* fix

* fix errors

* fixes

* fmt

* fix imports

* final fix?

* fmt

* fix?

* fixes after merge

* small fix

* cargo update -p polkadot-runtime-common

* cargo +nightly fmt

* update lockfile for {"polkadot", "substrate"}

* fix

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Sergej Sakac
2022-09-13 01:55:33 +02:00
committed by GitHub
parent 51eb647826
commit b43bc58cb6
39 changed files with 1020 additions and 958 deletions
+6 -4
View File
@@ -19,7 +19,7 @@
mod block_builder;
use codec::{Decode, Encode};
use runtime::{
Balance, Block, BlockHashCount, Call, GenesisConfig, Runtime, Signature, SignedExtra,
Balance, Block, BlockHashCount, GenesisConfig, Runtime, RuntimeCall, Signature, SignedExtra,
SignedPayload, UncheckedExtrinsic, VERSION,
};
use sc_executor::{WasmExecutionMethod, WasmExecutor};
@@ -122,7 +122,7 @@ fn genesis_config() -> GenesisConfig {
pub fn generate_extrinsic(
client: &Client,
origin: sp_keyring::AccountKeyring,
function: impl Into<Call>,
function: impl Into<RuntimeCall>,
) -> UncheckedExtrinsic {
let current_block_hash = client.info().best_hash;
let current_block = client.info().best_number.saturated_into();
@@ -165,8 +165,10 @@ pub fn transfer(
dest: sp_keyring::AccountKeyring,
value: Balance,
) -> UncheckedExtrinsic {
let function =
Call::Balances(pallet_balances::Call::transfer { dest: dest.public().into(), value });
let function = RuntimeCall::Balances(pallet_balances::Call::transfer {
dest: dest.public().into(),
value,
});
generate_extrinsic(client, origin, function)
}
+11 -10
View File
@@ -170,7 +170,7 @@ impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type Call = Call;
type RuntimeCall = RuntimeCall;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
/// The index type for storing how many extrinsics an account has signed.
@@ -184,7 +184,7 @@ impl frame_system::Config for Runtime {
/// The header type.
type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// The ubiquitous event type.
type Event = Event;
type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
@@ -229,7 +229,7 @@ impl pallet_balances::Config for Runtime {
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
@@ -244,7 +244,7 @@ parameter_types! {
}
impl pallet_transaction_payment::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
@@ -253,13 +253,13 @@ impl pallet_transaction_payment::Config for Runtime {
}
impl pallet_sudo::Config for Runtime {
type Call = Call;
type Event = Event;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
}
impl cumulus_pallet_parachain_system::Config for Runtime {
type SelfParaId = ParachainId;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type OutboundXcmpMessageSource = ();
type DmpMessageHandler = ();
@@ -328,9 +328,10 @@ pub type SignedExtra = (
pallet_transaction_payment::ChargeTransactionPayment<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>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Runtime,
@@ -341,7 +342,7 @@ pub type Executive = frame_executive::Executive<
TestOnRuntimeUpgrade,
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
pub struct TestOnRuntimeUpgrade;
+2 -2
View File
@@ -705,7 +705,7 @@ impl TestNode {
/// Send an extrinsic to this node.
pub async fn send_extrinsic(
&self,
function: impl Into<runtime::Call>,
function: impl Into<runtime::RuntimeCall>,
caller: Sr25519Keyring,
) -> Result<RpcTransactionOutput, RpcTransactionError> {
let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0));
@@ -741,7 +741,7 @@ pub fn fetch_nonce(client: &Client, account: sp_core::sr25519::Public) -> u32 {
/// Construct an extrinsic that can be applied to the test runtime.
pub fn construct_extrinsic(
client: &Client,
function: impl Into<runtime::Call>,
function: impl Into<runtime::RuntimeCall>,
caller: sp_core::sr25519::Pair,
nonce: Option<u32>,
) -> runtime::UncheckedExtrinsic {