鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

interface-lint

规范 Solidity 接口文件的格式与文档,按 EigenLayer 标准组织 Errors / Events / Types 子接口,自动生成错误码,统一要求函数、事件、类型和错误的注释结构,确保代码可读性、可维护性及跨链场景下的语义一致性。

区块链
访问 GitHub
文档Skills.MD
name
interface-lint
description
Format and lint Solidity interface files following EigenLayer conventions. Use when the user asks to format an interface, add documentation to an interface, or create a new interface. Ensures proper organization with Errors/Events/Types sub-interfaces.
allowed-tools
Read, Glob, Grep, Edit, Write, Bash(cast:*)

Interface Lint

Format Solidity interface files following EigenLayer's established conventions for organization, documentation, and error code generation.

Interface Structure

Every interface file should contain four interface contracts in this order:

  1. I{ContractName}Errors - All custom errors
  2. I{ContractName}Types - All structs and enums
  3. I{ContractName}Events - All events (inherits Types for struct access)
  4. I{ContractName} - Main interface (inherits Errors and Events)
▼
solidity
复制代码
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.27; // Imports interface I{ContractName}Errors { // All errors with error codes } interface I{ContractName}Types { // All structs and enums } interface I{ContractName}Events is I{ContractName}Types { // All events } interface I{ContractName} is I{ContractName}Errors, I{ContractName}Events { // All function declarations }

Error Documentation

Each error MUST include:

  1. @notice describing when the error is thrown
  2. @dev Error code: 0x... with the 4-byte selector from cast sig

Generating Error Codes

Use cast sig to generate the error code:

▼
bash
复制代码
cast sig "InvalidOperatorSet()" # Output: 0x7ec5c154

Error Format

▼
solidity
复制代码
interface IContractNameErrors { /// @notice Thrown when the operator set is not valid /// @dev Error code: 0x7ec5c154 error InvalidOperatorSet(); /// @notice Thrown when the chainId is invalid /// @dev Error code: 0x7a47c9a2 error InvalidChainId(); /// @notice Thrown when the key type is not set for the operatorSet /// @dev Error code: 0xe57cacbd /// @dev Additional context about why this is required error KeyTypeNotSet(); }

Types Documentation

Each struct/enum MUST include:

  1. @notice with a brief description
  2. @param for each field in structs
▼
solidity
复制代码
interface IContractNameTypes { /// @notice A per-operatorSet configuration struct /// @param owner the permissioned owner of the OperatorSet /// @param maxStalenessPeriod the maximum staleness period in seconds struct OperatorSetConfig { address owner; uint32 maxStalenessPeriod; } /// @notice Represents the status of an operator's registration /// @param registered Whether the operator is currently registered /// @param slashableUntil Block until which the operator remains slashable struct RegistrationStatus { bool registered; uint32 slashableUntil; } }

Event Documentation

Each event MUST include a singular @notice describing when the event is emitted:

▼
solidity
复制代码
interface IContractNameEvents is IContractNameTypes { /// @notice Emitted when a generation reservation is created event GenerationReservationCreated(OperatorSet operatorSet); /// @notice Emitted when an operator set config is set event OperatorSetConfigSet(OperatorSet operatorSet, OperatorSetConfig config); /// @notice Emitted when a chainID is added to the whitelist event ChainIDAddedToWhitelist(uint256 chainID, address operatorTableUpdater); }

Function Documentation

Each function in the main interface MUST include:

