{"eip":7985,"title":"Gateway Attributes for Message Control","description":"Gateway attributes for cancellation, timeout, retry, dependencies, and delivery control in cross-chain messaging.","authors":["Ernesto García (@ernestognw)","Kalman Lajko (@LajkoKalman)","Valera Grinenko (@0xValera)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-07-04","requires":[7786],"discussionsTo":"https://ethereum-magicians.org/t/new-erc-attributes-for-message-control-in-erc-7786-gateways/24734","repo":"ERCs","label":"ERC-7985","officialUrl":"https://eips.ethereum.org/EIPS/eip-7985","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7985.md","url":"https://eips.huatuo.xyz/eip-7985/","tldr":{"en":"Standard ERC-7786 attributes for cross-chain messages: cancellation, delivery windows, retry policy, revert behavior, dependencies and minimum gas, so apps can request the same controls from any gateway.","ja":"ERC-7786 のクロスチェーンメッセージ向け標準アトリビュート（キャンセル、配信ウィンドウ、リトライポリシー、リバート時の挙動、依存関係、最小ガス）。アプリはどのゲートウェイにも同じ制御を要求できる。","ko":"ERC-7786 크로스체인 메시지를 위한 표준 속성: 취소, 전달 시간대, 재시도 정책, 리버트 동작, 의존 관계, 최소 가스. 앱이 어떤 게이트웨이에든 같은 제어를 요청할 수 있게 한다.","zh":"ERC-7786 跨链消息的标准属性：取消、投递窗口、重试策略、回滚行为、依赖关系和最低 gas，让应用可以向任何网关请求相同的控制。"},"tags":["crosschain","messaging","gateway","attributes","interop"],"explainers":{"en":{"lang":"en","tldr":"Standard ERC-7786 attributes for cross-chain messages: cancellation, delivery windows, retry policy, revert behavior, dependencies and minimum gas, so apps can request the same controls from any gateway.","tags":["crosschain","messaging","gateway","attributes","interop"],"related":[7786,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7985/","markdown":"## What problem does it solve?\n\n[ERC-7786](/eip-7786/) defines one interface for sending messages across chains through any bridge or messaging protocol (a \"gateway\"). It deliberately leaves protocol-specific features to **attributes**: extra `bytes` entries attached to each message, each starting with a 4-byte key. ERC-7786 recommends standardizing common attributes in separate ERCs.\n\nERC-7985 is that follow-up for the controls nearly every cross-chain app ends up needing: cancel a message, stop it from arriving too late or too early, retry on failure, decide what happens when delivery fails, enforce ordering and guarantee enough gas. Without a shared definition, each gateway invents its own, and applications have to special-case every provider.\n\n## How it works\n\nEach attribute key is the function selector of a descriptive signature, and its value is the ABI encoding of the arguments, so an entry can be built with `abi.encodeWithSignature`. A gateway may support any subset, must validate the encoding of those it supports, and must revert on bad encoding.\n\n| Attribute | Selector | Meaning |\n| --- | --- | --- |\n| `cancellable(bool)` | `0xde986d7f` | If true, the gateway must offer a way to cancel the pending message. Defaults to false. |\n| `deliverBefore(uint256)` | `0x3e97d7ee` | Unix timestamp after which delivery is forbidden; `0` means no expiry. |\n| `deliverAfter(uint256)` | `0x745910eb` | Earliest delivery timestamp; `0` means no delay. Together with `deliverBefore` this forms a window. |\n| `retryPolicy(bytes)` | `0xf002c055` | Packed `uint16 maxRetries`, `uint32 retryDelay` (seconds), `uint32 backoffMultiplier` (basis points, 10000 = 1x). |\n| `revertBehavior(uint8)` | `0x9e521a77` | `0` revert on failure (default), `1` emit `MessageFailed` and continue, `2` fail silently. |\n| `dependsOn(bytes32[])` | `0xa9fed7b9` | Message IDs that must be delivered successfully first. |\n| `minGasLimit(uint256)` | `0x39f87ba1` | Minimum gas the gateway must make available for delivery. |\n\nGateways that do not know these attributes keep working under ERC-7786's rules; senders can check `supportsAttribute(selector)` first.\n\n## Sample code\n\nSending a message with a delivery window, a gas floor and a dependency:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7786GatewaySource {\n    function supportsAttribute(bytes4 selector) external view returns (bool);\n    function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)\n        external payable returns (bytes32 sendId);\n}\n\ncontract Sender {\n    IERC7786GatewaySource public immutable gateway;\n    constructor(IERC7786GatewaySource g) { gateway = g; }\n\n    function send(bytes calldata recipient, bytes calldata payload, bytes32 previous)\n        external payable returns (bytes32)\n    {\n        bytes32[] memory deps = new bytes32[](1);\n        deps[0] = previous;\n\n        bytes[] memory attrs = new bytes[](4);\n        attrs[0] = abi.encodeWithSignature(\"deliverAfter(uint256)\", block.timestamp + 10 minutes);\n        attrs[1] = abi.encodeWithSignature(\"deliverBefore(uint256)\", block.timestamp + 1 days);\n        attrs[2] = abi.encodeWithSignature(\"minGasLimit(uint256)\", 200_000);\n        attrs[3] = abi.encodeWithSignature(\"dependsOn(bytes32[])\", deps);\n\n        require(gateway.supportsAttribute(0xa9fed7b9), \"no dependsOn support\");\n        return gateway.sendMessage{value: msg.value}(recipient, payload, attrs);\n    }\n}\n```\n\n`recipient` is a binary Interoperable Address as used by ERC-7786 (see [ERC-7930](/eip-7930/)).\n\n## Things to know\n\n- **Status: Draft.** Selectors are fixed by their signatures, but semantics may still change.\n- Security Considerations are not written yet. An open question noted in the draft is how gateways should handle circular `dependsOn` chains.\n- The `retryPolicy` default text is ambiguous: an empty value is described as \"infinite retries\", while `maxRetries = 0` is described as \"no retries\". Do not rely on the default; set it explicitly if your gateway supports it.\n- Attributes are requests. Whether they are enforced depends on the gateway and the underlying bridge; check `supportsAttribute` before relying on any of them.\n"},"ja":{"lang":"ja","tldr":"ERC-7786 のクロスチェーンメッセージ向け標準アトリビュート（キャンセル、配信ウィンドウ、リトライポリシー、リバート時の挙動、依存関係、最小ガス）。アプリはどのゲートウェイにも同じ制御を要求できる。","tags":["crosschain","messaging","gateway","attributes","interop"],"related":[7786,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7985/","markdown":"## 何を解決するのか\n\n[ERC-7786](/eip-7786/) は、任意のブリッジやメッセージングプロトコル（「ゲートウェイ」）を通じてチェーン間でメッセージを送るための共通インターフェースを定義します。プロトコル固有の機能は意図的に**アトリビュート**に委ねられています。アトリビュートは各メッセージに付ける追加の `bytes` エントリで、先頭に 4 バイトのキーを持ちます。ERC-7786 は、よく使われるアトリビュートを別々の ERC で標準化することを推奨しています。\n\nERC-7985 は、ほぼすべてのクロスチェーンアプリが最終的に必要とする制御のための、その後続にあたります。メッセージのキャンセル、遅すぎる・早すぎる到着の防止、失敗時のリトライ、配信失敗時の挙動の決定、順序の強制、十分なガスの保証です。共通の定義がなければ、ゲートウェイごとに独自の仕様が作られ、アプリケーションはプロバイダーごとに個別対応しなければなりません。\n\n## 仕組み\n\n各アトリビュートのキーは、説明的なシグネチャの関数セレクターで、値は引数の ABI エンコードです。そのため `abi.encodeWithSignature` でエントリを作れます。ゲートウェイは任意のサブセットをサポートでき、サポートするものについてはエンコードを検証し、不正なエンコードの場合はリバートしなければなりません。\n\n| アトリビュート | セレクター | 意味 |\n| --- | --- | --- |\n| `cancellable(bool)` | `0xde986d7f` | true の場合、ゲートウェイは保留中のメッセージをキャンセルする手段を提供しなければならない。デフォルトは false。 |\n| `deliverBefore(uint256)` | `0x3e97d7ee` | これを過ぎると配信が禁止される Unix タイムスタンプ。`0` は期限なし。 |\n| `deliverAfter(uint256)` | `0x745910eb` | 最も早い配信タイムスタンプ。`0` は遅延なし。`deliverBefore` と組み合わせるとウィンドウになる。 |\n| `retryPolicy(bytes)` | `0xf002c055` | パックされた `uint16 maxRetries`、`uint32 retryDelay`（秒）、`uint32 backoffMultiplier`（ベーシスポイント、10000 = 1 倍）。 |\n| `revertBehavior(uint8)` | `0x9e521a77` | `0` は失敗時にリバート（デフォルト）、`1` は `MessageFailed` を発行して続行、`2` は黙って失敗。 |\n| `dependsOn(bytes32[])` | `0xa9fed7b9` | 先に正常に配信されなければならないメッセージ ID。 |\n| `minGasLimit(uint256)` | `0x39f87ba1` | ゲートウェイが配信のために確保しなければならない最小ガス。 |\n\nこれらのアトリビュートを知らないゲートウェイも ERC-7786 のルールの下で動作し続けます。送信側は先に `supportsAttribute(selector)` で確認できます。\n\n## サンプルコード\n\n配信ウィンドウ、ガスの下限、依存関係を指定してメッセージを送る例:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7786GatewaySource {\n    function supportsAttribute(bytes4 selector) external view returns (bool);\n    function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)\n        external payable returns (bytes32 sendId);\n}\n\ncontract Sender {\n    IERC7786GatewaySource public immutable gateway;\n    constructor(IERC7786GatewaySource g) { gateway = g; }\n\n    function send(bytes calldata recipient, bytes calldata payload, bytes32 previous)\n        external payable returns (bytes32)\n    {\n        bytes32[] memory deps = new bytes32[](1);\n        deps[0] = previous;\n\n        bytes[] memory attrs = new bytes[](4);\n        attrs[0] = abi.encodeWithSignature(\"deliverAfter(uint256)\", block.timestamp + 10 minutes);\n        attrs[1] = abi.encodeWithSignature(\"deliverBefore(uint256)\", block.timestamp + 1 days);\n        attrs[2] = abi.encodeWithSignature(\"minGasLimit(uint256)\", 200_000);\n        attrs[3] = abi.encodeWithSignature(\"dependsOn(bytes32[])\", deps);\n\n        require(gateway.supportsAttribute(0xa9fed7b9), \"no dependsOn support\");\n        return gateway.sendMessage{value: msg.value}(recipient, payload, attrs);\n    }\n}\n```\n\n`recipient` は、ERC-7786 で使われるバイナリ形式の Interoperable Address です（[ERC-7930](/eip-7930/) を参照）。\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** セレクターはシグネチャで固定されていますが、セマンティクスは今後変わる可能性があります。\n- Security Considerations はまだ書かれていません。ドラフトに記された未解決の課題として、ゲートウェイが循環した `dependsOn` のチェーンをどう扱うべきかがあります。\n- `retryPolicy` のデフォルトに関する記述は曖昧です。空の値は「無限リトライ」と説明される一方、`maxRetries = 0` は「リトライなし」と説明されています。デフォルトに頼らず、ゲートウェイが対応していれば明示的に設定してください。\n- アトリビュートはあくまでリクエストです。実際に強制されるかどうかはゲートウェイと基盤となるブリッジ次第です。どれかに頼る前に `supportsAttribute` を確認してください。\n"},"ko":{"lang":"ko","tldr":"ERC-7786 크로스체인 메시지를 위한 표준 속성: 취소, 전달 시간대, 재시도 정책, 리버트 동작, 의존 관계, 최소 가스. 앱이 어떤 게이트웨이에든 같은 제어를 요청할 수 있게 한다.","tags":["crosschain","messaging","gateway","attributes","interop"],"related":[7786,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7985/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-7786](/eip-7786/)은 어떤 브리지나 메시징 프로토콜(\"게이트웨이\")을 통해서든 체인 간에 메시지를 보낼 수 있는 하나의 인터페이스를 정의합니다. 프로토콜별 기능은 의도적으로 **속성**에 맡겨 두었습니다. 속성은 각 메시지에 붙는 추가 `bytes` 항목으로, 4바이트 키로 시작합니다. ERC-7786은 흔히 쓰이는 속성을 별도의 ERC에서 표준화하라고 권장합니다.\n\nERC-7985는 거의 모든 크로스체인 앱이 결국 필요로 하는 제어 기능을 위한 후속 표준입니다. 메시지 취소, 너무 늦거나 너무 일찍 도착하는 것 방지, 실패 시 재시도, 전달 실패 시 동작 결정, 순서 강제, 충분한 가스 보장입니다. 공통 정의가 없으면 게이트웨이마다 자기만의 방식을 만들고, 애플리케이션은 제공자마다 따로 처리해야 합니다.\n\n## 어떻게 동작하나요?\n\n각 속성의 키는 설명적인 시그니처의 함수 셀렉터이고, 값은 인자의 ABI 인코딩입니다. 그래서 `abi.encodeWithSignature`로 항목을 만들 수 있습니다. 게이트웨이는 임의의 부분 집합만 지원해도 되며, 지원하는 속성의 인코딩은 검증해야 하고 잘못된 인코딩이면 리버트해야 합니다.\n\n| 속성 | 셀렉터 | 의미 |\n| --- | --- | --- |\n| `cancellable(bool)` | `0xde986d7f` | true이면 게이트웨이는 대기 중인 메시지를 취소할 방법을 제공해야 합니다. 기본값은 false입니다. |\n| `deliverBefore(uint256)` | `0x3e97d7ee` | 이 Unix 타임스탬프 이후에는 전달이 금지됩니다. `0`은 만료 없음을 뜻합니다. |\n| `deliverAfter(uint256)` | `0x745910eb` | 가장 이른 전달 타임스탬프입니다. `0`은 지연 없음을 뜻합니다. `deliverBefore`와 함께 하나의 시간대를 이룹니다. |\n| `retryPolicy(bytes)` | `0xf002c055` | 패킹된 `uint16 maxRetries`, `uint32 retryDelay`(초), `uint32 backoffMultiplier`(베이시스 포인트, 10000 = 1배). |\n| `revertBehavior(uint8)` | `0x9e521a77` | `0`은 실패 시 리버트(기본값), `1`은 `MessageFailed`를 발생시키고 계속 진행, `2`는 조용히 실패. |\n| `dependsOn(bytes32[])` | `0xa9fed7b9` | 먼저 성공적으로 전달되어야 하는 메시지 ID. |\n| `minGasLimit(uint256)` | `0x39f87ba1` | 게이트웨이가 전달을 위해 확보해야 하는 최소 가스. |\n\n이 속성들을 모르는 게이트웨이도 ERC-7786의 규칙에 따라 계속 동작합니다. 발신자는 먼저 `supportsAttribute(selector)`로 확인할 수 있습니다.\n\n## 샘플 코드\n\n전달 시간대, 가스 하한, 의존 관계를 지정해 메시지를 보내는 예시:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7786GatewaySource {\n    function supportsAttribute(bytes4 selector) external view returns (bool);\n    function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)\n        external payable returns (bytes32 sendId);\n}\n\ncontract Sender {\n    IERC7786GatewaySource public immutable gateway;\n    constructor(IERC7786GatewaySource g) { gateway = g; }\n\n    function send(bytes calldata recipient, bytes calldata payload, bytes32 previous)\n        external payable returns (bytes32)\n    {\n        bytes32[] memory deps = new bytes32[](1);\n        deps[0] = previous;\n\n        bytes[] memory attrs = new bytes[](4);\n        attrs[0] = abi.encodeWithSignature(\"deliverAfter(uint256)\", block.timestamp + 10 minutes);\n        attrs[1] = abi.encodeWithSignature(\"deliverBefore(uint256)\", block.timestamp + 1 days);\n        attrs[2] = abi.encodeWithSignature(\"minGasLimit(uint256)\", 200_000);\n        attrs[3] = abi.encodeWithSignature(\"dependsOn(bytes32[])\", deps);\n\n        require(gateway.supportsAttribute(0xa9fed7b9), \"no dependsOn support\");\n        return gateway.sendMessage{value: msg.value}(recipient, payload, attrs);\n    }\n}\n```\n\n`recipient`는 ERC-7786에서 쓰는 바이너리 Interoperable Address입니다([ERC-7930](/eip-7930/) 참고).\n\n## 알아둘 점\n\n- **상태: Draft.** 셀렉터는 시그니처로 고정되어 있지만 의미 체계는 아직 바뀔 수 있습니다.\n- Security Considerations는 아직 작성되지 않았습니다. 초안에 적힌 미해결 질문 중 하나는 게이트웨이가 순환하는 `dependsOn` 체인을 어떻게 처리해야 하는가입니다.\n- `retryPolicy`의 기본값 설명은 모호합니다. 빈 값은 \"무한 재시도\"로, `maxRetries = 0`은 \"재시도 없음\"으로 설명되어 있습니다. 기본값에 의존하지 말고, 게이트웨이가 지원한다면 명시적으로 설정하세요.\n- 속성은 요청일 뿐입니다. 실제로 강제되는지는 게이트웨이와 기반 브리지에 달려 있으니, 어느 하나에 의존하기 전에 `supportsAttribute`를 확인하세요.\n"},"zh":{"lang":"zh","tldr":"ERC-7786 跨链消息的标准属性：取消、投递窗口、重试策略、回滚行为、依赖关系和最低 gas，让应用可以向任何网关请求相同的控制。","tags":["crosschain","messaging","gateway","attributes","interop"],"related":[7786,7930],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7985/","markdown":"## 它解决什么问题？\n\n[ERC-7786](/eip-7786/) 定义了一个统一接口，用于通过任意桥或消息协议（\"网关\"）在链之间发送消息。它有意把协议特有的功能留给**属性**：附加在每条消息上的额外 `bytes` 条目，每个条目以 4 字节的键开头。ERC-7786 建议在单独的 ERC 中把常见属性标准化。\n\nERC-7985 正是针对几乎每个跨链应用最终都需要的控制能力的后续标准：取消消息、防止消息到达得太晚或太早、失败时重试、决定投递失败时如何处理、强制执行顺序以及保证有足够的 gas。如果没有共同的定义，每个网关都会自创一套，应用也不得不为每个提供方单独处理。\n\n## 它如何运作\n\n每个属性的键是一个描述性签名的函数选择器，其值是参数的 ABI 编码，因此可以用 `abi.encodeWithSignature` 构造条目。网关可以支持任意子集，必须校验自己所支持属性的编码，并且在编码错误时必须回滚。\n\n| 属性 | 选择器 | 含义 |\n| --- | --- | --- |\n| `cancellable(bool)` | `0xde986d7f` | 若为 true，网关必须提供取消待处理消息的方式。默认为 false。 |\n| `deliverBefore(uint256)` | `0x3e97d7ee` | 禁止在此 Unix 时间戳之后投递；`0` 表示不过期。 |\n| `deliverAfter(uint256)` | `0x745910eb` | 最早投递时间戳；`0` 表示无延迟。与 `deliverBefore` 一起构成一个窗口。 |\n| `retryPolicy(bytes)` | `0xf002c055` | 紧凑打包的 `uint16 maxRetries`、`uint32 retryDelay`（秒）、`uint32 backoffMultiplier`（基点，10000 = 1 倍）。 |\n| `revertBehavior(uint8)` | `0x9e521a77` | `0` 失败时回滚（默认），`1` 触发 `MessageFailed` 并继续，`2` 静默失败。 |\n| `dependsOn(bytes32[])` | `0xa9fed7b9` | 必须先成功投递的消息 ID。 |\n| `minGasLimit(uint256)` | `0x39f87ba1` | 网关必须为投递提供的最低 gas。 |\n\n不认识这些属性的网关仍按 ERC-7786 的规则正常工作；发送方可以先检查 `supportsAttribute(selector)`。\n\n## 示例代码\n\n发送一条带有投递窗口、gas 下限和依赖关系的消息：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7786GatewaySource {\n    function supportsAttribute(bytes4 selector) external view returns (bool);\n    function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)\n        external payable returns (bytes32 sendId);\n}\n\ncontract Sender {\n    IERC7786GatewaySource public immutable gateway;\n    constructor(IERC7786GatewaySource g) { gateway = g; }\n\n    function send(bytes calldata recipient, bytes calldata payload, bytes32 previous)\n        external payable returns (bytes32)\n    {\n        bytes32[] memory deps = new bytes32[](1);\n        deps[0] = previous;\n\n        bytes[] memory attrs = new bytes[](4);\n        attrs[0] = abi.encodeWithSignature(\"deliverAfter(uint256)\", block.timestamp + 10 minutes);\n        attrs[1] = abi.encodeWithSignature(\"deliverBefore(uint256)\", block.timestamp + 1 days);\n        attrs[2] = abi.encodeWithSignature(\"minGasLimit(uint256)\", 200_000);\n        attrs[3] = abi.encodeWithSignature(\"dependsOn(bytes32[])\", deps);\n\n        require(gateway.supportsAttribute(0xa9fed7b9), \"no dependsOn support\");\n        return gateway.sendMessage{value: msg.value}(recipient, payload, attrs);\n    }\n}\n```\n\n`recipient` 是 ERC-7786 使用的二进制 Interoperable Address（参见 [ERC-7930](/eip-7930/)）。\n\n## 需要注意\n\n- **状态：Draft。** 选择器由其签名固定，但语义仍可能改变。\n- Security Considerations 尚未撰写。草案中提到的一个未决问题是网关应如何处理循环的 `dependsOn` 链。\n- `retryPolicy` 的默认值描述存在歧义：空值被描述为\"无限重试\"，而 `maxRetries = 0` 被描述为\"不重试\"。不要依赖默认值；如果你的网关支持，请显式设置。\n- 属性只是请求。是否会被强制执行取决于网关和底层的桥；在依赖任何属性之前，请先检查 `supportsAttribute`。\n"}}}
