This repository contains smart contracts for the Eigenlayer AVS (zkMapReduce AVS ServiceManager). These contracts are designed to manage operators and their associated strategies within the Eigenlayer ecosystem.
Represents an Eigenlayer strategy and shares multiplier.
struct StrategyParams {
IStrategy strategy;
uint96 multiplier;
}
Defines a quorum of Eigenlayer strategies (i.e. restaked tokens) and shares multipliers.
struct Quorum {
StrategyParams[] strategies;
}
Represents a point on an elliptic curve for ECDSA public keys. Operators authenticate within the AVS by signed JWTs and proofs with this public key after registering onchain.
struct PublicKey {
uint256 x;
uint256 y;
}
Interface for the ZKMR Stake Registry, which manages operator registrations, deregistrations, and quorum configurations.
interface IZKMRStakeRegistry {
// Events
event OperatorRegistered(address indexed operator, address indexed avs, PublicKey publicKey);
event OperatorDeregistered(address indexed operator, address indexed avs);
event OperatorUpdated(address indexed operator, address indexed avs, PublicKey publicKey);
event OperatorEvicted(address indexed operator, address indexed avs);
event QuorumUpdated(Quorum oldQuorum, Quorum newQuorum);
event MinimumSharesUpdated(uint256 oldShares, uint256 newShares);
// Errors
error ServiceManagerAlreadySet();
error InvalidPublicKey();
error InvalidQuorum();
error NotSorted();
error OperatorAlreadyRegistered();
error OperatorNotRegistered();
// Functions
function quorum() external view returns (Quorum memory);
function isRegistered(address operator) external view returns (bool);
function updateQuorumConfig(Quorum memory _quorum) external;
function registerOperator(PublicKey calldata publicKey, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature) external;
function deregisterOperator() external;
function getOperatorShares(address operator) external view returns (uint256);
function updateMinimumShares(uint256 newMinimumShares) external;
}
Manages AVS metadata, operator registrations, and quorum configurations. Only the ZKMRStakeRegistry can call certain functions.
Ensure to include a .env file and export its environment variables.
Install dependencies:
$ forge install
$ forge update
$ forge build
$ forge test
$ forge test -vvv
# Local development
$ anvil
$ make setup_integration_test
$ make local_deploy_avs
# Deploy to Holesky Testnet
$ make testnet_deploy_avs