Skip to main content

CSStrikes

CSStrikes.sol is a utility contract that stores information about strikes assigned to the CSM validators by CSM Performance Oracle. It has a permissionless method to prove that a particular validator should be ejected because the number of strikes is above the threshold for this validator. It calls CSEjector.sol to perform a strikes threshold check and eject the validator.

Upgradability

The contract uses OssifiableProxy for upgradability.

State Variables

ORACLE

address public immutable ORACLE;

MODULE

ICSModule public immutable MODULE;

ACCOUNTING

ICSAccounting public immutable ACCOUNTING;

EXIT_PENALTIES

ICSExitPenalties public immutable EXIT_PENALTIES;

PARAMETERS_REGISTRY

ICSParametersRegistry public immutable PARAMETERS_REGISTRY;

ejector

ICSEjector public ejector;

treeRoot

The latest Merkle Tree root

bytes32 public treeRoot;

treeCid

CID of the last published Merkle tree

string public treeCid;

Functions

setEjector

Set the address of the Ejector contract

function setEjector(address _ejector) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
_ejectoraddressAddress of the Ejector contract

processOracleReport

Receive the data of the Merkle tree from the Oracle contract and process it

New tree might be empty and it is valid value because of strikesLifetime

function processOracleReport(bytes32 _treeRoot, string calldata _treeCid) external onlyOracle;

Parameters

NameTypeDescription
_treeRootbytes32Root of the Merkle tree
_treeCidstringan IPFS CID of the tree

processBadPerformanceProof

Report multiple CSM keys as bad performing

function processBadPerformanceProof(
KeyStrikes[] calldata keyStrikesList,
bytes32[] calldata proof,
bool[] calldata proofFlags,
address refundRecipient
) external payable;

Parameters

NameTypeDescription
keyStrikesListKeyStrikes[]List of KeyStrikes structs
proofbytes32[]Multi-proof of the strikes
proofFlagsbool[]Flags to process the multi-proof, see OZ processMultiProof
refundRecipientaddressAddress to send the refund to

getInitializedVersion

Returns the initialized version of the contract

function getInitializedVersion() external view returns (uint64);

verifyProof

Check the contract accepts the provided multi-proof

function verifyProof(
KeyStrikes[] calldata keyStrikesList,
bytes[] memory pubkeys,
bytes32[] calldata proof,
bool[] calldata proofFlags
) public view returns (bool);

Parameters

NameTypeDescription
keyStrikesListKeyStrikes[]List of KeyStrikes structs
pubkeysbytes[]
proofbytes32[]Multi-proof of the strikes
proofFlagsbool[]Flags to process the multi-proof, see OZ processMultiProof

Returns

NameTypeDescription
<none>boolbool True if proof is accepted

hashLeaf

Get a hash of a leaf a tree of strikes

Double hash the leaf to prevent second pre-image attacks

function hashLeaf(KeyStrikes calldata keyStrikes, bytes memory pubkey) public pure returns (bytes32);

Parameters

NameTypeDescription
keyStrikesKeyStrikesKeyStrikes struct
pubkeybytesPublic key

Returns

NameTypeDescription
<none>bytes32Hash of the leaf

Events

StrikesDataUpdated

Emitted when strikes data is updated

event StrikesDataUpdated(bytes32 treeRoot, string treeCid);

StrikesDataWiped

Emitted when strikes is updated from non-empty to empty

event StrikesDataWiped();

EjectorSet

event EjectorSet(address ejector);