多重签名模块
使用验证者签名验证消息
MultisigISM
是最常用的 ISM 类型之一。这些 ISM 验证 n
个验证者中的 m
个是否已经证实了特定跨链消息的有效性。
接口
MultisigISM
必须实现 IMultisigIsm
接口。
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
import {IInterchainSecurityModule} from "../IInterchainSecurityModule.sol";
interface IMultisigIsm is IInterchainSecurityModule {
/**
* @notice Returns the set of validators responsible for verifying _message
* and the number of signatures required
* @dev Can change based on the content of _message
* @dev Signatures provided to `verify` must be consistent with validator ordering
* @param _message Hyperlane formatted interchain message
* @return validators The array of validator addresses
* @return threshold The number of validator signatures needed
*/
function validatorsAndThreshold(
bytes calldata _message
) external view returns (address[] memory validators, uint8 threshold);
}
配置
hyperlane-monorepo 包含 MultisigISM
实现(包括旧版本和更节省 gas 的版本,可通过工厂合约部署),应用开发者可以直接部署这些现成的实现,并指定所需的配置。
开发者可以为每个源链配置一组 n
个验证者,以及验证消息所需的验证者签名数量(m
)。
验证者签名不是特定于某个 ISM 的。换句话说,开发者可以配置他们的 MultisigISM
使用在 Hyperlane 上运行的任何验证者,它都能正常工作 。
自定义
hyperlane-monorepo 包含一个抽象的 MultisigISM
实现,应用开发者可以基于此进行扩展。
开发者只需要实现 validatorsAndThreshold()
函数即可。
通过创建自定义实现,应用开发者可以根据其应用需求定制 MultisigISM
提供的安全性。
例如,自定义实现可以根据待验证消息的内容来改变所需的签名数量。