Unalias Substrate Imports (#1530)

* cargo.toml updates

* session and system

* more

* more

* more

* more

* more

* fix

* compiles

* fix tests

* fix more tests

* fix mock

* fix deleted space

* Update validation/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update Cargo.lock

* update rococo

* remove unused warning

* update add benchmarks

* rename weight file

* forgot a file

* Update chain_spec.rs

* Revert "remove unused warning"

This reverts commit 4227cd0d1525286fb466dccb817564c9b37f8645.

* fix merge

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-08-04 15:23:33 +02:00
committed by GitHub
parent c01aa8bae8
commit 73f09e5154
54 changed files with 1680 additions and 1690 deletions
+71 -71
View File
@@ -52,15 +52,15 @@ use sp_runtime::{
Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
},
};
use im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use version::RuntimeVersion;
use transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
use sp_version::RuntimeVersion;
use pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo;
use pallet_grandpa::{AuthorityId as GrandpaId, fg_primitives};
use sp_core::OpaqueMetadata;
use sp_staking::SessionIndex;
use session::historical as session_historical;
use system::EnsureRoot;
use pallet_session::historical as session_historical;
use frame_system::EnsureRoot;
use runtime_common::paras_sudo_wrapper as paras_sudo_wrapper;
use runtime_parachains::configuration as parachains_configuration;
@@ -70,7 +70,7 @@ use runtime_parachains::initializer as parachains_initializer;
use runtime_parachains::paras as parachains_paras;
use runtime_parachains::scheduler as parachains_scheduler;
pub use balances::Call as BalancesCall;
pub use pallet_balances::Call as BalancesCall;
/// Constant values used within the runtime.
pub mod constants;
@@ -92,13 +92,13 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
system::CheckSpecVersion<Runtime>,
system::CheckTxVersion<Runtime>,
system::CheckGenesis<Runtime>,
system::CheckMortality<Runtime>,
system::CheckNonce<Runtime>,
system::CheckWeight<Runtime>,
transaction_payment::ChargeTransactionPayment<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckMortality<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
#[cfg(not(feature = "disable-runtime-api"))]
@@ -305,13 +305,13 @@ sp_api::impl_runtime_apis! {
}
}
impl system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
impl transaction_payment_rpc_runtime_api::TransactionPaymentApi<
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<
Block,
Balance,
> for Runtime {
@@ -325,7 +325,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Nonce, Call>;
/// Executive: handles dispatch to the various modules.
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
pub type Executive = frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllModules>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
@@ -343,25 +343,25 @@ construct_runtime! {
NodeBlock = primitives::v1::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Module, Call, Storage, Config, Event<T>},
System: frame_system::{Module, Call, Storage, Config, Event<T>},
// Must be before session.
Babe: babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
Timestamp: timestamp::{Module, Call, Storage, Inherent},
Indices: indices::{Module, Call, Storage, Config<T>, Event<T>},
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Indices: pallet_indices::{Module, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
// Consensus support.
Authorship: authorship::{Module, Call, Storage},
Staking: staking::{Module, Call, Storage, Config<T>, Event<T>, ValidateUnsigned},
Offences: offences::{Module, Call, Storage, Event},
Authorship: pallet_authorship::{Module, Call, Storage},
Staking: pallet_staking::{Module, Call, Storage, Config<T>, Event<T>, ValidateUnsigned},
Offences: pallet_offences::{Module, Call, Storage, Event},
Historical: session_historical::{Module},
Session: session::{Module, Call, Storage, Event, Config<T>},
Grandpa: grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config},
Session: pallet_session::{Module, Call, Storage, Event, Config<T>},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event, ValidateUnsigned},
ImOnline: pallet_im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: pallet_authority_discovery::{Module, Call, Config},
// Parachains modules.
Config: parachains_configuration::{Module, Call, Storage},
@@ -392,7 +392,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
#[cfg(feature = "disable-runtime-api")]
apis: version::create_apis_vec![[]],
apis: sp_version::create_apis_vec![[]],
transaction_version: 2,
};
@@ -400,7 +400,7 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
impl system::Trait for Runtime {
impl frame_system::Trait for Runtime {
type BaseCallFilter = BaseFilter;
type Origin = Origin;
type Call = Call;
@@ -422,7 +422,7 @@ impl system::Trait for Runtime {
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;
type ModuleToIndex = ModuleToIndex;
type AccountData = balances::AccountData<Balance>;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
@@ -438,14 +438,14 @@ parameter_types! {
/// Submits a transaction with the node's public and signature type. Adheres to the signed extension
/// format of the chain.
impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime where
impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime where
Call: From<LocalCall>,
{
fn create_transaction<C: system::offchain::AppCrypto<Self::Public, Self::Signature>>(
fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
call: Call,
public: <Signature as Verify>::Signer,
account: AccountId,
nonce: <Runtime as system::Trait>::Index,
nonce: <Runtime as frame_system::Trait>::Index,
) -> Option<(Call, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
// take the biggest period possible.
let period = BlockHashCount::get()
@@ -460,13 +460,13 @@ impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime
.saturating_sub(1);
let tip = 0;
let extra: SignedExtra = (
system::CheckSpecVersion::<Runtime>::new(),
system::CheckTxVersion::<Runtime>::new(),
system::CheckGenesis::<Runtime>::new(),
system::CheckMortality::<Runtime>::from(generic::Era::mortal(period, current_block)),
system::CheckNonce::<Runtime>::from(nonce),
system::CheckWeight::<Runtime>::new(),
transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
frame_system::CheckSpecVersion::<Runtime>::new(),
frame_system::CheckTxVersion::<Runtime>::new(),
frame_system::CheckGenesis::<Runtime>::new(),
frame_system::CheckMortality::<Runtime>::from(generic::Era::mortal(period, current_block)),
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
);
let raw_payload = SignedPayload::new(call, extra).map_err(|e| {
debug::warn!("Unable to create signed payload: {:?}", e);
@@ -479,14 +479,14 @@ impl<LocalCall> system::offchain::CreateSignedTransaction<LocalCall> for Runtime
}
}
impl system::offchain::SigningTypes for Runtime {
impl frame_system::offchain::SigningTypes for Runtime {
type Public = <Signature as Verify>::Signer;
type Signature = Signature;
}
impl session::historical::Trait for Runtime {
type FullIdentification = staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = staking::ExposureOf<Runtime>;
impl pallet_session::historical::Trait for Runtime {
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}
pallet_staking_reward_curve::build! {
@@ -504,9 +504,9 @@ parameter_types! {
// Six sessions in an era (6 hours).
pub const SessionsPerEra: SessionIndex = 6;
// 28 eras for unbonding (7 days).
pub const BondingDuration: staking::EraIndex = 28;
pub const BondingDuration: pallet_staking::EraIndex = 28;
// 27 eras in which slashes can be cancelled (~7 days).
pub const SlashDeferDuration: staking::EraIndex = 27;
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 64;
// quarter of the last session will be for election.
@@ -524,7 +524,7 @@ parameter_types! {
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}
impl im_online::Trait for Runtime {
impl pallet_im_online::Trait for Runtime {
type AuthorityId = ImOnlineId;
type Event = Event;
type ReportUnresponsiveness = Offences;
@@ -533,7 +533,7 @@ impl im_online::Trait for Runtime {
type WeightInfo = ();
}
impl staking::Trait for Runtime {
impl pallet_staking::Trait for Runtime {
type Currency = Balances;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVoteHandler<Self>;
@@ -562,7 +562,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 1 * CENTS;
}
impl balances::Trait for Runtime {
impl pallet_balances::Trait for Runtime {
type Balance = Balance;
type DustRemoval = ();
type Event = Event;
@@ -571,7 +571,7 @@ impl balances::Trait for Runtime {
type WeightInfo = ();
}
impl<C> system::offchain::SendTransactionTypes<C> for Runtime where
impl<C> frame_system::offchain::SendTransactionTypes<C> for Runtime where
Call: From<C>,
{
type OverarchingCall = Call;
@@ -588,20 +588,20 @@ parameter_types! {
pub OffencesWeightSoftLimit: Weight = Perbill::from_percent(60) * MaximumBlockWeight::get();
}
impl offences::Trait for Runtime {
impl pallet_offences::Trait for Runtime {
type Event = Event;
type IdentificationTuple = session::historical::IdentificationTuple<Self>;
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
type OnOffenceHandler = Staking;
type WeightSoftLimit = OffencesWeightSoftLimit;
type WeightInfo = ();
}
impl authority_discovery::Trait for Runtime {}
impl pallet_authority_discovery::Trait for Runtime {}
parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
impl timestamp::Trait for Runtime {
impl pallet_timestamp::Trait for Runtime {
type Moment = u64;
type OnTimestampSet = Babe;
type MinimumPeriod = MinimumPeriod;
@@ -612,7 +612,7 @@ parameter_types! {
pub const TransactionByteFee: Balance = 10 * MILLICENTS;
}
impl transaction_payment::Trait for Runtime {
impl pallet_transaction_payment::Trait for Runtime {
type Currency = Balances;
type OnTransactionPayment = ToAuthor<Runtime>;
type TransactionByteFee = TransactionByteFee;
@@ -624,13 +624,13 @@ parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl session::Trait for Runtime {
impl pallet_session::Trait for Runtime {
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = staking::StashOf<Self>;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type ShouldEndSession = Babe;
type NextSessionRotation = Babe;
type SessionManager = session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionManager = pallet_session::historical::NoteHistoricalRoot<Self, Staking>;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
@@ -642,34 +642,34 @@ parameter_types! {
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
}
impl babe::Trait for Runtime {
impl pallet_babe::Trait for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;
// session module is the trigger
type EpochChangeTrigger = babe::ExternalTrigger;
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type KeyOwnerProofSystem = Historical;
type KeyOwnerProof = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
babe::AuthorityId,
pallet_babe::AuthorityId,
)>>::Proof;
type KeyOwnerIdentification = <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(
KeyTypeId,
babe::AuthorityId,
pallet_babe::AuthorityId,
)>>::IdentificationTuple;
type HandleEquivocation =
babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
pallet_babe::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
}
parameter_types! {
pub const IndexDeposit: Balance = 1 * DOLLARS;
}
impl indices::Trait for Runtime {
impl pallet_indices::Trait for Runtime {
type AccountIndex = AccountIndex;
type Currency = Balances;
type Deposit = IndexDeposit;
@@ -681,7 +681,7 @@ parameter_types! {
pub const AttestationPeriod: BlockNumber = 50;
}
impl grandpa::Trait for Runtime {
impl pallet_grandpa::Trait for Runtime {
type Event = Event;
type Call = Call;
@@ -695,7 +695,7 @@ impl grandpa::Trait for Runtime {
GrandpaId,
)>>::IdentificationTuple;
type HandleEquivocation = grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
type HandleEquivocation = pallet_grandpa::EquivocationHandler<Self::KeyOwnerIdentification, Offences>;
}
parameter_types! {
@@ -703,8 +703,8 @@ parameter_types! {
}
// TODO: substrate#2986 implement this properly
impl authorship::Trait for Runtime {
type FindAuthor = session::FindAccountFromAuthorIndex<Self, Babe>;
impl pallet_authorship::Trait for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Babe>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
type EventHandler = (Staking, ImOnline);