[big refactor] Remove crate aliasing. (#4395)

* Rename: Phase 1.

* Unify codec.

* Fixing: Phase 2

* Fixing: Phase 3.

* Fixing: Phase 4.

* Fixing: Phase 5.

* Fixing: Phase 6.

* Fixing: Phase 7.

* Fixing: Phase 8. Tests

* Fixing: Phase 9. Tests!!!

* Fixing: Phase 10. Moar tests!

* Finally done!

* More fixes.

* Rename primitives:: to sp_core::

* Apply renames in finality-grandpa.

* Fix benches.

* Fix benches 2.

* Revert node-template.

* Fix frame-system in our modules.
This commit is contained in:
Tomasz Drwięga
2019-12-16 13:36:49 +01:00
committed by Gavin Wood
parent f14d98a439
commit 8778ca7dc8
485 changed files with 4023 additions and 4005 deletions
+13 -13
View File
@@ -32,7 +32,7 @@ pub use sp_finality_grandpa as fg_primitives;
use sp_std::prelude::*;
use codec::{self as codec, Encode, Decode, Error};
use support::{decl_event, decl_storage, decl_module, dispatch, storage};
use frame_support::{decl_event, decl_storage, decl_module, dispatch, storage};
use sp_runtime::{
generic::{DigestItem, OpaqueDigestItemId}, traits::Zero, Perbill,
};
@@ -44,14 +44,14 @@ use fg_primitives::{
GRANDPA_AUTHORITIES_KEY, GRANDPA_ENGINE_ID, ScheduledChange, ConsensusLog, SetId, RoundNumber,
};
pub use fg_primitives::{AuthorityId, AuthorityList, AuthorityWeight, VersionedAuthorityList};
use system::{ensure_signed, DigestOf};
use frame_system::{self as system, ensure_signed, DigestOf};
mod mock;
mod tests;
pub trait Trait: system::Trait {
pub trait Trait: frame_system::Trait {
/// The event type of this module.
type Event: From<Event> + Into<<Self as system::Trait>::Event>;
type Event: From<Event> + Into<<Self as frame_system::Trait>::Event>;
}
/// A stored pending change, old format.
@@ -266,7 +266,7 @@ impl<T: Trait> Module<T> {
/// Cannot be done when already paused.
pub fn schedule_pause(in_blocks: T::BlockNumber) -> dispatch::Result {
if let StoredState::Live = <State<T>>::get() {
let scheduled_at = <system::Module<T>>::block_number();
let scheduled_at = <frame_system::Module<T>>::block_number();
<State<T>>::put(StoredState::PendingPause {
delay: in_blocks,
scheduled_at,
@@ -282,7 +282,7 @@ impl<T: Trait> Module<T> {
/// Schedule a resume of GRANDPA after pausing.
pub fn schedule_resume(in_blocks: T::BlockNumber) -> dispatch::Result {
if let StoredState::Paused = <State<T>>::get() {
let scheduled_at = <system::Module<T>>::block_number();
let scheduled_at = <frame_system::Module<T>>::block_number();
<State<T>>::put(StoredState::PendingResume {
delay: in_blocks,
scheduled_at,
@@ -315,7 +315,7 @@ impl<T: Trait> Module<T> {
forced: Option<T::BlockNumber>,
) -> dispatch::Result {
if !<PendingChange<T>>::exists() {
let scheduled_at = <system::Module<T>>::block_number();
let scheduled_at = <frame_system::Module<T>>::block_number();
if let Some(_) = forced {
if Self::next_forced().map_or(false, |next| next > scheduled_at) {
@@ -343,7 +343,7 @@ impl<T: Trait> Module<T> {
/// Deposit one of this module's logs.
fn deposit_log(log: ConsensusLog<T::BlockNumber>) {
let log: DigestItem<T::Hash> = DigestItem::Consensus(GRANDPA_ENGINE_ID, log.encode());
<system::Module<T>>::deposit_log(log.into());
<frame_system::Module<T>>::deposit_log(log.into());
}
fn initialize_authorities(authorities: &AuthorityList) {
@@ -404,8 +404,8 @@ impl<T: Trait> sp_runtime::BoundToRuntimeAppPublic for Module<T> {
type Public = AuthorityId;
}
impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T>
where T: session::Trait
impl<T: Trait> pallet_session::OneSessionHandler<T::AccountId> for Module<T>
where T: pallet_session::Trait
{
type Key = AuthorityId;
@@ -438,7 +438,7 @@ impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T>
// if we didn't issue a change, we update the mapping to note that the current
// set corresponds to the latest equivalent session (i.e. now).
let session_index = <session::Module<T>>::current_index();
let session_index = <pallet_session::Module<T>>::current_index();
SetIdSession::insert(current_set_id, &session_index);
}
@@ -447,9 +447,9 @@ impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T>
}
}
impl<T: Trait> finality_tracker::OnFinalizationStalled<T::BlockNumber> for Module<T> {
impl<T: Trait> pallet_finality_tracker::OnFinalizationStalled<T::BlockNumber> for Module<T> {
fn on_stalled(further_wait: T::BlockNumber, median: T::BlockNumber) {
// when we record old authority sets, we can use `finality_tracker::median`
// when we record old authority sets, we can use `pallet_finality_tracker::median`
// to figure out _who_ failed. until then, we can't meaningfully guard
// against `next == last` the way that normal session changes do.
<Stalled<T>>::put((further_wait, median));