K2 Reporter
K2 Reporter is a Typescript server that uses the K2 SDK in order to work for the K2 protocol.
More information regarding the K2 protocol can be found here.
K2 reporters are paid in native ETH for:
- Slashing SBP (Slashable Borrow Positions) for detected liveness or corruption issues associated with software related to a service provider
- Kicking node operators with balances less than 32 ETH
and more soon!
When a protocol (referred to as a service provider) takes out Ethereum economic security coverage for their protocol, the SBP position will be created on chain and off chain they will spin up a middleware. The middleware software can be seen here.
K2 reporters work alongside middlewares to scan for the liveness and corruption issues where middlewares will verify these events according to their own custom slashing logic and if verified, will authorise slashing events, paying reporters in the process.
Spinning up the reporter
Installing dependencies
Yarn is the default package manager and therefore it’s as simple as:
Compiling
Triggering the typescript compiler can be done with
Configuring your environment
Before running the reporter, the environment needs to be set up.
The following parameters are important to the reporter:
- Middleware API Endpoint
- Execution layer Node URL
Execution layer node URL can be any node provider like Quicknode, Alchemy etc.
Middleware API endpoint will be the middleware serving one or more SBP positions. Every middleware has a default service provider borrow address but that can be overridden. Ultimately, when opening SBP positions on chain, borrowers are nominating the public key of the designated verifier middleware that will validate and process slashings where the contract will reject the slashing if it does not come from the correct designated verifier.
Running
The reporter can be run in development mode which will monitor files for changes and re-start the server. To do that run:
Alternatively, if you just want to run without making changes just run:
If it is running correctly, you should see a message that the server is running on the configured host and port.
Automatically doing liveness checks
After building and running the server, the following script can be run to automatically check for liveness issues:
This will start by kicking off a liveness scan that you should be able to see on the reporter server:
Where a verified liveness report looks like the following from the script:
The slashing could then be reported to the reporter registry contract as simply as:
Overriding the debtor
Multiple SBPs taken out for the same type of re-staking application which share a common middleware instance will require a debtor address override (owner of the SBP) when slashing the SBP position.
The checkLiveness
function in the liveness-scan
script covers how to do this and interact with the liveness API:
Scanning for kick-able proposers (from K2 protocol)
Proposers that do not maintain 32 ether
as an effective balance AND have natively delegated to K2 are not
eligible for continuous native delegation.
In order to check if any natively delegated proposers have violated this protocol rule, we can use the K2 reporter.
As above, make sure the reporter has been started:
Then call the following endpoint:
You will see logs like this in the reporter
With an API response in this format: