From aa75d36a973f80571fbd99b254371331cbcb5543 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Sun, 10 Feb 2019 19:11:40 +0100 Subject: [PATCH] Integrate geneirc casper logic and rewards to runtime (#58) * [WIP] support multiple validators in an attestation and rework runtime * [WIP] More fixes to nostd and basic new AttestationRecord * [WIP] finish runtime integration * [WIP] Fix deps * [WIP] some compile fixes * Make consensus compile * Make everything compile * Fix authoring * Fix doctest complain --- Cargo.lock | 611 ++++++++++++++++++-------------- casper/Cargo.toml | 3 + casper/src/casper.rs | 71 ++-- casper/src/lib.rs | 10 + casper/src/reward.rs | 52 +-- casper/src/store.rs | 29 +- consensus/Cargo.toml | 1 + consensus/primitives/src/lib.rs | 20 +- consensus/src/block_import.rs | 16 +- consensus/src/lib.rs | 15 +- primitives/Cargo.toml | 4 +- primitives/src/attestation.rs | 141 +++----- primitives/src/lib.rs | 18 +- runtime/Cargo.toml | 4 +- runtime/src/consts.rs | 19 +- runtime/src/extrinsic.rs | 58 +-- runtime/src/genesis.rs | 58 +-- runtime/src/lib.rs | 305 ++++++---------- runtime/src/spec.rs | 35 -- runtime/src/state.rs | 260 +++++--------- runtime/src/storage.rs | 92 +++-- runtime/src/utils.rs | 39 +- runtime/src/validation.rs | 383 -------------------- runtime/src/validators.rs | 43 --- runtime/wasm/Cargo.lock | 218 ++++++------ src/chain_spec.rs | 17 +- src/main.rs | 1 + util/ssz-hash-derive/Cargo.toml | 2 +- util/ssz-hash/Cargo.toml | 2 +- 29 files changed, 962 insertions(+), 1565 deletions(-) delete mode 100644 runtime/src/spec.rs delete mode 100644 runtime/src/validation.rs delete mode 100644 runtime/src/validators.rs diff --git a/Cargo.lock b/Cargo.lock index 793a1339..cabd00cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,33 +8,33 @@ dependencies = [ [[package]] name = "aes-ctr" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aes-soft 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "aesni 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ctr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aes-soft" -version = "0.2.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aesni" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -92,10 +92,19 @@ dependencies = [ [[package]] name = "asn1_der" -version = "0.5.10" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "etrace 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "asn1_der_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "asn1_der_derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -243,7 +252,7 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.7.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -254,10 +263,10 @@ dependencies = [ [[package]] name = "block-cipher-trait" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -322,6 +331,8 @@ version = "0.1.0" dependencies = [ "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "plain_hasher 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sr-std 0.1.0 (git+https://github.com/paritytech/substrate)", ] @@ -553,11 +564,11 @@ dependencies = [ [[package]] name = "ctr" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -591,6 +602,18 @@ dependencies = [ "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "curve25519-dalek" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "data-encoding" version = "2.1.2" @@ -685,11 +708,6 @@ dependencies = [ "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "etrace" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "exit-future" version = "0.1.3" @@ -703,6 +721,21 @@ dependencies = [ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "fake-simd" @@ -878,7 +911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hash256-std-hasher" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,8 +1114,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jsonrpc-core" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1091,35 +1124,35 @@ dependencies = [ "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "jsonrpc-derive" +version = "10.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "jsonrpc-http-server" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hyper 0.12.23 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-server-utils 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "jsonrpc-macros" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" -dependencies = [ - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-pubsub 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "jsonrpc-pubsub" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1127,12 +1160,12 @@ dependencies = [ [[package]] name = "jsonrpc-server-utils" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1143,12 +1176,12 @@ dependencies = [ [[package]] name = "jsonrpc-ws-server" -version = "10.0.0" -source = "git+https://github.com/paritytech/jsonrpc.git#2fe3bfc717775ba76537e00bb3d053e8948f5372" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-server-utils 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-ws 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1229,27 +1262,28 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-dns 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-floodsub 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-kad 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mdns 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-mplex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-plaintext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ratelimit 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-secio 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-tcp 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-uds 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-websocket 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-floodsub 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-kad 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-plaintext 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ratelimit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-secio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-uds 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-websocket 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1260,7 +1294,7 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.2.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1268,7 +1302,7 @@ dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "multistream-select 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1279,12 +1313,13 @@ dependencies = [ "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-core-derive" -version = "0.2.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1293,11 +1328,11 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-dns-unofficial 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1306,7 +1341,7 @@ dependencies = [ [[package]] name = "libp2p-floodsub" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1314,7 +1349,7 @@ dependencies = [ "cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1325,13 +1360,13 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1346,7 +1381,7 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.2.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1355,9 +1390,9 @@ dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-identify 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-ping 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identify 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1374,13 +1409,14 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dns-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1394,13 +1430,13 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1408,15 +1444,30 @@ dependencies = [ "unsigned-varint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libp2p-noise" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "snow 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libp2p-ping" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1429,22 +1480,22 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-ratelimit" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1452,38 +1503,38 @@ dependencies = [ [[package]] name = "libp2p-secio" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aes-ctr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "asn1_der 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "ctr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ed25519-dalek 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "secp256k1 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "twofish 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libp2p-tcp" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tk-listen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1493,11 +1544,11 @@ dependencies = [ [[package]] name = "libp2p-uds" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1505,11 +1556,11 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rw-stream-sink 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1520,11 +1571,11 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "yamux 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1603,24 +1654,6 @@ name = "make-cmd" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "mashup" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "mashup-impl" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "matches" version = "0.1.8" @@ -1642,10 +1675,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memory-db" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1714,7 +1747,7 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1827,11 +1860,6 @@ name = "once_cell" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "opaque-debug" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "opaque-debug" version = "0.2.2" @@ -1918,11 +1946,11 @@ dependencies = [ [[package]] name = "parity-crypto" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2375,13 +2403,15 @@ dependencies = [ [[package]] name = "ring" -version = "0.13.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2581,7 +2611,7 @@ name = "sha2" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2625,6 +2655,7 @@ dependencies = [ name = "shasper-consensus" version = "0.1.0" dependencies = [ + "casper 0.1.0", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2680,8 +2711,9 @@ name = "shasper-primitives" version = "0.1.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "casper 0.1.0", "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2702,7 +2734,8 @@ name = "shasper-runtime" version = "0.9.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "casper 0.1.0", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "keccak-hasher 0.1.1", @@ -2796,10 +2829,31 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "snow" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "spin" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "sr-api-macros" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2810,10 +2864,10 @@ dependencies = [ [[package]] name = "sr-io" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2827,7 +2881,7 @@ dependencies = [ [[package]] name = "sr-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2844,7 +2898,7 @@ dependencies = [ [[package]] name = "sr-std" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2852,7 +2906,7 @@ dependencies = [ [[package]] name = "sr-version" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2866,7 +2920,7 @@ dependencies = [ [[package]] name = "srml-metadata" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2879,12 +2933,12 @@ dependencies = [ [[package]] name = "srml-support" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2899,7 +2953,7 @@ dependencies = [ [[package]] name = "srml-support-procedural" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2911,7 +2965,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2922,7 +2976,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools-derive" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2951,7 +3005,7 @@ dependencies = [ name = "ssz-hash" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ssz 0.1.0", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", ] @@ -2960,7 +3014,7 @@ dependencies = [ name = "ssz-hash-derive" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "ssz-hash 0.1.0", @@ -2978,6 +3032,11 @@ name = "static_assertions" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "static_slice" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "stdweb" version = "0.4.13" @@ -3024,10 +3083,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "stream-cipher" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3063,7 +3122,7 @@ dependencies = [ [[package]] name = "substrate-basic-authorship" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3079,12 +3138,11 @@ dependencies = [ [[package]] name = "substrate-cli" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3095,15 +3153,15 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-network 0.1.0 (git+https://github.com/paritytech/substrate)", + "substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-service 0.3.0 (git+https://github.com/paritytech/substrate)", "substrate-telemetry 0.3.0 (git+https://github.com/paritytech/substrate)", - "sysinfo 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sysinfo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3111,19 +3169,19 @@ dependencies = [ [[package]] name = "substrate-client" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-std 0.1.0 (git+https://github.com/paritytech/substrate)", @@ -3141,9 +3199,9 @@ dependencies = [ [[package]] name = "substrate-client-db" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3163,21 +3221,15 @@ dependencies = [ [[package]] name = "substrate-consensus-aura-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ - "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/paritytech/substrate)", - "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", - "sr-version 0.1.0 (git+https://github.com/paritytech/substrate)", - "srml-support 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)", - "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", ] [[package]] name = "substrate-consensus-aura-slots" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3196,7 +3248,7 @@ dependencies = [ [[package]] name = "substrate-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3214,11 +3266,10 @@ dependencies = [ [[package]] name = "substrate-executor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3228,6 +3279,7 @@ dependencies = [ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-version 0.1.0 (git+https://github.com/paritytech/substrate)", + "substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-serializer 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate)", @@ -3239,7 +3291,7 @@ dependencies = [ [[package]] name = "substrate-inherents" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3251,7 +3303,7 @@ dependencies = [ [[package]] name = "substrate-keyring" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3261,11 +3313,11 @@ dependencies = [ [[package]] name = "substrate-keystore" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-crypto 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3277,13 +3329,15 @@ dependencies = [ [[package]] name = "substrate-network" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3300,14 +3354,14 @@ dependencies = [ [[package]] name = "substrate-network-libp2p" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libp2p 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3322,22 +3376,31 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "substrate-panic-handler" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3350,12 +3413,12 @@ dependencies = [ [[package]] name = "substrate-rpc" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-macros 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-pubsub 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-derive 10.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3375,11 +3438,11 @@ dependencies = [ [[package]] name = "substrate-rpc-servers" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ - "jsonrpc-http-server 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-pubsub 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", - "jsonrpc-ws-server 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)", + "jsonrpc-http-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-ws-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", @@ -3389,7 +3452,7 @@ dependencies = [ [[package]] name = "substrate-serializer" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3398,7 +3461,7 @@ dependencies = [ [[package]] name = "substrate-service" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3430,7 +3493,7 @@ dependencies = [ [[package]] name = "substrate-state-db" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3442,24 +3505,25 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-telemetry" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3474,7 +3538,7 @@ dependencies = [ [[package]] name = "substrate-transaction-graph" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3488,7 +3552,7 @@ dependencies = [ [[package]] name = "substrate-transaction-pool" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3504,13 +3568,13 @@ dependencies = [ [[package]] name = "substrate-trie" version = "0.4.0" -source = "git+https://github.com/paritytech/substrate#60801d8bfe6c9869d6f96b84539d5e8935e10709" +source = "git+https://github.com/paritytech/substrate#e8b558c05ba13a0ee63c7c90e8e4156be38237fd" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3553,9 +3617,20 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sysinfo" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3864,11 +3939,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "trie-db" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3881,6 +3956,14 @@ dependencies = [ "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "trie-root" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "try-lock" version = "0.2.2" @@ -3888,12 +3971,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "twofish" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4190,16 +4273,17 @@ dependencies = [ [metadata] "checksum MacTypes-sys 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eaf9f0d0b1cc33a4d2aee14fb4b2eac03462ef4db29c8ac4057327d8a71ad86f" -"checksum aes-ctr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f65958ff3692041c36fc009261ccd63f24cd8e0dc1164266f068c2387e8b4e4f" -"checksum aes-soft 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67cc03b0a090a05cb01e96998a01905d7ceedce1bc23b756c0bb7faa0682ccb1" -"checksum aesni 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6810b7fb9f2bb4f76f05ac1c170b8dde285b6308955dc3afd89710268c958d9e" +"checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" +"checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +"checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum aio-limited 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f10b352bc3fc08ae24dc5d2d3ddcac153678533986122dc283d747b12071000" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum asn1_der 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "766afdc5c6d7c15de1abe4c9c15e360be3aa972c363ba5b606be3c4271235886" +"checksum asn1_der 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9893d63fc3b1c44231e667da6836a33f27d8b6b3bdc82f83da5dfd579d1b6528" +"checksum asn1_der_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e7f92edafad155aff997fa5b727c6429b91e996b5a5d62a2b0adbae1306b5fe" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" @@ -4216,8 +4300,8 @@ dependencies = [ "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1339a1042f5d9f295737ad4d9a6ab6bf81c84a933dba110b9200cd6d1448b814" "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" -"checksum block-buffer 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "509de513cca6d92b6aacf9c61acfe7eaa160837323a81068d690cc1f8e5740da" -"checksum block-cipher-trait 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "370424437b9459f3dfd68428ed9376ddfe03d8b70ede29cc533b3557df186ab4" +"checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" +"checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" "checksum bls 0.0.1 (git+https://github.com/sorpaas/bls)" = "" "checksum bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0de79cfb98e7aa9988188784d8664b4b5dad6eaaa0863b91d9a4ed871d4f7a42" @@ -4252,10 +4336,11 @@ dependencies = [ "checksum crypto-mac 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0999b4ff4d3446d4ddb19a63e9e00c1876e75cd7000d20e57a693b4b3f08d958" "checksum crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -"checksum ctr 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4b669fcb8e20124db86dbd9b01e74ec0e9e420e65381311ce5249864fc7ff0c0" +"checksum ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "044f882973b245404e90c90e7e42e8ee8d7a64edfd7adf83d684fb97e8e2c1b6" "checksum ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "630391922b1b893692c6334369ff528dcc3a9d8061ccf4c803aa8f83cb13db5e" "checksum cuckoofilter 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd43f7cfaffe0a386636a10baea2ee05cc50df3b77bea4a456c9572a939bf1f" "checksum curve25519-dalek 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3eacf6ff1b911e3170a8c400b402e10c86dc3cb166bd69034ebbc2b785fea4c2" +"checksum curve25519-dalek 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dae47cc3529cdab597dbc8b606e565707209b506e55848f3c15679214a56c956" "checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" @@ -4268,9 +4353,9 @@ dependencies = [ "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" "checksum environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db746025e3ea695bfa0ae744dbacd5fcfc8db51b9760cf8bd0ab69708bb93c49" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum etrace 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f17311e68ea07046ee809b8513f6c259518bc10173681d98c21f8c3926f56f40" "checksum exit-future 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "87559b08e99a81a92bbb867d237543e43495857749f688e0773390a20d56c61c" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fdlimit 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1ee15a7050e5580b3712877157068ea713b245b080ff302ae2ca973cfcd9baa" "checksum fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a557e80084b05c32b455963ff565a9de6f2866da023d6671705c6aff6f65e01c" @@ -4293,7 +4378,7 @@ dependencies = [ "checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e" "checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483" "checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338" -"checksum hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fc2d94c8e127b205b3caf6fd3013fb5e5b314234bb0b9bea6588c52fddbb82b" +"checksum hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c13dbac3cc50684760f54af18545c9e80fb75e93a3e586d71ebdc13138f6a4" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" @@ -4316,12 +4401,12 @@ dependencies = [ "checksum interleaved-ordered 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "141340095b15ed7491bd3d4ced9d20cebfb826174b6bb03386381f62b01e3d77" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum jsonrpc-core 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" -"checksum jsonrpc-http-server 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" -"checksum jsonrpc-macros 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" -"checksum jsonrpc-pubsub 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" -"checksum jsonrpc-server-utils 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" -"checksum jsonrpc-ws-server 10.0.0 (git+https://github.com/paritytech/jsonrpc.git)" = "" +"checksum jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a5152c3fda235dfd68341b3edf4121bc4428642c93acbd6de88c26bf95fc5d7" +"checksum jsonrpc-derive 10.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c14be84e86c75935be83a34c6765bf31f97ed6c9163bb0b83007190e9703940a" +"checksum jsonrpc-http-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "99e1ce36c7cc9dcab398024d76849ab2cb917ee812653bce6f74fc9eb7c82d16" +"checksum jsonrpc-pubsub 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "56608ed54b1b2a69f4357cb8bdfbcbd99fe1179383c03a09bb428931bd35f592" +"checksum jsonrpc-server-utils 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5521613b31ea22d36d9f95ad642058dccec846a94ed8690957652d479f620707" +"checksum jsonrpc-ws-server 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20b8333a5a6e6ccbcf5c90f90919de557cba4929efa164e9bd0e8e497eb20e46" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum kvdb-rocksdb 0.1.4 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" @@ -4330,23 +4415,24 @@ dependencies = [ "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" -"checksum libp2p 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2cce57e82d0decdf5464e4e179a319ee14c218c330bb017f62453f4ab74842" -"checksum libp2p-core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "26977e332e88c070353864d5ed72b6e1175fc1c63af5709b5174877836a229b6" -"checksum libp2p-core-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a88f076f3f60f3f407ce4fc0f620e3592125461bec5aa4895316e1f0414b3ea" -"checksum libp2p-dns 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f7ad92f9711efece48bb7ce30e3f1e662cd3524dc5d9f96b8f68b6e4e7cde96" -"checksum libp2p-floodsub 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4feda0ff3afcf84dfee9ea088835293829d199a34491d7f0990a4ccfd627816c" -"checksum libp2p-identify 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "548f9180101bd5846f4f60e060a00032ba3671a77fc735c48a85b7d1016d28ef" -"checksum libp2p-kad 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91c28bf179a22fd1bfa3bad28ed86b8657ed2d193b76caa6f632ea83356d3a40" -"checksum libp2p-mdns 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1bbcb82063545605abf697967d919d418b1725f7d3688973fa26c98f81e8cda8" -"checksum libp2p-mplex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9406ea58ce4fef47820f7d2d6aa62b7e42b4972c30cc87de577d4da40852d4b1" -"checksum libp2p-ping 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c1ca7b60c2edb0cae7f9db56fbe6c21ca6960e96ec92cd1ed265ac06db24a1fe" -"checksum libp2p-plaintext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bdbdd4700d5edea10214e4733ab5ac5be87862bac8a9b259c987bc9c15004" -"checksum libp2p-ratelimit 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3001ea6afed5ccd1e5934715aa388b60b23e7587117db36b89d697e8ea43ff3" -"checksum libp2p-secio 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0fc2bee2dce0d0d054d81447b06f7e923f1a98e6b240e42674e0fdf2e4a4924f" -"checksum libp2p-tcp 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fcb2bcb9402f5fe42441dd4558306ff83a28624f67c6066bdbaa98928c180e3" -"checksum libp2p-uds 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3e88ac8f419f8d9487aaee9ef8785f592b37d78067c6764fe0adc1874a72c6c" -"checksum libp2p-websocket 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b60b65b8d7053220a0c78a09eda0a162db410067639d2b24432a9f1dc06230" -"checksum libp2p-yamux 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71b4fd69a1c038152d017366d759177e2580fb4fbb56ce65429a642e011a07b1" +"checksum libp2p 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cd53656209acc649a3aa4d9ce3580dd75d016317126fbdc6f8a8956f15f74de" +"checksum libp2p-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3bfdf7ab20e901f643cb0913e8e8feffd8439d3ee83d6cfea607f43fa3d14f6d" +"checksum libp2p-core-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "21d637c8aa4d8540d160d747755ac5bd75073de70bd3c0c238d8b1685a66a6be" +"checksum libp2p-dns 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a822c32da15ab0c4451792a4b000c37fbf8e3bc5ac471632f0b1f13e8e555524" +"checksum libp2p-floodsub 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4380fbc42ec03251c9e9a4656744e8e88bbe59cbf4e084fa66370ed0b868d085" +"checksum libp2p-identify 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "48923a9b3792aaf9af793a689c78bd0f42e70cc6cf86cc00d678d8f39ea720b6" +"checksum libp2p-kad 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e93be405af87e5911549ee4c5ffc3ef926bb88c5c416f29f3122fc9cd8545d29" +"checksum libp2p-mdns 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4388af57ce8144eb0f6719926139df4f728042931eee5a32daf783a2fc9e05" +"checksum libp2p-mplex 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58e4dcf1b8ee62d872ff38134969b0a2d63d014c200748eead158c58512a0c1b" +"checksum libp2p-noise 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9beca4939eb183708b8f172170044d977f1264394998e183efbf4972e09c163f" +"checksum libp2p-ping 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60d3acc575adbf6723b0965eca131e2525bed2c85ec88ddc4bff0462dbc0c2c3" +"checksum libp2p-plaintext 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7cae333f78b782907d9940cb8dca37ddfa353fcaa812172654969fa65ef280c" +"checksum libp2p-ratelimit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e298aa8036653ab9d4c37376066cb2fc69f63115522a9a3d402fcdc1654612ea" +"checksum libp2p-secio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3495935a389a6f4b26e71f9d6eac3fc33a9481f5f5d79ad886d5bc7efe0195c3" +"checksum libp2p-tcp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae301dcdd52087d40a106971575144c4f6220b37e0d1d98474085445327e2708" +"checksum libp2p-uds 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b5524df7a63d97a8bbe2064d6bc85a84594ad71a8fad4b82ae958fbe37770ce" +"checksum libp2p-websocket 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e80602e23cf58b92d47142a32560c19417f8e9113017eb105f5e580f3bbeb8bc" +"checksum libp2p-yamux 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de9a2ed873051c7a85ec7dece746d425564c366b87752e83056c33d8ae758dcf" "checksum librocksdb-sys 5.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b9024327233e7fac7982440f73301c00046d438c5b1011e8f4e394226ce19007" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" @@ -4356,19 +4442,17 @@ dependencies = [ "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8ca8afbe8af1785e09636acb5a41e08a765f5f0340568716c18a8700ba3c0d3" -"checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b" -"checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0c940ff365f921ac747e7a009d8f9688105acf956f3fbb7fd967920737e935d" +"checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum multistream-select 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "886fe7ba983a194afdd9074323171c8e313b2c145561da69464d5443f1a3d121" +"checksum multistream-select 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ed84364f0e921a32204896952ee80c7befc14a7a39f2c56cd955d71e8dae6" "checksum names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef320dab323286b50fb5cdda23f61c796a72a89998ab565ca32525c5c556f2da" "checksum native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8e08de0070bbf4c31f452ea2a70db092f36f6f2e4d897adf5674477d488fb2" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" @@ -4381,7 +4465,6 @@ dependencies = [ "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" "checksum once_cell 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "53075ac5dbd2798cfbcf9f710f2737de031d8076c192d8fe66fb23f639ccbdf4" -"checksum opaque-debug 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d620c9c26834b34f039489ac0dfdb12c7ac15ccaf818350a64c9b5334a452ad7" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" "checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" @@ -4392,7 +4475,7 @@ dependencies = [ "checksum parity-bytes 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)" = "" "checksum parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88f69984317b736dceac3baa86600fc089856f69b44b07231f39b5648b02bcd4" "checksum parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a58ba33211595f92cc2163ac583961d3dc767e656934146636b05256cc9acd7f" -"checksum parity-crypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8adf489acb31f1922db0ce43803b6f48a425241a8473611be3cc625a8e4a4c47" +"checksum parity-crypto 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b9db194dfbcfe3b398d63d765437a5c7232d59906e203055f0e993f6458ff1" "checksum parity-multiaddr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9a8e5d637787fe097ec1bfca2aa3eb687396518003df991c6c7216d86682d5ff" "checksum parity-multihash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8eab0287ccde7821e337a124dc5a4f1d6e4c25d10cc91e3f9361615dd95076" "checksum parity-wasm 0.31.3 (registry+https://github.com/rust-lang/crates.io-index)" = "511379a8194230c2395d2f5fa627a5a7e108a9f976656ce723ae68fca4097bfc" @@ -4442,7 +4525,7 @@ dependencies = [ "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +"checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" "checksum rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1651697fefd273bfb4fd69466cc2a9d20de557a0213b97233b22b5e95924b5e" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" @@ -4476,6 +4559,8 @@ dependencies = [ "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15" +"checksum snow 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7251f8920e9043106cfe466c04ed3eb257b8315a7699259c4fd0af6dffb6aef6" +"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" "checksum sr-api-macros 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum sr-io 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "" @@ -4488,11 +4573,12 @@ dependencies = [ "checksum srml-support-procedural-tools-derive 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5" +"checksum static_slice 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "92a7e0c5e3dfb52e8fbe0e63a1b947bbb17b4036408b151353c4491374931362" "checksum stdweb 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "461e7f2e33670b1c33f1ea22bb2f86de6136fabd0c4d27d167ed425c231143ca" "checksum stdweb-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0e21ebd9179de08f2300a65454268a17ea3de204627458588c84319c4def3930" "checksum stdweb-internal-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "432465093692af7379dcd196ce4be398c906958d91b412fff9102a66238d6f26" "checksum stdweb-internal-runtime 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2f4a2eb556337b2d1a302630bbddf989ae383c70393e89b48152b9896cbda" -"checksum stream-cipher 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30dc6118470d69ce0fdcf7e6f95e95853f7f4f72f80d835d4519577c323814ab" +"checksum stream-cipher 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8861bc80f649f5b4c9bd38b696ae9af74499d479dbfb327f0607de6b326a36bc" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" @@ -4510,6 +4596,7 @@ dependencies = [ "checksum substrate-keystore 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-network 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-network-libp2p 0.1.0 (git+https://github.com/paritytech/substrate)" = "" +"checksum substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-rpc 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-rpc-servers 0.1.0 (git+https://github.com/paritytech/substrate)" = "" @@ -4526,7 +4613,8 @@ dependencies = [ "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" "checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" -"checksum sysinfo 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c747a1fbe091faa7bf76c19f40099f9f12495384c811485d81cf3d60c0eae62" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum sysinfo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4da1ccc493b46042d6f5352910a7f18ed8fe81307dd7db3f2e2d8a7db6f6284" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum target_info 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" @@ -4554,10 +4642,11 @@ dependencies = [ "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" -"checksum trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec6ceb1ad749359cedcf6fa95d7b5104acf70e871e2416e71cabcc3a8b2dbb8" +"checksum trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7319e28ca295f27359d944a682f7f65b419158bf1590c92cadc0000258d788" +"checksum trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c6fef2705af3258ec46a7e22286090394a44216201a1cf7d04b78db825e543" "checksum trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6294c313431d8bd2dda88db3a57550c4911dd6f7f0e8be6001e23c1e6cbdcf1b" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" -"checksum twofish 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1eef327f05b0d0ec1b9d7d119d8f4d9f602ceee37e0540aff8071e8e66c2e22e" +"checksum twofish 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d261e83e727c8e2dbb75dacac67c36e35db36a958ee504f2164fc052434e1" "checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" diff --git a/casper/Cargo.toml b/casper/Cargo.toml index 72b80fbc..9519a901 100644 --- a/casper/Cargo.toml +++ b/casper/Cargo.toml @@ -5,6 +5,8 @@ authors = ["Parity Technologies "] edition = "2018" [dependencies] +parity-codec = { version = "3.0", default-features = false } +parity-codec-derive = "3.0" hash-db = { version = "0.11", default-features = false } rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", default-features = false } num-traits = { version = "0.2", default-features = false } @@ -17,4 +19,5 @@ default = ["std"] std = [ "hash-db/std", "rstd/std", + "parity-codec/std", ] diff --git a/casper/src/casper.rs b/casper/src/casper.rs index 37f19c1c..038c3246 100644 --- a/casper/src/casper.rs +++ b/casper/src/casper.rs @@ -17,6 +17,8 @@ //! Casper FFG generic consensus algorithm on justification and finalization. use num_traits::{One, Zero}; +use codec_derive::{Encode, Decode}; +use rstd::prelude::*; use rstd::ops::{Add, AddAssign, Sub, SubAssign}; use crate::store::{ @@ -25,30 +27,46 @@ use crate::store::{ }; /// Return whether given two attestations satisfy Casper slashing conditions. -pub fn slashable(a: &C, b: &C) -> bool { - // Two attestations must be different, and must be from the same validator. - if a == b || a.validator_id() != b.validator_id() { - return false; - } +pub fn slashable(a: &C, b: &C) -> Vec { + let slashable = { + // Two attestations must be different. + if a == b { + false + } - // If two attestations have the same target, then it is a double vote. - if a.target_epoch() == b.target_epoch() { - return true; - } + // If two attestations have the same target, then it is a double vote. + else if a.target_epoch() == b.target_epoch() { + true + } - // If one attestation surrounds the other, then it is a surround vote. - if a.source_epoch() < b.source_epoch() && b.target_epoch() < a.target_epoch() { - return true; - } - if b.source_epoch() < a.source_epoch() && a.target_epoch() < b.target_epoch() { - return true; - } + // If one attestation surrounds the other, then it is a surround vote. + else if a.source_epoch() < b.source_epoch() && b.target_epoch() < a.target_epoch() { + true + } + else if b.source_epoch() < a.source_epoch() && a.target_epoch() < b.target_epoch() { + true + } + + else { + false + } + }; - false + if slashable { + let mut ret = Vec::new(); + for validator_id in a.validator_ids() { + if b.validator_ids().into_iter().any(|v| v == validator_id) { + ret.push(validator_id); + } + } + ret + } else { + Vec::new() + } } /// Data needed for casper consensus. -#[derive(Default, Clone, Eq, PartialEq)] +#[derive(Default, Clone, Eq, PartialEq, Encode, Decode)] pub struct CasperContext { /// Bitfield holding justification information. pub justification_bitfield: u64, @@ -119,8 +137,8 @@ impl CasperContext where { assert!(self.epoch() == store.epoch(), "Store block epoch must equal to casper context."); debug_assert!({ - store.attestations().iter().all(|attestation| { - self.validate_attestation(attestation) + store.attestations().into_iter().all(|attestation| { + self.validate_attestation(&attestation) }) }); @@ -163,7 +181,7 @@ mod tests { use super::*; use std::collections::HashMap; - #[derive(PartialEq, Eq, Default)] + #[derive(PartialEq, Eq, Default, Clone)] pub struct DummyAttestation { pub validator_id: usize, pub source_epoch: usize, @@ -172,10 +190,11 @@ mod tests { impl Attestation for DummyAttestation { type ValidatorId = usize; + type ValidatorIdIterator = Vec; type Epoch = usize; - fn validator_id(&self) -> &usize { - &self.validator_id + fn validator_ids(&self) -> Vec { + vec![self.validator_id] } fn is_source_canon(&self) -> bool { @@ -204,6 +223,7 @@ mod tests { impl ValidatorStore for DummyStore { type ValidatorId = usize; + type ValidatorIdIterator = Vec; type Balance = usize; type Epoch = usize; @@ -228,9 +248,10 @@ mod tests { impl PendingAttestationsStore for DummyStore { type Attestation = DummyAttestation; + type AttestationIterator = Vec; - fn attestations(&self) -> &[DummyAttestation] { - &self.pending_attestations + fn attestations(&self) -> Vec { + self.pending_attestations.clone() } fn retain bool>(&mut self, f: F) { diff --git a/casper/src/lib.rs b/casper/src/lib.rs index f9ad05b6..b19d3686 100644 --- a/casper/src/lib.rs +++ b/casper/src/lib.rs @@ -16,9 +16,19 @@ //! Generic structs and traits for the Casper FFG. +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(not(feature = "std"), feature(alloc))] + #![warn(missing_docs)] +extern crate parity_codec as codec; +extern crate parity_codec_derive as codec_derive; + pub mod randao; pub mod casper; pub mod reward; pub mod store; + +pub use crate::casper::CasperContext; +pub use crate::store::Attestation; +pub use crate::reward::BeaconAttestation; diff --git a/casper/src/reward.rs b/casper/src/reward.rs index a3a5bfa0..0a5acebc 100644 --- a/casper/src/reward.rs +++ b/casper/src/reward.rs @@ -17,6 +17,7 @@ //! Beacon reward constructs. use num_traits::{One, Zero}; +use rstd::prelude::*; use rstd::ops::{Add, AddAssign, Sub, SubAssign, Div}; use crate::casper::CasperContext; use crate::store::{ @@ -26,7 +27,7 @@ use crate::store::{ }; /// Rewards for Casper. -#[derive(Eq, PartialEq)] +#[derive(Eq, PartialEq, Clone)] pub enum CasperRewardType { /// The attestation has an expected source. ExpectedSource, @@ -39,7 +40,7 @@ pub enum CasperRewardType { } /// Rewards for beacon chain. -#[derive(Eq, PartialEq)] +#[derive(Eq, PartialEq, Clone)] pub enum BeaconRewardType { /// The validator attested on the expected head. ExpectedHead, @@ -62,6 +63,15 @@ pub trait BeaconAttestation: Attestation { fn inclusion_distance(&self) -> Self::Slot; } +fn push_rewards(rewards: &mut Vec<(A::ValidatorId, T)>, attestation: &A, reward: T) where + A: Attestation, + T: Clone, +{ + for validator_id in attestation.validator_ids() { + rewards.push((validator_id.clone(), reward.clone())); + } +} + /// Get rewards for beacon chain. pub fn beacon_rewards(store: &S) -> Vec<(A::ValidatorId, BeaconRewardType)> where A: BeaconAttestation, @@ -72,17 +82,17 @@ pub fn beacon_rewards(store: &S) -> Vec<(A::ValidatorId, BeaconRewardType< Epoch=PendingAttestationsStoreEpoch >, { - let mut no_expected_head_validators = store.active_validators(store.previous_epoch()); + let mut no_expected_head_validators = store.active_validators(store.previous_epoch()).into_iter().collect::>(); let mut rewards = Vec::new(); for attestation in store.attestations() { if attestation.target_epoch() == store.previous_epoch() { - rewards.push((attestation.validator_id().clone(), BeaconRewardType::InclusionDistance(attestation.inclusion_distance()))); + push_rewards(&mut rewards, &attestation, BeaconRewardType::InclusionDistance(attestation.inclusion_distance())); if attestation.is_slot_canon() { - rewards.push((attestation.validator_id().clone(), BeaconRewardType::ExpectedHead)); + push_rewards(&mut rewards, &attestation, BeaconRewardType::ExpectedHead); no_expected_head_validators.retain(|validator_id| { - validator_id != attestation.validator_id() + !attestation.validator_ids().into_iter().any(|v| v == *validator_id) }); } } @@ -106,21 +116,21 @@ pub fn casper_rewards(context: &CasperContext, store: &S) -> Vec Epoch=PendingAttestationsStoreEpoch >, { - let mut no_expected_source_validators = store.active_validators(context.previous_epoch()); + let mut no_expected_source_validators = store.active_validators(context.previous_epoch()).into_iter().collect::>(); let mut no_expected_target_validators = no_expected_source_validators.clone(); let mut rewards = Vec::new(); for attestation in store.attestations() { if attestation.target_epoch() == store.previous_epoch() { - rewards.push((attestation.validator_id().clone(), CasperRewardType::ExpectedSource)); + push_rewards(&mut rewards, &attestation, CasperRewardType::ExpectedSource); no_expected_source_validators.retain(|validator_id| { - validator_id != attestation.validator_id() + !attestation.validator_ids().into_iter().any(|v| v == *validator_id) }); if attestation.is_target_canon() { - rewards.push((attestation.validator_id().clone(), CasperRewardType::ExpectedTarget)); + push_rewards(&mut rewards, &attestation, CasperRewardType::ExpectedTarget); no_expected_target_validators.retain(|validator_id| { - validator_id != attestation.validator_id() + !attestation.validator_ids().into_iter().any(|v| v == *validator_id) }); } } @@ -138,7 +148,7 @@ pub fn casper_rewards(context: &CasperContext, store: &S) -> Vec } /// Config for default reward scheme. -pub struct DefaultSchemeConfig { +pub struct DefaultSchemeConfig { /// Base reward quotient. pub base_reward_quotient: Balance, /// Inactivity penalty quotient. @@ -146,7 +156,7 @@ pub struct DefaultSchemeConfig { /// Includer reward quotient. pub includer_reward_quotient: Balance, /// Min attestation inclusion delay. - pub min_attestation_inclusion_delay: Balance, + pub min_attestation_inclusion_delay: Slot, /// Whistleblower reward quotient. pub whistleblower_reward_quotient: Balance, } @@ -196,16 +206,16 @@ pub fn default_scheme_rewards( beacon_rewards: &[(ValidatorStoreValidatorId, BeaconRewardType)], casper_rewards: &[(ValidatorStoreValidatorId, CasperRewardType)], epochs_since_finality: ValidatorStoreEpoch, - config: &DefaultSchemeConfig>, + config: &DefaultSchemeConfig, Slot>, ) -> Vec<(ValidatorStoreValidatorId, RewardAction>)> where S: ValidatorStore, S: BlockStore>, - Slot: Eq + PartialEq + Clone, + Slot: Eq + PartialEq + Clone + Copy, ValidatorStoreBalance: From> + From, ValidatorStoreEpoch: From, { let previous_epoch = store.previous_epoch(); - let previous_active_validators = store.active_validators(previous_epoch); + let previous_active_validators = store.active_validators(previous_epoch).into_iter().collect::>(); let previous_total_balance = store.total_balance(&previous_active_validators); let base_reward = |validator_id: ValidatorStoreValidatorId| { @@ -246,7 +256,7 @@ pub fn default_scheme_rewards( } if let BeaconRewardType::InclusionDistance(ref distance) = reward_type { - rewards.push((validator_id.clone(), RewardAction::Add(base_reward(validator_id.clone()) / config.min_attestation_inclusion_delay / From::from(distance.clone())))); + rewards.push((validator_id.clone(), RewardAction::Add(base_reward(validator_id.clone()) / From::from(config.min_attestation_inclusion_delay) / From::from(distance.clone())))); } } @@ -278,7 +288,7 @@ pub fn default_scheme_rewards( } if let BeaconRewardType::InclusionDistance(ref distance) = reward_type { - rewards.push((validator_id.clone(), RewardAction::Sub(base_reward(validator_id.clone()) - base_reward(validator_id.clone()) * config.min_attestation_inclusion_delay / From::from(distance.clone())))); + rewards.push((validator_id.clone(), RewardAction::Sub(base_reward(validator_id.clone()) - base_reward(validator_id.clone()) * From::from(config.min_attestation_inclusion_delay) / From::from(distance.clone())))); } } @@ -297,12 +307,12 @@ pub fn default_scheme_rewards( } /// Use default scheme for penalization. -pub fn default_scheme_penalties( +pub fn default_scheme_penalties( store: &S, whistleblower: &ValidatorStoreValidatorId, slashings: &[ValidatorStoreValidatorId], epochs_since_finality: ValidatorStoreEpoch, - config: &DefaultSchemeConfig>, + config: &DefaultSchemeConfig, Slot>, ) -> Vec<(ValidatorStoreValidatorId, RewardAction>)> where S: ValidatorStore, S: BlockStore>, @@ -320,7 +330,7 @@ pub fn default_scheme_penalties( if epochs_since_finality > From::from(4u8) { let previous_epoch = store.previous_epoch(); - let previous_active_validators = store.active_validators(previous_epoch); + let previous_active_validators = store.active_validators(previous_epoch).into_iter().collect::>(); let previous_total_balance = store.total_balance(&previous_active_validators); let base_reward = |validator_id: ValidatorStoreValidatorId| { diff --git a/casper/src/store.rs b/casper/src/store.rs index 29401bc3..a2ca15e7 100644 --- a/casper/src/store.rs +++ b/casper/src/store.rs @@ -17,17 +17,20 @@ //! Common store traits use num_traits::{One, Zero}; +use rstd::prelude::*; use rstd::ops::{Add, AddAssign, Sub, SubAssign, Mul, Div}; /// Casper attestation. The source should always be canon. pub trait Attestation: PartialEq + Eq { /// Type of validator Id. - type ValidatorId: PartialEq + Eq + Clone; + type ValidatorId: PartialEq + Eq + Clone + Copy; + /// Type of validator Id collection. + type ValidatorIdIterator: IntoIterator; /// Type of epoch. type Epoch: PartialEq + Eq + PartialOrd + Ord + Clone + Copy + Add + AddAssign + Sub + SubAssign + One + Zero; - /// Get validator Id of this attestation. - fn validator_id(&self) -> &Self::ValidatorId; + /// Get validator Ids of this attestation. + fn validator_ids(&self) -> Self::ValidatorIdIterator; /// Whether this attestation's source is on canon chain. fn is_source_canon(&self) -> bool; /// Whether this attestation's target is on canon chain. @@ -46,7 +49,9 @@ pub trait Attestation: PartialEq + Eq { /// Store that holds validator active and balance information. pub trait ValidatorStore { /// Type of validator Id. - type ValidatorId: PartialEq + Eq + Clone; + type ValidatorId: PartialEq + Eq + Clone + Copy; + /// Type of validator Id collection. + type ValidatorIdIterator: IntoIterator; /// Type of balance. type Balance: PartialEq + Eq + PartialOrd + Ord + Clone + Copy + Add + AddAssign + Sub + SubAssign + Mul + Div + From; /// Type of epoch. @@ -55,16 +60,18 @@ pub trait ValidatorStore { /// Get total balance of given validator Ids. fn total_balance(&self, validators: &[Self::ValidatorId]) -> Self::Balance; /// Get all active validators at given epoch. - fn active_validators(&self, epoch: Self::Epoch) -> Vec; + fn active_validators(&self, epoch: Self::Epoch) -> Self::ValidatorIdIterator; } /// Store that holds pending attestations. pub trait PendingAttestationsStore { /// Type of attestation. type Attestation: Attestation; + /// Type of attestation collection. + type AttestationIterator: IntoIterator; /// Get the current list of attestations. - fn attestations(&self) -> &[Self::Attestation]; + fn attestations(&self) -> Self::AttestationIterator; /// Retain specific attestations and remove the rest. fn retain bool>(&mut self, f: F); } @@ -112,7 +119,9 @@ pub fn canon_target_attesting_balance(store: &S, epoch: PendingAttestationsSt let mut validators = Vec::new(); for attestation in store.attestations() { if attestation.is_casper_canon() && attestation.target_epoch() == epoch { - validators.push(attestation.validator_id().clone()); + for validator_id in attestation.validator_ids() { + validators.push(validator_id.clone()); + } } } store.total_balance(&validators) @@ -129,7 +138,9 @@ pub fn canon_source_attesting_balance(store: &S, epoch: PendingAttestationsSt let mut validators = Vec::new(); for attestation in store.attestations() { if attestation.is_casper_canon() && attestation.source_epoch() == epoch { - validators.push(attestation.validator_id().clone()); + for validator_id in attestation.validator_ids() { + validators.push(validator_id.clone()); + } } } store.total_balance(&validators) @@ -139,6 +150,6 @@ pub fn canon_source_attesting_balance(store: &S, epoch: PendingAttestationsSt pub fn active_total_balance(store: &S, epoch: ValidatorStoreEpoch) -> ValidatorStoreBalance where S: ValidatorStore { - let validators = store.active_validators(epoch); + let validators = store.active_validators(epoch).into_iter().collect::>(); store.total_balance(&validators) } diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index 97525927..1be08b81 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -29,3 +29,4 @@ transaction-pool = { package = "substrate-transaction-pool", git = "https://gith basic-authorship = { package = "substrate-basic-authorship", git = "https://github.com/paritytech/substrate" } aura-slots = { package = "substrate-consensus-aura-slots", git = "https://github.com/paritytech/substrate" } inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate" } +casper = { path = "../casper" } diff --git a/consensus/primitives/src/lib.rs b/consensus/primitives/src/lib.rs index b286ecf6..fb34189a 100644 --- a/consensus/primitives/src/lib.rs +++ b/consensus/primitives/src/lib.rs @@ -99,7 +99,6 @@ pub mod utils { timestamp_and_slot_now(slot_duration).map(|(_, slot)| slot) } - pub fn time_until_next(now: Duration, slot_duration: u64) -> Duration { let remaining_full_secs = slot_duration - (now.as_secs() % slot_duration) - 1; let remaining_nanos = 1_000_000_000 - now.subsec_nanos(); @@ -133,24 +132,29 @@ pub mod id { /// Runtime-APIs pub mod api { - use rstd::prelude::*; - use primitives::{AttestationRecord, ValidatorId, Slot}; + use primitives::{Epoch, UncheckedAttestation, CheckedAttestation, Slot}; use client::decl_runtime_apis; decl_runtime_apis! { /// API necessary for block authorship with Shasper. pub trait ShasperApi { - /// Return validator attestation map. - fn validator_ids_from_attestation(attestation: &AttestationRecord) -> Vec; + /// Return the last finalized epoch. + fn finalized_epoch() -> Epoch; + + /// Return the last justified epoch. + fn justified_epoch() -> Epoch; /// Return the last finalized slot. - fn last_finalized_slot() -> Slot; + fn finalized_slot() -> Slot; /// Return the last justified slot. - fn last_justified_slot() -> Slot; + fn justified_slot() -> Slot; - /// Return the current slot; + /// Return the current slot. fn slot() -> Slot; + + /// Check an attestation. + fn check_attestation(unchecked: UncheckedAttestation) -> Option; } } } diff --git a/consensus/src/block_import.rs b/consensus/src/block_import.rs index d2b2763e..36b89330 100644 --- a/consensus/src/block_import.rs +++ b/consensus/src/block_import.rs @@ -58,6 +58,10 @@ impl, C> BlockImport for ShasperBlockImport where { type Error = ConsensusError; + fn check_block(&self, hash: B::Hash, parent_hash: B::Hash) -> Result { + self.client.check_block(hash, parent_hash) + } + fn import_block(&self, mut block: ImportBlock, new_authorities: Option>) -> Result { @@ -152,7 +156,7 @@ impl LatestAttestations { .clone() .into_iter() .map(|leaf| { - client.runtime_api().last_justified_slot(&BlockId::Hash(leaf)).map(|slot| (leaf, slot)) + client.runtime_api().justified_slot(&BlockId::Hash(leaf)).map(|slot| (leaf, slot)) }) .collect::>()?; @@ -161,12 +165,12 @@ impl LatestAttestations { .map(|(hleaf, hslot)| { let mut header = client.header(BlockId::Hash(hleaf))? .expect("Leaf header must exist; qed"); - let mut slot = client.runtime_api().slot(&BlockId::Hash(hleaf))?; + let mut slot = client.runtime_api().slot(&BlockId::Hash(hleaf))? - 1; while slot > hslot { header = client.header(BlockId::Hash(*header.parent_hash()))? .expect("Leaf's parent must exist; qed"); - slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))?; + slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))? - 1; } Ok(header.hash()) @@ -174,16 +178,16 @@ impl LatestAttestations { .map_or(Ok(None), |v: ::client::error::Result| v.map(Some))?; let chain_head_hash = client.best_block_header()?.hash(); - let last_finalized_slot = client.runtime_api().last_finalized_slot(&BlockId::Hash(chain_head_hash))?; + let last_finalized_slot = client.runtime_api().finalized_slot(&BlockId::Hash(chain_head_hash))?; let last_finalized_hash = { let mut header = client.header(*current)? .expect("Chain head header must exist; qed"); - let mut slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))?; + let mut slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))? - 1; while slot > last_finalized_slot { header = client.header(BlockId::Hash(*header.parent_hash()))? .expect("Chain head's parent must exist; qed"); - slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))?; + slot = client.runtime_api().slot(&BlockId::Hash(header.hash()))? - 1; } header.hash() diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs index ffa20066..015a5d83 100644 --- a/consensus/src/lib.rs +++ b/consensus/src/lib.rs @@ -39,11 +39,13 @@ use consensus_common::import_queue::{Verifier, BasicQueue}; use client::{blockchain::HeaderBackend, ChainHead}; use client::backend::AuxStore; use client::block_builder::api::BlockBuilder as BlockBuilderApi; +use runtime::utils::epoch_to_slot; use runtime_primitives::{generic::BlockId, Justification, RuntimeString}; use runtime_primitives::traits::{Block, Header, Digest, DigestItemFor, DigestItem, ProvideRuntimeApi}; use primitives::{ValidatorId, H256, Slot}; use aura_slots::{SlotCompatible, CheckedHeader, SlotWorker, SlotInfo}; use inherents::InherentDataProviders; +use casper::Attestation; use futures::{Future, IntoFuture, future}; use tokio::timer::Timeout; @@ -93,17 +95,17 @@ impl CompatibleExtrinsic for runtime::UncheckedExtrinsic { { match self { &runtime::UncheckedExtrinsic::Attestation(ref attestation) => { - let validators = match client.runtime_api().validator_ids_from_attestation(id, attestation) { - Ok(validators) => validators, + let checked = match client.runtime_api().check_attestation(id, attestation.clone()) { + Ok(checked) => checked?, Err(_) => return None, }; - Some(validators + Some(checked + .validator_ids() .into_iter() - .map(|v| (v, (attestation.justified_slot, attestation.justified_block_hash))) + .map(|v| (v, (epoch_to_slot(attestation.data.target_epoch), attestation.data.target_epoch_block_hash))) .collect()) }, - _ => None, } } } @@ -257,10 +259,11 @@ impl SlotWorker for ShasperWorker where } }; + let remaining_duration = slot_info.remaining_duration(); // deadline our production to approx. the end of the // slot Timeout::new( - proposer.propose(slot_info.inherent_data).into_future(), + proposer.propose(slot_info.inherent_data, remaining_duration).into_future(), utils::time_until_next(Duration::from_secs(timestamp), slot_duration), ) } else { diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 80de7f14..fbc8ca27 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -18,9 +18,10 @@ ssz = { path = "../util/ssz", default-features = false } ssz-hash = { path = "../util/ssz-hash", default-features = false } ssz-derive = { path = "../util/ssz-derive", default-features = false } ssz-hash-derive = { path = "../util/ssz-hash-derive", default-features = false } -hash-db = { version = "0.9", default-features = false } +hash-db = { version = "0.11", default-features = false } keccak-hasher = { path = "../util/keccak-hasher", default-features = false } byteorder = { version = "1.2", default-features = false } +casper = { path = "../casper", default-features = false } [features] default = ["std"] @@ -41,4 +42,5 @@ std = [ "hash-db/std", "keccak-hasher/std", "byteorder/std", + "casper/std", ] diff --git a/primitives/src/attestation.rs b/primitives/src/attestation.rs index 05cd1860..738ac318 100644 --- a/primitives/src/attestation.rs +++ b/primitives/src/attestation.rs @@ -1,105 +1,78 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use ssz_derive::{SszEncode, SszDecode}; -use ssz_hash_derive::SszHash; -use codec_derive::{Encode, Decode}; use rstd::prelude::*; - +use codec_derive::{Encode, Decode}; #[cfg(feature = "std")] use serde_derive::{Serialize, Deserialize}; +use casper::{Attestation, BeaconAttestation}; +use crate::{Slot, Hash, Epoch, ValidatorId, Signature}; -use super::{H256, ValidatorId, ShardId, BitField, Signature}; -use hash_db::Hasher; -use keccak_hasher::KeccakHasher; +#[derive(Eq, PartialEq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] +pub struct UnsignedAttestation { + pub slot: Slot, + pub slot_block_hash: Hash, + pub source_epoch: Epoch, + pub source_epoch_block_hash: Hash, + pub target_epoch: Epoch, + pub target_epoch_block_hash: Hash, + pub validator_index: u32, +} -#[derive(Clone, PartialEq, Eq, Decode, Encode, SszEncode, SszDecode, SszHash)] +#[derive(Eq, PartialEq, Clone, Encode, Decode)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] -#[ssz_codec(sorted)] -pub struct AttestationRecord { - pub slot: u64, - pub shard_id: ShardId, - pub oblique_parent_hashes: Vec, - pub shard_block_hash: H256, - pub attester_bitfield: BitField, - pub justified_slot: u64, - pub justified_block_hash: H256, - pub aggregate_sig: Signature, +pub struct UncheckedAttestation { + pub data: UnsignedAttestation, + pub signature: Signature, } -impl Default for AttestationRecord { - fn default() -> Self { - Self { - slot: 0, - shard_id: 0, - oblique_parent_hashes: Vec::new(), - shard_block_hash: H256::default(), - attester_bitfield: BitField::new(0), - justified_slot: 0, - justified_block_hash: H256::default(), - aggregate_sig: Signature::default(), - } - } +#[derive(Eq, PartialEq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] +pub struct CheckedAttestation { + pub data: UnsignedAttestation, + pub is_slot_canon: bool, + pub is_source_canon: bool, + pub is_target_canon: bool, + pub validator_id: ValidatorId, + pub inclusion_distance: Slot, } -impl AttestationRecord { - pub fn message(&self, parent_hashes: &[H256]) -> H256 { - use byteorder::{ByteOrder, BigEndian}; +impl Attestation for CheckedAttestation { + type ValidatorId = ValidatorId; + type ValidatorIdIterator = Vec; + type Epoch = Epoch; - let mut attestation_slot_bytes = [0u8; 8]; - BigEndian::write_u64(&mut attestation_slot_bytes, self.slot); + fn validator_ids(&self) -> Vec { + vec![self.validator_id] + } - let mut shard_id_bytes = [0u8; 2]; - BigEndian::write_u16(&mut shard_id_bytes, self.shard_id); + fn is_source_canon(&self) -> bool { + self.is_source_canon + } - let mut justified_slot_bytes = [0u8; 8]; - BigEndian::write_u64(&mut justified_slot_bytes, self.justified_slot); + fn is_target_canon(&self) -> bool { + self.is_target_canon + } - let mut v = Vec::new(); - for b in &attestation_slot_bytes { - v.push(*b); - } - for hash in parent_hashes { - for b in hash.as_ref() { - v.push(*b); - } - } - for b in &shard_id_bytes { - v.push(*b); - } - for b in self.shard_block_hash.as_ref() { - v.push(*b); - } - for b in &justified_slot_bytes { - v.push(*b); - } + fn source_epoch(&self) -> Epoch { + self.data.source_epoch + } - KeccakHasher::hash(&v) + fn target_epoch(&self) -> Epoch { + self.data.target_epoch } +} + +impl BeaconAttestation for CheckedAttestation { + type Slot = Slot; - pub fn verify_signatures(&self, parent_hashes: &[H256], pubkeys: &[ValidatorId]) { - let sig = self.aggregate_sig.into_aggregate_signature().expect("Signature decoding failed, attestation is invalid"); - let message = self.message(parent_hashes); + fn slot(&self) -> Slot { + self.data.slot + } - let mut inputs = Vec::new(); - for pubkey in pubkeys { - let pubkey = pubkey.into_public().expect("Public key provided is invalid"); - inputs.push((pubkey, message.as_ref().to_vec())); - } + fn is_slot_canon(&self) -> bool { + self.is_slot_canon + } - assert!(sig.verify(&inputs.iter().map(|(p, m)| (p, &m[..])).collect::>())); + fn inclusion_distance(&self) -> Slot { + self.inclusion_distance } } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index b8652da3..f0105b74 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -22,41 +22,37 @@ extern crate parity_codec_derive as codec_derive; mod authority_id; mod bitfield; -mod attestation; mod signature; +mod attestation; pub use crypto; pub use signature::{H768, Signature}; pub use authority_id::{H384, AuthorityId}; pub use bitfield::BitField; -pub use attestation::AttestationRecord; +pub use attestation::{UnsignedAttestation, UncheckedAttestation, CheckedAttestation}; pub use substrate_primitives::{storage, H256, OpaqueMetadata, Blake2Hasher}; #[cfg(feature = "std")] pub use substrate_primitives::bytes; -pub type ShardId = u16; - /// Shasper validator public key. pub type ValidatorId = AuthorityId; -/// Alias to Ed25519 pubkey that identifies an account on the chain. -pub type AccountId = substrate_primitives::H256; - /// A hash of some data used by the chain. pub type Hash = substrate_primitives::H256; /// Index of a block number in the chain. pub type BlockNumber = u64; -/// Index of an account's extrinsic in the chain. -pub type Nonce = u64; - /// Count value in Shasper. pub type Count = u64; /// Slot value in Shapser. pub type Slot = u64; -pub type EthereumAddress = substrate_primitives::H160; +/// Epoch value in Shasper. +pub type Epoch = u64; + +/// Balance value in Shasper. +pub type Balance = u128; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 8c326ebd..378d8085 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -30,9 +30,10 @@ ssz-hash = { path = "../util/ssz-hash", default-features = false } ssz-derive = { path = "../util/ssz-derive", default-features = false } ssz-hash-derive = { path = "../util/ssz-hash-derive", default-features = false } byteorder = { version = "1.2", default-features = false } -hash-db = { version = "0.9", default-features = false } +hash-db = { version = "0.11", default-features = false } crypto = { package = "shasper-crypto", path = "../crypto", default-features = false } shuffling = { path = "../util/shuffling", default-features = false } +casper = { path = "../casper", default-features = false } [features] default = ["std"] @@ -63,4 +64,5 @@ std = [ "crypto/std", "shuffling/std", "aura-primitives/std", + "casper/std", ] diff --git a/runtime/src/consts.rs b/runtime/src/consts.rs index 8dd4f443..0e9fdd63 100644 --- a/runtime/src/consts.rs +++ b/runtime/src/consts.rs @@ -14,16 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -pub const CYCLE_LENGTH: usize = 64; -pub const MIN_COMMITTEE_SIZE: usize = 128; -pub const SHARD_COUNT: u16 = 1024; -pub const WEI_PER_ETH: u128 = 1000000000000000000; -pub const BASE_REWARD_QUOTIENT: u128 = 32768; -pub const SQRT_E_DROP_TIME: u128 = 1048576; -pub const SLOT_DURATION: u128 = 8; -pub const MIN_DYNASTY_LENGTH: u64 = 256; +use primitives::{Slot, Balance}; -pub const TIMESTAMP_POSITION: u32 = 0; -pub const SLOT_POSITION: u32 = 1; -pub const RANDAO_REVEAL_POSITION: u32 = 2; -pub const POW_CHAIN_REF_POSITION: u32 = 3; +pub const CYCLE_LENGTH: Slot = 64; +pub const BASE_REWARD_QUOTIENT: Balance = 32; +pub const INACTIVITY_PENALTY_QUOTIENT: Balance = 16777216; +pub const INCLUDER_REWARD_QUOTIENT: Balance = 8; +pub const MIN_ATTESTATION_INCLUSION_DELAY: Slot = 4; +pub const WHISTLEBLOWER_REWARD_QUOTIENT: Balance = 512; diff --git a/runtime/src/extrinsic.rs b/runtime/src/extrinsic.rs index 97c3971b..70af3087 100644 --- a/runtime/src/extrinsic.rs +++ b/runtime/src/extrinsic.rs @@ -14,9 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use primitives::H256; +use primitives::UncheckedAttestation; use runtime_primitives::traits::{Extrinsic as ExtrinsicT}; -use crate::AttestationRecord; use codec_derive::{Encode, Decode}; #[cfg(feature = "std")] @@ -25,64 +24,13 @@ use serde_derive::{Serialize, Deserialize}; #[derive(Decode, Encode, Clone, Eq, PartialEq)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] pub enum UncheckedExtrinsic { - Timestamp(u64), - Slot(u64), - RandaoReveal(H256), - PowChainRef(H256), - Attestation(AttestationRecord) -} - -impl UncheckedExtrinsic { - pub fn timestamp(self) -> Option { - match self { - UncheckedExtrinsic::Timestamp(v) => Some(v), - _ => None, - } - } - - pub fn slot(self) -> Option { - match self { - UncheckedExtrinsic::Slot(v) => Some(v), - _ => None, - } - } - - pub fn randao_reveal(self) -> Option { - match self { - UncheckedExtrinsic::RandaoReveal(v) => Some(v), - _ => None, - } - } - - pub fn pow_chain_ref(self) -> Option { - match self { - UncheckedExtrinsic::PowChainRef(v) => Some(v), - _ => None, - } - } - - pub fn attestation(self) -> Option { - match self { - UncheckedExtrinsic::Attestation(v) => Some(v), - _ => None, - } - } -} - -impl Default for UncheckedExtrinsic { - fn default() -> UncheckedExtrinsic { - UncheckedExtrinsic::Attestation(AttestationRecord::default()) - } + Attestation(UncheckedAttestation) } impl ExtrinsicT for UncheckedExtrinsic { fn is_signed(&self) -> Option { match self { - UncheckedExtrinsic::Timestamp(_) => Some(false), - UncheckedExtrinsic::Slot(_) => Some(false), - UncheckedExtrinsic::RandaoReveal(_) => Some(false), - UncheckedExtrinsic::PowChainRef(_) => Some(false), - UncheckedExtrinsic::Attestation(_) => None, + UncheckedExtrinsic::Attestation(_) => Some(true), } } } diff --git a/runtime/src/genesis.rs b/runtime/src/genesis.rs index c000af48..0e7b329a 100644 --- a/runtime/src/genesis.rs +++ b/runtime/src/genesis.rs @@ -15,18 +15,16 @@ // along with Substrate. If not, see . use runtime_primitives::{BuildStorage, StorageMap, ChildrenStorageMap}; -use primitives::{ValidatorId, storage::well_known_keys}; -use runtime_io::twox_128; +use primitives::{ValidatorId, Epoch, Balance, storage::well_known_keys}; use codec::{Encode, KeyedVec}; -use crate::state::{ActiveState, CrystallizedState}; -use crate::validators::{ValidatorRecord, ShardAndCommittee}; -use crate::consts; +use crate::storage; +use crate::state::ValidatorRecord; use serde_derive::{Serialize, Deserialize}; #[derive(Serialize, Deserialize)] pub struct GenesisConfig { - pub authorities: Vec, + pub authorities: Vec<(ValidatorId, Balance)>, pub code: Vec, } @@ -34,50 +32,20 @@ impl BuildStorage for GenesisConfig { fn build_storage(self) -> Result<(StorageMap, ChildrenStorageMap), String> { let mut storage = StorageMap::default(); - storage.insert(well_known_keys::EXTRINSIC_INDEX.to_vec(), 0u32.encode()); storage.insert(well_known_keys::CODE.to_vec(), self.code.clone()); let auth_count = self.authorities.len() as u32; - self.authorities.iter().enumerate().for_each(|(i, v)| { - storage.insert((i as u32).to_keyed_vec(well_known_keys::AUTHORITY_PREFIX), v.encode()); - }); - storage.insert(well_known_keys::AUTHORITY_COUNT.to_vec(), auth_count.encode()); - - let mut active = ActiveState::default(); - for _ in 0..consts::CYCLE_LENGTH { - active.recent_block_hashes.push(Default::default()); - } - storage.insert(twox_128(b"sys:active").to_vec(), active.encode()); - - let start_time = match ::std::time::SystemTime::now().duration_since(::std::time::SystemTime::UNIX_EPOCH) { - Ok(start_time) => start_time.as_secs(), - Err(e) => return Err(format!("{:?}", e)), - }; - storage.insert(twox_128(b"sys:startslot").to_vec(), (start_time / 10).encode()); - - let mut crystallized = CrystallizedState::default(); - for authority in self.authorities.clone() { - let validator = ValidatorRecord { - pubkey: authority, - withdrawal_shard: 0, - withdrawal_address: Default::default(), - randao_commitment: Default::default(), - balance: 50000 * consts::WEI_PER_ETH, - start_dynasty: 0, - end_dynasty: u64::max_value() - 1, + self.authorities.iter().enumerate().for_each(|(i, (v, b))| { + let record = ValidatorRecord { + valid_from: 0, + valid_to: Epoch::max_value(), + balance: *b, + validator_id: *v, }; - crystallized.validators.push(validator); - } - let committee: Vec = self.authorities.iter().enumerate().map(|(k, _)| k as u32).collect(); - let mut shards_and_committees_for_slot = Vec::new(); - shards_and_committees_for_slot.push(ShardAndCommittee { - shard_id: 0, - committee: committee.clone(), + + storage.insert((i as u32).to_keyed_vec(storage::VALIDATORS_PREFIX), Some(record).encode()); }); - for _ in 0..(2 * consts::CYCLE_LENGTH) { - crystallized.shards_and_committees_for_slots.push(shards_and_committees_for_slot.clone()); - } - storage.insert(twox_128(b"sys:crystallized").to_vec(), crystallized.encode()); + storage.insert(b"len".to_keyed_vec(storage::VALIDATORS_PREFIX), auth_count.encode()); Ok((storage, Default::default())) } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index e22ae434..729dc536 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -29,16 +29,13 @@ extern crate substrate_client as client; mod genesis; mod storage; mod consts; -pub mod spec; mod extrinsic; -mod validators; -mod state; -mod utils; mod digest; -pub mod validation; +mod state; +pub mod utils; use rstd::prelude::*; -use primitives::{Slot, H256, ValidatorId, OpaqueMetadata}; +use primitives::{BlockNumber, ValidatorId, OpaqueMetadata, Hash, UncheckedAttestation, CheckedAttestation}; use client::block_builder::api::runtime_decl_for_BlockBuilder::BlockBuilder; use runtime_primitives::{ ApplyResult, transaction_validity::TransactionValidity, generic, @@ -49,30 +46,24 @@ use client::{ block_builder::api as block_builder_api, runtime_api as client_api }; -use inherents::{CheckInherentsResult, InherentData, MakeFatalError}; -use runtime_support::StorageMap; +use inherents::{CheckInherentsResult, InherentData}; +use runtime_support::storage::StorageValue; use runtime_support::storage::unhashed::StorageVec; use consensus_primitives::api as consensus_api; use runtime_version::RuntimeVersion; #[cfg(feature = "std")] use runtime_version::NativeVersion; use codec::Encode; -use keccak_hasher::KeccakHasher; -use spec::SpecHeader; -use ssz_hash::SpecHash; use client::impl_runtime_apis; +use casper::store::ValidatorStore; +use state::Store; // A few exports that help ease life for downstream crates. #[cfg(any(feature = "std", test))] pub use runtime_primitives::BuildStorage; -pub use runtime_primitives::{Permill, Perbill}; -pub use runtime_support::StorageValue; #[cfg(feature = "std")] pub use genesis::GenesisConfig; pub use extrinsic::UncheckedExtrinsic; -pub use primitives::{AttestationRecord, BlockNumber}; -pub use validators::{ValidatorRecord, ShardAndCommittee}; -pub use state::{CrosslinkRecord, ActiveState, BlockVoteInfo, CrystallizedState}; pub use digest::DigestItem; /// This runtime version. @@ -121,7 +112,10 @@ impl_runtime_apis! { } fn authorities() -> Vec { - ::items() + let store = Store; + + let current_slot = storage::Number::get(); + store.active_validators(current_slot) } fn execute_block(block: Block) { @@ -135,10 +129,13 @@ impl_runtime_apis! { } fn initialise_block(header: &::Header) { - ::put(header.number); - ::put(header.parent_hash); - ::put(header.extrinsics_root); - ::put(header.digest.clone()); + storage::Number::put(header.number); + storage::ParentHash::put(header.parent_hash); + storage::ExtrinsicsRoot::put(header.extrinsics_root); + storage::Digest::put(header.digest.clone()); + storage::ExtrinsicsRoot::put(Hash::from(BlakeTwo256::enumerated_trie_root(&[]))); + + storage::note_parent_hash(); } } @@ -150,98 +147,75 @@ impl_runtime_apis! { impl block_builder_api::BlockBuilder for Runtime { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyResult { - let extrinsic_index = ::count(); - - if extrinsic_index == consts::TIMESTAMP_POSITION { - ::put(extrinsic.clone().timestamp().expect("Invalid timestamp")); - } else if extrinsic_index == consts::SLOT_POSITION { - let start_slot = ::get(); - let parent_slot = ::get(); - ::put(parent_slot); - ::put(extrinsic.clone().slot().expect("Invalid slot") - start_slot); - } else if extrinsic_index == consts::RANDAO_REVEAL_POSITION { - ::put(extrinsic.clone().randao_reveal().expect("Invalid randao reveal")); - } else if extrinsic_index == consts::POW_CHAIN_REF_POSITION { - ::put(extrinsic.clone().pow_chain_ref().expect("Invalid pow chain ref")); - } else { - let attestation = extrinsic.clone().attestation().expect("Invalid attestation"); - let mut attestations = ::items(); - attestations.push(attestation); - ::set_items(attestations); - } + let _extrinsic_index = ::count(); let mut extrinsics = ::items(); - extrinsics.push(extrinsic); + extrinsics.push(Some(extrinsic.clone())); let extrinsics_data: Vec> = extrinsics.iter().map(Encode::encode).collect(); let extrinsics_root = BlakeTwo256::enumerated_trie_root(&extrinsics_data.iter().map(Vec::as_slice).collect::>()); - ::put(H256::from(extrinsics_root)); + ::put(Hash::from(extrinsics_root)); ::set_items(extrinsics); + match extrinsic { + UncheckedExtrinsic::Attestation(attestation) => { + let checked = state::check_attestation(attestation).expect("Extrinsic is invalid."); + let casper = storage::CasperContext::get(); + if !casper.validate_attestation(&checked) { + panic!("Extrinsic does not pass casper check."); + } + storage::PendingAttestations::set_item(storage::PendingAttestations::count(), &Some(checked)); + }, + } + Ok(ApplyOutcome::Success) } fn finalise_block() -> ::Header { + let mut store = Store; + let number = ::get(); + + if number % consts::CYCLE_LENGTH == 0 { + let mut casper = storage::CasperContext::get(); + let beacon_rewards = casper::reward::beacon_rewards(&store); + let casper_rewards = casper::reward::casper_rewards(&casper, &store); + let actions = casper::reward::default_scheme_rewards( + &store, + &beacon_rewards, + &casper_rewards, + casper.epoch - casper.finalized_epoch, + &casper::reward::DefaultSchemeConfig { + base_reward_quotient: consts::BASE_REWARD_QUOTIENT, + inactivity_penalty_quotient: consts::INACTIVITY_PENALTY_QUOTIENT, + includer_reward_quotient: consts::INCLUDER_REWARD_QUOTIENT, + min_attestation_inclusion_delay: consts::MIN_ATTESTATION_INCLUSION_DELAY, + whistleblower_reward_quotient: consts::WHISTLEBLOWER_REWARD_QUOTIENT, + }, + ); + + for action in actions { + use casper::reward::RewardAction; + + match action { + (validator_id, RewardAction::Add(balance)) => + storage::add_balance(&validator_id, balance), + (validator_id, RewardAction::Sub(balance)) => + storage::sub_balance(&validator_id, balance), + (validator_id, RewardAction::Penalize(balance)) => + storage::penalize_validator(&validator_id, balance) + } + } + + casper.advance_epoch(&mut store); + } + ::set_count(0); - let number = ::take(); - let extrinsics_root = ::take(); + ::take(); let parent_hash = ::take(); + let extrinsics_root = ::take(); let digest = ::take(); - let _timestamp = ::take(); - let slot = ::get(); - let parent_slot = ::get(); - let parent_header_hash = ::get(); - let randao_reveal = ::take(); - let pow_chain_ref = ::take(); - let attestations = ::items(); - - ::set_count(0); - - let mut active_state = ::get(); - let mut crystallized_state = ::get(); - - if number == 1 { - crystallized_state.last_state_recalc = slot; - } - - validation::validate_block_pre_processing_conditions(); - active_state.update_recent_block_hashes(parent_slot, slot, parent_header_hash); - - validation::process_block::( - slot, - parent_slot, - &crystallized_state, - &mut active_state, - &attestations - ); - - validation::process_cycle_transitions::( - slot, - parent_header_hash, - &mut crystallized_state, - &mut active_state - ); - - let active_state_root = active_state.spec_hash::(); - let crystallized_state_root = crystallized_state.spec_hash::(); - - let spec_header = SpecHeader { - randao_reveal, attestations, pow_chain_ref, - active_state_root, crystallized_state_root, - slot_number: slot, - parent_hash: parent_header_hash, - }; - let block_hash = ssz_hash::SpecHash::spec_hash::(&spec_header); - - ::insert(slot, block_hash); - ::put(&active_state); - ::put(&active_state_root); - ::put(&crystallized_state); - ::put(&crystallized_state_root); - ::put(&block_hash); - let state_root = BlakeTwo256::storage_root(); Header { @@ -249,95 +223,12 @@ impl_runtime_apis! { } } - fn inherent_extrinsics(data: InherentData) -> Vec<::Extrinsic> { - let data = data.get_data::( - &consensus_primitives::INHERENT_IDENTIFIER - ) - .expect("Decode inherent data failed") - .expect("Inherent does not exist"); - - let mut inherent = Vec::new(); - - inherent.push( - (consts::TIMESTAMP_POSITION, UncheckedExtrinsic::Timestamp(data.timestamp)) - ); - - inherent.push( - (consts::SLOT_POSITION, UncheckedExtrinsic::Slot(data.slot)) - ); - - inherent.push( - (consts::RANDAO_REVEAL_POSITION, UncheckedExtrinsic::RandaoReveal(Default::default())) - ); - - inherent.push( - (consts::POW_CHAIN_REF_POSITION, UncheckedExtrinsic::PowChainRef(Default::default())) - ); - - inherent.as_mut_slice().sort_unstable_by_key(|v| v.0); - inherent.into_iter().map(|v| v.1).collect() + fn inherent_extrinsics(_data: InherentData) -> Vec<::Extrinsic> { + Default::default() } - fn check_inherents(block: Block, _data: InherentData) -> CheckInherentsResult { - let mut result = CheckInherentsResult::new(); - - if block.extrinsics() - .get(consts::TIMESTAMP_POSITION as usize) - .and_then(|xt: &UncheckedExtrinsic| match xt { - UncheckedExtrinsic::Timestamp(ref t) => Some(t.clone()), - _ => None, - }).is_none() - { - result.put_error( - consensus_primitives::INHERENT_IDENTIFIER, - &MakeFatalError::from(()) - ).expect("Putting error failed"); - return result; - } - - if block.extrinsics() - .get(consts::SLOT_POSITION as usize) - .and_then(|xt: &UncheckedExtrinsic| match xt { - UncheckedExtrinsic::Slot(ref t) => Some(t.clone()), - _ => None, - }).is_none() - { - result.put_error( - consensus_primitives::INHERENT_IDENTIFIER, - &MakeFatalError::from(()) - ).expect("Putting error failed"); - return result; - } - - if block.extrinsics() - .get(consts::RANDAO_REVEAL_POSITION as usize) - .and_then(|xt: &UncheckedExtrinsic| match xt { - UncheckedExtrinsic::RandaoReveal(ref t) => Some(t.clone()), - _ => None, - }).is_none() - { - result.put_error( - consensus_primitives::INHERENT_IDENTIFIER, - &MakeFatalError::from(()) - ).expect("Putting error failed"); - return result; - } - - if block.extrinsics() - .get(consts::POW_CHAIN_REF_POSITION as usize) - .and_then(|xt: &UncheckedExtrinsic| match xt { - UncheckedExtrinsic::PowChainRef(ref t) => Some(t.clone()), - _ => None, - }).is_none() - { - result.put_error( - consensus_primitives::INHERENT_IDENTIFIER, - &MakeFatalError::from(()) - ).expect("Putting error failed"); - return result; - } - - result + fn check_inherents(_block: Block, _data: InherentData) -> CheckInherentsResult { + CheckInherentsResult::new() } fn random_seed() -> ::Hash { @@ -346,7 +237,17 @@ impl_runtime_apis! { } impl client_api::TaggedTransactionQueue for Runtime { - fn validate_transaction(_tx: ::Extrinsic) -> TransactionValidity { + fn validate_transaction(tx: ::Extrinsic) -> TransactionValidity { + match tx { + UncheckedExtrinsic::Attestation(attestation) => { + let checked = state::check_attestation(attestation).expect("Extrinsic is invalid."); + let casper = storage::CasperContext::get(); + if !casper.validate_attestation(&checked) { + panic!("Extrinsic does not pass casper check."); + } + }, + } + TransactionValidity::Valid { priority: 0, requires: Vec::new(), @@ -363,28 +264,32 @@ impl_runtime_apis! { } impl consensus_api::ShasperApi for Runtime { - fn slot() -> Slot { - ::get() + fn finalized_epoch() -> u64 { + let casper = storage::CasperContext::get(); + casper.finalized_epoch + } + + fn justified_epoch() -> u64 { + let casper = storage::CasperContext::get(); + casper.justified_epoch } - fn validator_ids_from_attestation(attestation: &AttestationRecord) -> Vec { - let crystallized_state = ::get(); - let attestation_indices = crystallized_state.attestation_indices(attestation); + fn slot() -> u64 { + storage::Number::get() + } - attestation_indices - .iter() - .enumerate() - .filter(|(i, _)| attestation.attester_bitfield.has_voted(*i)) - .map(|(_, index)| crystallized_state.validators[*index].pubkey.clone()) - .collect() + fn finalized_slot() -> u64 { + let casper = storage::CasperContext::get(); + utils::epoch_to_slot(casper.finalized_epoch) } - fn last_finalized_slot() -> u64 { - ::get().last_finalized_slot + fn justified_slot() -> u64 { + let casper = storage::CasperContext::get(); + utils::epoch_to_slot(casper.justified_epoch) } - fn last_justified_slot() -> u64 { - ::get().last_justified_slot + fn check_attestation(unchecked: UncheckedAttestation) -> Option { + state::check_attestation(unchecked) } } } diff --git a/runtime/src/spec.rs b/runtime/src/spec.rs deleted file mode 100644 index 1d4187f7..00000000 --- a/runtime/src/spec.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use primitives::H256; -use rstd::prelude::Vec; -use super::AttestationRecord; - -use ssz_derive::{SszEncode, SszDecode}; -use ssz_hash_derive::SszHash; - -#[derive(Clone, PartialEq, Eq, Default, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct SpecHeader { - pub parent_hash: H256, - pub slot_number: u64, - pub randao_reveal: H256, - pub attestations: Vec, - pub pow_chain_ref: H256, - pub active_state_root: H256, - pub crystallized_state_root: H256, -} diff --git a/runtime/src/state.rs b/runtime/src/state.rs index 2c5d1e1f..46f83e09 100644 --- a/runtime/src/state.rs +++ b/runtime/src/state.rs @@ -1,211 +1,113 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use primitives::H256; use rstd::prelude::*; - -use crate::consts::CYCLE_LENGTH; -use crate::AttestationRecord; -use crate::validators::{ValidatorRecord, ShardAndCommittee}; -use crate::utils; -use shuffling; - +use primitives::{Epoch, Balance, ValidatorId, UncheckedAttestation, CheckedAttestation}; +use runtime_support::storage::StorageValue; +use runtime_support::storage::unhashed::StorageVec; +use codec::Encode; use codec_derive::{Encode, Decode}; -use ssz_derive::{SszEncode, SszDecode}; -use ssz_hash_derive::SszHash; - -#[derive(Encode, Decode, Default, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct CrosslinkRecord { - pub dynasty: u64, - pub slot: u64, - pub hash: H256, +use casper::store::{ValidatorStore, PendingAttestationsStore, BlockStore}; +use crate::{storage, utils}; + +#[derive(Encode, Decode, PartialEq, Eq, Clone)] +pub struct ValidatorRecord { + pub valid_from: Epoch, + pub valid_to: Epoch, + pub balance: Balance, + pub validator_id: ValidatorId, } -#[derive(Encode, Decode, Default, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct ActiveState { - pub pending_attestations: Vec, - pub recent_block_hashes: Vec, -} +pub struct Store; -#[derive(Encode, Decode, Default)] -#[cfg_attr(feature = "std", derive(Debug))] -pub struct BlockVoteInfo { - pub voter_indices: Vec, - pub total_voter_deposits: u128, -} +impl ValidatorStore for Store { + type ValidatorId = ValidatorId; + type ValidatorIdIterator = Vec; + type Balance = Balance; + type Epoch = Epoch; -impl ActiveState { - pub fn block_hash(&self, current_slot: u64, target_slot: u64) -> H256 { - let current_slot = current_slot as usize; - let target_slot = target_slot as usize; + fn total_balance(&self, validators: &[ValidatorId]) -> Balance { + let mut total_balance = 0; - let sback = current_slot.saturating_sub(CYCLE_LENGTH * 2); - assert!(sback <= target_slot && target_slot > sback + CYCLE_LENGTH * 2); - self.recent_block_hashes[target_slot - sback] + for validator_id in validators { + if let Some(Some(validator)) = storage::Validators::items().iter().find(|v| v.as_ref().map(|v| &v.validator_id == validator_id).unwrap_or(false)) { + total_balance += validator.balance; + } + } + + total_balance } - pub fn block_hashes(&self, current_slot: u64, target_from_slot: u64, target_to_slot: u64) -> Vec { + fn active_validators(&self, epoch: Epoch) -> Vec { let mut ret = Vec::new(); - for target_slot in target_from_slot..(target_to_slot + 1) { - ret.push(self.block_hash(current_slot, target_slot)); + + for validator in storage::Validators::items() { + if let Some(validator) = validator { + if validator.valid_from <= epoch && epoch <= validator.valid_to { + ret.push(validator.validator_id); + } + } } - ret - } - pub fn block_hashes_to_sign(&self, current_slot: u64, current_hash: H256) -> Vec { - let mut ret = self.block_hashes( - current_slot, - current_slot.saturating_sub(CYCLE_LENGTH as u64 - 1), - current_slot.saturating_sub(1) - ); - ret.push(current_hash); ret } +} - pub fn signed_parent_block_hashes(&self, current_slot: u64, attestation: &AttestationRecord) -> Vec { - let mut ret = self.block_hashes( - current_slot, - attestation.slot.saturating_sub(CYCLE_LENGTH as u64 - 1), - attestation.slot - attestation.oblique_parent_hashes.len() as u64, - ); - ret.append(&mut attestation.oblique_parent_hashes.clone()); - ret - } +impl BlockStore for Store { + type Epoch = Epoch; - pub fn update_recent_block_hashes(&mut self, parent_slot: u64, current_slot: u64, parent_hash: H256) { - let d = (current_slot - parent_slot) as usize; - let mut ret = if d < self.recent_block_hashes.len() { - self.recent_block_hashes[d..].iter().cloned().collect::>() - } else { - Vec::new() - }; - for _ in 0..::rstd::cmp::min(d, self.recent_block_hashes.len()) { - ret.push(parent_hash); - } - self.recent_block_hashes = ret; + fn epoch(&self) -> Epoch { + let current_slot = storage::Number::get(); + utils::slot_to_epoch(current_slot) } } -#[derive(Encode, Decode, Default, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct CrystallizedState { - pub validators: Vec, - pub last_state_recalc: u64, - pub shards_and_committees_for_slots: Vec>, - pub last_justified_slot: u64, - pub justified_streak: u64, - pub last_finalized_slot: u64, - pub current_dynasty: u64, - pub crosslink_records: Vec, - pub dynasty_seed: H256, - pub dynasty_start: u64, -} - -impl CrystallizedState { - pub fn shards_and_committees_for_slot(&self, slot: u64) -> &[ShardAndCommittee] { - let slot = slot as usize; - let start = (self.last_state_recalc as usize).saturating_sub(CYCLE_LENGTH); - assert!(start <= slot && slot < start + CYCLE_LENGTH * 2); - &self.shards_and_committees_for_slots[slot - start] - } +impl PendingAttestationsStore for Store { + type Attestation = CheckedAttestation; + type AttestationIterator = Vec; - pub fn proposer_position(&self, parent_slot: u64) -> (usize, u16) { - let shard_and_committee = &self.shards_and_committees_for_slot(parent_slot)[0]; + fn attestations(&self) -> Vec { + let mut attestations = Vec::new(); - assert!(shard_and_committee.committee.len() > 0); - let proposer_index_in_committee = parent_slot as usize % shard_and_committee.committee.len(); + for attestation in storage::PendingAttestations::items() { + if let Some(attestation) = attestation { + attestations.push(attestation); + } + } - (proposer_index_in_committee, shard_and_committee.shard_id) + attestations } - pub fn attestation_indices(&self, attestation: &AttestationRecord) -> Vec { - self.shards_and_committees_for_slot(attestation.slot) - .iter() - .find(|x| x.shard_id == attestation.shard_id) - .map(|x| x.committee.iter().map(|i| *i as usize).collect()) - .unwrap_or_default() - } + fn retain bool>(&mut self, f: F) { + let mut attestations = self.attestations(); + attestations.retain(f); - pub fn active_validator_indices(&self) -> Vec { - self.validators - .iter() - .enumerate() - .filter(|(_, v)| v.start_dynasty <= self.current_dynasty && v.end_dynasty > self.current_dynasty) - .map(|(i, _)| i) - .collect() + storage::PendingAttestations::set_items(attestations.into_iter().map(|v| Some(v)).collect::>()); } +} - pub fn new_shuffling( - &self, - seed: H256, - crosslinking_start_shard: u16 - ) -> Vec> { - use crate::consts::{CYCLE_LENGTH, MIN_COMMITTEE_SIZE, SHARD_COUNT}; - - let avs = self.active_validator_indices(); - let (committees_per_slot, slots_per_committee) = if avs.len() >= CYCLE_LENGTH * MIN_COMMITTEE_SIZE { - let committees_per_slot = avs.len() / CYCLE_LENGTH / (MIN_COMMITTEE_SIZE * 2) + 1; - let slots_per_committee = 1; - (committees_per_slot, slots_per_committee) - } else { - let committees_per_slot = 1; - let mut slots_per_committee = 1; - while avs.len() * slots_per_committee < CYCLE_LENGTH * MIN_COMMITTEE_SIZE && - slots_per_committee < CYCLE_LENGTH - { - slots_per_committee *= 2; - } - (committees_per_slot, slots_per_committee) - }; - - let shuffled_active_validator_indices = shuffling::shuffle(seed.as_ref(), avs).expect("Shuffling failed, cannot build new block"); - let validators_per_slot = utils::split(shuffled_active_validator_indices, CYCLE_LENGTH); - - let mut ret = Vec::new(); - for (slot, slot_indices) in validators_per_slot.into_iter().enumerate() { - let shard_indices = utils::split(slot_indices, committees_per_slot); - let shard_id_start = crosslinking_start_shard + - (slot * committees_per_slot / slots_per_committee) as u16; - ret.push( - shard_indices - .into_iter() - .enumerate() - .map(|(j, indices)| { - ShardAndCommittee { - shard_id: (shard_id_start + j as u16) % SHARD_COUNT, - committee: indices.into_iter().map(|v| v as u32).collect(), - } - }) - .collect() - ); - } +pub fn check_attestation(unchecked: UncheckedAttestation) -> Option { + let signature = unchecked.signature.into_signature()?; + let validator_id = storage::Validators::item(unchecked.data.validator_index)?.validator_id; + let public = validator_id.into_public()?; + let current_slot = storage::Number::get(); - ret + if !public.verify(&unchecked.data.encode()[..], &signature) { + return None; } - pub fn total_deposits(&self) -> u128 { - self.active_validator_indices() - .iter() - .fold(0, |acc, index| { - acc + self.validators[*index].balance - }) + if current_slot >= unchecked.data.slot { + return None; } + + let is_slot_canon = storage::LatestBlockHashes::item(unchecked.data.slot as u32) == Some(unchecked.data.slot_block_hash); + let is_source_canon = storage::LatestBlockHashes::item(utils::epoch_to_slot(unchecked.data.source_epoch) as u32) == Some(unchecked.data.source_epoch_block_hash); + let is_target_canon = storage::LatestBlockHashes::item(utils::epoch_to_slot(unchecked.data.target_epoch) as u32) == Some(unchecked.data.target_epoch_block_hash); + let inclusion_distance = current_slot - unchecked.data.slot; + + Some(CheckedAttestation { + data: unchecked.data, + is_slot_canon, + is_source_canon, + is_target_canon, + validator_id, + inclusion_distance, + }) } diff --git a/runtime/src/storage.rs b/runtime/src/storage.rs index ea74353c..87128e60 100644 --- a/runtime/src/storage.rs +++ b/runtime/src/storage.rs @@ -14,48 +14,84 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use primitives::{H256, BlockNumber, Hash, ValidatorId}; -use primitives::storage::well_known_keys; +use primitives::{BlockNumber, Hash, Epoch, Balance, ValidatorId, CheckedAttestation}; use runtime_support::storage_items; -use runtime_support::storage::unhashed; -use crate::state::{ActiveState, CrystallizedState, BlockVoteInfo}; -use crate::{UncheckedExtrinsic, Digest as DigestT, AttestationRecord}; +use runtime_support::storage::StorageValue; +use runtime_support::storage::unhashed::{self, StorageVec}; +use crate::state::ValidatorRecord; +use crate::{UncheckedExtrinsic, Digest as DigestT, utils}; storage_items! { pub Number: b"sys:num" => default BlockNumber; pub ParentHash: b"sys:parenthash" => default Hash; pub ExtrinsicsRoot: b"sys:extrinsicsroot" => default Hash; pub Digest: b"sys:digest" => default DigestT; - pub Timestamp: b"sys:timestamp" => default u64; - pub Slot: b"sys:slot" => default u64; - pub ParentSlot: b"sys:parentslot" => default u64; - pub LastHeaderHash: b"sys:lasthash" => default H256; - pub RandaoReveal: b"sys:randaoreveal" => default H256; - pub PowChainRef: b"sys:powchainref" => default H256; - - pub StartSlot: b"sys:startslot" => default u64; - pub BlockHashesBySlot: b"sys:blockhashesbyslot" => map [ u64 => H256 ]; - pub Active: b"sys:active" => default ActiveState; - pub ActiveRoot: b"sys:activeroot" => default H256; - pub Crystallized: b"sys:crystallized" => default CrystallizedState; - pub CrystallizedRoot: b"sys:crystallizedroot" => default H256; - pub BlockVoteCache: b"sys:blockvotecache" => default map [ H256 => BlockVoteInfo ]; + pub CasperContext: b"sys:caspercontext" => default casper::CasperContext; } pub struct UncheckedExtrinsics; impl unhashed::StorageVec for UncheckedExtrinsics { - type Item = UncheckedExtrinsic; + type Item = Option; const PREFIX: &'static [u8] = b"sys:extrinsics"; } -pub struct Authorities; -impl unhashed::StorageVec for Authorities { - type Item = ValidatorId; - const PREFIX: &'static [u8] = well_known_keys::AUTHORITY_PREFIX; +pub struct LatestBlockHashes; +impl unhashed::StorageVec for LatestBlockHashes { + type Item = Option; + const PREFIX: &'static [u8] = b"sys:latestblockhashes"; } -pub struct Attestations; -impl unhashed::StorageVec for Attestations { - type Item = AttestationRecord; - const PREFIX: &'static [u8] = b"sys:attestations"; +pub struct PendingAttestations; +impl unhashed::StorageVec for PendingAttestations { + type Item = Option; + const PREFIX: &'static [u8] = b"sys:pendingattestations"; +} + +pub fn note_parent_hash() { + let slot = Number::get() - 1; + let hash = ParentHash::get(); + assert!(LatestBlockHashes::count() <= slot as u32); + for i in LatestBlockHashes::count()..(slot as u32) { + LatestBlockHashes::set_item(i, &None); + } + LatestBlockHashes::set_item(slot as u32, &Some(hash)); +} + +pub const VALIDATORS_PREFIX: &[u8] = b"sys:validators"; + +pub struct Validators; +impl unhashed::StorageVec for Validators { + type Item = Option; + const PREFIX: &'static [u8] = VALIDATORS_PREFIX; +} + +pub fn add_balance(validator_id: &ValidatorId, balance: Balance) { + if let Some((index, Some(mut record))) = Validators::items().into_iter() + .enumerate() + .find(|(_, record)| record.as_ref().map(|r| &r.validator_id == validator_id).unwrap_or(false)) + { + record.balance += balance; + Validators::set_item(index as u32, &Some(record)); + } +} + +pub fn sub_balance(validator_id: &ValidatorId, balance: Balance) { + if let Some((index, Some(mut record))) = Validators::items().into_iter() + .enumerate() + .find(|(_, record)| record.as_ref().map(|r| &r.validator_id == validator_id).unwrap_or(false)) + { + record.balance -= balance; + Validators::set_item(index as u32, &Some(record)); + } +} + +pub fn penalize_validator(validator_id: &ValidatorId, balance: Balance) { + if let Some((index, Some(mut record))) = Validators::items().into_iter() + .enumerate() + .find(|(_, record)| record.as_ref().map(|r| &r.validator_id == validator_id).unwrap_or(false)) + { + record.balance -= balance; + record.valid_to = utils::slot_to_epoch(Number::get()); + Validators::set_item(index as u32, &Some(record)); + } } diff --git a/runtime/src/utils.rs b/runtime/src/utils.rs index c4708689..1b674ca4 100644 --- a/runtime/src/utils.rs +++ b/runtime/src/utils.rs @@ -1,37 +1,10 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. +use primitives::{Slot, Epoch}; +use crate::consts; -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use rstd::prelude::*; - -pub fn split(list: Vec, n: usize) -> Vec> { - let mut ret = Vec::new(); - for i in 0..n { - let cur = list[(list.len() * i / n)..(list.len() * (i + 1) / n)] - .iter().cloned().collect(); - ret.push(cur); - } - ret +pub fn slot_to_epoch(slot: Slot) -> Epoch { + slot / consts::CYCLE_LENGTH } -pub fn sqrt(n: u128) -> u128 { - let mut x = n; - let mut y = (x + 1) / 2; - while y < x { - x = y; - y = (x + n / x) / 2; - } - x +pub fn epoch_to_slot(epoch: Epoch) -> Slot { + epoch * consts::CYCLE_LENGTH } diff --git a/runtime/src/validation.rs b/runtime/src/validation.rs deleted file mode 100644 index e1f15fbe..00000000 --- a/runtime/src/validation.rs +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use primitives::{H256, ShardId}; -use runtime_support::storage::StorageMap; -use rstd::prelude::*; -use rstd::collections::btree_map::BTreeMap; - -use crate::state::{ActiveState, CrystallizedState, BlockVoteInfo, CrosslinkRecord}; -use crate::AttestationRecord; -use crate::consts::{CYCLE_LENGTH, WEI_PER_ETH, BASE_REWARD_QUOTIENT, SQRT_E_DROP_TIME, SLOT_DURATION, MIN_DYNASTY_LENGTH, SHARD_COUNT}; -use crate::utils::sqrt; - -pub fn validate_block_pre_processing_conditions() { } - -pub fn validate_parent_block_proposer(slot: u64, parent_slot: u64, crystallized_state: &CrystallizedState, attestations: &[AttestationRecord]) { - if slot == 0 { - return; - } - - let (proposer_index_in_committee, shard_id) = crystallized_state.proposer_position(parent_slot); - - if attestations.len() == 0 { - return; - } - let attestation = &attestations[0]; - - assert!(attestation.shard_id == shard_id && - attestation.slot == parent_slot && - attestation.attester_bitfield.has_voted(proposer_index_in_committee)); -} - -pub fn validate_attestation>>( - slot: u64, - parent_slot: u64, - crystallized_state: &CrystallizedState, - active_state: &ActiveState, - attestation: &AttestationRecord -) { - assert!(attestation.slot <= parent_slot); - assert!(attestation.slot >= parent_slot.saturating_sub(CYCLE_LENGTH as u64 - 1)); - - assert!(attestation.justified_slot <= crystallized_state.last_justified_slot); - assert!(BlockHashesBySlot::get(attestation.justified_slot).expect("Justified block hash not found, attestation validation failed") == attestation.justified_block_hash); - - let parent_hashes = active_state.signed_parent_block_hashes(slot, attestation); - let attestation_indices = crystallized_state.attestation_indices(attestation); - - assert!(attestation.attester_bitfield.count() == attestation_indices.len()); - let pubkeys: Vec<_> = attestation_indices - .iter() - .enumerate() - .filter(|(i, _)| attestation.attester_bitfield.has_voted(*i)) - .map(|(_, index)| crystallized_state.validators[*index].pubkey.clone()) - .collect(); - - attestation.verify_signatures(&parent_hashes, &pubkeys); -} - -pub fn update_block_vote_cache>( - slot: u64, - crystallized_state: &CrystallizedState, - active_state: &ActiveState, - attestation: &AttestationRecord -) { - let parent_hashes = active_state.signed_parent_block_hashes(slot, attestation); - let attestation_indices = crystallized_state.attestation_indices(attestation); - - for parent_hash in parent_hashes { - if attestation.oblique_parent_hashes.contains(&parent_hash) { - continue; - } - - let mut info = BlockVoteCache::get(&parent_hash); - for (i, index) in attestation_indices.iter().enumerate() { - if attestation.attester_bitfield.has_voted(i) && !info.voter_indices.contains(index) { - info.voter_indices.push(*index); - info.total_voter_deposits += crystallized_state.validators[*index].balance; - } - } - BlockVoteCache::insert(parent_hash, info); - } -} - -pub fn process_block>, BlockVoteCache: StorageMap>( - slot: u64, - parent_slot: u64, - crystallized_state: &CrystallizedState, - active_state: &mut ActiveState, - attestations: &[AttestationRecord] -) { - validate_parent_block_proposer(slot, parent_slot, crystallized_state, attestations); - - for attestation in attestations { - validate_attestation::( - slot, - parent_slot, - crystallized_state, - active_state, - attestation - ); - update_block_vote_cache::( - slot, - crystallized_state, - active_state, - attestation - ); - } - - active_state.pending_attestations.append(&mut attestations.iter().cloned().collect()); -} - -pub fn process_updated_crosslinks( - crystallized_state: &mut CrystallizedState, - active_state: &ActiveState -) { - let mut total_attestation_balance: BTreeMap<(ShardId, H256), u128> = Default::default(); - - for attestation in &active_state.pending_attestations { - let shard_tuple = (attestation.shard_id, attestation.shard_block_hash); - - let attestation_indices = crystallized_state.attestation_indices(attestation); - let total_committee_balance = attestation_indices - .iter() - .fold(0, |acc, index| { - acc + crystallized_state.validators[*index].balance - }); - - *total_attestation_balance.entry(shard_tuple).or_insert(0) += attestation_indices - .iter() - .enumerate() - .filter(|(in_cycle_slot_height, _)| { - attestation.attester_bitfield.has_voted(*in_cycle_slot_height) - }) - .fold(0, |acc, (_, index)| { - acc + crystallized_state.validators[*index].balance - }); - - if 3 * *total_attestation_balance.entry(shard_tuple).or_insert(0) >= 2 * total_committee_balance && crystallized_state.current_dynasty > crystallized_state.crosslink_records[attestation.shard_id as usize].dynasty { - crystallized_state.crosslink_records[attestation.shard_id as usize] = CrosslinkRecord { - dynasty: crystallized_state.current_dynasty, - slot: crystallized_state.last_state_recalc + CYCLE_LENGTH as u64, - hash: attestation.shard_block_hash - }; - } - } -} - -pub fn calculate_ffg_rewards>, BlockVoteCache: StorageMap>( - slot: u64, - crystallized_state: &CrystallizedState, -) -> Vec { - let active_validator_indices = crystallized_state.active_validator_indices(); - let mut rewards_and_penalties: Vec = crystallized_state.validators.iter().map(|_| 0).collect(); - - let time_since_finality = slot - crystallized_state.last_finalized_slot; - - let total_deposits = crystallized_state.total_deposits(); - let total_deposits_in_eth = total_deposits / WEI_PER_ETH; - - if total_deposits_in_eth == 0 { - return rewards_and_penalties; - } - - let reward_quotient = BASE_REWARD_QUOTIENT * sqrt(total_deposits_in_eth); - let quadratic_penalty_quotient = (SQRT_E_DROP_TIME / SLOT_DURATION).pow(2); - - let last_state_recalc = crystallized_state.last_state_recalc; - - for slot in last_state_recalc.saturating_sub(CYCLE_LENGTH as u64)..last_state_recalc { - let block_hash = BlockHashesBySlot::get(slot); - - let (total_participated_deposits, voter_indices) = match block_hash { - Some(block_hash) => { - let cache = BlockVoteCache::get(block_hash); - (cache.total_voter_deposits, cache.voter_indices) - }, - None => { - (0, Vec::new()) - }, - }; - - let participating_validator_indices: Vec<_> = active_validator_indices - .iter() - .filter(|index| voter_indices.contains(index)) - .cloned() - .collect(); - - let non_participating_validator_indices: Vec<_> = active_validator_indices - .iter() - .filter(|index| !voter_indices.contains(index)) - .cloned() - .collect(); - - if time_since_finality <= 3 * CYCLE_LENGTH as u64 { - for index in participating_validator_indices { - let balance = crystallized_state.validators[index].balance; - - rewards_and_penalties[index] += ( - balance / - reward_quotient * - (2 * total_participated_deposits - total_deposits) / - total_deposits - ) as i128; - } - for index in non_participating_validator_indices { - let balance = crystallized_state.validators[index].balance; - - rewards_and_penalties[index] -= ( - balance / - reward_quotient - ) as i128; - } - } else { - for index in non_participating_validator_indices { - let balance = crystallized_state.validators[index].balance; - - rewards_and_penalties[index] -= ( - (balance / reward_quotient) + - (balance * time_since_finality as u128 / quadratic_penalty_quotient) - ) as i128; - } - } - } - - rewards_and_penalties -} - -pub fn calculate_crosslink_rewards( - _slot: u64, - crystallized_state: &CrystallizedState, -) -> Vec { - crystallized_state.validators.iter().map(|_| 0).collect() -} - -pub fn apply_rewards_and_penalties>, BlockVoteCache: StorageMap>( - slot: u64, - crystallized_state: &mut CrystallizedState, -) { - let ffg_rewards = calculate_ffg_rewards::(slot, crystallized_state); - let crosslink_rewards = calculate_crosslink_rewards(slot, crystallized_state); - - let active_validator_indices = crystallized_state.active_validator_indices(); - - for index in active_validator_indices { - if ffg_rewards[index] > 0 { - crystallized_state.validators[index].balance += ffg_rewards[index] as u128; - } - if ffg_rewards[index] < 0 { - crystallized_state.validators[index].balance = crystallized_state.validators[index].balance.saturating_sub((-ffg_rewards[index]) as u128); - } - - if crosslink_rewards[index] > 0 { - crystallized_state.validators[index].balance += crosslink_rewards[index] as u128; - } - if crosslink_rewards[index] < 0 { - crystallized_state.validators[index].balance = crystallized_state.validators[index].balance.saturating_sub((-crosslink_rewards[index]) as u128); - } - } -} - -pub fn initialize_new_cycle>, BlockVoteCache: StorageMap>( - slot: u64, - crystallized_state: &mut CrystallizedState, - active_state: &mut ActiveState -) { - let last_state_recalc = crystallized_state.last_state_recalc; - let total_deposits = crystallized_state.total_deposits(); - - let mut last_justified_slot = crystallized_state.last_justified_slot; - let mut last_finalized_slot = crystallized_state.last_finalized_slot; - let mut justified_streak = crystallized_state.justified_streak; - - for i in 0..CYCLE_LENGTH { - let slot = i as u64 + last_state_recalc.saturating_sub(CYCLE_LENGTH as u64); - - let block_hash = active_state.recent_block_hashes[i]; - let vote_balance = BlockVoteCache::get(&block_hash).total_voter_deposits; - - if 3 * vote_balance >= 2 * total_deposits { - last_justified_slot = ::rstd::cmp::max(last_justified_slot, slot); - justified_streak += 1; - } else { - justified_streak = 0; - } - - if justified_streak >= CYCLE_LENGTH as u64 + 1 { - last_finalized_slot = ::rstd::cmp::max(last_finalized_slot, slot.saturating_sub(CYCLE_LENGTH as u64 - 1)); - } - } - - process_updated_crosslinks(crystallized_state, active_state); - - active_state.pending_attestations = active_state.pending_attestations.clone() - .into_iter() - .filter(|a| a.slot >= last_state_recalc) - .collect(); - - apply_rewards_and_penalties::(slot, crystallized_state); - - let mut new_shards_and_committees_for_slots: Vec<_> = crystallized_state.shards_and_committees_for_slots[CYCLE_LENGTH..].iter().cloned().collect(); - let mut copied_shards_and_committees_for_slots = new_shards_and_committees_for_slots.clone(); - new_shards_and_committees_for_slots.append(&mut copied_shards_and_committees_for_slots); - - crystallized_state.last_state_recalc = last_state_recalc + CYCLE_LENGTH as u64; - crystallized_state.shards_and_committees_for_slots = new_shards_and_committees_for_slots; - crystallized_state.last_justified_slot = last_justified_slot; - crystallized_state.justified_streak = justified_streak; - crystallized_state.last_finalized_slot = last_finalized_slot; -} - -pub fn is_ready_for_dynasty_transition( - slot: u64, - crystallized_state: &CrystallizedState -) -> bool { - let slots_since_last_dynasty_change = slot - crystallized_state.dynasty_start; - if slots_since_last_dynasty_change < MIN_DYNASTY_LENGTH { - return false; - } - - if crystallized_state.last_finalized_slot <= crystallized_state.dynasty_start { - return false; - } - - let mut required_shards = Vec::new(); - for shards_and_committees_for_slot in &crystallized_state.shards_and_committees_for_slots { - for shard_and_committee in shards_and_committees_for_slot { - required_shards.push(shard_and_committee.shard_id); - } - } - - for (shard_id, crosslink) in crystallized_state.crosslink_records.iter().enumerate() { - if required_shards.contains(&(shard_id as u16)) { - if crosslink.slot <= crystallized_state.dynasty_start { - return false; - } - } - } - - return true; -} - -pub fn process_dynasty_transition( - parent_hash: H256, - crystallized_state: &mut CrystallizedState -) { - let new_start_shard = (crystallized_state.shards_and_committees_for_slots.last().expect("There must be at least one shard_and_committee").last().expect("There must be at least one shard_and_committee").shard_id + 1) % SHARD_COUNT; - - let mut new_shards_and_committees: Vec<_> = crystallized_state.shards_and_committees_for_slots[CYCLE_LENGTH..].iter().cloned().collect(); - new_shards_and_committees.append(&mut crystallized_state.new_shuffling(parent_hash, new_start_shard)); - crystallized_state.shards_and_committees_for_slots = new_shards_and_committees; - - crystallized_state.current_dynasty += 1; - crystallized_state.dynasty_start = crystallized_state.last_state_recalc; -} - -pub fn process_cycle_transitions>, BlockVoteCache: StorageMap>( - slot: u64, - parent_hash: H256, - crystallized_state: &mut CrystallizedState, - active_state: &mut ActiveState -) { - while slot >= crystallized_state.last_state_recalc + CYCLE_LENGTH as u64 { - initialize_new_cycle::(slot, crystallized_state, active_state); - - if is_ready_for_dynasty_transition(slot, crystallized_state) { - process_dynasty_transition(parent_hash, crystallized_state); - } - } -} diff --git a/runtime/src/validators.rs b/runtime/src/validators.rs deleted file mode 100644 index 2c36bd65..00000000 --- a/runtime/src/validators.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 Parity Technologies (UK) Ltd. -// This file is part of Substrate Shasper. - -// Substrate 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. - -// Substrate 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 Substrate. If not, see . - -use primitives::{H256, ValidatorId, EthereumAddress}; -use rstd::prelude::*; - -use codec_derive::{Encode, Decode}; -use ssz_derive::{SszEncode, SszDecode}; -use ssz_hash_derive::SszHash; - -#[derive(Clone, PartialEq, Eq, Default, Encode, Decode, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct ValidatorRecord { - pub pubkey: ValidatorId, - pub withdrawal_shard: u16, - pub withdrawal_address: EthereumAddress, - pub randao_commitment: H256, - pub balance: u128, - pub start_dynasty: u64, - pub end_dynasty: u64, -} - -#[derive(Clone, Encode, Decode, SszEncode, SszDecode, SszHash)] -#[cfg_attr(feature = "std", derive(Debug))] -#[ssz_codec(sorted)] -pub struct ShardAndCommittee { - pub shard_id: u16, - pub committee: Vec, -} diff --git a/runtime/wasm/Cargo.lock b/runtime/wasm/Cargo.lock index 343332d3..3cdebdf7 100644 --- a/runtime/wasm/Cargo.lock +++ b/runtime/wasm/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "arrayref" version = "0.3.5" @@ -18,7 +20,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -28,8 +30,8 @@ name = "backtrace-sys" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -98,9 +100,20 @@ dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "casper" +version = "0.1.0" +dependencies = [ + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sr-std 0.1.0 (git+https://github.com/paritytech/substrate)", +] + [[package]] name = "cc" -version = "1.0.25" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -243,7 +256,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -305,12 +318,12 @@ dependencies = [ [[package]] name = "hash-db" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hash256-std-hasher" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crunchy 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -408,7 +421,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -461,7 +474,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.44" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -494,24 +507,6 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "mashup" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "mashup-impl" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro-hack 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "matches" version = "0.1.8" @@ -524,10 +519,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "memory-db" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -546,7 +541,7 @@ dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -571,7 +566,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -592,7 +587,7 @@ version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -619,7 +614,7 @@ name = "num_cpus" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -636,7 +631,7 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -645,8 +640,8 @@ name = "openssl-sys" version = "0.9.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -724,7 +719,7 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -736,7 +731,7 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -837,7 +832,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -848,7 +843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -860,7 +855,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -933,13 +928,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ring" -version = "0.13.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1068,8 +1065,9 @@ name = "shasper-primitives" version = "0.1.0" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "casper 0.1.0", "fixed-hash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "keccak-hasher 0.1.1", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1090,7 +1088,8 @@ name = "shasper-runtime" version = "0.9.0" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "casper 0.1.0", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)", "keccak-hasher 0.1.1", @@ -1182,10 +1181,15 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "spin" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "sr-api-macros" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1196,10 +1200,10 @@ dependencies = [ [[package]] name = "sr-io" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "environmental 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1213,7 +1217,7 @@ dependencies = [ [[package]] name = "sr-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1230,7 +1234,7 @@ dependencies = [ [[package]] name = "sr-std" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1238,7 +1242,7 @@ dependencies = [ [[package]] name = "sr-version" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1252,7 +1256,7 @@ dependencies = [ [[package]] name = "srml-metadata" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1265,12 +1269,12 @@ dependencies = [ [[package]] name = "srml-support" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1285,7 +1289,7 @@ dependencies = [ [[package]] name = "srml-support-procedural" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1297,7 +1301,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1308,7 +1312,7 @@ dependencies = [ [[package]] name = "srml-support-procedural-tools-derive" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1336,7 +1340,7 @@ dependencies = [ name = "ssz-hash" version = "0.1.0" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ssz 0.1.0", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", ] @@ -1363,19 +1367,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "substrate-client" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.1.0 (git+https://github.com/paritytech/parity-common?rev=b0317f649ab2c665b7987b8475878fc4d2e1f81d)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "sr-api-macros 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-std 0.1.0 (git+https://github.com/paritytech/substrate)", @@ -1393,21 +1397,15 @@ dependencies = [ [[package]] name = "substrate-consensus-aura-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ - "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "sr-io 0.1.0 (git+https://github.com/paritytech/substrate)", - "sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", - "sr-version 0.1.0 (git+https://github.com/paritytech/substrate)", - "srml-support 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-client 0.1.0 (git+https://github.com/paritytech/substrate)", - "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", ] [[package]] name = "substrate-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1425,11 +1423,10 @@ dependencies = [ [[package]] name = "substrate-executor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1439,6 +1436,7 @@ dependencies = [ "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "sr-io 0.1.0 (git+https://github.com/paritytech/substrate)", "sr-version 0.1.0 (git+https://github.com/paritytech/substrate)", + "substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-serializer 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate)", @@ -1450,7 +1448,7 @@ dependencies = [ [[package]] name = "substrate-inherents" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1462,29 +1460,38 @@ dependencies = [ [[package]] name = "substrate-keyring" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", ] +[[package]] +name = "substrate-panic-handler" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" +dependencies = [ + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "substrate-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "impl-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec-derive 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "primitive-types 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1497,7 +1504,7 @@ dependencies = [ [[package]] name = "substrate-serializer" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1506,24 +1513,25 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)", "substrate-trie 0.4.0 (git+https://github.com/paritytech/substrate)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "substrate-telemetry" version = "0.3.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1538,13 +1546,13 @@ dependencies = [ [[package]] name = "substrate-trie" version = "0.4.0" -source = "git+https://github.com/paritytech/substrate#5c186dde571d6ddd2bb978a58578b516ae96d1a4" +source = "git+https://github.com/paritytech/substrate#6d4b7b0236109bb88783732aff807912614d3c45" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-codec 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1585,7 +1593,7 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1744,7 +1752,7 @@ dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1755,21 +1763,21 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trie-root" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1927,7 +1935,7 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4390a3b5f4f6bce9c1d0c00128379df433e53777fdd30e92f16a529332baec4e" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -1955,8 +1963,8 @@ dependencies = [ "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" -"checksum hash-db 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc5ec43724866bbc8337e09cab4d4b5f9fdbbe589f04bdc8bfda906a639ad338" -"checksum hash256-std-hasher 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5fc2d94c8e127b205b3caf6fd3013fb5e5b314234bb0b9bea6588c52fddbb82b" +"checksum hash-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b03501f6e1a2a97f1618879aba3156f14ca2847faa530c4e28859638bd11483" +"checksum hash256-std-hasher 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5c13dbac3cc50684760f54af18545c9e80fb75e93a3e586d71ebdc13138f6a4" "checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" "checksum hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4da5f0e01bd8a71a224a4eedecaacfcabda388dbb7a80faf04d3514287572d95" "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" @@ -1975,15 +1983,13 @@ dependencies = [ "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" -"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" +"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum libsecp256k1 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "688e8d65e495567c2c35ea0001b26b9debf0b4ea11f8cccc954233b75fc3428a" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum mashup 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f2d82b34c7fb11bb41719465c060589e291d505ca4735ea30016a91f6fc79c3b" -"checksum mashup-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "aa607bfb674b4efb310512527d64266b065de3f894fc52f84efcbf7eaa5965fb" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum memory-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0c940ff365f921ac747e7a009d8f9688105acf956f3fbb7fd967920737e935d" +"checksum memory-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94da53143d45f6bad3753f532e56ad57a6a26c0ca6881794583310c7cb4c885f" "checksum memory_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" @@ -2029,7 +2035,7 @@ dependencies = [ "checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" "checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" "checksum redox_syscall 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "cf8fb82a4d1c9b28f1c26c574a5b541f5ffb4315f6c9a791fa47b6a04438fe93" -"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +"checksum ring 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)" = "426bc186e3e95cac1e4a4be125a4aca7e84c2d616ffc02244eef36e2a60a093c" "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" "checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" "checksum rustc-hex 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "403bb3a286107a04825a5f82e1270acc1e14028d3d554d7a1e08914549575ab8" @@ -2050,6 +2056,7 @@ dependencies = [ "checksum slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddd14b8df2df39378b3e933c79784350bf715b11444d99f903df0253bbe524e5" "checksum slog-scope 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "053344c94c0e2b22da6305efddb698d7c485809427cf40555dc936085f67a9df" "checksum smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "622df2d454c29a4d89b30dc3b27b42d7d90d6b9e587dbf8f67652eb7514da484" +"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" "checksum sr-api-macros 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum sr-io 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum sr-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "" @@ -2068,6 +2075,7 @@ dependencies = [ "checksum substrate-executor 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-inherents 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-keyring 0.1.0 (git+https://github.com/paritytech/substrate)" = "" +"checksum substrate-panic-handler 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-primitives 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-serializer 0.1.0 (git+https://github.com/paritytech/substrate)" = "" "checksum substrate-state-machine 0.1.0 (git+https://github.com/paritytech/substrate)" = "" @@ -2091,8 +2099,8 @@ dependencies = [ "checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "99ce87382f6c1a24b513a72c048b2c8efe66cb5161c9061d00bee510f08dc168" -"checksum trie-db 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec6ceb1ad749359cedcf6fa95d7b5104acf70e871e2416e71cabcc3a8b2dbb8" -"checksum trie-root 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6294c313431d8bd2dda88db3a57550c4911dd6f7f0e8be6001e23c1e6cbdcf1b" +"checksum trie-db 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7319e28ca295f27359d944a682f7f65b419158bf1590c92cadc0000258d788" +"checksum trie-root 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c6fef2705af3258ec46a7e22286090394a44216201a1cf7d04b78db825e543" "checksum twox-hash 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f85be565a110ed72ed7048cf56570db04ce0a592c98aa59b7dacde3e5718750" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum uint 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7780bb27fd8a22295e0d9d53ae3be253f715a0dccb1808527f478f1c2603708" diff --git a/src/chain_spec.rs b/src/chain_spec.rs index b9113cdc..cbdad6ce 100644 --- a/src/chain_spec.rs +++ b/src/chain_spec.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Substrate. If not, see . -use primitives::{ValidatorId, AccountId}; +use primitives::ValidatorId; use runtime::GenesisConfig; use crypto::bls; @@ -50,10 +50,7 @@ impl Alternative { testnet_genesis( vec![ alice_id - ], vec![ - alice_id.into() - ], - alice_id.into() + ] ) }, vec![], @@ -79,11 +76,7 @@ impl Alternative { vec![ alice_id, bob_id, - ], vec![ - alice_id.into(), - bob_id.into(), - ], - alice_id.into(), + ] ) }, vec![], @@ -104,9 +97,9 @@ impl Alternative { } } -fn testnet_genesis(initial_authorities: Vec, _endowed_accounts: Vec, _upgrade_key: AccountId) -> GenesisConfig { +fn testnet_genesis(initial_authorities: Vec) -> GenesisConfig { GenesisConfig { code: include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/shasper_runtime.compact.wasm").to_vec(), - authorities: initial_authorities.clone(), + authorities: initial_authorities.into_iter().map(|v| (v, 1000000)).collect(), } } diff --git a/src/main.rs b/src/main.rs index 442e5f29..05b8ec40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,6 +35,7 @@ fn run() -> cli::error::Result<()> { executable_name: "shasper", author: "Parity Technologies ", description: "Substrate Shasper", + support_url: "https://github.com/paritytech/shasper", }; cli::run(::std::env::args(), cli::Exit, version) } diff --git a/util/ssz-hash-derive/Cargo.toml b/util/ssz-hash-derive/Cargo.toml index c8623c7b..694b7813 100644 --- a/util/ssz-hash-derive/Cargo.toml +++ b/util/ssz-hash-derive/Cargo.toml @@ -14,7 +14,7 @@ proc-macro2 = "0.4" [dev-dependencies] ssz-hash = { path = "../ssz-hash" } substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false } -hash-db = { version = "0.9", default-features = false } +hash-db = { version = "0.11", default-features = false } [features] default = ["std"] diff --git a/util/ssz-hash/Cargo.toml b/util/ssz-hash/Cargo.toml index 5038cb89..78870379 100644 --- a/util/ssz-hash/Cargo.toml +++ b/util/ssz-hash/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Team "] [dependencies] ssz = { path = "../ssz", default-features = false } substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false } -hash-db = { version = "0.9", default-features = false } +hash-db = { version = "0.11", default-features = false } [features] default = ["std"] -- GitLab