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 111 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
b20b807
Merge remote-tracking branch 'origin/master' into gav-xts-dont-panic
gavofyork May 29, 2018
b7ca4ae
Merge remote-tracking branch 'origin/master' into gav-xts-dont-panic
gavofyork May 29, 2018
b2a48c8
Update wasm.
gavofyork May 29, 2018
2d3a1ce
consensus, session and staking all panic-safe.
gavofyork May 29, 2018
881f6af
Democracy doesn't panic in apply.
gavofyork May 29, 2018
fee0f6f
Fix tests.
gavofyork May 29, 2018
8b9f50f
Extra helper macro, council depanicked.
gavofyork May 30, 2018
0e31a73
Fix one test.
gavofyork May 30, 2018
820ec13
Fix up all council tests. No panics!
gavofyork May 30, 2018
62ab840
Council voting depanicked.
gavofyork May 30, 2018
ff5da1a
Dispatch returns result.
gavofyork May 31, 2018
1123ff7
session & staking tests updated
gavofyork May 31, 2018
00ba4e0
Fix democracy tests.
gavofyork May 31, 2018
b6e54c1
Fix council tests.
gavofyork May 31, 2018
f3c1b9b
Fix up polkadot parachains in runtime
gavofyork May 31, 2018
3b8a4be
Merge branch 'master' into gav-result-dispatch
gavofyork May 31, 2018
d51a9bd
Merge remote-tracking branch 'origin/master' into gav-result-dispatch
gavofyork May 31, 2018
6c81a1e
Fix borked merge
gavofyork May 31, 2018
0141a68
More Slicable support
gavofyork Jun 1, 2018
34d0b75
Basic storage types.
gavofyork Jun 1, 2018
96a9b01
Existential deposit for contract creation
gavofyork Jun 1, 2018
ea2499f
Basic implemnetation along with removals
gavofyork Jun 1, 2018
193dde7
Fix tests.
gavofyork Jun 1, 2018
6f9636c
externalities builder fix.
gavofyork Jun 1, 2018
777f4dc
Tests.
gavofyork Jun 1, 2018
4027bd2
Fix up the runtime.
gavofyork Jun 1, 2018
de952ba
Fix tests.
gavofyork Jun 2, 2018
5e19a40
Add generic `Address` type.
gavofyork Jun 2, 2018
752f1a9
Merge branch 'master' into gav-enum-accounts
gavofyork Jun 2, 2018
014c13e
Initial function integration of Address into Extrinsic.
gavofyork Jun 3, 2018
8d34279
Fix build
gavofyork Jun 3, 2018
dd824ef
All tests compile.
gavofyork Jun 3, 2018
f2bebd2
Fix (some) tests.
gavofyork Jun 3, 2018
9ed26a5
Fix signing.
gavofyork Jun 3, 2018
f4ab2e5
Merge branch 'gav-enum-accounts' of github.com:paritytech/polkadot in…
gavofyork Jun 3, 2018
3a1835a
Push error.
gavofyork Jun 3, 2018
b3a5037
transfer can accept Address
gavofyork Jun 3, 2018
a0f0e05
Make Address generic over AccountIndex
gavofyork Jun 4, 2018
3e978c3
Fix test
gavofyork Jun 4, 2018
b04ff33
Make Council use Address for dispatch.
gavofyork Jun 4, 2018
95063be
Fix build
gavofyork Jun 4, 2018
0bd2d97
Bend over backwards to support braindead derive.
gavofyork Jun 4, 2018
e241ebd
Repot some files.
gavofyork Jun 4, 2018
67d1e74
Fix tests.
gavofyork Jun 4, 2018
d6439e8
Fix grumbles
gavofyork Jun 4, 2018
2a391c1
Remove Default bound
gavofyork Jun 4, 2018
2353b0b
Fix build for new nightly.
gavofyork Jun 4, 2018
1f5b7da
Merge remote-tracking branch 'origin/master' into gav-enum-accounts
gavofyork Jun 4, 2018
904c7cc
Make `apply_extrinsic` never panic, return useful Result.
gavofyork Jun 4, 2018
cef4d4e
Merge remote-tracking branch 'origin/master' into gav-enum-accounts
gavofyork Jun 5, 2018
5401577
Merge remote-tracking branch 'origin/master' into gav-enum-accounts
gavofyork Jun 7, 2018
48d1e9f
More merge hell
gavofyork Jun 7, 2018
b689e16
Doesn't build, but might do soon
gavofyork Jun 7, 2018
f9f875e
Serde woes
gavofyork Jun 7, 2018
d83316a
get substrate-runtime-staking compiling
rphmeier Jun 7, 2018
86de50a
Polkadot builds again!
gavofyork Jun 8, 2018
fcdfdce
Fix all build.
gavofyork Jun 8, 2018
9ad1272
Fix tests & binaries.
gavofyork Jun 8, 2018
6d27096
Merge remote-tracking branch 'origin/master' into gav-enum-accounts
gavofyork Jun 8, 2018
d3cb378
Reserve some extra initial byte values of address for future format c…
gavofyork Jun 8, 2018
c614f5d
Make semantic of `ReservedBalance` clear.
gavofyork Jun 8, 2018
684daf0
Fix panic handler.
gavofyork Jun 8, 2018
f5a8b74
Integrate other balance transformations into the new model
gavofyork Jun 8, 2018
6ba768d
Fix runtime tests.
gavofyork Jun 9, 2018
3534cc5
Fix panic build.
gavofyork Jun 10, 2018
267c360
Tests for demonstrating interaction between balance types.
gavofyork Jun 10, 2018
7abaa1d
Repot some runtime code
gavofyork Jun 10, 2018
2a39363
Fix checkedblock in non-std builds
gavofyork Jun 10, 2018
8b820ed
Get rid of `DoLookup` phantom.
gavofyork Jun 11, 2018
a6426db
Attempt to make transaction_pool work with lookups.
gavofyork Jun 11, 2018
fe6fee9
Remove vscode settings
gavofyork Jun 11, 2018
766e455
New attempt at making transaction pool work.
gavofyork Jun 12, 2018
2015e6d
It builds again!
gavofyork Jun 12, 2018
584d3e1
--all builds
gavofyork Jun 12, 2018
25bd52e
Fix tests.
gavofyork Jun 12, 2018
917455e
New build.
gavofyork Jun 12, 2018
abe5d64
Test account nonce reset.
gavofyork Jun 12, 2018
c4b2703
polkadot transaction pool tests/framework.
gavofyork Jun 13, 2018
97c0e02
Initial draft (working).
gavofyork Jun 14, 2018
8269eb3
Address grumbles.
gavofyork Jun 14, 2018
b54081a
Merge branch 'gav-enum-accounts' into gav-slogging
gavofyork Jun 14, 2018
1cea609
Revert bad `map_or`
gavofyork Jun 14, 2018
49b539e
Merge remote-tracking branch 'origin/dk-pwasm-alloc-fix' into gav-enu…
gavofyork Jun 15, 2018
8e30aad
Rebuild binaries, workaround.
gavofyork Jun 15, 2018
1d351d0
Merge branch 'gav-enum-accounts' into gav-slogging
gavofyork Jun 15, 2018
8c999d2
Avoid checking in vscode
gavofyork Jun 15, 2018
2dcd073
reconnecting, shared, slog
gavofyork Jun 15, 2018
0e2aa61
Merge
gavofyork Jun 15, 2018
678d027
Merge branch 'gav-enum-accounts' into gav-slogging
gavofyork Jun 15, 2018
4c2cb9c
CLI options for name and telemetry url
gavofyork Jun 15, 2018
9fe8144
ensure telemetry url imples enabled
gavofyork Jun 15, 2018
8065ad8
Avoid casting to usize early.
gavofyork Jun 15, 2018
5fa7866
Merge branch 'gav-enum-accounts' into gav-slogging
gavofyork Jun 15, 2018
f474509
Provide on-connect event for session message
gavofyork Jun 15, 2018
3747b9b
Better port
gavofyork Jun 15, 2018
94e15d0
heartbeat and some renaming
gavofyork Jun 15, 2018
e5cc4e3
transaction pool stuff
gavofyork Jun 15, 2018
e9fcff0
minor renaming.
gavofyork Jun 15, 2018
c1e89f5
report telemetry
gavofyork Jun 15, 2018
d924faf
cleanups.
gavofyork Jun 15, 2018
80aadf1
Fix for previous cleanup
gavofyork Jun 15, 2018
8bfd536
dump genesis, dev mode, renaming
gavofyork Jun 16, 2018
92e85e5
Rework chain spec/config &c. to allow for genesis file loading.
gavofyork Jun 16, 2018
6adec42
Avoid producing genesis storage when unneeded
gavofyork Jun 16, 2018
f175be9
Allow reading JSON genesis state dumps
gavofyork Jun 16, 2018
314f08b
tests work again
gavofyork Jun 16, 2018
3e602bd
better logging.
gavofyork Jun 16, 2018
a13b429
Fix wasm build.
gavofyork Jun 17, 2018
57cc25b
Introduce PoC-1 spec
gavofyork Jun 17, 2018
5cb584c
Made block message compatible with poc-1
arkpar Jun 17, 2018
0ef30ca
Squashed changes for dumping genesis block.
gavofyork Jun 20, 2018
afed52a
Binaries.
gavofyork Jun 20, 2018
cac5e4b
Merge branch 'net-v1-ext' into gav-genesis-dump-4
gavofyork Jun 20, 2018
ac2b145
Made block message compatible with poc-1
arkpar Jun 17, 2018
41ce302
Remove dead code.
gavofyork Jun 20, 2018
fb66a6d
Fix bad merge.
gavofyork Jun 20, 2018
062923e
Argument passing and returning values when invoking sandboxed funcs (…
pepyakin Jun 19, 2018
e475063
Fixed block download sequence (#223)
arkpar Jun 21, 2018
84d7df8
Trie-based execution proof (#177)
svyatonik Jun 21, 2018
22114c3
Relaying tx/blocks by light clients (#190)
svyatonik Jun 21, 2018
5d44c64
Merge branch 'master' into gav-genesis-dump
gavofyork Jun 21, 2018
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
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ members = [
"polkadot/runtime",
"polkadot/service",
"polkadot/statement-table",
"polkadot/telemetry",
"polkadot/transaction-pool",
"substrate/bft",
"substrate/client",
Expand Down
14 changes: 14 additions & 0 deletions polkadot/telemetry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "polkadot-telemetry"
version = "0.2.0"
authors = ["Parity Technologies <[email protected]>"]
description = "Telemetry utils"

[dependencies]
parking_lot = "0.4"
lazy_static = "1.0"
slog = "^2"
slog-json = "^2"
slog-async = "^2"
slog-scope = "*"
websocket = "*"
114 changes: 114 additions & 0 deletions polkadot/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright 2017 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

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

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

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

//! Telemtetry utils.
//!
//! `telemetry` macro be used from whereever in the Polkadot codebase
//! in order to send real-time logging information to the telemetry
//! server (if there is one). We use the async drain adapter of `slog`
//! so that the logging thread doesn't get held up at all.

extern crate parking_lot;
extern crate websocket as ws;
extern crate slog_async;
extern crate slog_json;
#[macro_use(o, kv)]
extern crate slog;
extern crate slog_scope;

use std::io;
use parking_lot::Mutex;
use slog::Drain;
pub use slog_scope::with_logger;

/// Configuration for telemetry.
pub struct TelemetryConfig {
/// URL of the telemetry WS server.
pub url: String,
/// What do do when we connect to the server.
pub on_connect: Box<Fn() + Send + 'static>,
}

/// Initialise telemetry.
pub fn init_telemetry(config: TelemetryConfig) -> slog_scope::GlobalLoggerGuard {
let log = slog::Logger::root(
slog_async::Async::new(
slog_json::Json::default(
TelemetryWriter {
buffer: vec![],
out: Mutex::new(
ws::ClientBuilder::new(&config.url).ok().and_then(|mut x| x.connect(None).ok())
),
config,
first_time: true, // ensures that on_connect will be called.
}
).fuse()
).build().fuse(), o!()
);
slog_scope::set_global_logger(log)
}

/// Exactly equivalent to `slog_scope::info`, provided as a convenience.
#[macro_export]
macro_rules! telemetry {
( $($t:tt)* ) => { $crate::with_logger(|l| slog_info!(l, $($t)* )) }
}

struct TelemetryWriter {
buffer: Vec<u8>,
out: Mutex<Option<ws::sync::Client<Box<ws::stream::sync::NetworkStream + Send>>>>,
config: TelemetryConfig,
first_time: bool,
}

impl TelemetryWriter {
fn ensure_connected(&mut self) {
if self.first_time {
(self.config.on_connect)();
self.first_time = false;
}
let mut client = self.out.lock();
if client.is_none() {
*client = ws::ClientBuilder::new(&self.config.url).ok().and_then(|mut x| x.connect(None).ok());
drop(client);
(self.config.on_connect)();
}
}
}

impl io::Write for TelemetryWriter {
fn write(&mut self, msg: &[u8]) -> io::Result<usize> {
if msg == b"\n" {
let _ = self.flush();
} else {
self.buffer.extend_from_slice(msg);
}
Ok(msg.len())
}

fn flush(&mut self) -> io::Result<()> {
self.ensure_connected();
if if let Some(ref mut socket) = *self.out.lock() {
if let Ok(s) = ::std::str::from_utf8(&self.buffer[..]) {
socket.send_message(&ws::Message::text(s)).is_err()
} else { false }
} else { false } {
*self.out.lock() = None;
}
self.buffer.clear();
Ok(())
}
}
2 changes: 1 addition & 1 deletion substrate/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ substrate-serializer = { path = "../../substrate/serializer" }
substrate-runtime-support = { path = "../../substrate/runtime-support" }
substrate-runtime-primitives = { path = "../../substrate/runtime/primitives" }
substrate-bft = { path = "../../substrate/bft" }
substrate-codec = { path = "../../substrate/codec" }

[dev-dependencies]
env_logger = "0.4"
substrate-codec = { path = "../../substrate/codec" }
substrate-keyring = { path = "../../substrate/keyring" }
substrate-test-client = { path = "../../substrate/test-client" }
2 changes: 1 addition & 1 deletion substrate/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extern crate substrate_client as client;
extern crate substrate_runtime_support as runtime_support;
extern crate substrate_runtime_primitives as runtime_primitives;
extern crate substrate_bft;
extern crate substrate_codec as codec;
extern crate serde;
extern crate serde_json;
extern crate futures;
Expand All @@ -42,7 +43,6 @@ extern crate ed25519;
#[macro_use] extern crate error_chain;

#[cfg(test)] extern crate env_logger;
#[cfg(test)] extern crate substrate_codec as codec;
#[cfg(test)] extern crate substrate_keyring as keyring;
#[cfg(test)] extern crate substrate_test_client as test_client;

Expand Down
31 changes: 29 additions & 2 deletions substrate/network/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT};
use service::Role as RoleFlags;

pub use self::generic::{BlockAnnounce, RemoteCallRequest, ConsensusVote, SignedConsensusVote, FromBlock};
pub use self::generic::{BlockAnnounce, RemoteCallRequest, ConsensusVote, SignedConsensusVote, FromBlock, Body};

pub type RequestId = u64;

Expand Down Expand Up @@ -171,10 +171,37 @@ pub struct RemoteCallResponse {
/// Generic types.
pub mod generic {
use primitives::AuthorityId;
use codec::Slicable;
use runtime_primitives::bft::Justification;
use ed25519;

use super::{Role, BlockAttribute, RemoteCallResponse, RequestId, Transactions, Direction};

use primitives::bytes;
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct V1Extrinsic(#[serde(with="bytes")] pub Vec<u8>);
// Alternative block format for poc-1 compatibility.
// TODO: remove this after poc-2
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Body<Extrinsic> {
V1(Vec<V1Extrinsic>),
Extrinsics(Vec<Extrinsic>),
}

impl<Extrinsic> Body<Extrinsic> where Extrinsic: Slicable {
pub fn to_extrinsics(self) -> Vec<Extrinsic> {
match self {
Body::Extrinsics(e) => e,
Body::V1(e) => {
e.into_iter().filter_map(|bytes|
Slicable::decode(&mut bytes.0.as_slice())
).collect()
}
}
}
}

/// Block data sent in the response.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct BlockData<Header, Hash, Extrinsic> {
Expand All @@ -183,7 +210,7 @@ pub mod generic {
/// Block header if requested.
pub header: Option<Header>,
/// Block body if requested.
pub body: Option<Vec<Extrinsic>>,
pub body: Option<Body<Extrinsic>>,
/// Block receipt if requested.
pub receipt: Option<Vec<u8>>,
/// Block message queue if requested.
Expand Down
2 changes: 1 addition & 1 deletion substrate/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl<B: BlockT> Protocol<B> where
let block_data = message::generic::BlockData {
hash: hash,
header: if get_header { Some(header) } else { None },
body: if get_body { self.chain.body(&BlockId::Hash(hash)).unwrap_or(None) } else { None },
body: (if get_body { self.chain.body(&BlockId::Hash(hash)).unwrap_or(None) } else { None }).map(|body| message::Body::Extrinsics(body)),
receipt: None,
message_queue: None,
justification: if get_justification { self.chain.justification(&BlockId::Hash(hash)).unwrap_or(None) } else { None },
Expand Down
2 changes: 1 addition & 1 deletion substrate/network/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl<B: BlockT> ChainSync<B> where
is_best,
header,
justification,
block.body
block.body.map(|b| b.to_extrinsics()),
);
match result {
Ok(ImportResult::AlreadyInChain) => {
Expand Down