GithubHelp home page GithubHelp logo

noah-foltz / zkmr-avs-contracts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lagrange-labs/zkmr-avs-contracts

0.0 0.0 0.0 31 KB

Contracts for the ZK Coprocessor AVS

Makefile 2.16% Solidity 97.84%

zkmr-avs-contracts's Introduction

ZK Coprocessor AVS

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.

Key structs and contracts

StrategyParams

Represents an Eigenlayer strategy and shares multiplier.

struct StrategyParams {
    IStrategy strategy;
    uint96 multiplier;
}

Quorum

Defines a quorum of Eigenlayer strategies (i.e. restaked tokens) and shares multipliers.

struct Quorum {
    StrategyParams[] strategies;
}

PublicKey

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;
}

IZKMRStakeRegistry

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;
}

ZKMRServiceManager

Manages AVS metadata, operator registrations, and quorum configurations. Only the ZKMRStakeRegistry can call certain functions.

Commands and Scripts

Environment Setup

Ensure to include a .env file and export its environment variables.

Installation

Install dependencies:

$ forge install
$ forge update

Build & Test

$ forge build
$ forge test
$ forge test -vvv

Deployment

# Local development
$ anvil
$ make setup_integration_test
$ make local_deploy_avs

# Deploy to Holesky Testnet
$ make testnet_deploy_avs

zkmr-avs-contracts's People

Contributors

jaeaster avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.