Refactor sr_primitives. (#3214)

* refactor sr_primitives.

* Fix try build error.

* Line-width

* Ui test.

* Final fixes.

* Fix build again.

* bring back ui test.

* Fix unsigned import.

* Another ui fix.

* Also refactor substrate-primitives

* Fix benchmarks.

* Fix doc test.

* fix doc tests
This commit is contained in:
Kian Paimani
2019-07-29 14:43:53 +02:00
committed by Bastian Köcher
parent cf80af9255
commit 79feb23a22
259 changed files with 667 additions and 665 deletions
+2 -3
View File
@@ -35,8 +35,8 @@ use parity_codec::{self as codec, Encode, Decode};
use srml_support::{
decl_event, decl_storage, decl_module, dispatch::Result, storage::StorageValue
};
use primitives::{
generic::{DigestItem, OpaqueDigestItemId}, traits::CurrentHeight
use sr_primitives::{
generic::{DigestItem, OpaqueDigestItemId}, traits::{CurrentHeight, Zero},
};
use fg_primitives::{ScheduledChange, ConsensusLog, GRANDPA_ENGINE_ID};
pub use fg_primitives::{AuthorityId, AuthorityWeight};
@@ -354,7 +354,6 @@ impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T> {
let next_authorities = validators.map(|(_, k)| (k, 1u64)).collect::<Vec<_>>();
let last_authorities = <Module<T>>::grandpa_authorities();
if next_authorities != last_authorities {
use primitives::traits::Zero;
if let Some((further_wait, median)) = <Stalled<T>>::take() {
let _ = Self::schedule_change(next_authorities, further_wait, Some(median));
} else {
+3 -3
View File
@@ -18,10 +18,10 @@
#![cfg(test)]
use primitives::{Perbill, DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}};
use sr_primitives::{Perbill, DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}};
use runtime_io;
use srml_support::{impl_outer_origin, impl_outer_event, parameter_types};
use substrate_primitives::{H256, Blake2Hasher};
use primitives::{H256, Blake2Hasher};
use parity_codec::{Encode, Decode};
use crate::{AuthorityId, GenesisConfig, Trait, Module, ConsensusLog};
use substrate_finality_grandpa_primitives::GRANDPA_ENGINE_ID;
@@ -52,7 +52,7 @@ impl system::Trait for Test {
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = ::primitives::traits::BlakeTwo256;
type Hashing = ::sr_primitives::traits::BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
+2 -2
View File
@@ -18,8 +18,8 @@
#![cfg(test)]
use primitives::testing::Digest;
use primitives::traits::{Header, OnFinalize};
use sr_primitives::testing::Digest;
use sr_primitives::traits::{Header, OnFinalize};
use runtime_io::with_externalities;
use crate::mock::*;
use system::{EventRecord, Phase};