---
eip: 7484
label: ERC-7484
title: Registry Extension for ERC-7579
status: Draft
type: Standards Track
category: ERC
created: 2023-08-14
requires: 7579
official: https://eips.ethereum.org/EIPS/eip-7484
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7484.md
canonical: https://eips.huatuo.xyz/zh/eip-7484/
lang: zh
tldr: 一个标准的模块注册表（Module Registry）接口，让 ERC-7579 模块化智能账户在安装或运行第三方模块之前，先检查链上的安全证明（attestation）。
tags: [account-abstraction, smart-accounts, modules, security, attestations]
---

# ERC-7484: Registry Extension for ERC-7579

> Adapters that allow modular smart accounts to verify the security of modules using a Module Registry

**TL;DR:** 一个标准的模块注册表（Module Registry）接口，让 ERC-7579 模块化智能账户在安装或运行第三方模块之前，先检查链上的安全证明（attestation）。

## 它解决什么问题？

模块化智能账户（基于 [ERC-4337](/eip-4337/) 的 [ERC-7579](/eip-7579/)）允许任何人编写插件模块：验证器、执行器、钩子等。这种开放性也是一种风险：安装到你账户里的恶意或有漏洞的模块可能会掏空账户，而且大多数重要的性质（例如"该模块只写入自己的存储"）无法在链上验证。

ERC-7484 提出了一个 **Module Registry**，审计方等各方可以在其中发布关于模块的**证明（attestation）**，同时规定了标准的**适配器（Adapter）** 行为，让账户在信任某个模块之前先查询该注册表。这样，无论账户采用何种架构，都可以通过同一个接口，依赖自己选择的那一组证明方。

## 它如何运作

角色：

- **证明方（Attester）**：对某个模块做出链上声明的实体（审计方、团队、DAO）。
- **注册表（Registry）**：存储证明（或对证明的引用）。它必须验证每条证明确实由该证明方创建，并允许证明方撤销。它应当支持过期。
- **适配器（Adapter）**：账户中查询注册表的逻辑（原生内置，或作为一个模块）。

注册表的核心调用是 `check` 函数，当模块不被信任时它们会直接 **revert**：

- `check(module)` / `checkForAccount(account, module)` 使用账户之前通过 `trustAttesters(threshold, attesters)` 存储的证明方和阈值。
- `check(module, attesters, threshold)` 显式传入证明方。
- 带 `moduleType` 的变体还会验证该模块是否被证明为该类型（例如验证器）。

如果给定证明方中做出证明的少于 `threshold` 个，如果其中任何一个撤销了证明，或者证明方列表不唯一且未排序，检查必须 revert。

适配器必须在首次调用某个模块的交易之前或期间，至少向注册表查询一次该模块，并且必须把注册表的 revert 视为安全风险。它应当在安装时和执行时都进行查询，并在失败时 revert 整个流程。

规范还包含一个无所有者的**单例**注册表参考实现，认为一个共享的注册表可以让证明集中起来，但账户并不必须使用它。

## 示例代码

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC7484 {
    function check(address module) external view;
    function check(address module, uint256 moduleType) external view;
    function check(address module, address[] calldata attesters, uint256 threshold) external view;
    function trustAttesters(uint8 threshold, address[] calldata attesters) external;
}

abstract contract RegistryAdapter {
    IERC7484 public immutable registry;

    constructor(IERC7484 _registry, address[] memory sortedAttesters, uint8 threshold) {
        registry = _registry;
        // stored per msg.sender, i.e. this account
        _registry.trustAttesters(threshold, sortedAttesters);
    }

    function _installModule(address module, uint256 moduleType) internal {
        registry.check(module, moduleType); // reverts if not attested
        // ... install logic
    }
}
```

## 需要注意

- 状态为 **Draft**。函数签名在草案期间已经变化过，今后可能再次变化。
- 证明方地址必须以唯一且按升序**排序**的方式传入，否则注册表会 revert。
- 证明的价值取决于证明方。选择信任谁、设置多大的阈值，才是真正的安全决策。
- 单例注册表是单点故障：如果有人能够冒充受信任的证明方做出证明，许多账户会同时受到影响。规范讨论了这一权衡。
- [ERC-6900](/eip-6900/) 是另一个主张更强的模块化账户标准；ERC-7484 面向的是 ERC-7579 账户。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7484
