BEEFY: implement equivocations detection, reporting and slashing (#13121)
* client/beefy: simplify self_vote logic * client/beefy: migrate to new state version * client/beefy: detect equivocated votes * fix typos * sp-beefy: add equivocation primitives * client/beefy: refactor vote processing * fix version migration for new rounds struct * client/beefy: track equivocations and create proofs * client/beefy: adjust tests for new voting logic * sp-beefy: fix commitment ordering and equality * client/beefy: simplify handle_vote() a bit * client/beefy: add simple equivocation test * client/beefy: submit equivocation proof - WIP * frame/beefy: add equivocation report runtime api - part 1 * frame/beefy: report equivocation logic - part 2 * frame/beefy: add pluggable Equivocation handler - part 3 * frame/beefy: impl ValidateUnsigned for equivocations reporting * client/beefy: submit report equivocation unsigned extrinsic * primitives/beefy: fix tests * frame/beefy: add default weights * frame/beefy: fix tests * client/beefy: fix tests * frame/beefy-mmr: fix tests * frame/beefy: cross-check session index with equivocation report * sp-beefy: make test Keyring useable in pallet * frame/beefy: add basic equivocation test * frame/beefy: test verify equivocation results in slashing * frame/beefy: test report_equivocation_old_set * frame/beefy: add more equivocation tests * sp-beefy: fix docs * beefy: simplify equivocations and fix tests * client/beefy: address review comments * frame/beefy: add ValidateUnsigned to test/mock runtime * client/beefy: fixes after merge master * fix missed merge damage * client/beefy: add test for reporting equivocations Also validated there's no unexpected equivocations reported in the other tests. Signed-off-by:acatangiu <adrian@parity.io> * sp-beefy: move test utils to their own file * client/beefy: add negative test for equivocation reports * sp-beefy: move back MmrRootProvider - used in polkadot-service * impl review suggestions * client/beefy: add equivocation metrics --------- Signed-off-by:
acatangiu <adrian@parity.io> Co-authored-by: parity-processbot <>
Showing
- substrate/Cargo.lock 8 additions, 0 deletionssubstrate/Cargo.lock
- substrate/client/beefy/src/communication/gossip.rs 2 additions, 2 deletionssubstrate/client/beefy/src/communication/gossip.rs
- substrate/client/beefy/src/error.rs 17 additions, 1 deletionsubstrate/client/beefy/src/error.rs
- substrate/client/beefy/src/justification.rs 1 addition, 2 deletionssubstrate/client/beefy/src/justification.rs
- substrate/client/beefy/src/keystore.rs 1 addition, 1 deletionsubstrate/client/beefy/src/keystore.rs
- substrate/client/beefy/src/lib.rs 2 additions, 1 deletionsubstrate/client/beefy/src/lib.rs
- substrate/client/beefy/src/metrics.rs 31 additions, 16 deletionssubstrate/client/beefy/src/metrics.rs
- substrate/client/beefy/src/round.rs 46 additions, 6 deletionssubstrate/client/beefy/src/round.rs
- substrate/client/beefy/src/tests.rs 96 additions, 31 deletionssubstrate/client/beefy/src/tests.rs
- substrate/client/beefy/src/worker.rs 142 additions, 15 deletionssubstrate/client/beefy/src/worker.rs
- substrate/client/consensus/babe/src/lib.rs 1 addition, 1 deletionsubstrate/client/consensus/babe/src/lib.rs
- substrate/frame/beefy-mmr/src/lib.rs 2 additions, 2 deletionssubstrate/frame/beefy-mmr/src/lib.rs
- substrate/frame/beefy-mmr/src/mock.rs 11 additions, 2 deletionssubstrate/frame/beefy-mmr/src/mock.rs
- substrate/frame/beefy/Cargo.toml 12 additions, 0 deletionssubstrate/frame/beefy/Cargo.toml
- substrate/frame/beefy/src/default_weights.rs 54 additions, 0 deletionssubstrate/frame/beefy/src/default_weights.rs
- substrate/frame/beefy/src/equivocation.rs 385 additions, 0 deletionssubstrate/frame/beefy/src/equivocation.rs
- substrate/frame/beefy/src/lib.rs 236 additions, 16 deletionssubstrate/frame/beefy/src/lib.rs
- substrate/frame/beefy/src/mock.rs 203 additions, 28 deletionssubstrate/frame/beefy/src/mock.rs
- substrate/frame/beefy/src/tests.rs 634 additions, 13 deletionssubstrate/frame/beefy/src/tests.rs
- substrate/primitives/beefy/src/lib.rs 132 additions, 76 deletionssubstrate/primitives/beefy/src/lib.rs
Please register or sign in to comment