ValidatorStrikes
ValidatorStrikes.sol is a supplementary contract that stores the latest Merkle tree root and CID for validator strike data reported by the Performance Oracle. Anyone can submit a valid Merkle proof showing that one or more validators have reached the strike threshold configured for their Node Operator type. For each qualifying validator, the contract records a bad-performance penalty through ExitPenalties and calls Ejector to trigger the validator's exit.
Upgradability​
The contract uses OssifiableProxy for upgradability.
State Variables​
ORACLE​
address public immutable ORACLE
MODULE​
IBaseModule public immutable MODULE
ACCOUNTING​
IAccounting public immutable ACCOUNTING
EXIT_PENALTIES​
IExitPenalties public immutable EXIT_PENALTIES
PARAMETERS_REGISTRY​
IParametersRegistry public immutable PARAMETERS_REGISTRY
ejector​
IEjector public ejector
treeRoot​
The latest Merkle Tree root
bytes32 public treeRoot
treeCid​
CID of the last published Merkle tree
string public treeCid
Functions​
onlyOracle​
modifier onlyOracle() ;
constructor​
constructor(address module, address oracle) ;
initialize​
Initialize contract from scratch. In case of a method call frontrun, the contract instance should be discarded. It is recommended to call this method in the same transaction as the deployment transaction and perform extensive deployment verification before using the contract instance.
function initialize(address admin, address _ejector) external initializer;
setEjector​
Set the address of the Ejector contract
function setEjector(address _ejector) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
| Name | Type | Description |
|---|---|---|
_ejector | address | Address 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
| Name | Type | Description |
|---|---|---|
_treeRoot | bytes32 | Root of the Merkle tree |
_treeCid | string | IPFS CID of the tree |
processBadPerformanceProof​
Report multiple keys as bad performing
function processBadPerformanceProof(
KeyStrikes[] calldata keyStrikesList,
bytes32[] calldata proof,
bool[] calldata proofFlags,
address refundRecipient
) external payable;
Parameters
| Name | Type | Description |
|---|---|---|
keyStrikesList | KeyStrikes[] | List of KeyStrikes structs |
proof | bytes32[] | Multi-proof of the strikes |
proofFlags | bool[] | Flags to process the multi-proof, see OZ processMultiProof |
refundRecipient | address | Address 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
| Name | Type | Description |
|---|---|---|
keyStrikesList | KeyStrikes[] | List of KeyStrikes structs |
pubkeys | bytes[] | Public keys corresponding to each entry in keyStrikesList |
proof | bytes32[] | Multi-proof of the strikes |
proofFlags | bool[] | Flags to process the multi-proof, see OZ processMultiProof |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | True if proof is accepted |
hashLeaf​
Get a hash of a leaf in 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
| Name | Type | Description |
|---|---|---|
keyStrikes | KeyStrikes | KeyStrikes struct |
pubkey | bytes | Public key |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes32 | Hash of the leaf |
_setEjector​
function _setEjector(address _ejector) internal;
_ejectByStrikes​
function _ejectByStrikes(
KeyStrikes calldata keyStrikes,
bytes memory pubkey,
uint256 value,
address refundRecipient
) internal;
_onlyOracle​
function _onlyOracle() internal view;