This document provides a comprehensive guide to testing the EigenLayer-AVS system.
This document provides a comprehensive guide to testing the EigenLayer-AVS system. It covers the testing utilities, setup procedures, and best practices for ensuring code quality and reliability. This document focuses specifically on the testing infrastructure and methodologies used in the codebase.
The EigenLayer-AVS system uses a combination of unit tests and integration tests to verify the functionality of its components. Testing is primarily implemented using Go's built-in testing framework, with additional utilities provided in the testutil package.
Sources:
The testutil package provides a set of utilities for setting up test environments and creating test data. These utilities help ensure tests are consistent, isolated, and representative of real-world scenarios.
Sources:
Test Database Creation: Creates a temporary BadgerDB instance for testing
Test RPC Configuration: Provides URL configuration for connecting to test blockchain nodes
Test Users: Pre-configured user objects for testing
Test Tasks: Pre-configured task templates for common test scenarios
Mock HTTP Servers: Creating test HTTP servers for isolated testing
Sources:
The EigenLayer-AVS testing framework provides multiple configuration options to support different testing environments.
| Environment Variable | Purpose | Default Value |
|---|---|---|
| RPC_URL | Ethereum RPC endpoint for tests | https://sepolia.drpc.org |
| WS_RPC_URL | WebSocket RPC endpoint for tests | wss://sepolia.drpc.org |
| CONTROLLER_PRIVATE_KEY | Private key for controller wallet | N/A (Required) |
| BASE_SEPOLIA_RPC_URL | Base Sepolia RPC endpoint | N/A |
| BASE_SEPOLIA_BUNDLER_RPC | Base Sepolia bundler RPC | N/A |
| FACTORY_ADDRESS | Address of account factory contract | 0x29adA1b5217242DEaBB142BC3b1bCfFdd56008e7 |
Sources:
The testutil package provides pre-configured objects for various test scenarios:
Aggregator Configuration:
Smart Wallet Configuration:
Cache Configuration:
Sources:
Unit tests in EigenLayer-AVS focus on testing individual components in isolation. The system extensively uses mocks and test doubles to isolate components from their dependencies.
Sources:
The task executor tests demonstrate the unit testing approach by:
This approach isolates the executor component while still testing its interactions with other system components through controlled interfaces.
Sources:
Test cases in EigenLayer-AVS are organized to cover various scenarios, including:
| Test Category | Purpose | Example |
|---|---|---|
| Happy Path | Verify correct behavior under normal conditions | TestExecutorRunTaskSucess |
| Error Handling | Verify graceful handling of errors | TestExecutorRunTaskStopAndReturnErrorWhenANodeFailed |
| Edge Cases | Test behavior at boundary conditions | TestExecutorRunTaskComputeSuccessFalseWhenANodeFailedToRun |
| Data Verification | Validate correct data processing | TestExecutorRunTaskReturnAllExecutionData |
Sources:
The system provides utilities for generating different types of test tasks:
Sources:
A predefined REST API task that makes HTTP requests to httpbin.org with a block trigger:
Sources:
A predefined JavaScript task that executes simple JavaScript code with a block trigger:
Sources:
When writing tests for the EigenLayer-AVS system, consider the following best practices:
Sources:
Tests are executed as part of the continuous integration pipeline. For more information about CI/CD and release processes, refer to the CI/CD and Releases documentation.
Feature this wiki to auto refresh weekly