mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 18:17:56 +00:00
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:
committed by
Bastian Köcher
parent
cf80af9255
commit
79feb23a22
@@ -5,14 +5,14 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
client = { package = "substrate-client", path = "../../core/client" }
|
||||
codec = { package = "parity-codec", version = "4.1.1" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" }
|
||||
futures-preview = "0.3.0-alpha.17"
|
||||
inherents = { package = "substrate-inherents", path = "../inherents" }
|
||||
log = "0.4"
|
||||
futures-preview = "0.3.0-alpha.17"
|
||||
codec = { package = "parity-codec", version = "4.1.1" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives" }
|
||||
client = { package = "substrate-client", path = "../../core/client" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../../core/consensus/common" }
|
||||
inherents = { package = "substrate-inherents", path = "../inherents" }
|
||||
substrate-telemetry = { path = "../telemetry" }
|
||||
transaction_pool = { package = "substrate-transaction-pool", path = "../../core/transaction-pool" }
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ use consensus_common::{evaluation};
|
||||
use inherents::InherentData;
|
||||
use log::{error, info, debug, trace};
|
||||
use primitives::{H256, Blake2Hasher, ExecutionContext};
|
||||
use runtime_primitives::{ApplyError, generic::BlockId};
|
||||
use runtime_primitives::traits::{
|
||||
Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi,
|
||||
DigestFor, BlakeTwo256,
|
||||
use sr_primitives::{
|
||||
traits::{Block as BlockT, Hash as HashT, Header as HeaderT, ProvideRuntimeApi, DigestFor, BlakeTwo256},
|
||||
generic::BlockId,
|
||||
ApplyError,
|
||||
};
|
||||
use transaction_pool::txpool::{self, Pool as TransactionPool};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! ```
|
||||
//! # use substrate_basic_authorship::ProposerFactory;
|
||||
//! # use consensus_common::{Environment, Proposer};
|
||||
//! # use runtime_primitives::generic::BlockId;
|
||||
//! # use sr_primitives::generic::BlockId;
|
||||
//! # use std::{sync::Arc, time::Duration};
|
||||
//! # use test_client::{self, runtime::{Extrinsic, Transfer}, AccountKeyring};
|
||||
//! # use transaction_pool::txpool::{self, Pool as TransactionPool};
|
||||
|
||||
@@ -25,7 +25,7 @@ serde_json = "1.0"
|
||||
panic-handler = { package = "substrate-panic-handler", path = "../../core/panic-handler" }
|
||||
client = { package = "substrate-client", path = "../../core/client" }
|
||||
network = { package = "substrate-network", path = "../../core/network" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
|
||||
service = { package = "substrate-service", path = "../../core/service" }
|
||||
state-machine = { package = "substrate-state-machine", path = "../../core/state-machine" }
|
||||
|
||||
@@ -20,8 +20,7 @@ use client::{backend::Backend, BlockchainEvents};
|
||||
use futures::{Future, Stream};
|
||||
use futures03::{StreamExt as _, TryStreamExt as _};
|
||||
use log::{info, warn};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::Header;
|
||||
use sr_primitives::{generic::BlockId, traits::Header};
|
||||
use service::{Service, Components};
|
||||
use tokio::runtime::TaskExecutor;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use ansi_term::Colour;
|
||||
use client::ClientInfo;
|
||||
use log::info;
|
||||
use network::SyncState;
|
||||
use runtime_primitives::traits::{Block as BlockT, CheckedDiv, NumberFor, Zero, Saturating};
|
||||
use sr_primitives::traits::{Block as BlockT, CheckedDiv, NumberFor, Zero, Saturating};
|
||||
use service::NetworkStatus;
|
||||
use std::{convert::{TryFrom, TryInto}, fmt, time};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ hash-db = { version = "0.14.0", default-features = false }
|
||||
kvdb = { git = "https://github.com/paritytech/parity-common", optional = true, rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" }
|
||||
parity-codec = { version = "4.1.1", default-features = false, features = ["derive"] }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
|
||||
runtime-primitives = { package = "sr-primitives", path = "../sr-primitives", default-features = false }
|
||||
sr-primitives = { path = "../sr-primitives", default-features = false }
|
||||
runtime-version = { package = "sr-version", path = "../sr-version", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
|
||||
inherents = { package = "substrate-inherents", path = "../inherents", default-features = false }
|
||||
@@ -38,7 +38,7 @@ std = [
|
||||
"parity-codec/std",
|
||||
"primitives/std",
|
||||
"inherents/std",
|
||||
"runtime-primitives/std",
|
||||
"sr-primitives/std",
|
||||
"runtime-version/std",
|
||||
"hash-db/std",
|
||||
"consensus",
|
||||
|
||||
@@ -14,7 +14,7 @@ kvdb-memorydb = { git = "https://github.com/paritytech/parity-common", rev="b031
|
||||
linked-hash-map = "0.5"
|
||||
hash-db = { version = "0.14.0" }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
|
||||
sr-primitives = { path = "../../sr-primitives" }
|
||||
client = { package = "substrate-client", path = "../../client" }
|
||||
state-machine = { package = "substrate-state-machine", path = "../../state-machine" }
|
||||
parity-codec = { version = "4.1.1", features = ["derive"] }
|
||||
|
||||
+4
-4
@@ -44,7 +44,7 @@ use std::collections::BTreeSet;
|
||||
use log::warn;
|
||||
|
||||
use client::error::{Error as ClientError, Result as ClientResult};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, NumberFor, Zero, Bounded, CheckedSub
|
||||
};
|
||||
|
||||
@@ -544,7 +544,7 @@ pub fn destroy_fork<Block: BlockT, T: CacheItemT, S: Storage<Block, T>, Tx: Stor
|
||||
|
||||
/// Blockchain related functions.
|
||||
mod chain {
|
||||
use runtime_primitives::traits::Header as HeaderT;
|
||||
use sr_primitives::traits::Header as HeaderT;
|
||||
use super::*;
|
||||
|
||||
/// Is the block1 connected both ends of the range.
|
||||
@@ -618,8 +618,8 @@ fn read_forks<Block: BlockT, T: CacheItemT, S: Storage<Block, T>>(
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use test_client::runtime::H256;
|
||||
use runtime_primitives::testing::{Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use runtime_primitives::traits::Header as HeaderT;
|
||||
use sr_primitives::testing::{Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::traits::Header as HeaderT;
|
||||
use crate::cache::list_storage::tests::{DummyStorage, FaultyStorage, DummyTransaction};
|
||||
use super::*;
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
//! List-cache storage entries.
|
||||
|
||||
use client::error::Result as ClientResult;
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use parity_codec::{Encode, Decode};
|
||||
|
||||
use crate::cache::{CacheItemT, ComplexBlockId};
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ use kvdb::{KeyValueDB, DBTransaction};
|
||||
|
||||
use client::error::{Error as ClientError, Result as ClientResult};
|
||||
use parity_codec::{Encode, Decode};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use crate::utils::{self, db_err, meta_keys};
|
||||
|
||||
use crate::cache::{CacheItemT, ComplexBlockId};
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ use kvdb::{KeyValueDB, DBTransaction};
|
||||
use client::blockchain::Cache as BlockchainCache;
|
||||
use client::error::Result as ClientResult;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
||||
use consensus_common::well_known_cache_keys::Id as CacheKeyId;
|
||||
use crate::utils::{self, COLUMN_META, db_err};
|
||||
|
||||
|
||||
@@ -49,11 +49,11 @@ use trie::{MemoryDB, PrefixedMemoryDB, prefixed_key};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use primitives::{H256, Blake2Hasher, ChangesTrieConfiguration, convert_hash};
|
||||
use primitives::storage::well_known_keys;
|
||||
use runtime_primitives::{
|
||||
use sr_primitives::{
|
||||
generic::{BlockId, DigestItem}, Justification, StorageOverlay, ChildrenStorageOverlay,
|
||||
BuildStorage
|
||||
};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, NumberFor, Zero, One, SaturatedConversion
|
||||
};
|
||||
use state_machine::backend::Backend as StateBackend;
|
||||
@@ -1427,8 +1427,8 @@ mod tests {
|
||||
use client::backend::Backend as BTrait;
|
||||
use client::blockchain::Backend as BLBTrait;
|
||||
use client::backend::BlockImportOperation as Op;
|
||||
use runtime_primitives::testing::{Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use runtime_primitives::traits::{Hash, BlakeTwo256};
|
||||
use sr_primitives::testing::{Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::traits::{Hash, BlakeTwo256};
|
||||
use state_machine::{TrieMut, TrieDBMut, ChangesTrieRootsStorage, ChangesTrieStorage};
|
||||
use test_client;
|
||||
|
||||
@@ -1457,7 +1457,7 @@ mod tests {
|
||||
changes: Vec<(Vec<u8>, Vec<u8>)>,
|
||||
extrinsics_root: H256,
|
||||
) -> H256 {
|
||||
use runtime_primitives::testing::Digest;
|
||||
use sr_primitives::testing::Digest;
|
||||
|
||||
let (changes_root, changes_trie_update) = prepare_changes(changes);
|
||||
let digest = Digest {
|
||||
|
||||
@@ -31,8 +31,8 @@ use client::error::{Error as ClientError, Result as ClientResult};
|
||||
use client::light::blockchain::Storage as LightBlockchainStorage;
|
||||
use parity_codec::{Decode, Encode};
|
||||
use primitives::Blake2Hasher;
|
||||
use runtime_primitives::generic::{DigestItem, BlockId};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, NumberFor};
|
||||
use sr_primitives::generic::{DigestItem, BlockId};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, NumberFor};
|
||||
use consensus_common::well_known_cache_keys;
|
||||
use crate::cache::{DbCacheSync, DbCache, ComplexBlockId, EntryType as CacheEntryType};
|
||||
use crate::utils::{self, meta_keys, Meta, db_err, read_db, block_id_to_lookup_key, read_meta};
|
||||
@@ -571,8 +571,8 @@ fn cht_key<N: TryInto<u32>>(cht_type: u8, block: N) -> ClientResult<[u8; 5]> {
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
use client::cht;
|
||||
use runtime_primitives::generic::DigestItem;
|
||||
use runtime_primitives::testing::{H256 as Hash, Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::generic::DigestItem;
|
||||
use sr_primitives::testing::{H256 as Hash, Header, Block as RawBlock, ExtrinsicWrapper};
|
||||
use super::*;
|
||||
|
||||
type Block = RawBlock<ExtrinsicWrapper<u32>>;
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::sync::Arc;
|
||||
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
|
||||
use linked_hash_map::{LinkedHashMap, Entry};
|
||||
use hash_db::Hasher;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header};
|
||||
use sr_primitives::traits::{Block as BlockT, Header};
|
||||
use state_machine::{backend::Backend as StateBackend, TrieBackend};
|
||||
use log::trace;
|
||||
use super::{StorageCollection, ChildStorageCollection};
|
||||
@@ -105,7 +105,7 @@ impl<K: EstimateSize + Eq + StdHash, V: EstimateSize> LRUMap<K, V> {
|
||||
// TODO assert k v size fit into limit?? to avoid insert remove?
|
||||
match lmap.entry(k) {
|
||||
Entry::Occupied(mut entry) => {
|
||||
// note that in this case we are not running pure lru as
|
||||
// note that in this case we are not running pure lru as
|
||||
// it would require to remove first
|
||||
*storage_used_size -= entry.get().estimate_size();
|
||||
entry.insert(v);
|
||||
@@ -143,7 +143,7 @@ impl<K: EstimateSize + Eq + StdHash, V: EstimateSize> LRUMap<K, V> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
impl<B: BlockT, H: Hasher> Cache<B, H> {
|
||||
/// Returns the used memory size of the storage cache in bytes.
|
||||
pub fn used_storage_cache_size(&self) -> usize {
|
||||
@@ -563,7 +563,7 @@ impl<H: Hasher, S: StateBackend<H>, B: BlockT> StateBackend<H> for CachingState<
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use runtime_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper};
|
||||
use state_machine::backend::InMemory;
|
||||
use primitives::Blake2Hasher;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ use log::debug;
|
||||
use client;
|
||||
use parity_codec::Decode;
|
||||
use trie::DBValue;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, Zero,
|
||||
UniqueSaturatedFrom, UniqueSaturatedInto,
|
||||
};
|
||||
@@ -187,7 +187,7 @@ pub fn block_id_to_lookup_key<Block>(
|
||||
id: BlockId<Block>
|
||||
) -> Result<Option<Vec<u8>>, client::error::Error> where
|
||||
Block: BlockT,
|
||||
::runtime_primitives::traits::NumberFor<Block>: UniqueSaturatedFrom<u64> + UniqueSaturatedInto<u64>,
|
||||
::sr_primitives::traits::NumberFor<Block>: UniqueSaturatedFrom<u64> + UniqueSaturatedInto<u64>,
|
||||
{
|
||||
let res = match id {
|
||||
BlockId::Number(n) => db.get(
|
||||
@@ -332,7 +332,7 @@ pub fn read_meta<Block>(db: &dyn KeyValueDB, col_meta: Option<u32>, col_header:
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use runtime_primitives::testing::{Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::testing::{Block as RawBlock, ExtrinsicWrapper};
|
||||
type Block = RawBlock<ExtrinsicWrapper<u32>>;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
use std::collections::HashMap;
|
||||
use crate::error;
|
||||
use primitives::ChangesTrieConfiguration;
|
||||
use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use sr_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use state_machine::backend::Backend as StateBackend;
|
||||
use state_machine::ChangesTrieStorage as StateChangesTrieStorage;
|
||||
use consensus::well_known_cache_keys;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! The runtime api for building blocks.
|
||||
|
||||
use runtime_primitives::{traits::Block as BlockT, ApplyResult};
|
||||
use sr_primitives::{traits::Block as BlockT, ApplyResult};
|
||||
use rstd::vec::Vec;
|
||||
use sr_api_macros::decl_runtime_apis;
|
||||
pub use inherents::{InherentData, CheckInherentsResult};
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
use super::api::BlockBuilder as BlockBuilderApi;
|
||||
use std::vec::Vec;
|
||||
use parity_codec::Encode;
|
||||
use runtime_primitives::ApplyOutcome;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::ApplyOutcome;
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{
|
||||
Header as HeaderT, Hash, Block as BlockT, One, HashFor, ProvideRuntimeApi, ApiRef, DigestFor,
|
||||
};
|
||||
use primitives::{H256, ExecutionContext};
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::Justification;
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::Justification;
|
||||
use consensus::well_known_cache_keys;
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
@@ -196,7 +196,7 @@ pub fn tree_route<Block: BlockT, Backend: HeaderBackend<Block>>(
|
||||
from: BlockId<Block>,
|
||||
to: BlockId<Block>,
|
||||
) -> Result<TreeRoute<Block>> {
|
||||
use runtime_primitives::traits::Header;
|
||||
use sr_primitives::traits::Header;
|
||||
|
||||
let load_header = |id: BlockId<Block>| {
|
||||
match backend.header(id) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::{sync::Arc, cmp::Ord, panic::UnwindSafe, result, cell::RefCell, rc::Rc};
|
||||
use parity_codec::{Encode, Decode};
|
||||
use runtime_primitives::{
|
||||
use sr_primitives::{
|
||||
generic::BlockId, traits::Block as BlockT,
|
||||
};
|
||||
use state_machine::{
|
||||
|
||||
@@ -30,7 +30,7 @@ use parity_codec::Encode;
|
||||
use trie;
|
||||
|
||||
use primitives::{H256, convert_hash};
|
||||
use runtime_primitives::traits::{Header as HeaderT, SimpleArithmetic, Zero, One};
|
||||
use sr_primitives::traits::{Header as HeaderT, SimpleArithmetic, Zero, One};
|
||||
use state_machine::backend::InMemory as InMemoryState;
|
||||
use state_machine::{MemoryDB, TrieBackend, Backend as StateBackend,
|
||||
prove_read_on_trie_backend, read_proof_check, read_proof_check_on_proving_backend};
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::error::Error;
|
||||
use futures::channel::mpsc;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use primitives::NativeOrEncoded;
|
||||
use runtime_primitives::{
|
||||
use sr_primitives::{
|
||||
Justification,
|
||||
generic::{BlockId, SignedBlock},
|
||||
};
|
||||
@@ -34,13 +34,13 @@ use consensus::{
|
||||
well_known_cache_keys::Id as CacheKeyId,
|
||||
SelectChain, self,
|
||||
};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, Zero, NumberFor, CurrentHeight,
|
||||
BlockNumberToHash, ApiRef, ProvideRuntimeApi,
|
||||
SaturatedConversion, One, DigestFor,
|
||||
};
|
||||
use runtime_primitives::generic::DigestItem;
|
||||
use runtime_primitives::BuildStorage;
|
||||
use sr_primitives::generic::DigestItem;
|
||||
use sr_primitives::BuildStorage;
|
||||
use crate::runtime_api::{
|
||||
CallRuntimeAt, ConstructRuntimeApi, Core as CoreApi, ProofRecorder,
|
||||
InitializeBlock,
|
||||
@@ -1851,7 +1851,7 @@ pub(crate) mod tests {
|
||||
use std::collections::HashMap;
|
||||
use super::*;
|
||||
use primitives::blake2_256;
|
||||
use runtime_primitives::DigestItem;
|
||||
use sr_primitives::DigestItem;
|
||||
use consensus::{BlockOrigin, SelectChain};
|
||||
use test_client::{
|
||||
prelude::*,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use std::{self, error, result};
|
||||
use state_machine;
|
||||
use runtime_primitives::ApplyError;
|
||||
use sr_primitives::ApplyError;
|
||||
use consensus;
|
||||
use derive_more::{Display, From};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Tool for creating the genesis block.
|
||||
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, Zero};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, Zero};
|
||||
|
||||
/// Create a genesis block, given the initial storage.
|
||||
pub fn construct_genesis_block<
|
||||
@@ -49,7 +49,7 @@ mod tests {
|
||||
runtime::{Hash, Transfer, Block, BlockNumber, Header, Digest},
|
||||
AccountKeyring, Sr25519Keyring,
|
||||
};
|
||||
use runtime_primitives::traits::BlakeTwo256;
|
||||
use sr_primitives::traits::BlakeTwo256;
|
||||
use primitives::Blake2Hasher;
|
||||
use hex::*;
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
use primitives::{ChangesTrieConfiguration, storage::well_known_keys};
|
||||
use runtime_primitives::generic::{BlockId, DigestItem};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, NumberFor};
|
||||
use runtime_primitives::{Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use sr_primitives::generic::{BlockId, DigestItem};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, NumberFor};
|
||||
use sr_primitives::{Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use state_machine::backend::{Backend as StateBackend, InMemory};
|
||||
use state_machine::{self, InMemoryChangesTrieStorage, ChangesTrieAnchorBlockId};
|
||||
use hash_db::Hasher;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::cmp::Reverse;
|
||||
use kvdb::{KeyValueDB, DBTransaction};
|
||||
use runtime_primitives::traits::SimpleArithmetic;
|
||||
use sr_primitives::traits::SimpleArithmetic;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use crate::error;
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ use std::collections::HashMap;
|
||||
use std::sync::{Arc, Weak};
|
||||
use parking_lot::{RwLock, Mutex};
|
||||
|
||||
use runtime_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use sr_primitives::{generic::BlockId, Justification, StorageOverlay, ChildrenStorageOverlay};
|
||||
use state_machine::{Backend as StateBackend, TrieBackend, backend::InMemory as InMemoryState};
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor, Zero, Header};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor, Zero, Header};
|
||||
use crate::in_mem::{self, check_genesis_storage};
|
||||
use crate::backend::{
|
||||
AuxStore, Backend as ClientBackend, BlockImportOperation, RemoteBackend, NewBlockState,
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
use std::{sync::{Weak, Arc}, collections::HashMap};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use runtime_primitives::{Justification, generic::BlockId};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
||||
use sr_primitives::{Justification, generic::BlockId};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor, Zero};
|
||||
use consensus::well_known_cache_keys;
|
||||
|
||||
use crate::backend::{AuxStore, NewBlockState};
|
||||
|
||||
@@ -24,8 +24,8 @@ use std::{
|
||||
|
||||
use parity_codec::{Encode, Decode};
|
||||
use primitives::{offchain, H256, Blake2Hasher, convert_hash, NativeOrEncoded};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{One, Block as BlockT, Header as HeaderT};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{One, Block as BlockT, Header as HeaderT};
|
||||
use state_machine::{
|
||||
self, Backend as StateBackend, CodeExecutor, OverlayedChanges,
|
||||
ExecutionStrategy, create_proof_check_backend,
|
||||
|
||||
@@ -24,7 +24,7 @@ use std::future::Future;
|
||||
use hash_db::{HashDB, Hasher};
|
||||
use parity_codec::{Decode, Encode};
|
||||
use primitives::{ChangesTrieConfiguration, convert_hash};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, Hash, HashFor, NumberFor,
|
||||
SimpleArithmetic, CheckedConversion,
|
||||
};
|
||||
@@ -502,7 +502,7 @@ pub mod tests {
|
||||
use crate::light::blockchain::tests::{DummyStorage, DummyBlockchain};
|
||||
use primitives::{blake2_256, Blake2Hasher, H256};
|
||||
use primitives::storage::{well_known_keys, StorageKey};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use sr_primitives::generic::BlockId;
|
||||
use state_machine::Backend;
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ use std::sync::Arc;
|
||||
|
||||
use executor::RuntimeInfo;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use runtime_primitives::BuildStorage;
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use sr_primitives::BuildStorage;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
use state_machine::CodeExecutor;
|
||||
|
||||
use crate::call_executor::LocalCallExecutor;
|
||||
|
||||
@@ -24,7 +24,7 @@ use std::{
|
||||
use fnv::{FnvHashSet, FnvHashMap};
|
||||
use futures::channel::mpsc;
|
||||
use primitives::storage::{StorageKey, StorageData};
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
|
||||
/// Storage change set
|
||||
#[derive(Debug)]
|
||||
@@ -307,7 +307,7 @@ impl<Block: BlockT> StorageNotifications<Block> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use runtime_primitives::testing::{H256 as Hash, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::testing::{H256 as Hash, Block as RawBlock, ExtrinsicWrapper};
|
||||
use super::*;
|
||||
use std::iter::{empty, Empty};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ pub use state_machine::OverlayedChanges;
|
||||
#[cfg(feature = "std")]
|
||||
pub use primitives::NativeOrEncoded;
|
||||
#[doc(hidden)]
|
||||
pub use runtime_primitives::{
|
||||
pub use sr_primitives::{
|
||||
traits::{
|
||||
Block as BlockT, GetNodeBlockType, GetRuntimeBlockType,
|
||||
Header as HeaderT, ApiRef, RuntimeApiInfo, Hash as HashT,
|
||||
|
||||
@@ -18,7 +18,7 @@ srml-aura = { path = "../../../srml/aura" }
|
||||
client = { package = "substrate-client", path = "../../client" }
|
||||
substrate-telemetry = { path = "../../telemetry" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../common" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
|
||||
sr-primitives = { path = "../../sr-primitives" }
|
||||
futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] }
|
||||
futures01 = { package = "futures", version = "0.1" }
|
||||
futures-timer = "0.2.1"
|
||||
|
||||
@@ -8,16 +8,16 @@ edition = "2018"
|
||||
[dependencies]
|
||||
parity-codec = { version = "4.1.1", default-features = false }
|
||||
substrate-client = { path = "../../../client", default-features = false }
|
||||
substrate-primitives = { path = "../../../primitives", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../../primitives", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../../../sr-std", default-features = false }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../../sr-primitives", default-features = false }
|
||||
sr-primitives = { path = "../../../sr-primitives", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"rstd/std",
|
||||
"parity-codec/std",
|
||||
"runtime_primitives/std",
|
||||
"sr-primitives/std",
|
||||
"substrate-client/std",
|
||||
"substrate-primitives/std",
|
||||
"primitives/std",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use parity_codec::{Encode, Decode, Codec};
|
||||
use substrate_client::decl_runtime_apis;
|
||||
use rstd::vec::Vec;
|
||||
use runtime_primitives::ConsensusEngineId;
|
||||
use sr_primitives::ConsensusEngineId;
|
||||
|
||||
/// The `ConsensusEngineId` of AuRa.
|
||||
pub const AURA_ENGINE_ID: ConsensusEngineId = [b'a', b'u', b'r', b'a'];
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
use primitives::Pair;
|
||||
use aura_primitives::AURA_ENGINE_ID;
|
||||
use runtime_primitives::generic::{DigestItem, OpaqueDigestItemId};
|
||||
use sr_primitives::generic::{DigestItem, OpaqueDigestItemId};
|
||||
use parity_codec::{Encode, Codec};
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ use client::{
|
||||
backend::AuxStore,
|
||||
};
|
||||
|
||||
use runtime_primitives::{generic::{self, BlockId, OpaqueDigestItemId}, Justification};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header, DigestItemFor, ProvideRuntimeApi, Zero, Member};
|
||||
use sr_primitives::{generic::{self, BlockId, OpaqueDigestItemId}, Justification};
|
||||
use sr_primitives::traits::{Block as BlockT, Header, DigestItemFor, ProvideRuntimeApi, Zero, Member};
|
||||
|
||||
use primitives::Pair;
|
||||
use inherents::{InherentDataProviders, InherentData};
|
||||
@@ -716,7 +716,7 @@ mod tests {
|
||||
use consensus_common::NoNetwork as DummyOracle;
|
||||
use network::test::*;
|
||||
use network::test::{Block as TestBlock, PeersClient, PeersFullClient};
|
||||
use runtime_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use sr_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use network::config::ProtocolConfig;
|
||||
use parking_lot::Mutex;
|
||||
use tokio::runtime::current_thread;
|
||||
|
||||
@@ -21,7 +21,7 @@ srml-babe = { path = "../../../srml/babe" }
|
||||
client = { package = "substrate-client", path = "../../client" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../common" }
|
||||
slots = { package = "substrate-consensus-slots", path = "../slots" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
|
||||
sr-primitives = { path = "../../sr-primitives" }
|
||||
fork-tree = { path = "../../utils/fork-tree" }
|
||||
futures-preview = { version = "0.3.0-alpha.17", features = ["compat"] }
|
||||
futures01 = { package = "futures", version = "0.1" }
|
||||
|
||||
@@ -8,8 +8,8 @@ edition = "2018"
|
||||
[dependencies]
|
||||
substrate-client = { path = "../../../client", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../../../sr-std", default-features = false }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../../sr-primitives", default-features = false }
|
||||
substrate-primitives = { path = "../../../primitives", default-features = false }
|
||||
sr-primitives = { path = "../../../sr-primitives", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../../primitives", default-features = false }
|
||||
slots = { package = "substrate-consensus-slots", path = "../../slots", optional = true }
|
||||
parity-codec = { version = "4.1.1", default-features = false }
|
||||
schnorrkel = { version = "0.1.1", optional = true }
|
||||
@@ -18,7 +18,7 @@ schnorrkel = { version = "0.1.1", optional = true }
|
||||
default = ["std"]
|
||||
std = [
|
||||
"rstd/std",
|
||||
"runtime_primitives/std",
|
||||
"sr-primitives/std",
|
||||
"substrate-client/std",
|
||||
"parity-codec/std",
|
||||
"schnorrkel",
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
//! Private implementation details of BABE digests.
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use substrate_primitives::sr25519::Signature;
|
||||
use primitives::sr25519::Signature;
|
||||
#[cfg(feature = "std")]
|
||||
use super::{BABE_ENGINE_ID, Epoch};
|
||||
#[cfg(not(feature = "std"))]
|
||||
use super::{VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH};
|
||||
use super::SlotNumber;
|
||||
#[cfg(feature = "std")]
|
||||
use runtime_primitives::{DigestItem, generic::OpaqueDigestItemId};
|
||||
use sr_primitives::{DigestItem, generic::OpaqueDigestItemId};
|
||||
#[cfg(feature = "std")]
|
||||
use std::fmt::Debug;
|
||||
use parity_codec::{Decode, Encode};
|
||||
|
||||
@@ -23,8 +23,8 @@ mod digest;
|
||||
|
||||
use parity_codec::{Encode, Decode};
|
||||
use rstd::vec::Vec;
|
||||
use runtime_primitives::ConsensusEngineId;
|
||||
use substrate_primitives::sr25519;
|
||||
use sr_primitives::ConsensusEngineId;
|
||||
use primitives::sr25519;
|
||||
use substrate_client::decl_runtime_apis;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
|
||||
@@ -21,7 +21,7 @@ use parity_codec::{Decode, Encode};
|
||||
|
||||
use client::backend::AuxStore;
|
||||
use client::error::{Result as ClientResult, Error as ClientError};
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
|
||||
use super::{EpochChanges, SharedEpochChanges};
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ use consensus_common::import_queue::{
|
||||
BoxJustificationImport, BoxFinalityProofImport,
|
||||
};
|
||||
use consensus_common::well_known_cache_keys::Id as CacheKeyId;
|
||||
use runtime_primitives::{generic, generic::{BlockId, OpaqueDigestItemId}, Justification};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::{generic, generic::{BlockId, OpaqueDigestItemId}, Justification};
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header, DigestItemFor, NumberFor, ProvideRuntimeApi,
|
||||
SimpleBitOps, Zero,
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ use client::{LongestChain, block_builder::BlockBuilder};
|
||||
use consensus_common::NoNetwork as DummyOracle;
|
||||
use network::test::*;
|
||||
use network::test::{Block as TestBlock, PeersClient};
|
||||
use runtime_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use sr_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use network::config::ProtocolConfig;
|
||||
use tokio::runtime::current_thread;
|
||||
use keyring::sr25519::Keyring;
|
||||
|
||||
@@ -15,7 +15,7 @@ futures-preview = "0.3.0-alpha.17"
|
||||
futures-timer = "0.2.1"
|
||||
rstd = { package = "sr-std", path = "../../sr-std" }
|
||||
runtime_version = { package = "sr-version", path = "../../sr-version" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
|
||||
sr-primitives = { path = "../../sr-primitives" }
|
||||
parity-codec = { version = "4.1.1", features = ["derive"] }
|
||||
parking_lot = "0.8.0"
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! Block import helpers.
|
||||
|
||||
use runtime_primitives::traits::{Block as BlockT, DigestItemFor, Header as HeaderT, NumberFor};
|
||||
use runtime_primitives::Justification;
|
||||
use sr_primitives::traits::{Block as BlockT, DigestItemFor, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::Justification;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use super::MAX_BLOCK_SIZE;
|
||||
|
||||
use parity_codec::Encode;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, One, CheckedConversion};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, One, CheckedConversion};
|
||||
|
||||
// This is just a best effort to encode the number. None indicated that it's too big to encode
|
||||
// in a u128.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//! queues to be instantiated simply.
|
||||
|
||||
use std::{sync::Arc, collections::HashMap};
|
||||
use runtime_primitives::{Justification, traits::{Block as BlockT, Header as _, NumberFor}};
|
||||
use sr_primitives::{Justification, traits::{Block as BlockT, Header as _, NumberFor}};
|
||||
use crate::{error::Error as ConsensusError, well_known_cache_keys::Id as CacheKeyId};
|
||||
use crate::block_import::{
|
||||
BlockImport, BlockOrigin, BlockImportParams, ImportedAux, JustificationImport, ImportResult,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::{mem, pin::Pin, sync::Arc, time::Duration};
|
||||
use futures::{prelude::*, channel::mpsc, task::SpawnExt as _, task::Context, task::Poll};
|
||||
use futures_timer::Delay;
|
||||
use runtime_primitives::{Justification, traits::{Block as BlockT, Header as HeaderT, NumberFor}};
|
||||
use sr_primitives::{Justification, traits::{Block as BlockT, Header as HeaderT, NumberFor}};
|
||||
|
||||
use crate::block_import::BlockOrigin;
|
||||
use crate::import_queue::{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//!
|
||||
|
||||
use futures::{prelude::*, channel::mpsc};
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use std::{pin::Pin, task::Context, task::Poll};
|
||||
use crate::import_queue::{Origin, Link, BlockImportResult, BlockImportError};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use runtime_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use sr_primitives::traits::{Block as BlockT, DigestFor};
|
||||
use futures::prelude::*;
|
||||
pub use inherents::InherentData;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// along with Substrate Consensus Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::error::Error;
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor};
|
||||
|
||||
|
||||
/// The SelectChain trait defines the strategy upon which the head is chosen
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -9,7 +9,7 @@ edition = "2018"
|
||||
codec = { package = "parity-codec", version = "4.1.1" }
|
||||
client = { package = "substrate-client", path = "../../client" }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../sr-primitives" }
|
||||
sr-primitives = { path = "../../sr-primitives" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../common" }
|
||||
inherents = { package = "substrate-inherents", path = "../../inherents" }
|
||||
futures-preview = "0.3.0-alpha.17"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use codec::{Encode, Decode};
|
||||
use client::backend::AuxStore;
|
||||
use client::error::{Result as ClientResult, Error as ClientError};
|
||||
use runtime_primitives::traits::Header;
|
||||
use sr_primitives::traits::Header;
|
||||
|
||||
const SLOT_HEADER_MAP_KEY: &[u8] = b"slot_header_map";
|
||||
const SLOT_HEADER_START: &[u8] = b"slot_header_start";
|
||||
@@ -153,7 +153,7 @@ pub fn check_equivocation<C, H, P>(
|
||||
mod test {
|
||||
use primitives::{sr25519, Pair};
|
||||
use primitives::hash::H256;
|
||||
use runtime_primitives::testing::{Header as HeaderTest, Digest as DigestTest};
|
||||
use sr_primitives::testing::{Header as HeaderTest, Digest as DigestTest};
|
||||
use test_client;
|
||||
|
||||
use super::{MAX_SLOT_CAPACITY, PRUNING_BOUND, check_equivocation};
|
||||
|
||||
@@ -35,8 +35,8 @@ use consensus_common::{SyncOracle, SelectChain};
|
||||
use futures::{prelude::*, future::{self, Either}, task::Poll};
|
||||
use inherents::{InherentData, InherentDataProviders};
|
||||
use log::{debug, error, info, warn};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{ApiRef, Block as BlockT, ProvideRuntimeApi};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{ApiRef, Block as BlockT, ProvideRuntimeApi};
|
||||
use std::{fmt::Debug, ops::Deref, panic, pin::Pin};
|
||||
|
||||
/// A worker that should be invoked at every new slot.
|
||||
@@ -208,7 +208,7 @@ impl<T: Clone> SlotDuration<T> {
|
||||
.into()
|
||||
}),
|
||||
None => {
|
||||
use runtime_primitives::traits::Zero;
|
||||
use sr_primitives::traits::Zero;
|
||||
let genesis_slot_duration =
|
||||
cb(client.runtime_api(), &BlockId::number(Zero::zero()))?;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ build = "build.rs"
|
||||
rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
|
||||
runtime_io = { package = "sr-io", path = "../../sr-io", default-features = false }
|
||||
sandbox = { package = "sr-sandbox", path = "../../sr-sandbox", default-features = false }
|
||||
substrate-primitives = { path = "../../primitives", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2", path = "../../utils/wasm-builder-runner" }
|
||||
|
||||
@@ -93,7 +93,7 @@ impl_stubs!(
|
||||
[sr25519_verify(&sig, &msg[..], &pubkey) as u8].to_vec()
|
||||
},
|
||||
test_enumerated_trie_root => |_| {
|
||||
enumerated_trie_root::<substrate_primitives::Blake2Hasher>(
|
||||
enumerated_trie_root::<primitives::Blake2Hasher>(
|
||||
&[
|
||||
&b"zero"[..],
|
||||
&b"one"[..],
|
||||
@@ -138,7 +138,7 @@ impl_stubs!(
|
||||
[code].to_vec()
|
||||
},
|
||||
test_offchain_local_storage => |_| {
|
||||
let kind = substrate_primitives::offchain::StorageKind::PERSISTENT;
|
||||
let kind = primitives::offchain::StorageKind::PERSISTENT;
|
||||
assert_eq!(runtime_io::local_storage_get(kind, b"test"), None);
|
||||
runtime_io::local_storage_set(kind, b"test", b"asd");
|
||||
assert_eq!(runtime_io::local_storage_get(kind, b"test"), Some(b"asd".to_vec()));
|
||||
@@ -150,7 +150,7 @@ impl_stubs!(
|
||||
[0].to_vec()
|
||||
},
|
||||
test_offchain_local_storage_with_none => |_| {
|
||||
let kind = substrate_primitives::offchain::StorageKind::PERSISTENT;
|
||||
let kind = primitives::offchain::StorageKind::PERSISTENT;
|
||||
assert_eq!(runtime_io::local_storage_get(kind, b"test"), None);
|
||||
|
||||
let res = runtime_io::local_storage_compare_and_set(kind, b"test", None, b"value");
|
||||
@@ -160,7 +160,7 @@ impl_stubs!(
|
||||
[0].to_vec()
|
||||
},
|
||||
test_offchain_http => |_| {
|
||||
use substrate_primitives::offchain::HttpRequestStatus;
|
||||
use primitives::offchain::HttpRequestStatus;
|
||||
let run = || -> Option<()> {
|
||||
let id = runtime_io::http_request_start("POST", "http://localhost:12345", &[]).ok()?;
|
||||
runtime_io::http_request_add_header(id, "X-Auth", "test").ok()?;
|
||||
|
||||
@@ -14,9 +14,9 @@ tokio-executor = "0.1.7"
|
||||
tokio-timer = "0.2.11"
|
||||
rand = "0.6"
|
||||
parity-codec = { version = "4.1.1", features = ["derive"] }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../sr-primitives" }
|
||||
sr-primitives = { path = "../sr-primitives" }
|
||||
consensus_common = { package = "substrate-consensus-common", path = "../consensus/common" }
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives" }
|
||||
substrate-telemetry = { path = "../telemetry" }
|
||||
serde_json = "1.0"
|
||||
client = { package = "substrate-client", path = "../client" }
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
client = { package = "substrate-client", path = "../../client", default-features = false }
|
||||
substrate-primitives = { path = "../../primitives", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false }
|
||||
parity-codec = { version = "4.1.1", default-features = false, features = ["derive"] }
|
||||
sr-primitives = { path = "../../sr-primitives", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
|
||||
@@ -15,7 +15,7 @@ serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"substrate-primitives/std",
|
||||
"primitives/std",
|
||||
"client/std",
|
||||
"parity-codec/std",
|
||||
"sr-primitives/std",
|
||||
|
||||
@@ -30,13 +30,13 @@ use rstd::vec::Vec;
|
||||
|
||||
/// The grandpa crypto scheme defined via the keypair type.
|
||||
#[cfg(feature = "std")]
|
||||
pub type AuthorityPair = substrate_primitives::ed25519::Pair;
|
||||
pub type AuthorityPair = primitives::ed25519::Pair;
|
||||
|
||||
/// Identity of a Grandpa authority.
|
||||
pub type AuthorityId = substrate_primitives::ed25519::Public;
|
||||
pub type AuthorityId = primitives::ed25519::Public;
|
||||
|
||||
/// Signature for a Grandpa authority.
|
||||
pub type AuthoritySignature = substrate_primitives::ed25519::Signature;
|
||||
pub type AuthoritySignature = primitives::ed25519::Signature;
|
||||
|
||||
/// The `ConsensusEngineId` of GRANDPA.
|
||||
pub const GRANDPA_ENGINE_ID: ConsensusEngineId = *b"FRNK";
|
||||
|
||||
@@ -23,7 +23,7 @@ use client::backend::AuxStore;
|
||||
use client::error::{Result as ClientResult, Error as ClientError};
|
||||
use fork_tree::ForkTree;
|
||||
use grandpa::round::State as RoundState;
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor};
|
||||
use log::{info, warn};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO};
|
||||
use fg_primitives::AuthorityId;
|
||||
@@ -456,7 +456,7 @@ pub(crate) fn load_authorities<B: AuxStore, H: Decode, N: Decode>(backend: &B)
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use substrate_primitives::H256;
|
||||
use primitives::H256;
|
||||
use test_client;
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
//!
|
||||
//! We only send polite messages to peers,
|
||||
|
||||
use runtime_primitives::traits::{NumberFor, Block as BlockT, Zero};
|
||||
use sr_primitives::traits::{NumberFor, Block as BlockT, Zero};
|
||||
use network::consensus_gossip::{self as network_gossip, MessageIntent, ValidatorContext};
|
||||
use network::{config::Roles, PeerId};
|
||||
use parity_codec::{Encode, Decode};
|
||||
@@ -1249,7 +1249,7 @@ mod tests {
|
||||
use crate::authorities::AuthoritySet;
|
||||
use crate::environment::{CompletedRound, CompletedRounds, HasVoted, VoterSetState};
|
||||
use grandpa::round::State as RoundState;
|
||||
use substrate_primitives::H256;
|
||||
use primitives::H256;
|
||||
|
||||
let state = RoundState::genesis((H256::zero(), 0));
|
||||
let base = state.prevote_ghost.unwrap();
|
||||
|
||||
@@ -36,9 +36,9 @@ use futures::sync::{oneshot, mpsc};
|
||||
use log::{debug, trace};
|
||||
use tokio_executor::Executor;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use substrate_primitives::{ed25519, Pair};
|
||||
use primitives::{ed25519, Pair};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_DEBUG, CONSENSUS_INFO};
|
||||
use runtime_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT};
|
||||
use sr_primitives::traits::{Block as BlockT, Hash as HashT, Header as HeaderT};
|
||||
use network::{consensus_gossip as network_gossip, NetworkService};
|
||||
use network_gossip::ConsensusMessage;
|
||||
|
||||
@@ -50,7 +50,7 @@ use crate::environment::HasVoted;
|
||||
use gossip::{
|
||||
GossipMessage, FullCatchUpMessage, FullCommitMessage, VoteOrPrecommitMessage, GossipValidator
|
||||
};
|
||||
use substrate_primitives::ed25519::{Public as AuthorityId, Signature as AuthoritySignature};
|
||||
use primitives::ed25519::{Public as AuthorityId, Signature as AuthoritySignature};
|
||||
|
||||
pub mod gossip;
|
||||
mod periodic;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use super::{gossip::{NeighborPacket, GossipMessage}, Network};
|
||||
use futures::prelude::*;
|
||||
use futures::sync::mpsc;
|
||||
use runtime_primitives::traits::{NumberFor, Block as BlockT};
|
||||
use sr_primitives::traits::{NumberFor, Block as BlockT};
|
||||
use network::PeerId;
|
||||
use tokio_timer::Delay;
|
||||
use log::warn;
|
||||
|
||||
@@ -143,7 +143,7 @@ fn voter_set_state() -> SharedVoterSetState<Block> {
|
||||
use crate::authorities::AuthoritySet;
|
||||
use crate::environment::{CompletedRound, CompletedRounds, HasVoted, VoterSetState};
|
||||
use grandpa::round::State as RoundState;
|
||||
use substrate_primitives::H256;
|
||||
use primitives::H256;
|
||||
|
||||
let state = RoundState::genesis((H256::zero(), 0));
|
||||
let base = state.prevote_ghost.unwrap();
|
||||
|
||||
@@ -33,11 +33,11 @@ use grandpa::{
|
||||
BlockNumberOps, Equivocation, Error as GrandpaError, round::State as RoundState,
|
||||
voter, voter_set::VoterSet,
|
||||
};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, NumberFor, One, Zero, BlockNumberToHash,
|
||||
};
|
||||
use substrate_primitives::{Blake2Hasher, ed25519, H256, Pair};
|
||||
use primitives::{Blake2Hasher, ed25519, H256, Pair};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO};
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -45,11 +45,11 @@ use client::{
|
||||
};
|
||||
use parity_codec::{Encode, Decode};
|
||||
use grandpa::BlockNumberOps;
|
||||
use runtime_primitives::{Justification, generic::BlockId};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::{Justification, generic::BlockId};
|
||||
use sr_primitives::traits::{
|
||||
NumberFor, Block as BlockT, Header as HeaderT, One,
|
||||
};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO};
|
||||
use fg_primitives::AuthorityId;
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ use consensus_common::{
|
||||
SelectChain,
|
||||
};
|
||||
use fg_primitives::GrandpaApi;
|
||||
use runtime_primitives::Justification;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::Justification;
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, DigestFor,
|
||||
Header as HeaderT, NumberFor, ProvideRuntimeApi,
|
||||
};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
|
||||
use crate::{Error, CommandOrError, NewAuthoritySet, VoterCommand};
|
||||
use crate::authorities::{AuthoritySet, SharedAuthoritySet, DelayKind, PendingChange};
|
||||
|
||||
@@ -23,9 +23,9 @@ use client::error::Error as ClientError;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use grandpa::voter_set::VoterSet;
|
||||
use grandpa::{Error as GrandpaError};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use runtime_primitives::traits::{NumberFor, Block as BlockT, Header as HeaderT};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use sr_primitives::traits::{NumberFor, Block as BlockT, Header as HeaderT};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use fg_primitives::AuthorityId;
|
||||
|
||||
use crate::{Commit, Error};
|
||||
|
||||
@@ -58,14 +58,14 @@ use futures::sync::mpsc;
|
||||
use client::{BlockchainEvents, CallExecutor, Client, backend::Backend, error::Error as ClientError};
|
||||
use client::blockchain::HeaderBackend;
|
||||
use parity_codec::Encode;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::traits::{
|
||||
NumberFor, Block as BlockT, DigestFor, ProvideRuntimeApi,
|
||||
};
|
||||
use fg_primitives::GrandpaApi;
|
||||
use inherents::InherentDataProviders;
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use sr_primitives::generic::BlockId;
|
||||
use consensus_common::SelectChain;
|
||||
use substrate_primitives::{ed25519, H256, Pair, Blake2Hasher};
|
||||
use primitives::{ed25519, H256, Pair, Blake2Hasher};
|
||||
use substrate_telemetry::{telemetry, CONSENSUS_INFO, CONSENSUS_DEBUG, CONSENSUS_WARN};
|
||||
use serde_json;
|
||||
|
||||
@@ -355,7 +355,7 @@ where
|
||||
PRA::Api: GrandpaApi<Block>,
|
||||
SC: SelectChain<Block>,
|
||||
{
|
||||
use runtime_primitives::traits::Zero;
|
||||
use sr_primitives::traits::Zero;
|
||||
|
||||
let chain_info = client.info();
|
||||
let genesis_hash = chain_info.chain.genesis_hash;
|
||||
|
||||
@@ -32,13 +32,13 @@ use consensus_common::{
|
||||
Error as ConsensusError,
|
||||
};
|
||||
use network::config::{BoxFinalityProofRequestBuilder, FinalityProofRequestBuilder};
|
||||
use runtime_primitives::Justification;
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::Justification;
|
||||
use sr_primitives::traits::{
|
||||
NumberFor, Block as BlockT, Header as HeaderT, ProvideRuntimeApi, DigestFor,
|
||||
};
|
||||
use fg_primitives::{GrandpaApi, AuthorityId};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
|
||||
use crate::aux_schema::load_decode;
|
||||
use crate::consensus_changes::ConsensusChanges;
|
||||
@@ -468,7 +468,7 @@ fn load_aux_import_data<B, Block: BlockT<Hash=H256>, PRA>(
|
||||
PRA: ProvideRuntimeApi,
|
||||
PRA::Api: GrandpaApi<Block>,
|
||||
{
|
||||
use runtime_primitives::traits::Zero;
|
||||
use sr_primitives::traits::Zero;
|
||||
let authority_set = match load_decode(aux_store, LIGHT_AUTHORITY_SET_KEY)? {
|
||||
Some(authority_set) => authority_set,
|
||||
None => {
|
||||
@@ -538,7 +538,7 @@ fn on_post_finalization_error(error: ClientError, value_type: &str) -> Consensus
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use consensus_common::ForkChoiceStrategy;
|
||||
use substrate_primitives::H256;
|
||||
use primitives::H256;
|
||||
use test_client::client::in_mem::Blockchain as InMemoryAuxStore;
|
||||
use test_client::runtime::{Block, Header};
|
||||
use crate::tests::TestApi;
|
||||
|
||||
@@ -26,8 +26,8 @@ use log::{debug, info, warn};
|
||||
|
||||
use consensus_common::SelectChain;
|
||||
use client::{CallExecutor, Client, backend::Backend};
|
||||
use runtime_primitives::traits::{NumberFor, Block as BlockT};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use sr_primitives::traits::{NumberFor, Block as BlockT};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
|
||||
use crate::{
|
||||
global_communication, CommandOrError, CommunicationIn, Config, environment,
|
||||
|
||||
@@ -35,9 +35,9 @@ use consensus_common::import_queue::{BoxBlockImport, BoxJustificationImport, Box
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::result;
|
||||
use parity_codec::Decode;
|
||||
use runtime_primitives::traits::{ApiRef, ProvideRuntimeApi, Header as HeaderT};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use substrate_primitives::{NativeOrEncoded, ExecutionContext};
|
||||
use sr_primitives::traits::{ApiRef, ProvideRuntimeApi, Header as HeaderT};
|
||||
use sr_primitives::generic::BlockId;
|
||||
use primitives::{NativeOrEncoded, ExecutionContext};
|
||||
use fg_primitives::AuthorityId;
|
||||
|
||||
use authorities::AuthoritySet;
|
||||
@@ -273,7 +273,7 @@ impl GrandpaApi<Block> for RuntimeApi {
|
||||
_: ExecutionContext,
|
||||
_: Option<()>,
|
||||
_: Vec<u8>,
|
||||
) -> Result<NativeOrEncoded<Vec<(substrate_primitives::ed25519::Public, u64)>>> {
|
||||
) -> Result<NativeOrEncoded<Vec<(primitives::ed25519::Public, u64)>>> {
|
||||
Ok(self.inner.genesis_authorities.clone()).map(NativeOrEncoded::Native)
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ impl AuthoritySetForFinalityChecker<Block> for TestApi {
|
||||
|
||||
const TEST_GOSSIP_DURATION: Duration = Duration::from_millis(500);
|
||||
|
||||
fn make_ids(keys: &[Ed25519Keyring]) -> Vec<(substrate_primitives::ed25519::Public, u64)> {
|
||||
fn make_ids(keys: &[Ed25519Keyring]) -> Vec<(primitives::ed25519::Public, u64)> {
|
||||
keys.iter()
|
||||
.map(|key| AuthorityId::from_raw(key.to_raw_public()))
|
||||
.map(|id| (id, 1))
|
||||
@@ -704,7 +704,7 @@ fn justification_is_emitted_when_consensus_data_changes() {
|
||||
let mut net = GrandpaTestNet::new(TestApi::new(make_ids(peers)), 3);
|
||||
|
||||
// import block#1 WITH consensus data change
|
||||
let new_authorities = vec![substrate_primitives::sr25519::Public::from_raw([42; 32])];
|
||||
let new_authorities = vec![primitives::sr25519::Public::from_raw([42; 32])];
|
||||
net.peer(0).push_authorities_change_block(new_authorities);
|
||||
net.block_until_sync(&mut runtime);
|
||||
let net = Arc::new(Mutex::new(net));
|
||||
@@ -1320,7 +1320,7 @@ fn finality_proof_is_fetched_by_light_client_when_consensus_data_changes() {
|
||||
|
||||
// import block#1 WITH consensus data change. Light client ignores justification
|
||||
// && instead fetches finality proof for block #1
|
||||
net.peer(0).push_authorities_change_block(vec![substrate_primitives::sr25519::Public::from_raw([42; 32])]);
|
||||
net.peer(0).push_authorities_change_block(vec![primitives::sr25519::Public::from_raw([42; 32])]);
|
||||
let net = Arc::new(Mutex::new(net));
|
||||
run_to_completion(&mut runtime, 1, net.clone(), peers);
|
||||
net.lock().block_until_sync(&mut runtime);
|
||||
@@ -1383,7 +1383,7 @@ fn empty_finality_proof_is_returned_to_light_client_when_authority_set_is_differ
|
||||
// normally it will reach light client, but because of the forced change, it will not
|
||||
net.lock().peer(0).push_blocks(8, false); // best is #9
|
||||
net.lock().peer(0).push_authorities_change_block(
|
||||
vec![substrate_primitives::sr25519::Public::from_raw([42; 32])]
|
||||
vec![primitives::sr25519::Public::from_raw([42; 32])]
|
||||
); // #10
|
||||
net.lock().peer(0).push_blocks(1, false); // best is #11
|
||||
net.lock().block_until_sync(&mut runtime);
|
||||
|
||||
@@ -29,7 +29,7 @@ use futures::stream::Fuse;
|
||||
use futures03::{StreamExt as _, TryStreamExt as _};
|
||||
use grandpa::voter;
|
||||
use parking_lot::Mutex;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use tokio_timer::Interval;
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
parking_lot = { version = "0.8.0", optional = true }
|
||||
rstd = { package = "sr-std", path = "../sr-std", default-features = false }
|
||||
parity-codec = { version = "4.1.1", default-features = false, features = ["derive"] }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../sr-primitives", default-features = false }
|
||||
sr-primitives = { path = "../sr-primitives", default-features = false }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
@@ -16,5 +16,5 @@ std = [
|
||||
"parking_lot",
|
||||
"rstd/std",
|
||||
"parity-codec/std",
|
||||
"runtime_primitives/std",
|
||||
"sr-primitives/std",
|
||||
]
|
||||
|
||||
@@ -44,7 +44,7 @@ use parking_lot::RwLock;
|
||||
#[cfg(feature = "std")]
|
||||
use std::{sync::Arc, format};
|
||||
|
||||
pub use runtime_primitives::RuntimeString;
|
||||
pub use sr_primitives::RuntimeString;
|
||||
|
||||
/// An identifier for an inherent.
|
||||
pub type InherentIdentifier = [u8; 8];
|
||||
|
||||
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives" }
|
||||
sr-primitives = { path = "../sr-primitives" }
|
||||
lazy_static = { version = "1.0" }
|
||||
strum = "0.14.0"
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
use std::{collections::HashMap, ops::Deref};
|
||||
use lazy_static::lazy_static;
|
||||
use substrate_primitives::{ed25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
|
||||
pub use substrate_primitives::ed25519;
|
||||
use primitives::{ed25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
|
||||
pub use primitives::ed25519;
|
||||
|
||||
/// Set of test accounts.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, strum_macros::Display, strum_macros::EnumIter)]
|
||||
@@ -168,7 +168,7 @@ impl Deref for Keyring {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use substrate_primitives::{ed25519::Pair, Pair as PairT};
|
||||
use primitives::{ed25519::Pair, Pair as PairT};
|
||||
|
||||
#[test]
|
||||
fn should_work() {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use lazy_static::lazy_static;
|
||||
use substrate_primitives::{sr25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
|
||||
pub use substrate_primitives::sr25519;
|
||||
use primitives::{sr25519::{Pair, Public, Signature}, Pair as PairT, Public as PublicT, H256};
|
||||
pub use primitives::sr25519;
|
||||
|
||||
/// Set of test accounts.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, strum_macros::Display, strum_macros::EnumIter)]
|
||||
@@ -178,7 +178,7 @@ impl Deref for Keyring {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use substrate_primitives::{sr25519::Pair, Pair as PairT};
|
||||
use primitives::{sr25519::Pair, Pair as PairT};
|
||||
|
||||
#[test]
|
||||
fn should_work() {
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
derive_more = "0.14.0"
|
||||
substrate-primitives = { path = "../primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../primitives" }
|
||||
hex = "0.3"
|
||||
rand = "0.6"
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::path::PathBuf;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Write};
|
||||
|
||||
use substrate_primitives::crypto::{KeyTypeId, Pair, Public};
|
||||
use primitives::crypto::{KeyTypeId, Pair, Public};
|
||||
|
||||
/// Keystore error.
|
||||
#[derive(Debug, derive_more::Display, derive_more::From)]
|
||||
@@ -165,8 +165,8 @@ impl Store {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use tempdir::TempDir;
|
||||
use substrate_primitives::ed25519;
|
||||
use substrate_primitives::crypto::Ss58Codec;
|
||||
use primitives::ed25519;
|
||||
use primitives::crypto::Ss58Codec;
|
||||
|
||||
#[test]
|
||||
fn basic_store() {
|
||||
|
||||
@@ -24,10 +24,10 @@ rustc-hex = "2.0"
|
||||
rand = "0.6"
|
||||
libp2p = { version = "0.11.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] }
|
||||
fork-tree = { path = "../../core/utils/fork-tree" }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
|
||||
consensus = { package = "substrate-consensus-common", path = "../../core/consensus/common" }
|
||||
client = { package = "substrate-client", path = "../../core/client" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives" }
|
||||
sr-primitives = { path = "../../core/sr-primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
|
||||
parity-codec = { version = "4.1.1", features = ["derive"] }
|
||||
peerset = { package = "substrate-peerset", path = "../../core/peerset" }
|
||||
serde = { version = "1.0.70", features = ["derive"] }
|
||||
|
||||
@@ -27,7 +27,7 @@ use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess};
|
||||
use libp2p::core::{nodes::Substream, muxing::StreamMuxerBox};
|
||||
use libp2p::multihash::Multihash;
|
||||
use log::warn;
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
use std::iter;
|
||||
use void;
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ use client::{self, Client as SubstrateClient, ClientInfo, BlockStatus, CallExecu
|
||||
use client::error::Error;
|
||||
use client::light::fetcher::ChangesProof;
|
||||
use consensus::{BlockImport, Error as ConsensusError};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT};
|
||||
use runtime_primitives::generic::{BlockId};
|
||||
use runtime_primitives::Justification;
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT};
|
||||
use sr_primitives::generic::{BlockId};
|
||||
use sr_primitives::Justification;
|
||||
use primitives::{H256, Blake2Hasher, storage::StorageKey};
|
||||
|
||||
/// Local client abstraction for the network.
|
||||
|
||||
@@ -28,7 +28,7 @@ use crate::service::{ExHashT, TransactionPool};
|
||||
use bitflags::bitflags;
|
||||
use consensus::import_queue::ImportQueue;
|
||||
use parity_codec;
|
||||
use runtime_primitives::traits::{Block as BlockT};
|
||||
use sr_primitives::traits::{Block as BlockT};
|
||||
use std::sync::Arc;
|
||||
use libp2p::identity::{Keypair, secp256k1, ed25519};
|
||||
use libp2p::wasm_ext;
|
||||
|
||||
@@ -202,7 +202,7 @@ pub use on_demand_layer::{OnDemand, RemoteResponse};
|
||||
|
||||
// Used by the `construct_simple_protocol!` macro.
|
||||
#[doc(hidden)]
|
||||
pub use runtime_primitives::traits::Block as BlockT;
|
||||
pub use sr_primitives::traits::Block as BlockT;
|
||||
|
||||
use libp2p::core::ConnectedPoint;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -25,7 +25,7 @@ use client::error::Error as ClientError;
|
||||
use client::light::fetcher::{Fetcher, FetchChecker, RemoteHeaderRequest,
|
||||
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest,
|
||||
RemoteReadChildRequest, RemoteBodyRequest};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
|
||||
/// Implements the `Fetcher` trait of the client. Makes it possible for the light client to perform
|
||||
/// network requests for some state.
|
||||
|
||||
@@ -24,8 +24,8 @@ use libp2p::swarm::{ProtocolsHandler, IntoProtocolsHandler};
|
||||
use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use primitives::storage::StorageKey;
|
||||
use consensus::{import_queue::IncomingBlock, import_queue::Origin, BlockOrigin};
|
||||
use runtime_primitives::{generic::BlockId, ConsensusEngineId, Justification};
|
||||
use runtime_primitives::traits::{
|
||||
use sr_primitives::{generic::BlockId, ConsensusEngineId, Justification};
|
||||
use sr_primitives::traits::{
|
||||
Block as BlockT, Header as HeaderT, NumberFor, One, Zero,
|
||||
CheckedSub, SaturatedConversion
|
||||
};
|
||||
|
||||
@@ -25,8 +25,8 @@ use log::{trace, debug};
|
||||
use futures::sync::mpsc;
|
||||
use lru_cache::LruCache;
|
||||
use libp2p::PeerId;
|
||||
use runtime_primitives::traits::{Block as BlockT, Hash, HashFor};
|
||||
use runtime_primitives::ConsensusEngineId;
|
||||
use sr_primitives::traits::{Block as BlockT, Hash, HashFor};
|
||||
use sr_primitives::ConsensusEngineId;
|
||||
pub use crate::message::generic::{Message, ConsensusMessage};
|
||||
use crate::protocol::Context;
|
||||
use crate::config::Roles;
|
||||
@@ -556,7 +556,7 @@ impl<B: BlockT> ConsensusGossip<B> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use runtime_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::testing::{H256, Block as RawBlock, ExtrinsicWrapper};
|
||||
use futures::Stream;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Network packet message types. These get serialized and put into the lower level protocol payload.
|
||||
|
||||
use bitflags::bitflags;
|
||||
use runtime_primitives::{ConsensusEngineId, traits::{Block as BlockT, Header as HeaderT}};
|
||||
use sr_primitives::{ConsensusEngineId, traits::{Block as BlockT, Header as HeaderT}};
|
||||
use parity_codec::{Encode, Decode, Input, Output};
|
||||
pub use self::generic::{
|
||||
BlockAnnounce, RemoteCallRequest, RemoteReadRequest,
|
||||
@@ -126,7 +126,7 @@ pub struct RemoteReadResponse {
|
||||
/// Generic types.
|
||||
pub mod generic {
|
||||
use parity_codec::{Encode, Decode};
|
||||
use runtime_primitives::Justification;
|
||||
use sr_primitives::Justification;
|
||||
use crate::config::Roles;
|
||||
use super::{
|
||||
RemoteReadResponse, Transactions, Direction,
|
||||
|
||||
@@ -29,7 +29,7 @@ use client::light::fetcher::{FetchChecker, RemoteHeaderRequest,
|
||||
use crate::message::{self, BlockAttributes, Direction, FromBlock, RequestId};
|
||||
use libp2p::PeerId;
|
||||
use crate::config::Roles;
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use sr_primitives::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
|
||||
/// Remote request timeout.
|
||||
const REQUEST_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
@@ -637,7 +637,7 @@ pub mod tests {
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use futures::{Future, sync::oneshot};
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor, Header as HeaderT};
|
||||
use client::{error::{Error as ClientError, Result as ClientResult}};
|
||||
use client::light::fetcher::{FetchChecker, RemoteHeaderRequest,
|
||||
ChangesProof, RemoteCallRequest, RemoteReadRequest,
|
||||
|
||||
@@ -20,7 +20,7 @@ pub use crate::protocol::event::{DhtEvent, Event};
|
||||
|
||||
use crate::protocol::Context;
|
||||
use libp2p::PeerId;
|
||||
use runtime_primitives::traits::Block as BlockT;
|
||||
use sr_primitives::traits::Block as BlockT;
|
||||
|
||||
/// A specialization of the substrate network protocol. Handles events and sends messages.
|
||||
pub trait NetworkSpecialization<B: BlockT>: Send + Sync + 'static {
|
||||
|
||||
@@ -39,7 +39,7 @@ use either::Either;
|
||||
use extra_requests::ExtraRequests;
|
||||
use libp2p::PeerId;
|
||||
use log::{debug, trace, warn, info, error};
|
||||
use runtime_primitives::{
|
||||
use sr_primitives::{
|
||||
Justification,
|
||||
generic::BlockId,
|
||||
traits::{Block as BlockT, Header, NumberFor, Zero, One, CheckedSub, SaturatedConversion}
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::collections::{HashMap, BTreeMap};
|
||||
use std::collections::hash_map::Entry;
|
||||
use log::trace;
|
||||
use libp2p::PeerId;
|
||||
use runtime_primitives::traits::{Block as BlockT, NumberFor, One};
|
||||
use sr_primitives::traits::{Block as BlockT, NumberFor, One};
|
||||
use crate::message;
|
||||
|
||||
const MAX_PARALLEL_DOWNLOADS: u32 = 1;
|
||||
@@ -202,7 +202,7 @@ impl<B: BlockT> BlockCollection<B> {
|
||||
mod test {
|
||||
use super::{BlockCollection, BlockData, BlockRangeState};
|
||||
use crate::{message, PeerId};
|
||||
use runtime_primitives::testing::{Block as RawBlock, ExtrinsicWrapper};
|
||||
use sr_primitives::testing::{Block as RawBlock, ExtrinsicWrapper};
|
||||
use primitives::H256;
|
||||
|
||||
type Block = RawBlock<ExtrinsicWrapper<u64>>;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user