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
@@ -21,8 +21,8 @@ use futures::prelude::*;
use futures03::TryFutureExt as _;
use log::{info, warn};
use runtime_primitives::generic::{SignedBlock, BlockId};
use runtime_primitives::traits::{SaturatedConversion, Zero, One, Block, Header, NumberFor};
use sr_primitives::generic::{SignedBlock, BlockId};
use sr_primitives::traits::{SaturatedConversion, Zero, One, Block, Header, NumberFor};
use consensus_common::import_queue::{ImportQueue, IncomingBlock, Link, BlockImportError, BlockImportResult};
use network::message;
+1 -1
View File
@@ -21,7 +21,7 @@ use std::fs::File;
use std::path::PathBuf;
use serde::{Serialize, Deserialize};
use primitives::storage::{StorageKey, StorageData};
use runtime_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay};
use sr_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay};
use serde_json as json;
use crate::components::RuntimeGenesis;
use network::Multiaddr;
+1 -1
View File
@@ -26,7 +26,7 @@ use consensus_common::{import_queue::ImportQueue, SelectChain};
use network::{self, OnDemand, FinalityProofProvider, NetworkStateInfo, config::BoxFinalityProofRequestBuilder};
use substrate_executor::{NativeExecutor, NativeExecutionDispatch};
use transaction_pool::txpool::{self, Options as TransactionPoolOptions, Pool as TransactionPool};
use runtime_primitives::{
use sr_primitives::{
BuildStorage, traits::{Block as BlockT, Header as HeaderT, ProvideRuntimeApi}, generic::BlockId
};
use crate::config::Configuration;
+1 -1
View File
@@ -24,7 +24,7 @@ use std::{path::PathBuf, net::SocketAddr};
use transaction_pool;
use crate::chain_spec::ChainSpec;
use primitives::crypto::Protected;
use runtime_primitives::BuildStorage;
use sr_primitives::BuildStorage;
use serde::{Serialize, de::DeserializeOwned};
use target_info::Target;
use tel::TelemetryEndpoints;
+8 -8
View File
@@ -42,8 +42,8 @@ use network::{NetworkState, NetworkStateInfo};
use log::{log, info, warn, debug, error, Level};
use parity_codec::{Encode, Decode};
use primitives::{Pair, ed25519, sr25519, crypto};
use runtime_primitives::generic::BlockId;
use runtime_primitives::traits::{Header, NumberFor, SaturatedConversion, Zero};
use sr_primitives::generic::BlockId;
use sr_primitives::traits::{Header, NumberFor, SaturatedConversion, Zero};
use substrate_executor::NativeExecutor;
use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
use tel::{telemetry, SUBSTRATE_INFO};
@@ -722,7 +722,7 @@ fn build_network_future<
"Polling the network future took {:?}",
polling_dur
);
Ok(Async::NotReady)
})
}
@@ -846,7 +846,7 @@ fn transactions_to_propagate<PoolApi, B, H, E>(pool: &TransactionPool<PoolApi>)
where
PoolApi: ChainApi<Block=B, Hash=H, Error=E>,
B: BlockT,
H: std::hash::Hash + Eq + runtime_primitives::traits::Member + serde::Serialize,
H: std::hash::Hash + Eq + sr_primitives::traits::Member + serde::Serialize,
E: txpool::error::IntoPoolError + From<txpool::error::Error>,
{
pool.ready()
@@ -916,7 +916,7 @@ impl<Block, ConsensusPair, FinalityPair>
offchain::AuthorityKeyProvider<Block>
for AuthorityKeyProvider<Block, ConsensusPair, FinalityPair>
where
Block: runtime_primitives::traits::Block,
Block: sr_primitives::traits::Block,
ConsensusPair: Pair,
FinalityPair: Pair,
{
@@ -991,8 +991,8 @@ where
/// # use node_runtime::{GenesisConfig, RuntimeApi};
/// # use std::sync::Arc;
/// # use node_primitives::Block;
/// # use runtime_primitives::Justification;
/// # use runtime_primitives::traits::Block as BlockT;
/// # use sr_primitives::Justification;
/// # use sr_primitives::traits::Block as BlockT;
/// # use grandpa;
/// # construct_simple_protocol! {
/// # pub struct NodeProtocol where Block = Block { }
@@ -1178,7 +1178,7 @@ macro_rules! construct_service_factory {
mod tests {
use super::*;
use consensus_common::SelectChain;
use runtime_primitives::traits::BlindCheckable;
use sr_primitives::traits::BlindCheckable;
use substrate_test_runtime_client::{prelude::*, runtime::{Extrinsic, Transfer}};
#[test]