---
eip: 7985
label: ERC-7985
title: Gateway Attributes for Message Control
status: Draft
type: Standards Track
category: ERC
created: 2024-07-04
requires: 7786
official: https://eips.ethereum.org/EIPS/eip-7985
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7985.md
canonical: https://eips.huatuo.xyz/ko/eip-7985/
lang: ko
tldr: "ERC-7786 크로스체인 메시지를 위한 표준 속성: 취소, 전달 시간대, 재시도 정책, 리버트 동작, 의존 관계, 최소 가스. 앱이 어떤 게이트웨이에든 같은 제어를 요청할 수 있게 한다."
tags: [crosschain, messaging, gateway, attributes, interop]
---

# ERC-7985: Gateway Attributes for Message Control

> Gateway attributes for cancellation, timeout, retry, dependencies, and delivery control in cross-chain messaging.

**TL;DR:** ERC-7786 크로스체인 메시지를 위한 표준 속성: 취소, 전달 시간대, 재시도 정책, 리버트 동작, 의존 관계, 최소 가스. 앱이 어떤 게이트웨이에든 같은 제어를 요청할 수 있게 한다.

## 어떤 문제를 해결하나요?

[ERC-7786](/eip-7786/)은 어떤 브리지나 메시징 프로토콜("게이트웨이")을 통해서든 체인 간에 메시지를 보낼 수 있는 하나의 인터페이스를 정의합니다. 프로토콜별 기능은 의도적으로 **속성**에 맡겨 두었습니다. 속성은 각 메시지에 붙는 추가 `bytes` 항목으로, 4바이트 키로 시작합니다. ERC-7786은 흔히 쓰이는 속성을 별도의 ERC에서 표준화하라고 권장합니다.

ERC-7985는 거의 모든 크로스체인 앱이 결국 필요로 하는 제어 기능을 위한 후속 표준입니다. 메시지 취소, 너무 늦거나 너무 일찍 도착하는 것 방지, 실패 시 재시도, 전달 실패 시 동작 결정, 순서 강제, 충분한 가스 보장입니다. 공통 정의가 없으면 게이트웨이마다 자기만의 방식을 만들고, 애플리케이션은 제공자마다 따로 처리해야 합니다.

## 어떻게 동작하나요?

각 속성의 키는 설명적인 시그니처의 함수 셀렉터이고, 값은 인자의 ABI 인코딩입니다. 그래서 `abi.encodeWithSignature`로 항목을 만들 수 있습니다. 게이트웨이는 임의의 부분 집합만 지원해도 되며, 지원하는 속성의 인코딩은 검증해야 하고 잘못된 인코딩이면 리버트해야 합니다.

| 속성 | 셀렉터 | 의미 |
| --- | --- | --- |
| `cancellable(bool)` | `0xde986d7f` | true이면 게이트웨이는 대기 중인 메시지를 취소할 방법을 제공해야 합니다. 기본값은 false입니다. |
| `deliverBefore(uint256)` | `0x3e97d7ee` | 이 Unix 타임스탬프 이후에는 전달이 금지됩니다. `0`은 만료 없음을 뜻합니다. |
| `deliverAfter(uint256)` | `0x745910eb` | 가장 이른 전달 타임스탬프입니다. `0`은 지연 없음을 뜻합니다. `deliverBefore`와 함께 하나의 시간대를 이룹니다. |
| `retryPolicy(bytes)` | `0xf002c055` | 패킹된 `uint16 maxRetries`, `uint32 retryDelay`(초), `uint32 backoffMultiplier`(베이시스 포인트, 10000 = 1배). |
| `revertBehavior(uint8)` | `0x9e521a77` | `0`은 실패 시 리버트(기본값), `1`은 `MessageFailed`를 발생시키고 계속 진행, `2`는 조용히 실패. |
| `dependsOn(bytes32[])` | `0xa9fed7b9` | 먼저 성공적으로 전달되어야 하는 메시지 ID. |
| `minGasLimit(uint256)` | `0x39f87ba1` | 게이트웨이가 전달을 위해 확보해야 하는 최소 가스. |

이 속성들을 모르는 게이트웨이도 ERC-7786의 규칙에 따라 계속 동작합니다. 발신자는 먼저 `supportsAttribute(selector)`로 확인할 수 있습니다.

## 샘플 코드

전달 시간대, 가스 하한, 의존 관계를 지정해 메시지를 보내는 예시:

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

interface IERC7786GatewaySource {
    function supportsAttribute(bytes4 selector) external view returns (bool);
    function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)
        external payable returns (bytes32 sendId);
}

contract Sender {
    IERC7786GatewaySource public immutable gateway;
    constructor(IERC7786GatewaySource g) { gateway = g; }

    function send(bytes calldata recipient, bytes calldata payload, bytes32 previous)
        external payable returns (bytes32)
    {
        bytes32[] memory deps = new bytes32[](1);
        deps[0] = previous;

        bytes[] memory attrs = new bytes[](4);
        attrs[0] = abi.encodeWithSignature("deliverAfter(uint256)", block.timestamp + 10 minutes);
        attrs[1] = abi.encodeWithSignature("deliverBefore(uint256)", block.timestamp + 1 days);
        attrs[2] = abi.encodeWithSignature("minGasLimit(uint256)", 200_000);
        attrs[3] = abi.encodeWithSignature("dependsOn(bytes32[])", deps);

        require(gateway.supportsAttribute(0xa9fed7b9), "no dependsOn support");
        return gateway.sendMessage{value: msg.value}(recipient, payload, attrs);
    }
}
```

`recipient`는 ERC-7786에서 쓰는 바이너리 Interoperable Address입니다([ERC-7930](/eip-7930/) 참고).

## 알아둘 점

- **상태: Draft.** 셀렉터는 시그니처로 고정되어 있지만 의미 체계는 아직 바뀔 수 있습니다.
- Security Considerations는 아직 작성되지 않았습니다. 초안에 적힌 미해결 질문 중 하나는 게이트웨이가 순환하는 `dependsOn` 체인을 어떻게 처리해야 하는가입니다.
- `retryPolicy`의 기본값 설명은 모호합니다. 빈 값은 "무한 재시도"로, `maxRetries = 0`은 "재시도 없음"으로 설명되어 있습니다. 기본값에 의존하지 말고, 게이트웨이가 지원한다면 명시적으로 설정하세요.
- 속성은 요청일 뿐입니다. 실제로 강제되는지는 게이트웨이와 기반 브리지에 달려 있으니, 어느 하나에 의존하기 전에 `supportsAttribute`를 확인하세요.


---

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