Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

integration-test-writer

БесплатноБез исполняемых скриптовНе проверен

Write Solidity integration tests for EigenLayer contracts. Use when the user asks to write integration tests, test user flows, test cross-contract…

Layr-Labsот Layr-Labs★ 721 звезда на GitHub16 установок в других каталогах

Об этом скилле

Integration Test Writer

Write comprehensive integration tests for EigenLayer Solidity contracts following the project's established conventions.

Overview

Integration tests orchestrate the deployment of all EigenLayer core contracts to test high-level user flows across multiple contracts. There are three test modes:

  1. Local Integration Tests - Deploy fresh contracts and test user flows
  2. Fork Tests - Fork mainnet, upgrade all contracts to latest implementations, then run the integration test suite
  3. Upgrade Tests - Fork mainnet, perform actions on OLD contracts, then upgrade and verify compatibility

Test Function Signature

All integration test functions MUST:

  1. Be named testFuzz_action1_action2_... describing the flow
  2. Take uint24 _random (or _r) as the only parameter - this seeds randomness
  3. Use the rand(_random) modifier to initialize the random seed
function testFuzz_deposit_delegate_queue_complete(uint24 _random) public rand(_random) {
    // Test implementation
}

The rand() modifier initializes the test's random seed, which is used by helper functions like _newRandomStaker() to generate deterministic random values for reproducible tests.

Test File Locations

Type Location
Normal integration tests src/test/integration/tests/
Upgrade tests src/test/integration/tests/upgrade/
Check functions src/test/integration/IntegrationChecks.t.sol
Multichain checks src/test/integration/MultichainIntegrationChecks.t.sol

Core Principles

1. All Actions Must Be Called Through User Contracts

Never call contracts directly. Use the User or AVS actor contracts:

// ✅ CORRECT - Actions through User/AVS
staker.depositIntoEigenlayer(strategies, tokenBalances);
operator.delegateTo(operator);
avs.createOperatorSet(strategies);

// ❌ WRONG - Direct contract calls
strategyManager.depositIntoStrategy(...);
delegationManager.delegateTo(...);

2. Every Action Must Be Followed By a Check

After each numbered action, verify state changes using check_* functions from IntegrationChecks.t.sol:

// 1. Deposit Into Strategies
staker.depositIntoEigenlayer(strategies, tokenBalances);
check_Deposit_State(staker, strategies, shares);

// 2. Delegate to an operator
staker.delegateTo(operator);
check_Delegation_State(staker, operator, strategies, shares);

3. Actions Must Be Numbered

Use comments to number each action step for clarity:

// 1. Deposit Into Strategies
staker.depositIntoEigenlayer(strategies, tokenBalances);
check_Deposit_State(staker, strategies, shares);

// 2. Delegate to an operator
staker.delegateTo(operator);
check_Delegation_State(staker, operator, strategies, shares);

// 3. Queue Withdrawals
Withdrawal[] memory withdrawals = staker.queueWithdrawals(strategies, shares);
check_QueuedWithdrawal_State(staker, operator, strategies, shares, withdrawableShares, withdrawals, withdrawalRoots);

User Types

User (Staker/Operator)

Located in src/test/integration/users/User.t.sol. A User can act as both a staker AND an operator.

Key methods:

  • depositIntoEigenlayer(strategies, tokenBalances) - Deposit tokens
  • delegateTo(operator) - Delegate to an operator
  • registerAsOperator() - Register as an operator
  • queueWithdrawals(strategies, shares) - Queue withdrawals
  • completeWithdrawalAsTokens(withdrawal) / completeWithdrawalAsShares(withdrawal) - Complete withdrawals
  • registerForOperatorSet(operatorSet) - Register for an operator set
  • modifyAllocations(params) - Allocate magnitude to operator sets
  • startValidators() / verifyWithdrawalCredentials(validators) - Native ETH staking
  • startCheckpoint() / completeCheckpoint() - Checkpoint EigenPod

AVS

Located in src/test/integration/users/AVS.t.sol. Represents an AVS that creates operator sets and slashes operators.

Key methods:

  • createOperatorSet(strategies) - Create an operator set
  • createRedistributingOperatorSets(strategies, recipients) - Create redistributing operator sets
  • slashOperator(params) - Slash an operator
  • updateSlasher(operatorSetId, slasher) - Update the slasher for an operator set

Test Structure

Normal Integration Test

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.27;

import "src/test/integration/IntegrationChecks.t.sol";

/// @notice Base contract for shared setup across test variants
contract Integration_FlowName_Base is IntegrationCheckUtils {
    using ArrayLib for *;

    // Declare state used across tests
    AVS avs;
    OperatorSet operatorSet;
    User operator;
    User staker;
    IStrategy[] strategies;
    uint[] initTokenBalances;
    uint[] initDepositShares;

    /// @dev Setup state used across all test functions
    function _init() internal virtual override {
        _configAssetTypes(HOLDS_LST | HOLDS_ETH); // Configure asset types

        // Create
Полный SKILL.md на GitHub

Установить integration-test-writer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Glob
Grep
Edit
Write
Bash(forge:*)

FAQ

Что делает скилл integration-test-writer?

Write Solidity integration tests for EigenLayer contracts. Use when the user asks to write integration tests, test user flows, test cross-contract interactions, or test upgrade scenarios. Follows project conventions with User/AVS actors and numbered action steps.

Как установить скилл integration-test-writer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл integration-test-writer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить integration-test-writer с