Skip to main content

路由模块

开发人员可以使用RoutingISM将消息验证委托给不同的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,应用程序开发人员可以部署现成的,指定他们想要的配置。

该ISM只是根据消息的源链切换安全模型。一个简单的用例是为每个链使用不同的Multisig ISM验证器集。

最终,你可以实现一个DomainRoutingIsm路由到不同的基于轻客户端的ISMs,这取决于在origin链上使用的共识协议的类型。

自定义

hyperlane-monorepo包含一个抽象的RoutingISM实现,应用程序开发人员可以对其进行分叉。

开发人员只需要实现route()函数。

通过创建自定义实现,应用程序开发人员可以根据应用程序的需要定制RoutingISM提供的安全性。

例如,自定义实现可以根据消息的内容或接收消息的应用程序的状态更改安全模型。