paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

BEEFY: add support for slashing validators signing forking commitments #14744

Open Lederstrumpf opened 1 year ago

Lederstrumpf commented 1 year ago

Description

Builds on and supersedes paritytech/substrate#14520. The original scope was to support slashing validators equivocating by virtue of a gossiped vote which votes on a fork that has not been finalized.

This PR's aim differs in the following ways:

  1. we do not slash for voting on unfinalized payloads, but rather for payloads that differ from the payload known to the runtime. As such, we do not check GRANDPA finalization.
  2. while slashing equivocations detected in votes is also supported, the scope is extended to (and the focus placed on) equivocations detected in a SignedCommitment

Rationale for 1.

Since GRANDPA finalization proof is not checked, which leads to slashing on forks that may not be finalized. This is fine since honest validators will not be slashed on the chain finalized by GRANDPA, which is the only chain that ultimately matters. The only material difference not checking GRANDPA proofs makes is that validators are not slashed for signing BEEFY commitments prior to the blocks committed to being finalized by GRANDPA. This is fine too, since the slashing risk of committing to an incorrect block implies validators will only sign blocks they know will be finalized by GRANDPA.

Rationale for 2.

While dishonest might gossip their equivocating votes via the standard gossip protocol, this hurts the prospect of their attack, and opens the door for the colluders to get slashed even if they don't ultimately carry out the attack on, for instance, the Ethereum bridge. Instead, we should face the reality that we will likely only detect the attack once it is carried out, that is: an equivocating payload of a submitInitial/submitInitialWithHandover call is detected in Ethereum's mempool / a block.

Proposed Solution

Runtime

Client-side

Closes paritytech/polkadot-sdk#1120

TODOs

paritytech-cicd-pr commented 1 year ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: cargo-check-benches Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3433651