路由 ISM
开发者可以使用 RoutingISM
将消息验证委托给不同的 ISM。这使得开发者可以根据消息内容或应用上下文更改安全模型。
该 ISM 简单地根据消息的来源链切换安全模型。一个简单的用例是为每个链使用不同的 Multisig ISM 验证者集。
最终,您可以想象一个 DomainRoutingIsm
根据原始链上使用的共识协议类型路由到不同的基于轻客户端的 ISM。
接口
RoutingISMs
必须实现 IRoutingIsm
接口。
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;
import {IInterchainSecurityModule} from "../IInterchainSecurityModule.sol";
interface IRoutingIsm is IInterchainSecurityModule {
/**
* @notice Returns the ISM responsible for verifying _message
* @dev Can change based on the content of _message
* @param _message Formatted Hyperlane message (see Message.sol).
* @return module The ISM to use to verify _message
*/
function route(
bytes calldata _message
) external view returns (IInterchainSecurityModule);
}
配置
hyperlane-monorepo 包含一个 RoutingISM
实现,DomainRoutingIsm
和 DefaultFallbackRoutingIsm
,应用开发者可以直接部署,指定他们所需的配置。
自定义
hyperlane-monorepo 包含一个抽象的 RoutingISM
实现,应用开发者可以进行分叉。