Commit ee67fdf4 authored by asynchronous rob's avatar asynchronous rob
Browse files

get building

parents 8ad74595 0b37ecd8
**/target/
**/*.rs.bk
*.swp
.wasm-binaries
polkadot/runtime/wasm/target/
**/._*
.vscode
polkadot.*
.DS_Store
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -45,8 +45,8 @@ exclude = [
[badges]
travis-ci = { repository = "paritytech/polkadot", branch = "master" }
maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "paritytech/polkadot" }
is-it-maintained-open-issues = { repository = "paritytech/polkadot" }
is-it-maintained-issue-resolution = { repository = "paritytech/polkadot", branch = "split-substrate" }
is-it-maintained-open-issues = { repository = "paritytech/polkadot", branch = "split-substrate" }
[profile.release]
# Substrate runtime requires unwinding.
......
......@@ -30,6 +30,7 @@ use primitives::{
SessionKey, Timestamp, UncheckedExtrinsic,
};
use primitives::parachain::{DutyRoster, Id as ParaId};
use substrate_primitives::{KeccakHasher, RlpCodec};
use {BlockBuilder, PolkadotApi, LocalPolkadotApi, ErrorKind, Error, Result};
......@@ -60,7 +61,7 @@ macro_rules! with_runtime {
}}
}
impl<B: LocalBackend<Block>> BlockBuilder for ClientBlockBuilder<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block> {
impl<B: LocalBackend<Block, KeccakHasher, RlpCodec>> BlockBuilder for ClientBlockBuilder<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block, KeccakHasher, RlpCodec> {
fn push_extrinsic(&mut self, extrinsic: UncheckedExtrinsic) -> Result<()> {
self.push(extrinsic).map_err(Into::into)
}
......@@ -71,8 +72,8 @@ impl<B: LocalBackend<Block>> BlockBuilder for ClientBlockBuilder<B, LocalCallExe
}
}
impl<B: LocalBackend<Block>> PolkadotApi for Client<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block> {
type BlockBuilder = ClientBlockBuilder<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block>;
impl<B: LocalBackend<Block, KeccakHasher, RlpCodec>> PolkadotApi for Client<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block> {
type BlockBuilder = ClientBlockBuilder<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block, KeccakHasher, RlpCodec>;
fn session_keys(&self, at: &BlockId) -> Result<Vec<SessionKey>> {
with_runtime!(self, at, ::runtime::Consensus::authorities)
......@@ -158,7 +159,7 @@ impl<B: LocalBackend<Block>> PolkadotApi for Client<B, LocalCallExecutor<B, Nati
}
}
impl<B: LocalBackend<Block>> LocalPolkadotApi for Client<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block>
impl<B: LocalBackend<Block, KeccakHasher, RlpCodec>> LocalPolkadotApi for Client<B, LocalCallExecutor<B, NativeExecutor<LocalDispatch>>, Block>
{}
#[cfg(test)]
......@@ -184,7 +185,7 @@ mod tests {
]
}
fn client() -> Client<InMemory<Block>, LocalCallExecutor<InMemory<Block>, NativeExecutor<LocalDispatch>>, Block> {
fn client() -> Client<InMemory<Block, KeccakHasher, RlpCodec>, LocalCallExecutor<InMemory<Block, KeccakHasher, RlpCodec>, NativeExecutor<LocalDispatch>>, Block> {
let genesis_config = GenesisConfig {
consensus: Some(ConsensusConfig {
code: LocalDispatch::native_equivalent().to_vec(),
......
......@@ -27,6 +27,7 @@ use primitives::{
use runtime::Address;
use primitives::parachain::{DutyRoster, Id as ParaId};
use {PolkadotApi, BlockBuilder, RemotePolkadotApi, Result, ErrorKind};
use substrate_primitives::{KeccakHasher, RlpCodec};
/// Light block builder. TODO: make this work (efficiently)
#[derive(Clone, Copy)]
......@@ -43,9 +44,9 @@ impl BlockBuilder for LightBlockBuilder {
}
/// Remote polkadot API implementation.
pub struct RemotePolkadotApiWrapper<B: Backend<Block>, E: CallExecutor<Block>>(pub Arc<Client<B, E, Block>>);
pub struct RemotePolkadotApiWrapper<B: Backend<Block, KeccakHasher, RlpCodec>, E: CallExecutor<Block, KeccakHasher, RlpCodec>>(pub Arc<Client<B, E, Block>>);
impl<B: Backend<Block>, E: CallExecutor<Block>> PolkadotApi for RemotePolkadotApiWrapper<B, E> {
impl<B: Backend<Block, KeccakHasher, RlpCodec>, E: CallExecutor<Block, KeccakHasher, RlpCodec>> PolkadotApi for RemotePolkadotApiWrapper<B, E> {
type BlockBuilder = LightBlockBuilder;
fn session_keys(&self, at: &BlockId) -> Result<Vec<SessionKey>> {
......@@ -104,4 +105,4 @@ impl<B: Backend<Block>, E: CallExecutor<Block>> PolkadotApi for RemotePolkadotAp
}
}
impl<B: RemoteBackend<Block>, E: CallExecutor<Block>> RemotePolkadotApi for RemotePolkadotApiWrapper<B, E> {}
impl<B: RemoteBackend<Block, KeccakHasher, RlpCodec>, E: CallExecutor<Block, KeccakHasher, RlpCodec>> RemotePolkadotApi for RemotePolkadotApiWrapper<B, E> {}
......@@ -10,6 +10,6 @@ parking_lot = "0.4"
log = "0.3"
substrate-codec = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
substrate-primitives = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
kvdb = { git = "https://github.com/paritytech/parity.git" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity.git" }
kvdb-memorydb = { git = "https://github.com/paritytech/parity.git" }
kvdb = { git = "https://github.com/paritytech/parity-common.git" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common.git" }
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common.git" }
......@@ -66,20 +66,6 @@ pub struct Data {
pub extrinsic: Option<Extrinsic>,
}
fn extract_io_err(err: ::kvdb::Error) -> io::Error {
match err {
::kvdb::Error(::kvdb::ErrorKind::Io(io_err), _) => io_err,
::kvdb::Error(::kvdb::ErrorKind::Msg(msg), _) => io::Error::new(
io::ErrorKind::Other,
msg,
),
x => io::Error::new(
io::ErrorKind::Other,
format!("Unexpected error variant: {:?}", x), // only necessary because of nonexaustive match.
)
}
}
fn block_data_key(relay_parent: &Hash, candidate_hash: &Hash) -> Vec<u8> {
(relay_parent, candidate_hash, 0i8).encode()
}
......@@ -99,14 +85,13 @@ impl Store {
pub fn new(config: Config) -> io::Result<Self> {
let mut db_config = DatabaseConfig::with_columns(Some(columns::NUM_COLUMNS));
db_config.memory_budget = config.cache_size;
db_config.wal = true;
let path = config.path.to_str().ok_or_else(|| io::Error::new(
io::ErrorKind::Other,
format!("Bad database path: {:?}", config.path),
))?;
let db = Database::open(&db_config, &path).map_err(extract_io_err)?;
let db = Database::open(&db_config, &path)?;
Ok(Store {
inner: Arc::new(db),
......@@ -151,7 +136,7 @@ impl Store {
);
}
self.inner.write(tx).map_err(extract_io_err)
self.inner.write(tx)
}
/// Note that a set of candidates have been included in a finalized block with given hash and parent hash.
......@@ -175,7 +160,7 @@ impl Store {
}
}
self.inner.write(tx).map_err(extract_io_err)
self.inner.write(tx)
}
/// Query block data.
......
......@@ -14,5 +14,5 @@ polkadot-runtime = { path = "../runtime", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" }
polkadot-cli = { path = "../cli" }
log = "0.4"
ed25519 = { git = "https://github.com/paritytech/polkadot" }
ed25519 = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
tokio = "0.1.7"
......@@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
futures = "0.1.17"
parking_lot = "0.4"
tokio = "0.1.7"
ed25519 = { git = "https://github.com/paritytech/polkadot" }
ed25519 = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
error-chain = "0.12"
log = "0.3"
exit-future = "0.1"
......
......@@ -6,4 +6,5 @@ description = "Polkadot node implementation in Rust."
[dependencies]
substrate-executor = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
substrate-primitives = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
polkadot-runtime = { path = "../runtime" }
......@@ -19,5 +19,6 @@
extern crate polkadot_runtime;
#[macro_use] extern crate substrate_executor;
extern crate substrate_primitives as primitives;
native_executor_instance!(pub Executor, polkadot_runtime::api::dispatch, polkadot_runtime::VERSION, include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm"));
......@@ -15,7 +15,7 @@ substrate-codec = { git = "https://github.com/paritytech/polkadot", branch = "sp
substrate-codec-derive = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
substrate-network = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
substrate-primitives = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
ed25519 = { git = "https://github.com/paritytech/polkadot" }
ed25519 = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
futures = "0.1"
tokio = "0.1.7"
log = "0.4"
......
......@@ -30,7 +30,10 @@ use substrate_runtime_support::dispatch::Result;
use rstd::marker::PhantomData;
#[cfg(any(feature = "std", test))]
use {runtime_io, runtime_primitives};
use runtime_primitives;
#[cfg(any(feature = "std", test))]
use std::collections::HashMap;
pub trait Trait: system::Trait<Hash = ::primitives::Hash> + session::Trait {
/// The position of the set_heads call in the block.
......@@ -214,8 +217,7 @@ impl<T: Trait> Default for GenesisConfig<T> {
#[cfg(any(feature = "std", test))]
impl<T: Trait> runtime_primitives::BuildStorage for GenesisConfig<T>
{
fn build_storage(mut self) -> ::std::result::Result<runtime_io::TestExternalities, String> {
use std::collections::HashMap;
fn build_storage(mut self) -> ::std::result::Result<HashMap<Vec<u8>, Vec<u8>>, String> {
use codec::Encode;
self.parachains.sort_unstable_by_key(|&(ref id, _, _)| id.clone());
......@@ -235,15 +237,15 @@ impl<T: Trait> runtime_primitives::BuildStorage for GenesisConfig<T>
map.insert(head_key, genesis.encode());
}
Ok(map.into())
Ok(map)
}
}
#[cfg(test)]
mod tests {
use super::*;
use runtime_io::with_externalities;
use substrate_primitives::H256;
use runtime_io::{TestExternalities, with_externalities};
use substrate_primitives::{H256, KeccakHasher};
use runtime_primitives::BuildStorage;
use runtime_primitives::traits::{HasPublicAux, Identity, BlakeTwo256};
use runtime_primitives::testing::{Digest, Header};
......@@ -284,7 +286,7 @@ mod tests {
type Parachains = Module<Test>;
fn new_test_ext(parachains: Vec<(Id, Vec<u8>, Vec<u8>)>) -> runtime_io::TestExternalities {
fn new_test_ext(parachains: Vec<(Id, Vec<u8>, Vec<u8>)>) -> TestExternalities<KeccakHasher> {
let mut t = system::GenesisConfig::<Test>::default().build_storage().unwrap();
t.extend(consensus::GenesisConfig::<Test>{
code: vec![],
......@@ -299,7 +301,7 @@ mod tests {
parachains: parachains,
phantom: PhantomData,
}.build_storage().unwrap());
t
t.into()
}
#[test]
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ log = "0.3"
slog = "^2"
tokio = "0.1.7"
hex-literal = "0.1"
ed25519 = { git = "https://github.com/paritytech/polkadot" }
ed25519 = { git = "https://github.com/paritytech/polkadot", branch = "split-substrate" }
polkadot-availability-store = { path = "../availability-store" }
polkadot-primitives = { path = "../primitives" }
polkadot-runtime = { path = "../runtime" }
......
......@@ -53,6 +53,7 @@ use client::Client;
use polkadot_network::{PolkadotProtocol, consensus::ConsensusNetwork};
use tokio::runtime::TaskExecutor;
use service::FactoryFullConfiguration;
use primitives::{KeccakHasher, RlpCodec};
pub use service::{Roles, PruningMode, ExtrinsicPoolOptions,
ErrorKind, Error, ComponentBlock, LightComponents, FullComponents};
......@@ -69,9 +70,9 @@ pub trait Components: service::Components {
/// Polkadot API.
type Api: 'static + PolkadotApi + Send + Sync;
/// Client backend.
type Backend: 'static + client::backend::Backend<Block>;
type Backend: 'static + client::backend::Backend<Block, KeccakHasher, RlpCodec>;
/// Client executor.
type Executor: 'static + client::CallExecutor<Block> + Send + Sync;
type Executor: 'static + client::CallExecutor<Block, KeccakHasher, RlpCodec> + Send + Sync;
}
impl Components for service::LightComponents<Factory> {
......@@ -271,8 +272,8 @@ pub struct TransactionPoolAdapter<B, E, A> where A: Send + Sync, E: Send + Sync
impl<B, E, A> TransactionPoolAdapter<B, E, A>
where
A: Send + Sync,
B: client::backend::Backend<Block> + Send + Sync,
E: client::CallExecutor<Block> + Send + Sync,
B: client::backend::Backend<Block, KeccakHasher, RlpCodec> + Send + Sync,
E: client::CallExecutor<Block, KeccakHasher, RlpCodec> + Send + Sync,
{
fn best_block_id(&self) -> Option<BlockId> {
self.client.info()
......@@ -286,8 +287,8 @@ impl<B, E, A> TransactionPoolAdapter<B, E, A>
impl<B, E, A> network::TransactionPool<Block> for TransactionPoolAdapter<B, E, A>
where
B: client::backend::Backend<Block> + Send + Sync,
E: client::CallExecutor<Block> + Send + Sync,
B: client::backend::Backend<Block, KeccakHasher, RlpCodec> + Send + Sync,
E: client::CallExecutor<Block, KeccakHasher, RlpCodec> + Send + Sync,
A: polkadot_api::PolkadotApi + Send + Sync,
{
fn transactions(&self) -> Vec<(Hash, Vec<u8>)> {
......@@ -338,8 +339,8 @@ impl<B, E, A> network::TransactionPool<Block> for TransactionPoolAdapter<B, E, A
impl<B, E, A> service::ExtrinsicPool<Block> for TransactionPoolAdapter<B, E, A>
where
B: client::backend::Backend<Block> + Send + Sync + 'static,
E: client::CallExecutor<Block> + Send + Sync + 'static,
B: client::backend::Backend<Block, KeccakHasher, RlpCodec> + Send + Sync + 'static,
E: client::CallExecutor<Block, KeccakHasher, RlpCodec> + Send + Sync + 'static,
A: polkadot_api::PolkadotApi + Send + Sync + 'static,
{
type Api = TransactionPool<A>;
......
src
\ No newline at end of file
src
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment