跳到主要内容

聚合 ISM

开发者可以使用 AggregationISM 来结合多个 ISM 的安全性。简单来说,AggregationISM 要求 m 个 ISM 中的 n 个验证特定的跨链消息。

开发者可以为每个源链配置一组 n 个 ISM,以及验证消息所需的 ISM 数量。

AggregationISMs 可以聚合任何 ISM 的安全性。例如,用户可以部署一个带有自己验证者集的 Multisig ISM,并部署一个将该 ISM 与 Hyperlane 默认 ISM 聚合的 AggregationISM

接口

AggregationISMs 必须实现 IAggregationIsm 接口。

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;

import {IInterchainSecurityModule} from "../IInterchainSecurityModule.sol";

interface IAggregationIsm is IInterchainSecurityModule {
/**
* @notice Returns the set of modules responsible for verifying _message
* and the number of modules that must verify
* @dev Can change based on the content of _message
* @param _message Hyperlane formatted interchain message
* @return modules The array of ISM addresses
* @return threshold The number of modules needed to verify
*/
function modulesAndThreshold(
bytes calldata _message
) external view returns (address[] memory modules, uint8 threshold);
}

配置

Hyperlane 单体库 包含一个 AggregationISM 实现,应用开发者可以按需部署,指定所需的配置。

开发者可以为每个源链配置一组 n 个 ISM,以及验证消息所需的 ISM 数量。

AggregationISMs 可以聚合任何 ISM 的安全性。例如,用户可以部署一个带有自己验证者集的 Multisig ISM,并部署一个将该 ISM 与 Hyperlane 默认 ISM 聚合的 AggregationISM

自定义

hyperlane-monorepo 包含一个抽象的 AggregationISM 实现,应用开发者可以进行分叉。

开发者只需实现 modulesAndThreshold() 函数。

通过创建自定义实现,应用开发者可以根据其应用的需求调整 AggregationISM 提供的安全性。

例如,自定义实现可以要求低价值消息由 Multisig ISM 验证,而高价值消息 需要由 Wormhole ISM 验证。