Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ matrix:

script:
- cargo test --all
- cargo clean
- ./publish-wasm.sh
322 changes: 206 additions & 116 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ members = [
"polkadot/service",
"substrate/bft",
"substrate/client",
"substrate/client/db",
"substrate/codec",
"substrate/environmental",
"substrate/executor",
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions polkadot/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ app_dirs = "1.2"
tokio-core = "0.1.12"
futures = "0.1.17"
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
fdlimit = "0.1"
substrate-client = { path = "../../substrate/client" }
substrate-network = { path = "../../substrate/network" }
substrate-codec = { path = "../../substrate/codec" }
Expand Down
10 changes: 10 additions & 0 deletions polkadot/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern crate time;
extern crate futures;
extern crate tokio_core;
extern crate ctrlc;
extern crate fdlimit;
extern crate ed25519;
extern crate triehash;
extern crate substrate_codec as codec;
Expand Down Expand Up @@ -98,6 +99,7 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
// TODO [ToDr] Split parameters parsing from actual execution.
let log_pattern = matches.value_of("log").unwrap_or("");
init_logger(log_pattern);
fdlimit::raise_fd_limit();

let mut config = service::Configuration::default();

Expand All @@ -111,6 +113,8 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
.to_string_lossy()
.into();

config.database_path = db_path(&base_path).to_string_lossy().into();

let mut role = service::Role::FULL;
if matches.is_present("collator") {
info!("Starting collator.");
Expand Down Expand Up @@ -204,6 +208,12 @@ fn keystore_path(base_path: &Path) -> PathBuf {
path
}

fn db_path(base_path: &Path) -> PathBuf {
let mut path = base_path.to_owned();
path.push("db");
path
}

fn network_path(base_path: &Path) -> PathBuf {
let mut path = base_path.to_owned();
path.push("network");
Expand Down
2 changes: 1 addition & 1 deletion polkadot/keystore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]

[dependencies]
ethcrypto = { git = "https://github.com/paritytech/parity", default_features = false }
ethcore-crypto = { git = "https://github.com/paritytech/parity", default_features = false }
ed25519 = { path = "../../substrate/ed25519" }
error-chain = "0.11"
hex = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion polkadot/keystore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

//! Keystore (and session key management) for polkadot.

extern crate ethcrypto as crypto;
extern crate ethcore_crypto as crypto;
extern crate subtle;
extern crate ed25519;
extern crate rand;
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions polkadot/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-network = { path = "../../substrate/network" }
substrate-client = { path = "../../substrate/client" }
substrate-client-db = { path = "../../substrate/client/db" }
substrate-codec = { path = "../../substrate/codec" }
substrate-executor = { path = "../../substrate/executor" }
3 changes: 3 additions & 0 deletions polkadot/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub struct Configuration {
pub network: NetworkConfiguration,
/// Path to key files.
pub keystore_path: String,
/// Path to the database.
pub database_path: String,
/// Additional key seeds.
pub keys: Vec<String>,
/// Chain specification.
Expand All @@ -52,6 +54,7 @@ impl Default for Configuration {
transaction_pool: Default::default(),
network: Default::default(),
keystore_path: Default::default(),
database_path: Default::default(),
keys: Default::default(),
chain_spec: ChainSpec::Development,
}
Expand Down
11 changes: 8 additions & 3 deletions polkadot/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extern crate substrate_runtime_io as runtime_io;
extern crate substrate_primitives as primitives;
extern crate substrate_network as network;
extern crate substrate_codec as codec;
extern crate substrate_client_db as client_db;
extern crate substrate_executor;

extern crate exit_future;
Expand Down Expand Up @@ -64,14 +65,13 @@ use polkadot_api::PolkadotApi;
use polkadot_runtime::{GenesisConfig, ConsensusConfig, CouncilConfig, DemocracyConfig,
SessionConfig, StakingConfig, BuildExternalities};
use client::{genesis, BlockchainEvents};
use client::in_mem::Backend as InMemory;
use network::ManageNetwork;
use exit_future::Signal;

pub use self::error::{ErrorKind, Error};
pub use config::{Configuration, Role, ChainSpec};

type Client = client::Client<InMemory, NativeExecutor<LocalDispatch>>;
type Client = client::Client<client_db::Backend, NativeExecutor<LocalDispatch>>;

/// Polkadot service.
pub struct Service {
Expand Down Expand Up @@ -275,7 +275,12 @@ impl Service {
(primitives::block::Header::decode(&mut block.header.encode().as_ref()).expect("to_vec() always gives a valid serialisation; qed"), storage.into_iter().collect())
};

let client = Arc::new(client::new_in_mem(executor, prepare_genesis)?);
let db_settings = client_db::DatabaseSettings {
cache_size: None,
path: config.database_path.into(),
};

let client = Arc::new(client_db::new_client(db_settings, executor, prepare_genesis)?);
let best_header = client.best_block_header()?;
info!("Starting Polkadot. Best block is #{}", best_header.number);
let transaction_pool = Arc::new(Mutex::new(TransactionPool::new(config.transaction_pool)));
Expand Down
17 changes: 17 additions & 0 deletions substrate/client/db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "substrate-client-db"
version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]

[dependencies]
parking_lot = "0.4"
log = "0.3"
kvdb = { git = "https://github.com/paritytech/parity.git" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity.git" }
substrate-primitives = { path = "../../../substrate/primitives" }
substrate-client = { path = "../../../substrate/client" }
substrate-state-machine = { path = "../../../substrate/state-machine" }
substrate-runtime-support = { path = "../../../substrate/runtime-support" }
substrate-codec = { path = "../../../substrate/codec" }

[dev-dependencies]
Loading