Over the course of this quarter, we have redesigned our slasher to perform efficient slashing detection of blocks, double votes, and surround votes. Instead of having the slasher as a separate process from the beacon node, we now make it a service of the beacon node which can be toggled with a feature flag.
This new slasher has a really simple entrypoint: all it needs is a beaconDB and a feed of indexed attestations and beacon block headers. Anyone can send these items over their corresponding feed and slasher will be able to perform its job accordingly. That is:
Given this simple API, we can design a simulator which generates indexed attestations and beacon block headers of different kinds to profile and ensure that slasher works as expected. This document defines the requirements for such a simulator.
Our goal is to create a standalone binary which runs a slasher simulator and can allow us to profile the behavior of slasher as it would perform in a real node, helping us analyze disk i/o, CPU, and RAM usage in isolation. Additionally, we can also use a simulator to ensure that slasher can indeed detect slashable events. Eventually, we want the code for this simulator to make it into our end to end tests as a component.
Double Block Proposals
In order to simulate block proposals, the only pieces of information slasher needs are:
When performing double block checking, we simply check the DB if we have an existing proposal for a slot:proposer_index combination, and check if the signing roots are mismatched.
As such, the simulator need not be concerned about the details of blocks. If we can simply simulate the 3 pieces of information, that's enough for the slasher to detect.
Double Votes and Surround Votes
The only pieces of information slasher needs for attester slashing checks are:
Every other part of an attestation is unnecessary. To detect double votes, the slasher algorithm when receiving a package containing the 4 fields above, simply:
As such, the generator need not be concerned with other fields of attestations, such as roots, slot, etc.
Surround votes are more complicated, but once again, slasher only needs the 4 fields above from an attestation in order to perform its duty.
We want the ability to configure:
We want the ability to profile this with –pprof. The simulator branch already has this ability