Skip to main content

Aggregation Module

开发人员可以使用“Aggregation ISM”来组合来自多个ISM的安全性。简单地说,“Aggregation ISM”要求“n个”ISM中的“m个”验证特定的链间消息。

接口

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-monorepo包含一个AggregationISM实现,应用程序开发人员可以部署现成的实现,指定他们想要的配置。

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

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

自定义

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

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

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

例如,自定义实现可能要求低值消息由Multisig ISM验证,并要求高值消息也由Wormhole ISM验证。