Skip to content

Layr-Labs/incredible-squaring-avs-rs

Repository files navigation

Incredible Squaring Avs

Basic repo demoing a simple AVS middleware with full eigenlayer integration, in rust.

Dependencies

To run

  • Start anvil in a separate terminal
anvil
  • git submodule and copy env
git submodule update --init --recursive
cp contracts/.env.example contracts/.env
  • Deploy eigenlayer and avs contracts and setup payments
make deploy-el-and-avs-contracts
  • Single command AVS start using the following command (default values)
cargo run --bin incredible-squaring-avs  start
  • To change the parameters, provide path to a toml config file
cargo run --bin incredible-squaring-avs  start --config-path <PATH>

We have an example file incredible_config.toml for reference.

This command launches 5 services(crates) together:

  • Operator1 : It listens for new tasks , responds them by signing with their bls key and send the signed response to the aggregator. Stake in strategy: 5000 tokens
  • Operator2: Same task as operator 1. Stake in strategy: 7000 tokens
  • Aggregator: Sets up an Rpc client to receive signed task responses from operators, aggregates the signatures, if quorums is met (i.e both operators sign the response), it calls the respondToTask function in the TaskManager contract.
  • Challenger : It listens for new tasks , checks the operators response, if found wrong, it raises a challenge by calling the raiseAndResolveChallenge function in the task manager contract.
  • Task Spam : It creates a new task every 10 seconds by calling the createNewTask function in the task manager contract.

Testing

  • To run unit tests(start anvil in a separate terminal)
make pr
  • To run integration tests(start anvil in a separate terminal)
make integration-tests

Architecture

The architecture of the AVS contains:

  • Eigenlayer core contracts
  • AVS contracts
  • Task Generator
    • This is a separate entity .
  • Aggregator
    • aggregates BLS signatures from operators and posts the aggregated response to the task manager
    • For this simple demo, the aggregator is not an operator, and thus does not need to register with eigenlayer or the AVS contract. It's IP address is simply hardcoded into the operators' config.
  • Operators
    • Square the number sent to the task manager by the task generator, sign it, and send it to the aggregator

architecture (1)

Default Configuration

  • Metrics http endpoint - http://localhost:9001/metrics
  • Aggregator Rpc endpoint - 127.0.0.1:8080
  • Operator1 - 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (anvil's 0 index key)
  • Operator2 - 0x0b065a0423f076a340f37e16e1ce22e23d66caf2

Dependencies

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages