Skip to content

Commit 0548949

Browse files
authored
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
1 parent 28db048 commit 0548949

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/mock.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ impl ReportOffence<u64, IdentificationTuple, Offence> for OffenceHandler {
8686
OFFENCES.with(|l| l.borrow_mut().push((reporters, offence)));
8787
Ok(())
8888
}
89+
90+
fn is_known_offence(_offenders: &[IdentificationTuple], _time_slot: &SessionIndex) -> bool {
91+
false
92+
}
8993
}
9094

9195
pub fn new_test_ext() -> sp_io::TestExternalities {
92-
let t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
96+
let t = frame_system::GenesisConfig::default()
97+
.build_storage::<Runtime>()
98+
.unwrap();
9399
t.into()
94100
}
95101

0 commit comments

Comments
 (0)