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 -2
View File
@@ -15,7 +15,7 @@ client = { package = "substrate-client", path = "../../client" }
transaction_pool = { package = "substrate-transaction-pool", path = "../../transaction-pool" }
runtime_support = { package = "srml-support", path = "../../../srml/support" }
srml-system = { path = "../../../srml/system" }
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
sr-primitives = { path = "../../sr-primitives" }
runtime_version = { package = "sr-version", path = "../../sr-version" }
runtime_io = { package = "sr-io", path = "../../sr-io" }
tokio = "0.1.7"
@@ -32,6 +32,6 @@ default = ["std"]
std = [
"primitives/std",
"runtime_support/std",
"runtime_primitives/std",
"sr-primitives/std",
"runtime_version/std",
]
+8 -8
View File
@@ -46,13 +46,13 @@ use consensus::error::{ErrorKind as CommonErrorKind};
use consensus::{Authorities, BlockImport, Environment, Proposer as BaseProposer};
use client::{Client as SubstrateClient, CallExecutor};
use client::runtime_api::{Core, BlockBuilder as BlockBuilderAPI, OldTxQueue, BlockBuilderError};
use runtime_primitives::generic::{BlockId, Era, ImportResult, BlockImportParams, BlockOrigin};
use runtime_primitives::traits::{Block, Header};
use runtime_primitives::traits::{
use sr_primitives::generic::{BlockId, Era, ImportResult, BlockImportParams, BlockOrigin};
use sr_primitives::traits::{Block, Header};
use sr_primitives::traits::{
Block as BlockT, Hash as HashT, Header as HeaderT,
BlockNumberToHash, SaturatedConversion
};
use runtime_primitives::Justification;
use sr_primitives::Justification;
use primitives::{AuthorityId, ed25519, Blake2Hasher, ed25519::LocalizedSignature};
use srml_system::Trait as SystemT;
@@ -982,7 +982,7 @@ impl<N, C, A> consensus::Environment<<C as AuthoringApi>::Block> for ProposerFac
authorities: &[AuthorityId],
sign_with: Arc<ed25519::Pair>,
) -> Result<Self::Proposer, Error> {
use runtime_primitives::traits::Hash as HashT;
use sr_primitives::traits::Hash as HashT;
let parent_hash = parent_header.hash();
let id = BlockId::hash(parent_hash);
@@ -1061,7 +1061,7 @@ impl<C, A> BaseProposer<<C as AuthoringApi>::Block> for Proposer<C, A> where
type Evaluate = Box<Future<Item=bool, Error=Error>>;
fn propose(&self) -> Self::Create {
use runtime_primitives::traits::BlakeTwo256;
use sr_primitives::traits::BlakeTwo256;
const MAX_VOTE_OFFLINE_SECONDS: Duration = Duration::from_secs(60);
@@ -1237,7 +1237,7 @@ impl<C, A> LocalProposer<<C as AuthoringApi>::Block> for Proposer<C, A> where
_misbehavior: Vec<(AuthorityId, Misbehavior<<<C as AuthoringApi>::Block as BlockT>::Hash>)>
) {
use rhododendron::Misbehavior as GenericMisbehavior;
use runtime_primitives::bft::{MisbehaviorKind, MisbehaviorReport};
use sr_primitives::bft::{MisbehaviorKind, MisbehaviorReport};
use node_runtime::{Call, UncheckedExtrinsic, ConsensusCall};
let mut next_index = {
@@ -1329,7 +1329,7 @@ mod tests {
use std::collections::HashSet;
use std::marker::PhantomData;
use runtime_primitives::testing::{Block as GenericTestBlock, Header as TestHeader};
use sr_primitives::testing::{Block as GenericTestBlock, Header as TestHeader};
use primitives::H256;
use keyring::Ed25519Keyring;
@@ -77,7 +77,7 @@ mod tests {
use keyring::Ed25519Keyring;
use rhododendron;
use runtime_primitives::testing::{H256, Block as RawBlock};
use sr_primitives::testing::{H256, Block as RawBlock};
type Block = RawBlock<u64>;
+1 -1
View File
@@ -25,7 +25,7 @@ use std::sync::Arc;
use client::{BlockchainEvents, BlockBody};
use futures::prelude::*;
use transaction_pool::txpool::{Pool as TransactionPool, ChainApi as PoolChainApi};
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, BlockNumberToHash};
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, BlockNumberToHash};
use tokio::executor::current_thread::TaskExecutor as LocalThreadHandle;
use tokio::runtime::TaskExecutor as ThreadPoolHandle;