babe: report equivocations (#6362)

* slots: create primitives crate for consensus slots

* offences: add method to check if an offence is unknown

* babe: initial equivocation reporting implementation

* babe: organize imports

* babe: working equivocation reporting

* babe: add slot number to equivocation proof

* session: move duplicate traits to session primitives

* babe: move equivocation stuff to its own file

* offences: fix test

* session: don't have primitives depend on frame_support

* babe: use opaque type for key owner proof

* babe: cleanup client equivocation reporting

* babe: cleanup equivocation code in pallet

* babe: allow sending signed equivocation reports

* node: fix compilation

* fix test compilation

* babe: return bool on check_equivocation_proof

* babe: add test for equivocation reporting

* babe: add more tests

* babe: add test for validate unsigned

* babe: take slot number in generate_key_ownership_proof API

* babe: add benchmark for equivocation proof checking

* session: add benchmark for membership proof checking

* offences: fix babe benchmark

* babe: add weights based on benchmark results

* babe: adjust weights after benchmarking on reference hardware

* babe: reorder checks in check_and_report_equivocation
This commit is contained in:
André Silva
2020-07-04 11:18:13 +01:00
committed by GitHub
parent 61635e75c1
commit a9c21b8b84
34 changed files with 2031 additions and 275 deletions
+8 -2
View File
@@ -83,7 +83,7 @@ macro_rules! new_full_start {
let (grandpa_block_import, grandpa_link) = grandpa::block_import(
client.clone(),
&(client.clone() as Arc<_>),
select_chain,
select_chain.clone(),
)?;
let justification_import = grandpa_block_import.clone();
@@ -99,6 +99,7 @@ macro_rules! new_full_start {
Some(Box::new(justification_import)),
None,
client,
select_chain,
inherent_data_providers.clone(),
spawn_task_handle,
prometheus_registry,
@@ -367,14 +368,18 @@ pub fn new_light_base(config: Configuration) -> Result<(
client,
backend,
fetcher,
_select_chain,
mut select_chain,
_tx_pool,
spawn_task_handle,
registry,
| {
let select_chain = select_chain.take()
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
let grandpa_block_import = grandpa::light_block_import(
client.clone(),
backend,
@@ -398,6 +403,7 @@ pub fn new_light_base(config: Configuration) -> Result<(
None,
Some(Box::new(finality_proof_import)),
client.clone(),
select_chain,
inherent_data_providers.clone(),
spawn_task_handle,
registry,