Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit c82057c

Browse files
committed
Merged.
2 parents 57cc25b + c593380 commit c82057c

File tree

12 files changed

+72
-69
lines changed

12 files changed

+72
-69
lines changed

Cargo.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ members = [
1818
"polkadot/collator",
1919
"polkadot/consensus",
2020
"polkadot/executor",
21-
"polkadot/keystore",
2221
"polkadot/parachain",
2322
"polkadot/primitives",
2423
"polkadot/runtime",
2524
"polkadot/service",
2625
"polkadot/statement-table",
27-
"polkadot/telemetry",
2826
"polkadot/transaction-pool",
2927
"substrate/bft",
3028
"substrate/client",
@@ -56,6 +54,8 @@ members = [
5654
"substrate/serializer",
5755
"substrate/state-machine",
5856
"substrate/test-runtime",
57+
"substrate/telemetry",
58+
"substrate/keystore",
5959

6060
"demo/cli",
6161
"demo/executor",

polkadot/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ substrate-rpc-servers = { path = "../../substrate/rpc-servers" }
3333
substrate-network = { path = "../../substrate/network" }
3434
substrate-primitives = { path = "../../substrate/primitives" }
3535
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
36+
substrate-telemetry = { path = "../../substrate/telemetry" }
3637
polkadot-primitives = { path = "../primitives" }
3738
polkadot-runtime = { path = "../runtime" }
3839
polkadot-service = { path = "../service" }
3940
polkadot-transaction-pool = { path = "../transaction-pool" }
40-
polkadot-telemetry = { path = "../telemetry" }

polkadot/cli/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ extern crate polkadot_primitives;
4545
extern crate polkadot_runtime;
4646
extern crate polkadot_service as service;
4747
#[macro_use]
48-
extern crate slog; // needed until we can reexport `slog_info` from `polkadot_telemetry`
48+
extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry`
4949
#[macro_use]
50-
extern crate polkadot_telemetry;
50+
extern crate substrate_telemetry;
5151
extern crate polkadot_transaction_pool as txpool;
5252

5353
#[macro_use]
@@ -76,9 +76,9 @@ use std::path::{Path, PathBuf};
7676
use std::collections::HashMap;
7777
use substrate_primitives::hexdisplay::HexDisplay;
7878
use substrate_primitives::storage::{StorageData, StorageKey};
79-
use polkadot_primitives::Block;
80-
use polkadot_telemetry::{init_telemetry, TelemetryConfig};
79+
use substrate_telemetry::{init_telemetry, TelemetryConfig};
8180
use runtime_primitives::StorageMap;
81+
use polkadot_primitives::Block;
8282

8383
use futures::sync::mpsc;
8484
use futures::{Sink, Future, Stream};

polkadot/parachain/test-chains/basic_add/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
polkadot-parachain = { path = "../../", default-features = false }
12-
wee_alloc = { git = "https://github.com/rustwasm/wee_alloc", rev = "4e9f23fff1f2474962085ca693f8884db666889f" }
12+
wee_alloc = "0.4.1"
1313
tiny-keccak = "1.4"
1414
pwasm-libc = "0.2"
1515

polkadot/parachain/test-chains/basic_add/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Basic parachain that adds a number as part of its state.
1818
1919
#![cfg_attr(not(feature = "std"), no_std)]
20-
#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, global_allocator, lang_items, panic_implementation, core_panic_info))]
20+
#![cfg_attr(not(feature = "std"), feature(alloc, core_intrinsics, lang_items, panic_implementation, core_panic_info))]
2121

2222
#[cfg(not(feature = "std"))]
2323
extern crate alloc;

polkadot/service/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ polkadot-consensus = { path = "../consensus" }
2121
polkadot-executor = { path = "../executor" }
2222
polkadot-api = { path = "../api" }
2323
polkadot-transaction-pool = { path = "../transaction-pool" }
24-
polkadot-keystore = { path = "../keystore" }
25-
polkadot-telemetry = { path = "../telemetry" }
24+
substrate-keystore = { path = "../../substrate/keystore" }
2625
substrate-runtime-io = { path = "../../substrate/runtime-io" }
2726
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
2827
substrate-primitives = { path = "../../substrate/primitives" }
@@ -32,3 +31,4 @@ substrate-client-db = { path = "../../substrate/client/db" }
3231
substrate-codec = { path = "../../substrate/codec" }
3332
substrate-executor = { path = "../../substrate/executor" }
3433
substrate-state-machine = { path = "../../substrate/state-machine" }
34+
substrate-telemetry = { path = "../../substrate/telemetry" }

polkadot/service/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern crate polkadot_executor;
2828
extern crate polkadot_api;
2929
extern crate polkadot_consensus as consensus;
3030
extern crate polkadot_transaction_pool as transaction_pool;
31-
extern crate polkadot_keystore as keystore;
31+
extern crate substrate_keystore as keystore;
3232
extern crate substrate_runtime_io as runtime_io;
3333
extern crate substrate_primitives as primitives;
3434
extern crate substrate_runtime_primitives as runtime_primitives;
@@ -42,11 +42,11 @@ extern crate substrate_client as client;
4242
extern crate substrate_client_db as client_db;
4343

4444
#[macro_use]
45-
extern crate polkadot_telemetry;
45+
extern crate substrate_telemetry;
4646
#[macro_use]
4747
extern crate error_chain;
4848
#[macro_use]
49-
extern crate slog; // needed until we can reexport `slog_info` from `polkadot_telemetry`
49+
extern crate slog; // needed until we can reexport `slog_info` from `substrate_telemetry`
5050
#[macro_use]
5151
extern crate log;
5252

polkadot/keystore/Cargo.toml renamed to substrate/keystore/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
2-
name = "polkadot-keystore"
2+
name = "substrate-keystore"
33
version = "0.1.0"
4-
authors = ["Parity Technologies <robert@parity.io>"]
4+
authors = ["Parity Technologies <admin@parity.io>"]
55

66
[dependencies]
77
ethcore-crypto = { git = "https://github.com/paritytech/parity.git", default_features = false }
8-
ed25519 = { path = "../../substrate/ed25519" }
8+
ed25519 = { path = "../ed25519" }
99
error-chain = "0.11"
1010
hex = "0.3"
1111
rand = "0.4"

polkadot/keystore/src/lib.rs renamed to substrate/keystore/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// Copyright 2017 Parity Technologies (UK) Ltd.
2-
// This file is part of Polkadot.
1+
// Copyright 2017-2018 Parity Technologies (UK) Ltd.
2+
// This file is part of Substrate.
33

4-
// Polkadot is free software: you can redistribute it and/or modify
4+
// Substrate is free software: you can redistribute it and/or modify
55
// it under the terms of the GNU General Public License as published by
66
// the Free Software Foundation, either version 3 of the License, or
77
// (at your option) any later version.
88

9-
// Polkadot is distributed in the hope that it will be useful,
9+
// Substrate is distributed in the hope that it will be useful,
1010
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1111
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
// GNU General Public License for more details.
1313

1414
// You should have received a copy of the GNU General Public License
15-
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
15+
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//! Keystore (and session key management) for polkadot.
17+
//! Keystore (and session key management) for ed25519 based chains like Polkadot.
1818
1919
extern crate ethcore_crypto as crypto;
2020
extern crate subtle;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "polkadot-telemetry"
2+
name = "substrate-telemetry"
33
version = "0.2.0"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Telemetry utils"
@@ -10,5 +10,5 @@ lazy_static = "1.0"
1010
slog = "^2"
1111
slog-json = "^2"
1212
slog-async = "^2"
13-
slog-scope = "*"
14-
websocket = "*"
13+
slog-scope = "^4"
14+
websocket = "^0.20"

polkadot/telemetry/src/lib.rs renamed to substrate/telemetry/src/lib.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// Copyright 2017 Parity Technologies (UK) Ltd.
2-
// This file is part of Polkadot.
2+
// This file is part of Substrate.
33

4-
// Polkadot is free software: you can redistribute it and/or modify
4+
// Substrate is free software: you can redistribute it and/or modify
55
// it under the terms of the GNU General Public License as published by
66
// the Free Software Foundation, either version 3 of the License, or
77
// (at your option) any later version.
88

9-
// Polkadot is distributed in the hope that it will be useful,
9+
// Substrate is distributed in the hope that it will be useful,
1010
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1111
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
// GNU General Public License for more details.
1313

1414
// You should have received a copy of the GNU General Public License
15-
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
15+
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
1616

1717
//! Telemtetry utils.
1818
//!
19-
//! `telemetry` macro be used from whereever in the Polkadot codebase
19+
//! `telemetry` macro be used from whereever in the Substrate codebase
2020
//! in order to send real-time logging information to the telemetry
2121
//! server (if there is one). We use the async drain adapter of `slog`
2222
//! so that the logging thread doesn't get held up at all.
@@ -36,7 +36,7 @@ pub use slog_scope::with_logger;
3636

3737
/// Configuration for telemetry.
3838
pub struct TelemetryConfig {
39-
/// URL of the telemetry WS server.
39+
/// URL of the telemetry WebSocket server.
4040
pub url: String,
4141
/// What do do when we connect to the server.
4242
pub on_connect: Box<Fn() + Send + 'static>,
@@ -91,7 +91,7 @@ impl TelemetryWriter {
9191

9292
impl io::Write for TelemetryWriter {
9393
fn write(&mut self, msg: &[u8]) -> io::Result<usize> {
94-
if msg == b"\n" {
94+
if msg.iter().any(|x| *x == b'\n') {
9595
let _ = self.flush();
9696
} else {
9797
self.buffer.extend_from_slice(msg);
@@ -101,12 +101,15 @@ impl io::Write for TelemetryWriter {
101101

102102
fn flush(&mut self) -> io::Result<()> {
103103
self.ensure_connected();
104-
if if let Some(ref mut socket) = *self.out.lock() {
104+
105+
let mut l = self.out.lock();
106+
let socket_closed = if let Some(ref mut socket) = *l {
105107
if let Ok(s) = ::std::str::from_utf8(&self.buffer[..]) {
106-
socket.send_message(&ws::Message::text(s)).is_err()
108+
socket.send_message(&ws::Message::text(s)).is_ok()
107109
} else { false }
108-
} else { false } {
109-
*self.out.lock() = None;
110+
} else { false };
111+
if socket_closed {
112+
*l = None;
110113
}
111114
self.buffer.clear();
112115
Ok(())

0 commit comments

Comments
 (0)