  1. @notice - What the function does
  2. @param - Description for each parameter
  3. @return - Description for each return value (for view functions)
  4. @dev - Additional context (optional, but include caller requirements)
  5. @dev Reverts for: - List ALL revert conditions
  6. @dev Emits the following events: - List ALL events emitted

Function Documentation Format

▼
solidity
复制代码
interface IContractName is IContractNameErrors, IContractNameEvents { /// @notice Creates a generation reservation for cross-chain transport /// @param operatorSet the operatorSet to make a reservation for /// @param operatorTableCalculator the calculator contract address /// @param config the config containing owner and staleness period /// @dev msg.sender must be an authorized caller for operatorSet.avs /// @dev Reverts for: /// - CurrentlyPaused: Generation reservations are paused /// - InvalidPermissions: Caller is not authorized /// - InvalidOperatorSet: The operatorSet does not exist /// - GenerationReservationAlreadyExists: Reservation already exists /// - InvalidStalenessPeriod: The maxStalenessPeriod is invalid /// @dev Emits the following events: /// - GenerationReservationCreated: When the reservation is created /// - OperatorTableCalculatorSet: When the calculator is set /// - OperatorSetConfigSet: When the config is set function createGenerationReservation( OperatorSet calldata operatorSet, IOperatorTableCalculator operatorTableCalculator, OperatorSetConfig calldata config ) external; /// @notice Gets the operator set config /// @param operatorSet the operatorSet to query /// @return The OperatorSetConfig for the given operatorSet /// @dev You should check if an operatorSet has an active reservation first function getOperatorSetConfig( OperatorSet memory operatorSet ) external view returns (OperatorSetConfig memory); }

Revert Conditions Format

List each revert condition with the error name and when it occurs:

▼
solidity
复制代码
/// @dev Reverts for: /// - CurrentlyPaused: Generation reservations are paused /// - InvalidPermissions: Caller is not an authorized caller for operatorSet.avs /// - InvalidOperatorSet: The operatorSet does not exist in the AllocationManager /// - GenerationReservationAlreadyExists: A generation reservation already exists

For Ownable errors, use the string format:

▼
solidity
复制代码
/// @dev Reverts for: /// - "Ownable: caller is not the owner": Caller is not the owner

Events Emitted Format

List each event with a brief description of when it's emitted:

▼
solidity
复制代码
/// @dev Emits the following events: /// - GenerationReservationCreated: When the reservation is successfully created /// - OperatorTableCalculatorSet: When the calculator is set for the operatorSet /// - OperatorSetConfigSet: When the config is set for the operatorSet

View Functions

View functions typically don't revert (except for input validation) and don't emit events. Document them simpler:

▼
solidity
复制代码
/// @notice Gets the active generation reservations /// @return An array of operatorSets with active generationReservations function getActiveGenerationReservations() external view returns (OperatorSet[] memory); /// @notice Gets reservations by range for pagination /// @param startIndex the start index of the range, inclusive /// @param endIndex the end index of the range, exclusive /// @return An array of operatorSets in the specified range /// @dev Reverts for: /// - InvalidRange: startIndex is greater than endIndex /// - InvalidEndIndex: endIndex exceeds array length function getActiveGenerationReservationsByRange( uint256 startIndex, uint256 endIndex ) external view returns (OperatorSet[] memory);

Complete Example

Reference: src/contracts/interfaces/ICrossChainRegistry.sol

This file demonstrates the full pattern with:

  • Errors interface with cast sig error codes
  • Types interface with documented structs
  • Events interface inheriting Types
  • Main interface with full function documentation

Checklist for Linting an Interface

  1. ☐ Split into Errors, Types, Events, and main interface contracts
  2. ☐ Errors have @notice and @dev Error code: 0x... (use cast sig)
  3. ☐ Types have @notice and @param for each field
  4. ☐ Events have singular @notice describing when emitted
  5. ☐ Events interface inherits Types interface
  6. ☐ Main interface inherits Errors and Events interfaces
  7. ☐ Functions have @notice, @param, and @return (for views)
  8. ☐ Functions list ALL revert conditions under @dev Reverts for:
  9. ☐ Functions list ALL events under @dev Emits the following events:
  10. ☐ View functions document reverts only when they can revert

Generating All Error Codes

To generate error codes for an entire interface:

▼
bash
复制代码
# For each error in the interface, run: cast sig "ErrorName()" cast sig "ErrorName(uint256)" # Include params if error has them # Example output: # 0x7ec5c154 # InvalidOperatorSet() # 0x7a47c9a2 # InvalidChainId()

Common Error Patterns

ErrorTypical CodeUsage
InvalidOperatorSet()0x7ec5c154OperatorSet doesn't exist
InvalidPermissions()variesCaller not authorized
InvalidCaller()variesWrong msg.sender
ArrayLengthMismatch()0xa24a13a6Input arrays have different lengths
区块链

快捷安装

复制到终端去安装 Skill

npxskillsaddLayr-Labs/eigenlayer-contracts--skill"interface-lint"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
property-based-testing
通过生成随机输入验证代码在各类边界条件下的行为一致性,适用于序列化、解析、归一化及纯函数等场景,能有效发现隐含缺陷并提升测试覆盖率,尤其适合需要高可靠性的算法与智能合约验证。
compliance-checker
能够对基础设施配置进行合规性评估,检查是否符合 SOC2、HIPAA 和 PCI DSS 等行业标准,识别潜在的安全风险与违规项,并生成改进建议报告,适用于安全审计与合规审查场景。
orchestration
作为系统的核心协调中枢,负责将用户复杂需求拆解为并行任务流,动态调度不同能力的智能体协同工作,自动管理任务依赖与执行状态,并在后台静默完成多线程探索、分析与实现,最终整合结果交付完整解决方案。
skill-adapter
对基础设施配置进行多标准合规性评估,覆盖 SOC2、HIPAA 和 PCI DSS 等主流框架,自动识别配置偏差与安全风险,并生成可操作的整改建议报告,支撑持续合规治理与审计准备。
contract-test-creator
自动生成符合行业规范的契约测试代码与配置,提供从框架搭建到单元测试、集成测试及模拟对象编写的全流程支持,适用于需要实现高质量自动化测试验证的开发场景。