Punish offline validators, aura-style (#1216)

* make offline-reporting infrastructure more generic

* add a listener-trait for watching when the timestamp has been set

* prevent inclusion of empty offline reports

* add test for exclusion

* generate aura-offline reports

* ability to slash many times for being offline "multiple" times

* Logic for punishing validators for missing aura steps

* stub tests

* pave way for verification of timestamp vs slot

* alter aura import queue to wait for timestamp

* check timestamp matches seal

* do inherent check properly

* service compiles

* all tests compile

* test srml-aura logic

* aura tests pass

* everything builds

* some more final tweaks to block authorship for aura

* switch to manual delays before step

* restore substrate-consensus-aura to always std and address grumbles

* update some state roots in executor tests

* node-executor tests pass

* get most tests passing

* address grumbles
This commit is contained in:
Robert Habermeier
2018-12-10 18:37:08 +01:00
committed by GitHub
parent dcc38fe45a
commit 6299b42a4d
41 changed files with 1344 additions and 379 deletions
+2
View File
@@ -13,6 +13,7 @@ parity-codec-derive = { version = "2.1", default-features = false }
substrate-keyring = { path = "../keyring", optional = true }
substrate-client = { path = "../client", optional = true }
substrate-primitives = { path = "../primitives", default-features = false }
substrate-consensus-aura-primitives = { path = "../consensus/aura/primitives", default-features = false }
sr-std = { path = "../sr-std", default-features = false }
sr-io = { path = "../sr-io", default-features = false }
sr-primitives = { path = "../sr-primitives", default-features = false }
@@ -35,4 +36,5 @@ std = [
"substrate-primitives/std",
"sr-primitives/std",
"sr-version/std",
"substrate-consensus-aura-primitives/std",
]
+7 -1
View File
@@ -24,6 +24,7 @@ extern crate serde;
extern crate sr_std as rstd;
extern crate parity_codec as codec;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_consensus_aura_primitives as consensus_aura;
#[macro_use]
extern crate substrate_client as client;
@@ -64,6 +65,7 @@ use primitives::AuthorityId;
use primitives::OpaqueMetadata;
#[cfg(any(feature = "std", test))]
use runtime_version::NativeVersion;
use consensus_aura::api as aura_api;
/// Test runtime version.
pub const VERSION: RuntimeVersion = RuntimeVersion {
@@ -234,7 +236,7 @@ impl_runtime_apis! {
}
fn check_inherents(_block: Block, _data: ()) -> Result<(), CheckInherentError> {
unimplemented!()
Ok(())
}
fn random_seed() -> <Block as BlockT>::Hash {
@@ -247,4 +249,8 @@ impl_runtime_apis! {
system::balance_of(id)
}
}
impl aura_api::AuraApi<Block> for Runtime {
fn slot_duration() -> u64 { 1 }
}
}
+14
View File
@@ -1087,6 +1087,19 @@ dependencies = [
"substrate-trie 0.4.0",
]
[[package]]
name = "substrate-consensus-aura-primitives"
version = "0.1.0"
dependencies = [
"parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-io 0.1.0",
"sr-primitives 0.1.0",
"sr-version 0.1.0",
"srml-support 0.1.0",
"substrate-client 0.1.0",
"substrate-primitives 0.1.0",
]
[[package]]
name = "substrate-consensus-common"
version = "0.1.0"
@@ -1208,6 +1221,7 @@ dependencies = [
"sr-version 0.1.0",
"srml-support 0.1.0",
"substrate-client 0.1.0",
"substrate-consensus-aura-primitives 0.1.0",
"substrate-primitives 0.1.0",
]
+3 -1
View File
@@ -9,6 +9,7 @@ hex-literal = { version = "0.1.0", optional = true }
parity-codec = { version = "2.1", default-features = false }
parity-codec-derive = { version = "2.1", default-features = false }
substrate-primitives = { path = "../../primitives", default-features = false }
substrate-consensus-aura-primitives = { path = "../../consensus/aura/primitives", default-features = false }
substrate-client = { path = "../../client", default-features = false }
sr-std = { path = "../../sr-std", default-features = false }
sr-io = { path = "../../sr-io", default-features = false }
@@ -28,7 +29,8 @@ std = [
"sr-version/std",
"substrate-primitives/std",
"substrate-client/std",
"sr-primitives/std"
"sr-primitives/std",
"substrate-consensus-aura-primitives/std",
]
[lib]